share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua
changeset 15126 ab21cbb0e3a0
parent 15125 9e1e234a417c
child 15128 40537955de63
equal deleted inserted replaced
15125:9e1e234a417c 15126:ab21cbb0e3a0
  1172 function onKingDeath(KingHog)
  1172 function onKingDeath(KingHog)
  1173   local team = getHogInfo(KingHog, 'team')
  1173   local team = getHogInfo(KingHog, 'team')
  1174   local msgColor = getHogInfo(KingHog, 'clanColor')
  1174   local msgColor = getHogInfo(KingHog, 'clanColor')
  1175 
  1175 
  1176   AddCaption(string.format(loc("The king of %s has died!"), team), capcolDefault, capgrpGameState)
  1176   AddCaption(string.format(loc("The king of %s has died!"), team), capcolDefault, capgrpGameState)
       
  1177   SetState(KingHog, gstHHDeath)
  1177 
  1178 
  1178   -- Kill the rest of the team normally, just like the official King Mode game modifier
  1179   -- Kill the rest of the team normally, just like the official King Mode game modifier
  1179   for hog, val in pairs(hogInfo) do
  1180   for hog, val in pairs(hogInfo) do
  1180     if getHogInfo(hog, 'team') == team then
  1181     if getHogInfo(hog, 'team') == team then
  1181       hp = GetHealth(hog)
  1182       hp = GetHealth(hog)
  1182       if hp ~= nil and hp > 0 then
  1183       if hp ~= nil and hp > 0 then
  1183         SetState(KingHog, gstHHDeath)
       
  1184         SetHealth(hog, 0)
  1184         SetHealth(hog, 0)
  1185         SetGearValues(hog, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0)
       
  1186       end
  1185       end
  1187     end
  1186     end
  1188   end
  1187   end
  1189 
  1188 
  1190   -- We don't use DismissTeam, it causes a lot of problems and nasty side-effects.
  1189   -- We don't use DismissTeam, it causes a lot of problems and nasty side-effects.