Skip to content

Commit

Permalink
Hotfix unit_carrier_spawner.lua (#3751)
Browse files Browse the repository at this point in the history
Added a check for projectile owner id.
  • Loading branch information
Xehrath authored Sep 21, 2024
1 parent 592120c commit bf4c177
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions luarules/gadgets/unit_carrier_spawner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -716,17 +716,19 @@ function gadget:UnitCmdDone(unitID, unitDefID, unitTeam, cmdID, cmdTag, cmdParam
end

function gadget:ProjectileCreated(proID, proOwnerID, proWeaponDefID)
local carrierUnitID = spGetUnitRulesParam(proOwnerID, "carrier_host_unit_id")
if carrierUnitID then
if carrierMetaList[carrierUnitID].subUnitsList[proOwnerID] then
if carrierMetaList[carrierUnitID].subUnitsList[proOwnerID].dronetype == "bomber" and carrierMetaList[carrierUnitID].subUnitsList[proOwnerID].bomberStage > 0 then
local currentTime = spGetGameSeconds()
if ((currentTime - carrierMetaList[carrierUnitID].subUnitsList[proOwnerID].lastBombing) >= 4) then
Spring.MoveCtrl.SetAirMoveTypeData(proOwnerID, {maxRudder = carrierMetaList[carrierUnitID].subUnitsList[proOwnerID].originalmaxrudder})
carrierMetaList[carrierUnitID].subUnitsList[proOwnerID].bomberStage = carrierMetaList[carrierUnitID].subUnitsList[proOwnerID].bomberStage + 1
carrierMetaList[carrierUnitID].subUnitsList[proOwnerID].lastBombing = spGetGameSeconds()
end
end
if proOwnerID then
local carrierUnitID = spGetUnitRulesParam(proOwnerID, "carrier_host_unit_id")
if carrierUnitID then
if carrierMetaList[carrierUnitID].subUnitsList[proOwnerID] then
if carrierMetaList[carrierUnitID].subUnitsList[proOwnerID].dronetype == "bomber" and carrierMetaList[carrierUnitID].subUnitsList[proOwnerID].bomberStage > 0 then
local currentTime = spGetGameSeconds()
if ((currentTime - carrierMetaList[carrierUnitID].subUnitsList[proOwnerID].lastBombing) >= 4) then
Spring.MoveCtrl.SetAirMoveTypeData(proOwnerID, {maxRudder = carrierMetaList[carrierUnitID].subUnitsList[proOwnerID].originalmaxrudder})
carrierMetaList[carrierUnitID].subUnitsList[proOwnerID].bomberStage = carrierMetaList[carrierUnitID].subUnitsList[proOwnerID].bomberStage + 1
carrierMetaList[carrierUnitID].subUnitsList[proOwnerID].lastBombing = spGetGameSeconds()
end
end
end
end
end
end
Expand Down

0 comments on commit bf4c177

Please sign in to comment.