From 83a13b96c4f62ed581d4a2b6609274e440a36e75 Mon Sep 17 00:00:00 2001 From: KAMKEEL Date: Sun, 8 Jan 2023 17:27:37 -0500 Subject: [PATCH 1/2] setMovingType and getMovingType Allows script to change types between 0 = standing, 1 = wandering, 2 = moving path --- src/api | 2 +- .../npcs/scripted/entity/ScriptNpc.java | 25 +++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/api b/src/api index e4a0840ae..d33ed5c41 160000 --- a/src/api +++ b/src/api @@ -1 +1 @@ -Subproject commit e4a0840ae287bd2ffc3f04a6fc0a45d4873343f8 +Subproject commit d33ed5c4124b632f2223a0cc1ce1cc997180b8f5 diff --git a/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java b/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java index 6441e4764..768006575 100644 --- a/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java +++ b/src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java @@ -9,11 +9,7 @@ import noppes.npcs.NoppesUtilServer; import noppes.npcs.api.jobs.IJob; import noppes.npcs.api.roles.IRole; import noppes.npcs.config.ConfigMain; -import noppes.npcs.constants.EnumAnimation; -import noppes.npcs.constants.EnumJobType; -import noppes.npcs.constants.EnumNavType; -import noppes.npcs.constants.EnumRoleType; -import noppes.npcs.constants.EnumStandingType; +import noppes.npcs.constants.*; import noppes.npcs.controllers.FactionController; import noppes.npcs.controllers.data.Line; import noppes.npcs.entity.EntityCustomNpc; @@ -123,6 +119,25 @@ public class ScriptNpc extends ScriptLiving imp return npc.ai.standingType.ordinal(); } + /** + * @param movingType The moving type of the npc. 0 = standing, 1 = wandering, 2 = moving path + */ + public void setMovingType(int movingType){ + for(EnumMovingType e : EnumMovingType.values()) { + if (e.ordinal() == movingType) { + npc.ai.movingType = e; + break; + } + } + } + + /** + * @return The moving type of the npc. 0 = standing, 1 = wandering, 2 = moving path + */ + public int getMovingType(){ + return npc.ai.movingType.ordinal(); + } + /** * @param name The name of the npc */ From 763a38894788c17aa658d277d8897861752c4eb9 Mon Sep 17 00:00:00 2001 From: KAMKEEL Date: Sun, 8 Jan 2023 17:32:25 -0500 Subject: [PATCH 2/2] Update api --- src/api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api b/src/api index d33ed5c41..8e7f08577 160000 --- a/src/api +++ b/src/api @@ -1 +1 @@ -Subproject commit d33ed5c4124b632f2223a0cc1ce1cc997180b8f5 +Subproject commit 8e7f085774373b2970910b552b5d1a5da3d37891