# HG changeset patch # User sheepluva # Date 1461682944 -7200 # Node ID d07e749d925dbd993c4ee765d1cac880cadbae6e # Parent ecbf5e6c2c376e80654da7b493cc79da13f9839f# Parent 8cc9c8a43dcc8878f7792a8cb0ca60180f0c16b7 merge construction mode patches by Wuzzy diff -r ecbf5e6c2c37 -r d07e749d925d share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua Tue Apr 26 15:19:36 2016 +0200 +++ b/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua Tue Apr 26 17:02:24 2016 +0200 @@ -22,6 +22,21 @@ -- limit number of generators? ------------------------------------------------------------------------------ +-- SCRIPT PARAMETER +------------------------------------------------------------------------------ +-- The script parameter can be used to configure the energy +-- of the game. It is a comma-seperated list of key=value pairs, where each +-- key is a word and each value is an integer between 0 and 4294967295. +-- +-- Possible keys: +--- initialenergy: Amount of energy that each team starts with (default: 550) +--- energyperround: Amount of energy that each team gets per round (default: 50) +--- maxenergy: Maximum amount of energy each team can hold (default: 1000) + +-- Example: “initialenergy=750, maxenergy=2000” starts thee game with 750 energy +-- and sets the maximum energy to 2000 + +------------------------------------------------------------------------------ --version history ------------------------------------------------------------------------------ --v0.1 @@ -112,6 +127,7 @@ HedgewarsScriptLoad("/Scripts/Locale.lua") HedgewarsScriptLoad("/Scripts/Tracker.lua") +HedgewarsScriptLoad("/Scripts/Params.lua") ---------------------------------------------- -- STRUC CRAP @@ -145,7 +161,6 @@ clanBoundsEY = {} clanPower = {} -clanBoon = {} clanID = {} clanLStrucIndex = {} @@ -154,6 +169,7 @@ clanLGearIndex = {} clanUsedExtraTime = {} clanCratesSpawned = {} +clanFirstTurn = {} effectTimer = 0 @@ -165,11 +181,16 @@ wCol = {} margin = 20 -tauntString = "" - vTag = {} lastWep = nil +checkForSpecialWeaponsIn = -1 + +-- Config variables (script parameter) +conf_initialEnergy = 550 +conf_energyPerRound = 50 +conf_maxEnergy = 1000 + function HideTags() for i = 0, 2 do @@ -187,7 +208,7 @@ if i == 0 then yOffset = 40 tCol = 0xffba00ff - tValue = 30--TimeLeft + tValue = 30 elseif i == 1 then zoomL = 1.1 xOffset = 45 @@ -199,7 +220,7 @@ xOffset = 60 + 35 yOffset = 70 tCol = 0xa800ffff - tValue = 10--shieldHealth - 80 + tValue = 10 end DeleteVisualGear(vTag[i]) @@ -267,7 +288,7 @@ function HandleBorderEffects() effectTimer = effectTimer + 1 - if effectTimer > 15 then --25 + if effectTimer > 15 then effectTimer = 1 for i = 1, #wX do BorderSpark(wX[i],wY[i],wWidth[i],wHeight[i], wCol[i]) @@ -283,16 +304,12 @@ function gearCanBeDeflected(gear) if (GetGearType(gear) == gtShell) or - --(GetGearType(gear) == gtBee) or (GetGearType(gear) == gtGrenade) or (GetGearType(gear) == gtAirBomb) or - --(GetGearType(gear) == gtRCPlane) or - --(GetGearType(gear) == gtRope) or (GetGearType(gear) == gtClusterBomb) or (GetGearType(gear) == gtCluster) or (GetGearType(gear) == gtGasBomb) or - --(GetGearType(gear) == gtSeduction) or - (GetGearType(gear) == gtMine) or ------- + (GetGearType(gear) == gtMine) or (GetGearType(gear) == gtMortar) or (GetGearType(gear) == gtHellishBomb) or (GetGearType(gear) == gtWatermelon) or @@ -300,15 +317,11 @@ (GetGearType(gear) == gtEgg) or (GetGearType(gear) == gtDrill) or (GetGearType(gear) == gtBall) or - (GetGearType(gear) == gtExplosives) or ------ + (GetGearType(gear) == gtExplosives) or (GetGearType(gear) == gtFlame) or (GetGearType(gear) == gtPortal) or (GetGearType(gear) == gtDynamite) or (GetGearType(gear) == gtSMine) or - --(GetGearType(gear) == gtKamikaze) or - --(GetGearType(gear) == gtRCPlane) or - --(GetGearType(gear) == gtCake) or - --(GetGearType(gear) == gtHedgehog) or ------ (GetGearType(gear) == gtKnife) or (GetGearType(gear) == gtJetpack) or -- test this and birdy plz (GetGearType(gear) == gtBirdy) or -- test this and birdy plz @@ -349,10 +362,6 @@ elseif (GetGearType(gear) == gtFlame) or (GetGearType(gear) == gtPortal) or (GetGearType(gear) == gtDynamite) - --(GetGearType(gear) == gtKamikaze) or - --(GetGearType(gear) == gtRCPlane) or - - --(GetGearType(gear) == gtCake) then dmg = 0 @@ -373,10 +382,10 @@ setGearValue(gear,"damage",dmg) setGearValue(gear,"deflects",0) - if (CurrentHedgehog ~= nil) then --and (gameStarted == true) then + if (CurrentHedgehog ~= nil) then setGearValue(gear,"owner",GetHogClan(CurrentHedgehog)) -- NEW NEEDS CHANGE? else - setGearValue(gear,"owner",10) -- nil + setGearValue(gear,"owner",10) end end @@ -408,13 +417,8 @@ if pType == loc("Reflector Shield") then table.insert(strucHealth,255) - --SetVisualGearValues(madness, g1, g2, 0, 0, g5, frameID, g7, visualSprite, g9, g10 ) - --SetState(tempG, bor(GetState(tempG),gstInvisible) ) - --table.insert(strucAltDisplay, madness) - else table.insert(strucHealth,1) - --table.insert(strucAltDisplay, 1) end table.insert(strucCirc,tempCirc) @@ -426,12 +430,10 @@ frameID = 7 elseif pType == loc("Healing Station") then table.insert(strucCircCol,0xFF00FF00) - --table.insert(strucCircCol,colorGreen) table.insert(strucCircRadius,500) frameID = 3 elseif pType == loc("Respawner") then table.insert(strucCircCol,0xFF00FF00) - --table.insert(strucCircCol,0xFF00FFFF) table.insert(strucCircRadius,75) runOnHogs(EnableHogResurrectionForThisClan) frameID = 1 @@ -439,9 +441,6 @@ table.insert(strucCircCol,0x0000FFFF) table.insert(strucCircRadius,350) frameID = 6 - elseif pType == loc("Core") then - table.insert(strucCircCol,0xFFFFFFFF) - table.insert(strucCircRadius,350) elseif pType == loc("Generator") then table.insert(strucCircCol,0xFFFF00FF) table.insert(strucCircRadius,75) @@ -470,10 +469,6 @@ SetState(tempG, bor(GetState(tempG),gstInvisible) ) table.insert(strucAltDisplay, madness) - -- may be needed for non gear-based structures - --table.insert(strucX, GetX(tempG)) - --table.insert(strucY, GetY(tempG)) - end -- this is basically onStructureDelete @@ -583,7 +578,6 @@ NR = strucCircRadius[i] else NR = (48/100*strucCircRadius[i])/2 - --NR = div((div(48,100) * strucCircRadius[tempID]),2) end if dist <= NR*NR then teleportOriginSuccessful = true @@ -594,7 +588,6 @@ NR = strucCircRadius[i] else NR = (48/100*strucCircRadius[i])/2 - --NR = div((div(48,100) * strucCircRadius[tempID]),2) end if dist <= NR*NR then teleportDestinationSuccessful = true @@ -615,222 +608,185 @@ --Check for proximity of gears to structures, and make structures behave accordingly function CheckProximity(gear) - --if isAStructureEffectingGear(gear) then - - dist = GetDistFromGearToXY(gear, GetX(strucGear[tempID]), GetY(strucGear[tempID])) - - -- calculate my real radius if I am an aura - if strucCircType[tempID] == 0 then - NR = strucCircRadius[tempID] - else - NR = (48/100*strucCircRadius[tempID])/2 - --NR = div((div(48,100) * strucCircRadius[tempID]),2) -- doesn't work ffff - --NR = div((48/100*strucCircRadius[tempID]),2) -- still works - - end - - -- we're in business - if dist <= NR*NR then + dist = GetDistFromGearToXY(gear, GetX(strucGear[tempID]), GetY(strucGear[tempID])) - - -- heal clan hogs - if strucType[tempID] == loc("Healing Station") then - - if GetGearType(gear) == gtHedgehog then - if GetHogClan(gear) == strucClan[tempID] then + -- calculate my real radius if I am an aura + if strucCircType[tempID] == 0 then + NR = strucCircRadius[tempID] + else + NR = (48/100*strucCircRadius[tempID])/2 + end - hogLife = GetHealth(gear) + 1 - if hogLife > 150 then - hogLife = 150 - end - SetHealth(gear, hogLife) - - -- change this to the med kit sprite health ++++s later - tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) - g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) - SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, colorGreen ) + -- we're in business + if dist <= NR*NR then + -- heal clan hogs + if strucType[tempID] == loc("Healing Station") then + + if GetGearType(gear) == gtHedgehog then + if GetHogClan(gear) == strucClan[tempID] then + + hogLife = GetHealth(gear) + 1 + if hogLife > 150 then + hogLife = 150 end + SetHealth(gear, hogLife) + + -- change this to the med kit sprite health ++++s later + tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) + g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) + SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, colorGreen ) + end + end + + -- explode enemy clan hogs + elseif strucType[tempID] == loc("Bio-Filter") then - -- explode enemy clan hogs - elseif strucType[tempID] == loc("Bio-Filter") then + if GetGearType(gear) == gtHedgehog then + if (GetHogClan(gear) ~= strucClan[tempID]) and (GetHealth(gear) > 0) then + AddGear(GetX(gear), GetY(gear), gtGrenade, 0, 0, 0, 1) + end + end + + -- were those weapons in your pocket, or were you just happy to see me? + elseif strucType[tempID] == loc("Weapon Filter") then + + if GetGearType(gear) == gtHedgehog then + if (GetHogClan(gear) ~= strucClan[tempID]) then - --tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) - --g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) - --SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, colorRed ) + for wpnIndex = 1, #atkArray do + AddAmmo(gear, atkArray[wpnIndex][1], 0) + end + + for wpnIndex = 1, #utilArray do + AddAmmo(gear, utilArray[wpnIndex][1], 0) + end + + AddAmmo(gear, amAirAttack, 100) + AddAmmo(gear, amSwitch, 100) + AddAmmo(gear, amSkip, 100) - if GetGearType(gear) == gtHedgehog then - if (GetHogClan(gear) ~= strucClan[tempID]) and (GetHealth(gear) > 0) then - AddGear(GetX(gear), GetY(gear), gtGrenade, 0, 0, 0, 1) - end end + end + + -- BOUNCE! POGO! POGO! POGO! POGO! + elseif strucType[tempID] == loc("Reflector Shield") then + + -- add check for whose projectile it is + if gearCanBeDeflected(gear) == true then + + gOwner = getGearValue(gear,"owner") + gDeflects = getGearValue(gear,"deflects") + gDmg = getGearValue(gear,"damage") + + if gDeflects >= 3 then + DeleteGear(gear) + AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false) + PlaySound(sndVaporize) + elseif gOwner ~= strucClan[tempID] then + --whether to vaporize gears or bounce them + if gDmg ~= 0 then + dx, dy = GetGearVelocity(gear) - -- were those weapons in your pocket, or were you just happy to see me? - elseif strucType[tempID] == loc("Weapon Filter") then + if (dx == 0) and (dy == 0) then + -- static mine, explosive, etc encountered + -- do nothing + else + + --let's bounce something! + + dx = dx*(-1) + dy = dy*(-1) + SetGearVelocity(gear,dx,dy) + setGearValue(gear,"deflects",(gDeflects+1)) - if GetGearType(gear) == gtHedgehog then - if (GetHogClan(gear) ~= strucClan[tempID]) then + AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) + PlaySound(sndExplosion) + + strucHealth[tempID] = strucHealth[tempID] - gDmg + strucCircCol[tempID] = strucCircCol[tempID] - gDmg - for wpnIndex = 1, #atkArray do - AddAmmo(gear, atkArray[wpnIndex][1], 0) + if strucHealth[tempID] <= 0 then + AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtExplosion, 0, false) + DeleteGear(strucGear[tempID]) + PlaySound(sndExplosion) + end + end - for wpnIndex = 1, #utilArray do - AddAmmo(gear, utilArray[wpnIndex][1], 0) - end - - AddAmmo(gear, amAirAttack, 100) - AddAmmo(gear, amSwitch, 100) - AddAmmo(gear, amSkip, 100) - - end - end - - -- BOUNCE! POGO! POGO! POGO! POGO! - elseif strucType[tempID] == loc("Reflector Shield") then - - -- add check for whose projectile it is - if gearCanBeDeflected(gear) == true then - - gOwner = getGearValue(gear,"owner") - gDeflects = getGearValue(gear,"deflects") - gDmg = getGearValue(gear,"damage") - - if gDeflects >= 3 then + else DeleteGear(gear) AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false) PlaySound(sndVaporize) - elseif gOwner ~= strucClan[tempID] then - --whether to vaporize gears or bounce them - if gDmg ~= 0 then - dx, dy = GetGearVelocity(gear) - - if (dx == 0) and (dy == 0) then - -- static mine, explosive, etc encountered - -- do nothing - else - - --let's bounce something! - - --if dx == 0 then - -- bounce away eggs - -- dx = 0.5 - --end - - dx = dx*(-1) - dy = dy*(-1) - SetGearVelocity(gear,dx,dy) - setGearValue(gear,"deflects",(gDeflects+1)) - - AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) - PlaySound(sndExplosion) - - strucHealth[tempID] = strucHealth[tempID] - gDmg - strucCircCol[tempID] = strucCircCol[tempID] - gDmg - - if strucHealth[tempID] <= 0 then - AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtExplosion, 0, false) - DeleteGear(strucGear[tempID]) - PlaySound(sndExplosion) - end - - end - - else - DeleteGear(gear) - AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false) - PlaySound(sndVaporize) - end - end - end - - --mark as within range of a teleporter node - elseif strucType[tempID] == loc("Teleportation Node") then - - if GetGearType(gear) == gtHedgehog then - if GetHogClan(gear) == strucClan[tempID] then - --tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) - - for i = 1, #sProx do - if sProx[i][1] == loc("Teleportation Mode") then - sProx[i][2] = true - end - end - end end + end - -- mark as within range of construction station - -- and thus allow menu access to placement modes - -- for girders, mines, sticky mines and barrels - elseif strucType[tempID] == loc("Construction Station") then + --mark as within range of a teleporter node + elseif strucType[tempID] == loc("Teleportation Node") then + + if GetGearType(gear) == gtHedgehog then + if GetHogClan(gear) == strucClan[tempID] then - if GetGearType(gear) == gtHedgehog then - if GetHogClan(gear) == strucClan[tempID] then - tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) + for i = 1, #sProx do + if sProx[i][1] == loc("Teleportation Mode") then + sProx[i][2] = true + end + end + + end + end - for i = 1, #sProx do - if ((sProx[i][1] == loc("Girder Placement Mode")) - or (sProx[i][1] == loc("Rubber Placement Mode")) - or (sProx[i][1] == loc("Mine Placement Mode")) - or (sProx[i][1] == loc("Sticky Mine Placement Mode")) - or (sProx[i][1] == loc("Barrel Placement Mode"))) - then - sProx[i][2] = true - end + -- mark as within range of construction station + -- and thus allow menu access to placement modes + -- for girders, mines, sticky mines and barrels + elseif strucType[tempID] == loc("Construction Station") then + + if GetGearType(gear) == gtHedgehog then + if GetHogClan(gear) == strucClan[tempID] then + tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) + + for i = 1, #sProx do + if ((sProx[i][1] == loc("Girder Placement Mode")) + or (sProx[i][1] == loc("Rubber Placement Mode")) + or (sProx[i][1] == loc("Mine Placement Mode")) + or (sProx[i][1] == loc("Sticky Mine Placement Mode")) + or (sProx[i][1] == loc("Barrel Placement Mode"))) + then + sProx[i][2] = true end + end - end end + end - -- mark as within stupport station range - -- and thus allow menu access to placement modes - -- for weapon, utility, and med crates - elseif strucType[tempID] == loc("Support Station") then + -- mark as within stupport station range + -- and thus allow menu access to placement modes + -- for weapon, utility, and med crates + elseif strucType[tempID] == loc("Support Station") then - if GetGearType(gear) == gtHedgehog then - if GetHogClan(gear) == strucClan[tempID] then - tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) + if GetGearType(gear) == gtHedgehog then + if GetHogClan(gear) == strucClan[tempID] then + tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) - for i = 1, #sProx do - if ((sProx[i][1] == loc("Health Crate Placement Mode")) - or (sProx[i][1] == loc("Weapon Crate Placement Mode")) - or (sProx[i][1] == loc("Utility Crate Placement Mode"))) - then - sProx[i][2] = true - --AddCaption("wahey in a support station") - end + for i = 1, #sProx do + if ((sProx[i][1] == loc("Health Crate Placement Mode")) + or (sProx[i][1] == loc("Weapon Crate Placement Mode")) + or (sProx[i][1] == loc("Utility Crate Placement Mode"))) + then + sProx[i][2] = true end + end - end end - - -- doesn't do shit - elseif strucType[tempID] == loc("Core") then - - if GetGearType(gear) == gtHedgehog then - if GetHogClan(gear) == strucClan[tempID] then - - tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) - g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) - SetVisualGearValues(tempE, g1+20, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(strucClan[tempID]) ) - - tempE = AddVisualGear(GetX(strucGear[tempID]), GetY(strucGear[tempID]), vgtSmoke, 0, true) - g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) - SetVisualGearValues(tempE, g1-20, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(strucClan[tempID]) ) - - end - end - end - end - --end + end end @@ -849,70 +805,49 @@ function HandleStructures() - for i = 1, #sProx do - sProx[i][2] = false + if GameTime % 100 == 0 then + for i = 1, #sProx do + sProx[i][2] = false - if sProx[i][1] == loc("Structure Placement Mode") then - sProx[i][2] = true + if sProx[i][1] == loc("Structure Placement Mode") then + sProx[i][2] = true + end + end - end for i = 1, #strucID do - g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(strucCirc[i]) - SetVisualGearValues(strucCirc[i], GetX(strucGear[i]), GetY(strucGear[i]), g3, g4, g5, g6, g7, strucCircRadius[i], g9, strucCircCol[i]) + SetVisualGearValues(strucCirc[i], GetX(strucGear[i]), GetY(strucGear[i]), nil, nil, nil, nil, nil, strucCircRadius[i], nil, strucCircCol[i]) tempID = i - g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(strucAltDisplay[i]) --8000 - SetVisualGearValues(strucAltDisplay[i], GetX(strucGear[i]), GetY(strucGear[i]), 0, 0, g5, g6, 800000, sprTarget, g9, g10 ) - - + SetVisualGearValues(strucAltDisplay[i], GetX(strucGear[i]), GetY(strucGear[i]), 0, 0, nil, nil, 800000, sprTarget) - -- Check For proximity of stuff to our structures - if isAStructureThatAppliesToMultipleGears(i) then - runOnGears(CheckProximity) - else -- only check prox on CurrentHedgehog - CheckProximity(CurrentHedgehog) - end - - if strucType[i] == loc("Core") then - tempE = AddVisualGear(GetX(strucGear[i]), GetY(strucGear[i]), vgtSmoke, 0, true) - g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) - SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(strucClan[i]) ) - elseif strucType[i] == loc("Reflector Shield") then - - + if GameTime % 100 == 0 then + -- Check For proximity of stuff to our structures + if isAStructureThatAppliesToMultipleGears(i) then + runOnGears(CheckProximity) + else -- only check prox on CurrentHedgehog + if CurrentHedgehog ~= nil then + CheckProximity(CurrentHedgehog) + end + end - --frameID = 1 - --visualSprite = sprTarget - --g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(strucAltDisplay[i]) --frameID / g6 - --SetVisualGearValues(strucAltDisplay[i], GetX(strucGear[i]), GetY(strucGear[i]), 0, 0, g5, g6, 8000, visualSprite, g9, g10 ) - - elseif strucType[i] == loc("Generator") then - - --frameID = 1 - --visualSprite = sprTarget - --layer - --tempE = AddVisualGear(GetX(strucGear[i]), GetY(strucGear[i]), vgtStraightShot, 1, true,1) - --g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) --g9 - --SetVisualGearValues(tempE, g1, g2, 0, 0, g5, frameID, g7, visualSprite, g9, g10 ) - --SetState(strucGear[i], bor(GetState(strucGear[i]),gstInvisible) ) - - --currently generate power for all clans. - -- or should power only be generated for current clan? - for z = 0, ClansCount-1 do - if z == strucClan[i] then - increaseGearValue(strucGear[i],"power") - if getGearValue(strucGear[i],"power") == 10 then - setGearValue(strucGear[i],"power",0) - clanPower[z] = clanPower[z] + 1 - if clanPower[z] > 1000 then - clanPower[z] = 1000 + if strucType[i] == loc("Generator") then + + for z = 0, ClansCount-1 do + if z == strucClan[i] then + increaseGearValue(strucGear[i],"power") + if getGearValue(strucGear[i],"power") == 10 then + setGearValue(strucGear[i],"power",0) + clanPower[z] = clanPower[z] + 1 + if conf_maxEnergy ~= "inf" and clanPower[z] > conf_maxEnergy then + clanPower[z] = conf_maxEnergy + end end + end - end end @@ -925,47 +860,41 @@ -- this is kinda messy and gross (even more than usual), fix it up at some point -- it just assumes that if you have access to girders, it works for rubbers -- as that is what the struc implemenation means due to construction station - anyUIProx = false - for i = 1, #sProx do + if GameTime % 100 == 0 and CurrentHedgehog ~= nil then + anyUIProx = false + for i = 1, #sProx do - if sProx[i][1] == loc("Girder Placement Mode") then - if sProx[i][2] == true then - AddAmmo(CurrentHedgehog, amGirder, 100) - AddAmmo(CurrentHedgehog, amRubber, 100) - AddAmmo(CurrentHedgehog, amDrillStrike, 100) - else - AddAmmo(CurrentHedgehog, amGirder, 0) - AddAmmo(CurrentHedgehog, amRubber, 0) - AddAmmo(CurrentHedgehog, amDrillStrike, 0) -- new - end - elseif sProx[i][1] == loc("Teleportation Mode") then - if sProx[i][2] == true then - AddAmmo(CurrentHedgehog, amTeleport, 100) - else - AddAmmo(CurrentHedgehog, amTeleport, 0) + if sProx[i][1] == loc("Girder Placement Mode") then + if sProx[i][2] == true then + AddAmmo(CurrentHedgehog, amGirder, 100) + AddAmmo(CurrentHedgehog, amRubber, 100) + AddAmmo(CurrentHedgehog, amDrillStrike, 100) + else + AddAmmo(CurrentHedgehog, amGirder, 0) + AddAmmo(CurrentHedgehog, amRubber, 0) + AddAmmo(CurrentHedgehog, amDrillStrike, 0) -- new + end + elseif sProx[i][1] == loc("Teleportation Mode") then + if sProx[i][2] == true then + AddAmmo(CurrentHedgehog, amTeleport, 100) + else + AddAmmo(CurrentHedgehog, amTeleport, 0) + end + elseif sProx[i][1] == loc("Weapon Crate Placement Mode") then + -- this is new stuff + if sProx[i][2] == true then + AddAmmo(CurrentHedgehog, amNapalm, 100) + else + AddAmmo(CurrentHedgehog, amNapalm, 0) + end end - elseif sProx[i][1] == loc("Weapon Crate Placement Mode") then - -- this is new stuff - if sProx[i][2] == true then - AddAmmo(CurrentHedgehog, amNapalm, 100) - else - AddAmmo(CurrentHedgehog, amNapalm, 0) - end - end - if (sProx[i][2] == true) then - anyUIProx = true - end - - end + if (sProx[i][2] == true) then + anyUIProx = true + end - -- doesn't do shit atm, maybe later when we add cores we can use this - --if anyUIProx == true then --(and core is placed) - -- AddAmmo(CurrentHedgehog, amAirAttack, 100) - --else - -- AddAmmo(CurrentHedgehog, amAirAttack, 0) - --end - + end + end end @@ -1014,16 +943,16 @@ {amClusterBomb, "amClusterBomb", 0, loc("Cluster Bomb"), 3*placeholder}, {amMolotov, "amMolotov", 0, loc("Molotov Cocktail"), 3*placeholder}, {amWatermelon, "amWatermelon", 0, loc("Watermelon Bomb"), 25*placeholder}, - {amHellishBomb, "amHellishBomb", 0, loc("Hellish Handgrenade"), 25*placeholder}, - {amGasBomb, "amGasBomb", 0, loc("Limburger"), 3*placeholder}, + {amHellishBomb, "amHellishBomb", 0, loc("Hellish hand-grenade"), 25*placeholder}, + {amGasBomb, "amGasBomb", 0, loc("Old Limburger"), 3*placeholder}, {amShotgun, "amShotgun", 0, loc("Shotgun"), 2*placeholder}, {amDEagle, "amDEagle", 0, loc("Desert Eagle"), 2*placeholder}, {amFlamethrower,"amFlamethrower", 0, loc("Flamethrower"), 4*placeholder}, {amSniperRifle, "amSniperRifle", 0, loc("Sniper Rifle"), 3*placeholder}, - --{amSineGun, "amSineGun", 0, loc("SineGun"), 6*placeholder}, + --{amSineGun, "amSineGun", 0, loc("Sine Gun"), 6*placeholder}, {amIceGun, "amIceGun", 0, loc("Freezer"), 15*placeholder}, - {amLandGun, "amLandGun", 0, loc("Land Sprayer"), 5*placeholder}, + {amLandGun, "amLandGun", 0, loc("Land Spray"), 5*placeholder}, {amFirePunch, "amFirePunch", 0, loc("Shoryuken"), 3*placeholder}, {amWhip, "amWhip", 0, loc("Whip"), 1*placeholder}, @@ -1053,11 +982,11 @@ utilArray = { - {amBlowTorch, "amBlowTorch", 0, loc("Blowtorch"), 4*placeholder}, - {amPickHammer, "amPickHammer", 0, loc("Pickhammer"), 2*placeholder}, + {amBlowTorch, "amBlowTorch", 0, loc("Blow Torch"), 4*placeholder}, + {amPickHammer, "amPickHammer", 0, loc("Pick Hammer"), 2*placeholder}, --{amGirder, "amGirder", 0, loc("Girder"), 4*placeholder}, - --{amRubber, "amRubber", 0, loc("Rubber Band"), 5*placeholder}, - {amPortalGun, "amPortalGun", 0, loc("Personal Portal Device"), 15*placeholder}, + --{amRubber, "amRubber", 0, loc("Rubber"), 5*placeholder}, + {amPortalGun, "amPortalGun", 0, loc("Portable Portal Device"), 15*placeholder}, {amRope, "amRope", 0, loc("Rope"), 7*placeholder}, {amParachute, "amParachute", 0, loc("Parachute"), 2*placeholder}, @@ -1073,24 +1002,12 @@ {amExtraTime, "amExtraTime", 0, loc("Extra Time"), 8*placeholder} --{amResurrector, "amResurrector", 0, loc("Resurrector"), 8*placeholder}, - --{amTardis, "amTardis", 0, loc("Tardis"), 2*placeholder}, + --{amTardis, "amTardis", 0, loc("Time Box"), 2*placeholder}, --{amSwitch, "amSwitch", 0, loc("Switch Hog"), 4*placeholder} } ---------------------------- --- hog and map editting junk ----------------------------- - - local reducedSpriteIDArray = { - sprBigDigit, sprKowtow, sprBee, sprExplosion50, sprGirder - } - - local reducedSpriteTextArray = { - "sprBigDigit", "sprKowtow", "sprBee", "sprExplosion50", "sprGirder" - } - ----------------------------- -- placement shite ---------------------------- @@ -1108,13 +1025,6 @@ "Health Crate Placement Mode", "Weapon Crate Placement Mode", "Utility Crate Placement Mode", - --"Target Placement Mode", - --"Cleaver Placement Mode", - - --"Advanced Repositioning Mode", - --"Tagging Mode", - --"Sprite Testing Mode", - --"Sprite Placement Mode", "Structure Placement Mode" } @@ -1128,13 +1038,6 @@ {loc("Health Crate Placement Mode"),false}, {loc("Weapon Crate Placement Mode"),false}, {loc("Utility Crate Placement Mode"),false}, - --{loc("Target Placement Mode"),false}, - --{loc("Cleaver Placement Mode"),false}, - - --{loc("Advanced Repositioning Mode"),false}, - --{loc("Tagging Mode"),false}, - --{loc("Sprite Testing Mode"),false}, - --{loc("Sprite Placement Mode"),false}, {loc("Structure Placement Mode"),false}, {loc("Teleportation Mode"),false} } @@ -1143,8 +1046,6 @@ local pMode = {} -- pMode contains custom subsets of the main categories local pIndex = 1 -local genTimer = 0 - local CGR = 1 -- current girder rotation, we actually need this as HW remembers what rotation you last used local placedX = {} @@ -1202,7 +1103,7 @@ placedSpec[placedCount] = pMode[pIndex] if (clanUsedExtraTime[GetHogClan(CurrentHedgehog)] == true) and (cat[cIndex] == "Utility Crate Placement Mode") and (utilArray[pIndex][1] == amExtraTime) then - AddCaption(loc("You may only use 1 Extra Time per turn."),0xffba00ff,capgrpVolume) + AddCaption(loc("You may only spawn 1 Extra Time per turn."),0xffba00ff,capgrpVolume) PlaySound(sndDenied) elseif (clanCratesSpawned[GetHogClan(CurrentHedgehog)] > 4) and ( (cat[cIndex] == "Health Crate Placement Mode") or (cat[cIndex] == "Utility Crate Placement Mode") or (cat[cIndex] == "Weapon Crate Placement Mode") ) then AddCaption(loc("You may only spawn 5 crates per turn."),0xffba00ff,capgrpVolume) @@ -1218,12 +1119,7 @@ placedSpec[placedCount] = CGR elseif cat[cIndex] == "Rubber Placement Mode" then PlaceSprite(x,y, sprAmRubber, CGR, nil, nil, nil, nil, lfBouncy) - --PlaceGirder(x, y, CGR) placedSpec[placedCount] = CGR - elseif cat[cIndex] == "Target Placement Mode" then - gear = AddGear(x, y, gtTarget, 0, 0, 0, 0) - elseif cat[cIndex] == "Cleaver Placement Mode" then - gear = AddGear(x, y, gtKnife, 0, 0, 0, 0) elseif cat[cIndex] == "Health Crate Placement Mode" then gear = SpawnHealthCrate(x,y) SetHealth(gear, pMode[pIndex]) @@ -1252,88 +1148,6 @@ SetTimer(gear, pMode[pIndex]) elseif cat[cIndex] == "Sticky Mine Placement Mode" then gear = AddGear(x, y, gtSMine, 0, 0, 0, 0) - elseif cat[cIndex] == "Advanced Repositioning Mode" then - - if pMode[pIndex] == "Selection Mode" then - closestDist = 999999999 - closestGear = nil -- just in case - sGear = nil - runOnGears(SelectGear) - sGear = closestGear - closestGear = nil - elseif pMode[pIndex] == "Placement Mode" then - if sGear ~= nil then - SetGearPosition(sGear, x, y) - end - end - - elseif cat[cIndex] == "Tagging Mode" then - - closestDist = 999999999 - closestGear = nil - sGear = nil - runOnGears(SelectGear) - - - if closestGear ~= nil then - - if getGearValue(closestGear,"tag") == nil then - - --if there is no tag, add a victory/failure tag and circle - setGearValue(closestGear, "tCirc",AddVisualGear(0,0,vgtCircle,0,true)) - - --AddCaption("circ added",0xffba00ff,capgrpVolume) - - if pMode[pIndex] == "Tag Victory Mode" then - setGearValue(closestGear, "tag","victory") - SetVisualGearValues(getGearValue(closestGear,"tCirc"), 0, 0, 100, 255, 1, 10, 0, 40, 3, 0xff0000ff) - elseif pMode[pIndex] == "Tag Failure Mode" then - setGearValue(closestGear, "tag","failure") - SetVisualGearValues(getGearValue(closestGear,"tCirc"), 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x0000ffff) - end - - - else - -- remove tag and delete circ - --AddCaption("circ removed",0xffba00ff,capgrpVolume) - setGearValue(closestGear, "tag", nil) - DeleteVisualGear(getGearValue(closestGear,"tCirc")) - setGearValue(closestGear, "tCirc", nil) - end - - end - - - elseif cat[cIndex] == "Sprite Testing Mode" then - - frameID = 1 - visualSprite = reducedSpriteIDArray[pIndex] - --visualSprite = spriteIDArray[pIndex] - tempE = AddVisualGear(x, y, vgtStraightShot, 0, true) - g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) - SetVisualGearValues(tempE, g1, g2, 0, 0, g5, frameID, g7, visualSprite, g9, g10 ) - --sprHorizonLong crashes game, so does skyL, as does flake - - -- reduced list of cool sprites - -- sprBigDigit, sprKnife, sprFrozenHog, sprKowtow, sprBee, sprExplosion50, sprPiano, sprChunk, sprHHTelepMask, sprSeduction, sprSwitch, sprGirder, - --sprAMAmmos, sprAMSlotKeys, sprTurnsLeft, sprExplosivesRoll + maybe some others like the health case, arrows, etc - - elseif cat[cIndex] == "Sprite Placement Mode" then - - PlaceSprite(x,y, reducedSpriteIDArray[pIndex], 1, nil, nil, nil, nil, landType) - --PlaceGirder(x, y, CGR) - placedSpec[placedCount] = reducedSpriteTextArray[pIndex] - placedSuperSpec[placedCount] = landType - - if landType == lfIce then - placedSuperSpec[placedCount] = "lfIce" - elseif landType == lfIndestructible then - placedSuperSpec[placedCount] = "lfIndestructible" - elseif landType == lfBouncy then - placedSuperSpec[placedCount] = "lfBouncy" - else - placedSuperSpec[placedCount] = "lfNormal" - end elseif cat[cIndex] == "Structure Placement Mode" then @@ -1367,64 +1181,35 @@ if cat[cIndex] == "Girder Placement Mode" then pIndex = CGR - pMode = {"Girder"} - -- pCount = 1 + pMode = {loc("Girder")} elseif cat[cIndex] == "Rubber Placement Mode" then pIndex = CGR - pMode = {"Rubber"} + pMode = {loc("Rubber")} placedExpense = 3 - -- pCount = 1??? - elseif cat[cIndex] == "Target Placement Mode" then - pMode = {"Standard Target"} - elseif cat[cIndex] == "Cleaver Placement Mode" then - pMode = {"Standard Cleaver"} elseif cat[cIndex] == "Barrel Placement Mode" then - --pMode = {1,50,75,100} - pMode = {50} + pMode = {60} placedExpense = 10 elseif cat[cIndex] == "Health Crate Placement Mode" then - --pMode = {25,50,75,100} - pMode = {25} + pMode = {HealthCaseAmount} placedExpense = 5 elseif cat[cIndex] == "Weapon Crate Placement Mode" then for i = 1, #atkArray do - pMode[i] = atkArray[i][4] -- was [2] - --placedExpense = atkArray[5] + pMode[i] = atkArray[i][4] end - placedExpense = 30 + placedExpense = atkArray[pIndex][5] elseif cat[cIndex] == "Utility Crate Placement Mode" then for i = 1, #utilArray do - pMode[i] = utilArray[i][4] -- was [2] - --placedExpense = utilArray[5] + pMode[i] = utilArray[i][4] end - placedExpense = 20 + placedExpense = utilArray[pIndex][5] elseif cat[cIndex] == "Mine Placement Mode" then - --pMode = {1,1000,2000,3000,4000,5000,0} - pMode = {1,1000,2000,3000,4000,5000} - -- 0 is dud right, or is that nil? + pMode = {0,1000,2000,3000,4000,5000} placedExpense = 15 elseif cat[cIndex] == "Sticky Mine Placement Mode" then - pMode = {"Normal Sticky Mine"} - --elseif cat[cIndex] == "Gear Repositioning Mode" then - -- for i = 1, #hhs do - -- pMode[i] = GetHogName(hhs[i]) - -- end + pMode = {loc("Sticky Mine")} placedExpense = 20 - elseif cat[cIndex] == "Advanced Repositioning Mode" then - pMode = {"Selection Mode","Placement Mode"} - elseif cat[cIndex] == "Tagging Mode" then - pMode = {"Tag Victory Mode","Tag Failure Mode"} - elseif cat[cIndex] == "Sprite Testing Mode" or cat[cIndex] == "Sprite Placement Mode" then - --for i = 1, #spriteTextArray do - -- pMode[i] = spriteTextArray[i] - --end - for i = 1, #reducedSpriteTextArray do - pMode[i] = reducedSpriteTextArray[i] - end - placedExpense = 100 elseif cat[cIndex] == "Structure Placement Mode" then - pMode = {loc("Healing Station"), loc("Bio-Filter"), loc("Weapon Filter"), loc("Reflector Shield"), loc("Respawner"),loc("Teleportation Node"),--[[loc("Core"),]]loc("Generator"),loc("Construction Station"),loc("Support Station")} - --placedExpense = 100 + pMode = {loc("Healing Station"), loc("Bio-Filter"), loc("Weapon Filter"), loc("Reflector Shield"), loc("Respawner"),loc("Teleportation Node"),loc("Generator"),loc("Construction Station"),loc("Support Station")} end @@ -1435,6 +1220,8 @@ -- called in onGameTick() function HandleHedgeEditor() + HandleStructures() + if CurrentHedgehog ~= nil then if wallsVisible == true then @@ -1444,19 +1231,18 @@ if (CurrentHedgehog ~= nil) and (TurnTimeLeft ~= TurnTime) then if (lastWep ~= GetCurAmmoType()) then checkForSpecialWeapons() + elseif checkForSpecialWeaponsIn == 0 then + checkForSpecialWeapons() + checkForSpecialWeaponsIn = -1 + else + checkForSpecialWeaponsIn = checkForSpecialWeaponsIn - 1 end end - genTimer = genTimer + 1 - - if genTimer >= 100 then - - genTimer = 0 + if GameTime % 100 == 0 then DrawTag(1) - HandleStructures() - curWep = GetCurAmmoType() -- change to girder mode on weapon swap @@ -1468,10 +1254,10 @@ RedefineSubset() -- change to generic mode if girder no longer selected elseif (cIndex == 1) and (curWep ~= amGirder) then - cIndex = 3 -- was 2 + cIndex = 3 RedefineSubset() elseif (cIndex == 2) and (curWep ~= amRubber) then - cIndex = 3 --new + cIndex = 3 RedefineSubset() end @@ -1518,7 +1304,7 @@ AddCaption(loc(cat[cIndex]),0xffba00ff,capgrpMessage) - AddCaption(pMode[pIndex],0xffba00ff,capgrpMessage2) + showModeMessage() wallsVisible = true else wallsVisible = false @@ -1528,17 +1314,6 @@ end - --update selected gear display - if (cat[cIndex] == "Advanced Repositioning Mode") and (sGear ~= nil) then - SetVisualGearValues(sCirc, GetX(sGear), GetY(sGear), 100, 255, 1, 10, 0, 300, 3, 0xff00ffff) - elseif (cat[cIndex] == "Tagging Mode") then - if (sGear ~= nil) or (closestGear ~= nil) then - SetVisualGearValues(sCirc, GetX(sGear), GetY(sGear), 0, 1, 1, 10, 0, 1, 1, 0x00000000) - closestGear = nil - sGear = nil - end - end - -- some kind of target detected, tell me your story if cGear ~= nil then @@ -1555,52 +1330,13 @@ CGR = GetState(cGear) - -- improve rectangle test based on CGR when you can be bothered - --if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then - -- AddCaption("Invalid Girder Placement",0xffba00ff,capgrpVolume) - --else - PlaceObject(x, y) - --end - - -- this allows the girder tool to be used like a mining laser - - --[[ - - if CGR < 4 then - AddGear(x, y, gtGrenade, 0, 0, 0, 1) - elseif CGR == 4 then - g = AddGear(x-30, y, gtGrenade, 0, 0, 0, 1) - g = AddGear(x+30, y, gtGrenade, 0, 0, 0, 1) - elseif CGR == 5 then ------- - g = AddGear(x+30, y+30, gtGrenade, 0, 0, 0, 1) - g = AddGear(x-30, y-30, gtGrenade, 0, 0, 0, 1) - elseif CGR == 6 then - g = AddGear(x, y+30, gtGrenade, 0, 0, 0, 1) - g = AddGear(x, y-30, gtGrenade, 0, 0, 0, 1) - elseif CGR == 7 then ------- - g = AddGear(x+30, y-30, gtGrenade, 0, 0, 0, 1) - g = AddGear(x-30, y+30, gtGrenade, 0, 0, 0, 1) - end -]] + PlaceObject(x, y) end end end --------------------------------------------------- --- EVENT HANDLERS --------------------------------------------------- - -function onTaunt(t) - tauntString = tauntString .. t - if (tauntString == "101") and (clanPower[GetHogClan(CurrentHedgehog)] < 300) and (clanBoon[GetHogClan(CurrentHedgehog)] == false) then - clanBoon[GetHogClan(CurrentHedgehog)] = true - clanPower[GetHogClan(CurrentHedgehog)] = 1000 - AddCaption(loc("The Great Hog in the sky sees your sadness and grants you a boon.")) - end -end - --------------------------------------------------------------- -- Cycle through selection subsets (by changing pIndex, pMode) -- i.e health of barrels, medikits, @@ -1629,11 +1365,9 @@ placedExpense = 300 elseif pMode[pIndex] == loc("Reflector Shield") then placedExpense = 200 - elseif pMode[pIndex] == loc("Core") then - placedExpense = 1 - elseif cat[cIndex] == loc("Weapon Crate Placement Mode") then + elseif cat[cIndex] == "Weapon Crate Placement Mode" then placedExpense = atkArray[pIndex][5] - elseif cat[cIndex] == loc("Utility Crate Placement Mode") then + elseif cat[cIndex] == "Utility Crate Placement Mode" then placedExpense = utilArray[pIndex][5] end @@ -1641,6 +1375,12 @@ end +function onTimer(key) + + checkForSpecialWeaponsIn = 1 + +end + function onLeft() pIndex = pIndex - 1 @@ -1649,7 +1389,7 @@ end if (curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) then - AddCaption(pMode[pIndex],0xffba00ff,capgrpMessage2) + showModeMessage() updateCost() end @@ -1664,12 +1404,28 @@ end if (curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) then - AddCaption(pMode[pIndex],0xffba00ff,capgrpMessage2) + showModeMessage() updateCost() end end +function showModeMessage() + if CurrentHedgehog == nil then return end + local val = pMode[pIndex] + local str + if cat[cIndex] == "Mine Placement Mode" then + -- timer in seconds + str = string.format(loc("%d sec"), div(val, 1000)) + elseif cat[cIndex] == "Girder Placement Mode" then + str = loc("Girder") + elseif cat[cIndex] == "Rubber Placement Mode" then + str = loc("Rubber") + else + str = tostring(val) + end + AddCaption(str,0xffba00ff,capgrpMessage2) +end function updatePlacementDisplay(pDir) @@ -1683,10 +1439,6 @@ cIndex = 3 -- 2 ----we no longer hit girder by normal means end - -- new way of doing things - -- sProx[cIndex][2] == true just basically means we have ACCESS to something - -- but that doesn't neccessarily mean we are in the correct content menu, anymore - -- so we need to refine this a little if sProx[cIndex][2] == true then if (GetCurAmmoType() == amNapalm) then if (sProx[cIndex][1] == loc("Health Crate Placement Mode")) or @@ -1711,9 +1463,6 @@ if foundMatch == true then - --if sProx[cIndex][2] == true then - -- normal case (scrolling through) - --foundMatch = true RedefineSubset() updateCost() end @@ -1729,7 +1478,7 @@ --------------------------------------------------------- function onUp() - if ((curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) ) then + if ( (curWep == amNapalm) or (curWep == amDrillStrike) ) then updatePlacementDisplay(-1) end @@ -1737,7 +1486,7 @@ function onDown() - if ((curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) ) then + if ( (curWep == amNapalm) or (curWep == amDrillStrike) ) then updatePlacementDisplay(1) end @@ -1747,6 +1496,29 @@ -- standard event handlers ---------------------------- +-- Parses a positive integer +function parseInt(str, default) + if str == nil then return default end + local s = string.match(str, "(%d*)") + if s ~= nil then + return math.min(4294967295, math.max(0, tonumber(s))) + else + return nil + end +end + +-- Parse parameters +function onParameters() + parseParams() + conf_initialEnergy = parseInt(params["initialenergy"], conf_initialEnergy) + conf_energyPerRound = parseInt(params["energyperround"], conf_energyPerRound) + if params["maxenergy"] == "inf" then + conf_maxEnergy = "inf" + else + conf_maxEnergy = parseInt(params["maxenergy"], conf_maxEnergy) + end +end + function onGameInit() Explosives = 0 @@ -1777,13 +1549,10 @@ ShowMission ( loc("CONSTRUCTION MODE"), loc("a Hedgewars mini-game"), - " " .. "|" .. loc("Build a fortress and destroy your enemy.") .. "|" .. - --loc("Defend your core from the enemy.") .. "|" .. loc("There are a variety of structures available to aid you.") .. "|" .. loc("Use the air-attack weapons and the arrow keys to select structures.") .. "|" .. " " .. "|" .. - --loc("Core") .. ": " .. loc("Allows placement of structures.") .. "|" .. loc("Healing Station") .. ": " .. loc("Grants nearby hogs life-regeneration.") .. "|" .. loc("Bio-Filter") .. ": " .. loc("Aggressively removes enemy hedgehogs.") .. "|" .. loc("Weapon Filter") .. ": " .. loc("Dematerializes weapons and equipment carried by enemy hedgehogs.") .. "|" .. @@ -1793,12 +1562,8 @@ loc("Respawner") .. ": " .. loc("Resurrects dead hedgehogs.") .. "|" .. loc("Teleportation Node") .. ": " .. loc("Allows free teleportation between other nodes.") .. "|" .. loc("Construction Station") .. ": " .. loc("Allows placement of girders, rubber-bands, mines, sticky mines and barrels.") .. "|" .. - loc("Support Station") .. ": " .. loc("Allows the placement of weapons, utiliites, and health crates.") .. "|" .. - - - " " .. "|" .. - --" " .. "|" .. - "", 4, 5000 + loc("Support Station") .. ": " .. loc("Allows the placement of weapons, utiliites, and health crates.") + , 4, 5000 ) @@ -1806,14 +1571,13 @@ SetVisualGearValues(sCirc, 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x00000000) for i = 0, ClansCount-1 do - clanPower[i] = 500 - clanBoon[i] = false + clanPower[i] = conf_initialEnergy clanLWepIndex[i] = 1 -- for ease of use let's track this stuff clanLUtilIndex[i] = 1 clanLGearIndex[i] = 1 clanUsedExtraTime[i] = false clanCratesSpawned[i] = 0 - + clanFirstTurn[i] = true end @@ -1845,10 +1609,17 @@ function onNewTurn() - tauntString = "" - clanPower[GetHogClan(CurrentHedgehog)] = clanPower[GetHogClan(CurrentHedgehog)] + 50 - clanUsedExtraTime[GetHogClan(CurrentHedgehog)] = false - clanCratesSpawned[GetHogClan(CurrentHedgehog)] = 0 + local clan = GetHogClan(CurrentHedgehog) + if clanFirstTurn[clan] then + clanFirstTurn[clan] = false + else + clanPower[clan] = clanPower[clan] + conf_energyPerRound + if conf_maxEnergy ~= "inf" and clanPower[clan] > conf_maxEnergy then + clanPower[clan] = conf_maxEnergy + end + end + clanUsedExtraTime[clan] = false + clanCratesSpawned[clan] = 0 end @@ -1871,7 +1642,6 @@ function onGearAdd(gear) if GetGearType(gear) == gtHedgehog then - --table.insert(hhs, gear) elseif (GetGearType(gear) == gtAirAttack) or (GetGearType(gear) == gtTeleport) or (GetGearType(gear) == gtGirder) then cGear = gear