From 78693bbbbc141e68a38faeebc5ceb71c39fc4d87 Mon Sep 17 00:00:00 2001 From: psyopcutie Date: Wed, 17 Jun 2026 04:16:17 +0200 Subject: [PATCH] queueScript rewrite --- .../waterbirth/handlers/SpinolypNPC.java | 57 ++++++++----------- 1 file changed, 23 insertions(+), 34 deletions(-) diff --git a/Server/src/main/content/region/fremennik/waterbirth/handlers/SpinolypNPC.java b/Server/src/main/content/region/fremennik/waterbirth/handlers/SpinolypNPC.java index c8511a7f4..e41e584aa 100644 --- a/Server/src/main/content/region/fremennik/waterbirth/handlers/SpinolypNPC.java +++ b/Server/src/main/content/region/fremennik/waterbirth/handlers/SpinolypNPC.java @@ -1,5 +1,6 @@ package content.region.fremennik.waterbirth.handlers; +import core.game.interaction.QueueStrength; import core.game.node.entity.Entity; import core.game.node.entity.combat.BattleState; import core.game.node.entity.combat.spell.CombatSpell; @@ -8,8 +9,6 @@ import core.game.node.entity.combat.InteractionType; import core.game.node.entity.combat.equipment.SwitchAttack; import core.game.node.entity.npc.AbstractNPC; import core.game.node.entity.player.link.SpellBookManager.SpellBook; -import core.game.system.task.Pulse; -import core.game.world.GameWorld; import core.game.world.map.Location; import core.game.world.update.flag.context.Animation; import core.game.world.update.flag.context.Graphics; @@ -81,7 +80,7 @@ public final class SpinolypNPC extends AbstractNPC { setSpell(); getAggressiveHandler().setAllowTolerance(false); startSubmerged(); - startSubmergePulse(); + startSubmergeScript(); } /** @@ -148,38 +147,28 @@ public final class SpinolypNPC extends AbstractNPC { visualize(Animation.create(RESURFACE_ANIMATION), Graphics.create(WATER_SPLASH_GFX)); } - private void startSubmergePulse() { - GameWorld.getPulser().submit(new Pulse(getInitialResurfaceDelay(), this) { - private int stage = 2; - - @Override - public boolean pulse() { - if (stage == 0) { - submerge(); - stage = 1; - setDelay(SUBMERGE_ANIMATION_DELAY); - return false; - } - - if (stage == 1) { - transformWithHpCarryover(SUBMERGED_SPINOLYP); - setNeverWalks(false); - setWalks(true); - getLocks().unlockMovement(); - resetWalk(); - stage = 2; - setDelay(getSubmergedDuration()); - return false; - } - - if (stage == 2) { - resurface(); - stage = 0; - setDelay(getCombatDuration()); - return false; - } - return false; + private void startSubmergeScript() { + queueScript(this, getInitialResurfaceDelay(), QueueStrength.SOFT, true, (Integer stage) -> { + if (stage == 0) { + resurface(); + return delayScript(this, getCombatDuration()); } + + if (stage == 1) { + submerge(); + return delayScript(this, SUBMERGE_ANIMATION_DELAY); + } + + if (stage == 2) { + transformWithHpCarryover(SUBMERGED_SPINOLYP); + setNeverWalks(false); + setWalks(true); + getLocks().unlockMovement(); + resetWalk(); + setCurrentScriptState(this, 0); + return delayScript(this, getSubmergedDuration()); + } + return stopExecuting(this); }); }