share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
changeset 11721 8c1a30d4cbc8
parent 11720 5cb2f245ee2f
child 11722 fc4909039db8
equal deleted inserted replaced
11720:5cb2f245ee2f 11721:8c1a30d4cbc8
    27 -- The script parameter can be used to configure the energy
    27 -- The script parameter can be used to configure the energy
    28 -- of the game. It is a comma-seperated list of key=value pairs, where each
    28 -- of the game. It is a comma-seperated list of key=value pairs, where each
    29 -- key is a word and each value is non-negative integer.
    29 -- key is a word and each value is non-negative integer.
    30 --
    30 --
    31 -- Possible keys:
    31 -- Possible keys:
    32 --- initialenergy: Amount of energy that each team starts with (default: 500)
    32 --- initialenergy: Amount of energy that each team starts with (default: 550)
    33 --- energyperround: Amount of energy that each team gets per round (default: 50)
    33 --- energyperround: Amount of energy that each team gets per round (default: 50)
    34 --- maxenergy: Maximum amount of energy each team can hold (default: 1000)
    34 --- maxenergy: Maximum amount of energy each team can hold (default: 1000)
    35 
    35 
    36 -- Example: “initialenergy=750, maxenergy=2000” starts thee game with 750 energy
    36 -- Example: “initialenergy=750, maxenergy=2000” starts thee game with 750 energy
    37 -- and sets the maximum energy to 2000
    37 -- and sets the maximum energy to 2000
   167 clanLWepIndex = {} -- for ease of use let's track this stuff
   167 clanLWepIndex = {} -- for ease of use let's track this stuff
   168 clanLUtilIndex = {}
   168 clanLUtilIndex = {}
   169 clanLGearIndex = {}
   169 clanLGearIndex = {}
   170 clanUsedExtraTime = {}
   170 clanUsedExtraTime = {}
   171 clanCratesSpawned = {}
   171 clanCratesSpawned = {}
       
   172 clanFirstTurn = {}
   172 
   173 
   173 effectTimer = 0
   174 effectTimer = 0
   174 
   175 
   175 wallsVisible = false
   176 wallsVisible = false
   176 wX = {}
   177 wX = {}
   184 lastWep = nil
   185 lastWep = nil
   185 
   186 
   186 checkForSpecialWeaponsIn = -1
   187 checkForSpecialWeaponsIn = -1
   187 
   188 
   188 -- Config variables (script parameter)
   189 -- Config variables (script parameter)
   189 conf_initialEnergy = 500
   190 conf_initialEnergy = 550
   190 conf_energyPerRound = 50
   191 conf_energyPerRound = 50
   191 conf_maxEnergy = 1000
   192 conf_maxEnergy = 1000
   192 
   193 
   193 function HideTags()
   194 function HideTags()
   194 
   195 
  1575 		clanLWepIndex[i] = 1 -- for ease of use let's track this stuff
  1576 		clanLWepIndex[i] = 1 -- for ease of use let's track this stuff
  1576 		clanLUtilIndex[i] = 1
  1577 		clanLUtilIndex[i] = 1
  1577 		clanLGearIndex[i] = 1
  1578 		clanLGearIndex[i] = 1
  1578 		clanUsedExtraTime[i] = false
  1579 		clanUsedExtraTime[i] = false
  1579 		clanCratesSpawned[i] = 0
  1580 		clanCratesSpawned[i] = 0
  1580 
  1581 		clanFirstTurn[i] = true
  1581 
  1582 
  1582 	end
  1583 	end
  1583 
  1584 
  1584 	tMapWidth = RightX - LeftX
  1585 	tMapWidth = RightX - LeftX
  1585 	tMapHeight = WaterLine - TopY
  1586 	tMapHeight = WaterLine - TopY
  1608 
  1609 
  1609 
  1610 
  1610 function onNewTurn()
  1611 function onNewTurn()
  1611 
  1612 
  1612 	local clan = GetHogClan(CurrentHedgehog)
  1613 	local clan = GetHogClan(CurrentHedgehog)
  1613 	clanPower[clan] = clanPower[clan] + conf_energyPerRound
  1614 	if clanFirstTurn[clan] then
  1614 	if clanPower[clan] > conf_maxEnergy then
  1615 		clanFirstTurn[clan] = false
  1615 		clanPower[clan] = conf_maxEnergy
  1616 	else
       
  1617 		clanPower[clan] = clanPower[clan] + conf_energyPerRound
       
  1618 		if clanPower[clan] > conf_maxEnergy then
       
  1619 			clanPower[clan] = conf_maxEnergy
       
  1620 		end
  1616 	end
  1621 	end
  1617 	clanUsedExtraTime[clan] = false
  1622 	clanUsedExtraTime[clan] = false
  1618 	clanCratesSpawned[clan] = 0
  1623 	clanCratesSpawned[clan] = 0
  1619 
  1624 
  1620 end
  1625 end