Skip to content

Commit 3d925aa

Browse files
committed
Merge branch 'pre5-patch' into development
2 parents 8c59a63 + bb8c165 commit 3d925aa

File tree

3 files changed

+30
-9
lines changed

3 files changed

+30
-9
lines changed

Data/Base.rte/Devices/Shared/Scripts/GrenadeBandolierAttachable.lua

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ local replenishGrenade = function(self, forceEquipGrenade)
2222
if forceEquipGrenade or self.grenadeReplenishDelay < 100 then
2323
self:modifyGrenadeCount(-1);
2424
self.rootParent.UpperBodyState = AHuman.WEAPON_READY;
25-
-- Only actually equip the grenade if the root parent was previously holding one, or we're forcing it to equip it. This avoids issues when, for example, removing a grenade from the root paren'ts inventory via Lua.
25+
-- Only actually equip the grenade if the root parent was previously holding one, or we're forcing it to equip it. This avoids issues when, for example, removing a grenade from the root parent's inventory via Lua.
2626
return (forceEquipGrenade or self.grenadePreviouslyHeldByRootParent) and self.rootParent:EquipNamedDevice(self.grenadeTech, self.grenadeName, true);
2727
else
2828
self.grenadeReplenishGUITimer:Reset();
@@ -91,7 +91,7 @@ function Create(self)
9191
end
9292

9393
function Update(self)
94-
if self.rootParent and self.rootParent.Health > 0 and MovableMan:IsActor(self.rootParent) then
94+
if self.rootParent and self.rootParent.Health > 0 and MovableMan:ValidMO(self.rootParent) then
9595
local rootParentEquippedItemModuleAndPresetName = self.rootParent.EquippedItem ~= nil and self.rootParent.EquippedItem:GetModuleAndPresetName() or nil;
9696
local rootParentIsHoldingGrenade = rootParentEquippedItemModuleAndPresetName == self.grenadeObject:GetModuleAndPresetName();
9797

@@ -154,16 +154,37 @@ function Update(self)
154154
end
155155

156156
function Destroy(self)
157-
if self.rootParent and MovableMan:IsActor(self.rootParent) then
157+
if self.rootParent and MovableMan:ValidMO(self.rootParent) then
158158
self.rootParent:RemoveNumberValue(self.bandolierKey);
159159
end
160160
if self.currentGrenadeCount > 0 then
161+
local bandolierPosition = self.Pos;
162+
local bandolierVel = self.Vel;
163+
local bandolierRotAngle = self.RotAngle;
164+
local bandolierAngularVel = self.AngularVel;
165+
161166
if self.grenadePreviouslyHeldByRootParent then
162-
self.grenadePreviouslyHeldByRootParent.ToDelete = true;
167+
if MovableMan:ValidMO(self.grenadePreviouslyHeldByRootParent) and not self.grenadePreviouslyHeldByRootParent:IsActivated() then
168+
self.grenadePreviouslyHeldByRootParent.ToDelete = true;
169+
self:modifyGrenadeCount(1);
170+
171+
bandolierPosition = self.grenadePreviouslyHeldByRootParent.Pos;
172+
bandolierVel = self.grenadePreviouslyHeldByRootParent.Vel;
173+
bandolierRotAngle = self.grenadePreviouslyHeldByRootParent.RotAngle;
174+
bandolierAngularVel = self.grenadePreviouslyHeldByRootParent.AngularVel;
175+
end
176+
end
177+
if self.currentGrenadeCount > 0 then
178+
self.bandolierObjectForDropping:SetNumberValue("GrenadesRemainingInBandolier", self.currentGrenadeCount);
179+
180+
self.bandolierObjectForDropping.Pos = bandolierPosition;
181+
self.bandolierObjectForDropping.Vel = bandolierVel;
182+
self.bandolierObjectForDropping.RotAngle = bandolierRotAngle;
183+
self.bandolierObjectForDropping.AngularVel = bandolierAngularVel;
184+
185+
self.bandolierObjectForDropping.Mass = self.bandolierMass + (self.grenadeMass * self.currentGrenadeCount);
186+
187+
MovableMan:AddItem(self.bandolierObjectForDropping);
163188
end
164-
self.bandolierObjectForDropping:SetNumberValue("GrenadesRemainingInBandolier", self.currentGrenadeCount + 1);
165-
self.bandolierObjectForDropping.Pos = self.Pos;
166-
self.bandolierObjectForDropping.Mass = self.bandolierMass + (self.grenadeMass * self.currentGrenadeCount);
167-
MovableMan:AddItem(self.bandolierObjectForDropping);
168189
end
169190
end

Data/Base.rte/Scenes/Objects/Bunkers/BunkerSystems/Automovers/Controller/Controller.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ function Update(self)
187187
if self.actorMovementUpdateTimer:IsPastSimTimeLimit() then
188188
for actorUniqueID, actorData in pairs(self.affectedActors) do
189189
local actor = actorData.actor;
190-
if not MovableMan:ValidMO(actor) or not self.combinedAutomoverArea:IsInside(actor.Pos) then
190+
if not MovableMan:ValidMO(actor) or actor.Health <= 0 or not self.combinedAutomoverArea:IsInside(actor.Pos) then
191191
self:removeActorFromAutomoverTable(actor, actorUniqueID);
192192
else
193193
if actor:NumberValueExists("Automover_LeaveAutomoverNetwork") then
-106 Bytes
Loading

0 commit comments

Comments
 (0)