Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/snippets/fix.7284.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix error when issuing an assist order to a mobile shield/deceiver with a destroyed unit in the selection (#7284). This should fix mobile shields sometimes stopping in range of enemies while assisting another unit, instead of continuing to move.
3 changes: 2 additions & 1 deletion lua/SimCallbacks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ Callbacks.FlagShield = function(data, units)
local target = GetEntityById(data.target)
if units and target then
for k, u in units do
if IsEntity(u) and u.PointerEnabled == true then
if not IsDestroyed(u) and u.PointerEnabled == true then
---@cast u UAL0307 | UEL0307 | URL0306 | XSL0307
u.PointerEnabled = false --turn the pointer flag off
u:DisablePointer() --turn the pointer off
end
Expand Down
7 changes: 4 additions & 3 deletions units/UAL0307/UAL0307_script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ UAL0307 = ClassUnit(AShieldHoverLandUnit, ShieldEffectsComponent) {
end,

DisablePointer = function(self)
self.TargetPointer:SetFireTargetLayerCaps('None') --this disables the stop feature - note that its reset on layer change!
self.PointerRestartThread = self.Trash:Add(ForkThread(self.PointerRestart,self))
if not IsDestroyed(self.TargetPointer) then
self.TargetPointer:SetFireTargetLayerCaps('None') --this disables the stop feature - note that its reset on layer change!
self.PointerRestartThread = self.Trash:Add(ForkThread(self.PointerRestart, self))
end
end,

PointerRestart = function(self)
--sadly i couldnt find some way of doing this without a thread. dont know where to check if its still assisting other than this.
while self.PointerEnabled == false do
WaitTicks(11)
if IsDestroyed(self) or IsDestroyed(self.TargetPointer) then
Expand Down
13 changes: 5 additions & 8 deletions units/UEL0307/UEL0307_script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,19 @@ UEL0307 = ClassUnit(TShieldLandUnit, ShieldEffectsComponent) {
end,

DisablePointer = function(self)
self.TargetPointer:SetFireTargetLayerCaps('None') --this disables the stop feature - note that its reset on layer change!
self.PointerRestartThread = self:ForkThread(self.PointerRestart)
if not IsDestroyed(self.TargetPointer) then
self.TargetPointer:SetFireTargetLayerCaps('None') --this disables the stop feature - note that its reset on layer change!
self.PointerRestartThread = self:ForkThread(self.PointerRestart)
end
end,

PointerRestart = function(self)
--sadly i couldnt find some way of doing this without a thread. dont know where to check if its still assisting other than this.
while not self.PointerEnabled do

WaitSeconds(1)

-- break if we're a gooner
WaitTicks(11)
if IsDestroyed(self) or IsDestroyed(self.TargetPointer) then
break
end

-- if not gooner, check whether we need to enable our weapon to keep reasonable distance
if not self:GetGuardedUnit() then
self.PointerEnabled = true
self.TargetPointer:SetFireTargetLayerCaps(self.TargetLayerCaps[self.Layer]) --this resets the stop feature - note that its reset on layer change!
Expand Down
15 changes: 10 additions & 5 deletions units/URL0306/URL0306_Script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,21 @@ URL0306 = ClassUnit(CLandUnit) {
end,

DisablePointer = function(self)
self.TargetPointer:SetFireTargetLayerCaps('None') --this disables the stop feature - note that its reset on layer change!
local thread = ForkThread(self.PointerRestart,self)
self.Trash:Add(thread)
self.PointerRestartThread = thread
if not IsDestroyed(self.TargetPointer) then
self.TargetPointer:SetFireTargetLayerCaps('None') --this disables the stop feature - note that its reset on layer change!
local thread = ForkThread(self.PointerRestart, self)
self.Trash:Add(thread)
self.PointerRestartThread = thread
end
Comment thread
coderabbitai[bot] marked this conversation as resolved.
end,

PointerRestart = function(self)
--sadly i couldnt find some way of doing this without a thread. dont know where to check if its still assisting other than this.
while self.PointerEnabled == false do
WaitTicks(11)
if IsDestroyed(self) or IsDestroyed(self.TargetPointer) then
break
end

if not self:GetGuardedUnit() then
self.PointerEnabled = true
self.TargetPointer:SetFireTargetLayerCaps(self.TargetLayerCaps[self.Layer]) --this resets the stop feature - note that its reset on layer change!
Expand Down
10 changes: 6 additions & 4 deletions units/XSL0307/XSL0307_script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ XSL0307 = ClassUnit(SShieldHoverLandUnit, ShieldEffectsComponent) {

---@param self XSL0307
DisablePointer = function(self)
self.TargetPointer:SetFireTargetLayerCaps('None')
if not IsDestroyed(self.TargetPointer) then
self.TargetPointer:SetFireTargetLayerCaps('None')

local thread = ForkThread(self.PointerRestart, self)
self.Trash:Add(thread)
self.PointerRestartThread = thread
local thread = ForkThread(self.PointerRestart, self)
self.Trash:Add(thread)
self.PointerRestartThread = thread
end
end,

---@param self XSL0307
Expand Down