diff --git a/README.md b/README.md index eb684c1..0100070 100644 --- a/README.md +++ b/README.md @@ -64,3 +64,4 @@ All other information should be explored by reading the source code! - [2023/3/23 13:30] fix: remove non-hero units after round ends.([#23](https://github.com/Escapingbug/dotaxctf/pull/23), reporter: AAA剑圣) - [2023/3/24 00:22] feat: support `GetItemInSlot(slot)` to return a sandboxed item.([#24](https://github.com/Escapingbug/dotaxctf/pull/24), reporter: AAA剑圣) - [2023/3/27 00:22] feat: support getting game time by `GetGameTime()`.([#28](https://github.com/Escapingbug/dotaxctf/pull/28), reporter: Syclover) +- [2023/3/27 23:53] fix: use `npc:GetEntityIndex()` and `npc:GetTeam()` to avoid unexpect behaviors.([#27](https://github.com/Escapingbug/dotaxctf/pull/27), reporter: 114@x1ct34m) diff --git a/sandbox.lua b/sandbox.lua index 7c388ce..74fbafd 100644 --- a/sandbox.lua +++ b/sandbox.lua @@ -167,7 +167,7 @@ function Sandbox:SandboxBaseNPC(npc, readonly) find_order ) local units = FindUnitsInRadius( - self:GetTeam(), + npc:GetTeam(), location, nil, -- cacheUnit radius, @@ -210,7 +210,7 @@ function Sandbox:SandboxBaseNPC(npc, readonly) return end ExecuteOrderFromTable{ - UnitIndex = self:GetEntityIndex(), + UnitIndex = npc:GetEntityIndex(), OrderType = order_type, TargetIndex = target_index, AbilityIndex = ability_index,