changeset 11720 | 5cb2f245ee2f |
parent 11719 | 9fea4e2dceaa |
child 11721 | 8c1a30d4cbc8 |
11719:9fea4e2dceaa | 11720:5cb2f245ee2f |
---|---|
18 -- based on your money? |
18 -- based on your money? |
19 -- based on the number of strucs/gens you own? |
19 -- based on the number of strucs/gens you own? |
20 -- based on your existing arsenal? |
20 -- based on your existing arsenal? |
21 -- limit number of crates spawned per round perhaps (done) |
21 -- limit number of crates spawned per round perhaps (done) |
22 -- limit number of generators? |
22 -- limit number of generators? |
23 |
|
24 ------------------------------------------------------------------------------ |
|
25 -- SCRIPT PARAMETER |
|
26 ------------------------------------------------------------------------------ |
|
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 |
|
29 -- key is a word and each value is non-negative integer. |
|
30 -- |
|
31 -- Possible keys: |
|
32 --- initialenergy: Amount of energy that each team starts with (default: 500) |
|
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) |
|
35 |
|
36 -- Example: “initialenergy=750, maxenergy=2000” starts thee game with 750 energy |
|
37 -- and sets the maximum energy to 2000 |
|
23 |
38 |
24 ------------------------------------------------------------------------------ |
39 ------------------------------------------------------------------------------ |
25 --version history |
40 --version history |
26 ------------------------------------------------------------------------------ |
41 ------------------------------------------------------------------------------ |
27 --v0.1 |
42 --v0.1 |
110 -- it would be cool to have a red mask we could apply over girders |
125 -- it would be cool to have a red mask we could apply over girders |
111 -- that would indicate they were Indestructible |
126 -- that would indicate they were Indestructible |
112 |
127 |
113 HedgewarsScriptLoad("/Scripts/Locale.lua") |
128 HedgewarsScriptLoad("/Scripts/Locale.lua") |
114 HedgewarsScriptLoad("/Scripts/Tracker.lua") |
129 HedgewarsScriptLoad("/Scripts/Tracker.lua") |
130 HedgewarsScriptLoad("/Scripts/Params.lua") |
|
115 |
131 |
116 ---------------------------------------------- |
132 ---------------------------------------------- |
117 -- STRUC CRAP |
133 -- STRUC CRAP |
118 ---------------------------------------------- |
134 ---------------------------------------------- |
119 |
135 |
166 |
182 |
167 vTag = {} |
183 vTag = {} |
168 lastWep = nil |
184 lastWep = nil |
169 |
185 |
170 checkForSpecialWeaponsIn = -1 |
186 checkForSpecialWeaponsIn = -1 |
187 |
|
188 -- Config variables (script parameter) |
|
189 conf_initialEnergy = 500 |
|
190 conf_energyPerRound = 50 |
|
191 conf_maxEnergy = 1000 |
|
171 |
192 |
172 function HideTags() |
193 function HideTags() |
173 |
194 |
174 for i = 0, 2 do |
195 for i = 0, 2 do |
175 SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00) |
196 SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00) |
819 if z == strucClan[i] then |
840 if z == strucClan[i] then |
820 increaseGearValue(strucGear[i],"power") |
841 increaseGearValue(strucGear[i],"power") |
821 if getGearValue(strucGear[i],"power") == 10 then |
842 if getGearValue(strucGear[i],"power") == 10 then |
822 setGearValue(strucGear[i],"power",0) |
843 setGearValue(strucGear[i],"power",0) |
823 clanPower[z] = clanPower[z] + 1 |
844 clanPower[z] = clanPower[z] + 1 |
824 if clanPower[z] > 1000 then |
845 if clanPower[z] > conf_maxEnergy then |
825 clanPower[z] = 1000 |
846 clanPower[z] = conf_maxEnergy |
826 end |
847 end |
827 end |
848 end |
828 |
849 |
829 end |
850 end |
830 end |
851 end |
1473 |
1494 |
1474 ---------------------------- |
1495 ---------------------------- |
1475 -- standard event handlers |
1496 -- standard event handlers |
1476 ---------------------------- |
1497 ---------------------------- |
1477 |
1498 |
1499 -- Parses a positive integer |
|
1500 function parseInt(str, default) |
|
1501 if str == nil then return default end |
|
1502 local s = string.match(str, "(%d*)") |
|
1503 if s ~= nil then |
|
1504 return math.max(0, tonumber(s)) |
|
1505 else |
|
1506 return nil |
|
1507 end |
|
1508 end |
|
1509 |
|
1510 -- Parse parameters |
|
1511 function onParameters() |
|
1512 parseParams() |
|
1513 conf_initialEnergy = parseInt(params["initialenergy"], conf_initialEnergy) |
|
1514 conf_energyPerRound = parseInt(params["energyperround"], conf_energyPerRound) |
|
1515 conf_maxEnergy = parseInt(params["maxenergy"], conf_maxEnergy) |
|
1516 end |
|
1517 |
|
1478 function onGameInit() |
1518 function onGameInit() |
1479 |
1519 |
1480 Explosives = 0 |
1520 Explosives = 0 |
1481 MinesNum = 0 |
1521 MinesNum = 0 |
1482 |
1522 |
1529 |
1569 |
1530 sCirc = AddVisualGear(0,0,vgtCircle,0,true) |
1570 sCirc = AddVisualGear(0,0,vgtCircle,0,true) |
1531 SetVisualGearValues(sCirc, 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x00000000) |
1571 SetVisualGearValues(sCirc, 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x00000000) |
1532 |
1572 |
1533 for i = 0, ClansCount-1 do |
1573 for i = 0, ClansCount-1 do |
1534 clanPower[i] = 500 |
1574 clanPower[i] = conf_initialEnergy |
1535 clanLWepIndex[i] = 1 -- for ease of use let's track this stuff |
1575 clanLWepIndex[i] = 1 -- for ease of use let's track this stuff |
1536 clanLUtilIndex[i] = 1 |
1576 clanLUtilIndex[i] = 1 |
1537 clanLGearIndex[i] = 1 |
1577 clanLGearIndex[i] = 1 |
1538 clanUsedExtraTime[i] = false |
1578 clanUsedExtraTime[i] = false |
1539 clanCratesSpawned[i] = 0 |
1579 clanCratesSpawned[i] = 0 |
1567 end |
1607 end |
1568 |
1608 |
1569 |
1609 |
1570 function onNewTurn() |
1610 function onNewTurn() |
1571 |
1611 |
1572 clanPower[GetHogClan(CurrentHedgehog)] = clanPower[GetHogClan(CurrentHedgehog)] + 50 |
1612 local clan = GetHogClan(CurrentHedgehog) |
1573 clanUsedExtraTime[GetHogClan(CurrentHedgehog)] = false |
1613 clanPower[clan] = clanPower[clan] + conf_energyPerRound |
1574 clanCratesSpawned[GetHogClan(CurrentHedgehog)] = 0 |
1614 if clanPower[clan] > conf_maxEnergy then |
1615 clanPower[clan] = conf_maxEnergy |
|
1616 end |
|
1617 clanUsedExtraTime[clan] = false |
|
1618 clanCratesSpawned[clan] = 0 |
|
1575 |
1619 |
1576 end |
1620 end |
1577 |
1621 |
1578 function onGameTick() |
1622 function onGameTick() |
1579 HandleHedgeEditor() |
1623 HandleHedgeEditor() |