Flightjoust lua script
authortiyuri@gmail.com
Wed, 04 Aug 2010 17:18:21 +0100
changeset 3726 5909c3c19bb1
parent 3725 5870a7d2b5c9
child 3727 1bee60236515
Flightjoust lua script
share/hedgewars/Data/Maps/FlightJoust/map.lua
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Maps/FlightJoust/map.lua	Wed Aug 04 17:18:21 2010 +0100
@@ -0,0 +1,53 @@
+local hogs = {}
+
+function mapM_(func, tbl)
+    for i,v in pairs(tbl) do
+        func(v)
+    end 
+end
+
+function map(func, tbl)
+    local newtbl = {}
+    for i,v in pairs(tbl) do
+        newtbl[i] = func(v)
+    end 
+    return newtbl
+end
+
+function onGameInit()
+    GameFlags = gfSolidLand + gfDivideTeams
+    TurnTime = 10000
+    CaseFreq = 0 
+    LandAdds = 0 
+    Explosives = 0 
+    Delay = 500 
+    SuddenDeathTurns = 99999 -- "disable" sudden death
+    Theme = Compost
+end
+
+function setHogPositions(gear)
+    if GetHogClan(gear) == 0 then
+        SetGearPosition(gear, 250, 1000)
+    end 
+    if GetHogClan(gear) == 1 then
+        SetGearPosition(gear, 3500, 1000)
+    end 
+end
+
+function onGameStart()
+    mapM_(setHogPositions, hogs)
+end
+
+function onAmmoStoreInit()
+    SetAmmo(amRCPlane, 9, 0, 0, 0)
+    SetAmmo(amSkip, 9, 0, 0, 0)
+end
+
+function onGearAdd(gear)
+    if GetGearType(gear) == gtRCPlane then
+        SetTimer(gear,60000)
+    end 
+    if GetGearType(gear) == gtHedgehog then
+        table.insert(hogs, gear)
+    end 
+end
\ No newline at end of file