share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
changeset 10219 bbeb1e9aaa65
parent 10096 51d6b80ba43c
child 10250 887610b44848
equal deleted inserted replaced
10218:1d7112ccb3e9 10219:bbeb1e9aaa65
    87 -- derp, script follows
    87 -- derp, script follows
    88 -------------------------------
    88 -------------------------------
    89 
    89 
    90 HedgewarsScriptLoad("/Scripts/Locale.lua")
    90 HedgewarsScriptLoad("/Scripts/Locale.lua")
    91 HedgewarsScriptLoad("/Scripts/Tracker.lua")
    91 HedgewarsScriptLoad("/Scripts/Tracker.lua")
       
    92 HedgewarsScriptLoad("/Scripts/Params.lua")
    92 
    93 
    93 -- These define weps allowed by the script. At present Tardis and Resurrection is banned for example
    94 -- These define weps allowed by the script. At present Tardis and Resurrection is banned for example
    94 -- These were arbitrarily defined out-of-order in initial script, so that was preserved here, resulting 
    95 -- These were arbitrarily defined out-of-order in initial script, so that was preserved here, resulting 
    95 -- in a moderately odd syntax.
    96 -- in a moderately odd syntax.
    96 local atkWeps = 	{
    97 local atkWeps = 	{
   130 local utiltot = 0
   131 local utiltot = 0
   131 local maxWep = 56 -- game crashes if you exceed supported #
   132 local maxWep = 56 -- game crashes if you exceed supported #
   132 
   133 
   133 local someHog = nil -- just for looking up the weps
   134 local someHog = nil -- just for looking up the weps
   134 
   135 
       
   136 local mode = nil
       
   137 
       
   138 function onParameters()
       
   139     parseParams()
       
   140     mode = params["mode"]
       
   141 end
       
   142 
   135 function CheckForWeaponSwap()
   143 function CheckForWeaponSwap()
   136 	if GetCurAmmoType() ~= lastWep then
   144 	if GetCurAmmoType() ~= lastWep then
   137 		shotsFired = 0
   145 		shotsFired = 0
   138 	end
   146 	end
   139 	lastWep = GetCurAmmoType()
   147 	lastWep = GetCurAmmoType()
   210 
   218 
   211 	if CurrentHedgehog ~= nil then
   219 	if CurrentHedgehog ~= nil then
   212 
   220 
   213         for w,c in pairs(wepArray) do
   221         for w,c in pairs(wepArray) do
   214 			val = getGearValue(gear,w)
   222 			val = getGearValue(gear,w)
   215 			if val ~= 0 and wepArray[w] ~= 9 and getGearValue(CurrentHedgehog, w) == 0  then
   223 			if val ~= 0 and (mode == "orig" or (wepArray[w] ~= 9 and getGearValue(CurrentHedgehog, w) == 0))  then
   216 				setGearValue(CurrentHedgehog, w, val)
   224 				setGearValue(CurrentHedgehog, w, val)
   217 
   225 
   218 				-- if you are using multi-shot weapon, gimme one more
   226 				-- if you are using multi-shot weapon, gimme one more
   219 				if (GetCurAmmoType() == w) and (shotsFired ~= 0) then
   227 				if (GetCurAmmoType() == w) and (shotsFired ~= 0) then
   220 					AddAmmo(CurrentHedgehog, w, val+1)
   228 					AddAmmo(CurrentHedgehog, w, val+1)