From d29ea06a3bf312b23a9485edee24cc553e50b5a6 Mon Sep 17 00:00:00 2001 From: Das Keifer <43280661+DasKeifer@users.noreply.github.com> Date: Thu, 12 Mar 2026 08:29:55 -0400 Subject: [PATCH] Implemented GetQueued which is the basis for all queued attack functions in modloader using memedit and vanilla apis to avoid needed 100% up to date save data. --- functions/pawn.lua | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/functions/pawn.lua b/functions/pawn.lua index b4e70ee..640ac55 100644 --- a/functions/pawn.lua +++ b/functions/pawn.lua @@ -14,11 +14,12 @@ end function onPawnClassInitialized(BoardPawn, pawn) - -- Reference to overridden vanilla functions + -- Reference to overridden vanilla/modloader functions BoardPawn.AddWeaponVanilla = pawn.AddWeapon BoardPawn.GetArmedWeaponVanilla = BoardPawn.GetArmedWeapon BoardPawn.GetEquippedWeaponsVanilla = BoardPawn.GetEquippedWeapons BoardPawn.GetPoweredWeaponsVanilla = BoardPawn.GetPoweredWeapons + BoardPawn.GetQueuedVanilla = pawn.GetQueued BoardPawn.IsJumperVanilla = pawn.IsJumper BoardPawn.IsTeleporterVanilla = pawn.IsTeleporter BoardPawn.IsWeaponEquippedVanilla = BoardPawn.IsWeaponEquipped @@ -27,7 +28,7 @@ function onPawnClassInitialized(BoardPawn, pawn) BoardPawn.SetFrozenVanilla = pawn.SetFrozen BoardPawn.SetMechVanilla = pawn.SetMech BoardPawn.SetShieldVanilla = pawn.SetShield - + -- With the addition of BoardPawn.IsNeutral, -- mod loader's BoardPawn.SetNeutral is no longer needed. @@ -360,6 +361,25 @@ function onPawnClassInitialized(BoardPawn, pawn) return self:GetPoweredWeaponsVanilla() end + + BoardPawn.GetQueued = function(self) + Assert.Equals("userdata", type(self), "Argument #0") + + local memedit = memedit:get() + if memedit then + local target = self:GetQueuedTarget() + if target and Board:IsValid(target) then + return { + piOrigin = self:GetSpace(), + piTarget = target, + piQueuedShot = target, + iQueuedSkill = self:GetSelectedWeapon(), + } + end + return nil + end + self:GetQueuedVanilla() + end BoardPawn.GetQueuedTarget = function(self) Assert.Equals("userdata", type(self), "Argument #0")