Skip to content

Commit

Permalink
doScript.txt: only save state of ground vehicles
Browse files Browse the repository at this point in the history
  • Loading branch information
jboecker committed Feb 28, 2014
1 parent 3f94737 commit 5df6160
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions scripts/save-mission-state/doScript.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@ ret.position_updates = {}
ret.destroyed_units = {}

for _, aliveUnit in pairs(mist.DBs.aliveUnits) do
local unit = Unit.getByName(aliveUnit.unitName)
local pos = unit:getPosition()
ret.position_updates[#ret.position_updates+1] = {
unitId = aliveUnit.unitId,
heading = mist.getHeading(unit),
x = pos.p.x,
y = pos.p.z,
}
if aliveUnit.category == "vehicle" then
local unit = Unit.getByName(aliveUnit.unitName)
local pos = unit:getPosition()
ret.position_updates[#ret.position_updates+1] = {
unitId = aliveUnit.unitId,
heading = mist.getHeading(unit),
x = pos.p.x,
y = pos.p.z,
}
end
end

for _, deadUnit in pairs(mist.DBs.removedAliveUnits) do
if deadUnit.category == "vehicle" then
ret.destroyed_units[#ret.destroyed_units+1] = {
unitId = deadUnit.unitId
}
end
end

saveMissionState(ret)

0 comments on commit 5df6160

Please sign in to comment.