SHOW:
|
|
- or go back to the newest paste.
1 | function gadget:GetInfo() | |
2 | return { | |
3 | name = "AoS Mode", | |
4 | desc = "AoS Mode", | |
5 | author = "sprung", | |
6 | date = "25/8/2012", | |
7 | license = "PD", | |
8 | layer = 1, | |
9 | enabled = true, | |
10 | } | |
11 | end | |
12 | ||
13 | if (not gadgetHandler:IsSyncedCode()) then | |
14 | return | |
15 | end | |
16 | ||
17 | --[[if (tobool(Spring.GetModOptions().aos) == false) then | |
18 | return | |
19 | end]] | |
20 | ||
21 | local hq0 | |
22 | local hq1 | |
23 | ||
24 | local edge_dist = 1000 -- cc | |
25 | local edge_dist2 = 1200 -- spawnpoint | |
26 | ||
27 | function gadget:UnitCreated(unitID, unitDefID, unitTeam) | |
28 | Spring.SetUnitBuildSpeed(unitID, 0, UnitDefs[unitDefID].repairSpeed, UnitDefs[unitDefID].reclaimSpeed, 0, 0, UnitDefs[unitDefID].terraformSpeed) | |
29 | -- blocks building and rez | |
30 | end | |
31 | ||
32 | function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) | |
33 | if(unitID == hq0) then Spring.GameOver({1}) | |
34 | elseif (unitID == hq1) then Spring.GameOver({0}) | |
35 | else | |
36 | _,_,_,_,_,allyteam = Spring.GetTeamInfo(unitTeam) | |
37 | if(allyteam == 0) then Spring.CreateUnit(UnitDefs[unitDefID].name, edge_dist2, Spring.GetGroundHeight(edge_dist2, edge_dist2), edge_dist2, 0, unitTeam) | |
38 | else Spring.CreateUnit(UnitDefs[unitDefID].name, Game.mapSizeX - edge_dist2, Spring.GetGroundHeight(Game.mapSizeX - edge_dist2, Game.mapSizeZ - edge_dist2), Game.mapSizeZ - edge_dist2, 2, unitTeam) | |
39 | end | |
40 | end | |
41 | end | |
42 | ||
43 | function gadget:GameStart() | |
44 | local team1 = Spring.GetTeamList(0)[1] | |
45 | local team2 = Spring.GetTeamList(1)[1] | |
46 | hq0 = Spring.CreateUnit("pw_hq", edge_dist, Spring.GetGroundHeight(edge_dist, edge_dist), edge_dist, 0, team1) | |
47 | hq1 = Spring.CreateUnit("pw_hq", Game.mapSizeX - edge_dist, Spring.GetGroundHeight(Game.mapSizeX - edge_dist, Game.mapSizeZ - edge_dist), Game.mapSizeZ - edge_dist, 2, team2) | |
48 | end |