Added backend code for health display

And fixed the issue of ground units not being deleted correctly
This commit is contained in:
Pax1601
2023-11-08 21:56:39 +01:00
parent ec971aa822
commit ea1758a1a9
12 changed files with 90 additions and 104 deletions

View File

@@ -937,11 +937,15 @@ function Olympus.setUnitsData(arg, time)
table["hasTask"] = controller:hasTask()
table["ammo"] = unit:getAmmo() --TODO remove a lot of stuff we don't really need
table["fuel"] = unit:getFuel()
table["life"] = unit:getLife() / unit:getLife0()
table["health"] = unit:getLife() / unit:getLife0() * 100
table["contacts"] = contacts
units[ID] = table
end
else
-- If the unit reference is nil it means the unit no longer exits
units[ID] = {isAlive = false}
Olympus.units[ID] = nil
end
end
else