Battalion, Points Mode: Show points next to team bars
authorWuzzy <Wuzzy2@mail.ru>
Sat, 17 Feb 2018 20:51:36 +0100
changeset 13030 da691787fcd2
parent 13029 905449169319
child 13031 bef97cc310b0
Battalion, Points Mode: Show points next to team bars
share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua	Sat Feb 17 17:36:26 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua	Sat Feb 17 20:51:36 2018 +0100
@@ -499,6 +499,10 @@
   return ammo
 end
 
+function updatePointsLabel(team)
+  SetTeamLabel(team, string.format(loc("%d / %d"), pointsPerTeam[team]["weapons"], pointsPerTeam[team]["helpers"]))
+end
+
 function addTurnAmmo(hog)
   -- Check if hog is valid
   if hog == nil then
@@ -1203,6 +1207,7 @@
 
   pointsPerTeam[team]['weapons'] = pointsPerTeam[team]['weapons'] + 2
   pointsPerTeam[team]['helpers'] = pointsPerTeam[team]['helpers'] + 1
+  updatePointsLabel(team)
 
   local effect = AddVisualGear(GetX(CurHog) - (cratePickupGap / 2), GetY(CurHog), vgtHealthTag, 2, false)
   -- Set Tint
@@ -1381,6 +1386,8 @@
     pointsPerTeam[team]['helpers'] = pointsPerTeam[team]['helpersRem'] + hlpWoTax + div(hlpToTax * pointsKeepSDPerc, 100)
   end
 
+  updatePointsLabel(team)
+
   local effect = AddVisualGear(GetX(hog) - (cratePickupGap / 2), GetY(hog), vgtHealthTag, pointsPerTeam[team]['weapons'], false)
   -- Set Tint
   SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF)
@@ -1609,6 +1616,7 @@
       pointsPerTeam[key] = {}
       pointsPerTeam[key]['weapons'] = pointsWepBase
       pointsPerTeam[key]['helpers'] = pointsHlpBase
+      updatePointsLabel(key)
     else
       setTeamHogs(key)
     end