68 |
68 |
69 function onAmmoStoreInit() |
69 function onAmmoStoreInit() |
70 SetAmmo(amRope, 9, 2, 0) |
70 SetAmmo(amRope, 9, 2, 0) |
71 end |
71 end |
72 |
72 |
73 function onGameTick() |
73 function onGameTick20() |
74 if TurnTimeLeft == 1 and CurrentHedgehog ~= nil then |
74 if CurrentHedgehog ~= nil and TurnTimeLeft <= 20 and TurnTimeLeft > 0 then |
75 SetHealth(CurrentHedgehog, 0) |
75 SetHealth(CurrentHedgehog, 0) |
76 x, y = GetGearPosition(CurrentHedgehog) |
76 x, y = GetGearPosition(CurrentHedgehog) |
77 AddGear(x, y, gtAmmo_Grenade, 0, 0, 0, 0) |
77 AddGear(x, y, gtShell, 0, 0, 0, 0) |
78 worsttime = 99999 |
78 worsttime = 99999 |
79 worsthog = nil |
79 worsthog = nil |
80 elseif TurnTimeLeft == maxtime - 1 and CurrentHedgehog ~= nil then |
80 elseif TurnTimeLeft > maxtime - 25 and CurrentHedgehog ~= nil then |
81 if lasthog ~= nil then |
81 if lasthog ~= nil then |
82 SetGearPosition(lasthog, p , 0) |
82 SetGearPosition(lasthog, p , 0) |
83 end |
83 end |
84 reached = false |
84 reached = false |
|
85 SetGearVelocity(CurrentHedgehog, 1, 0) |
85 SetGearPosition(CurrentHedgehog, start_area[1] + start_area[3] / 2, start_area[2] + start_area[4] / 2) |
86 SetGearPosition(CurrentHedgehog, start_area[1] + start_area[3] / 2, start_area[2] + start_area[4] / 2) |
|
87 ParseCommand("setweap " .. string.char(amRope)) |
|
88 lasthog = CurrentHedgehog |
86 elseif CurrentHedgehog ~= nil then |
89 elseif CurrentHedgehog ~= nil then |
87 x, y = GetGearPosition(CurrentHedgehog) |
90 x, y = GetGearPosition(CurrentHedgehog) |
88 if not reached and x > goal_area[1] and x < goal_area[1] + goal_area[3] and y > goal_area[2] and y < goal_area[2] + goal_area[4] then -- hog is within goal rectangle |
91 if not reached and x > goal_area[1] and x < goal_area[1] + goal_area[3] and y > goal_area[2] and y < goal_area[2] + goal_area[4] then -- hog is within goal rectangle |
89 reached = true |
92 reached = true |
90 local ttime = maxtime - TurnTimeLeft |
93 local ttime = maxtime - TurnTimeLeft |
146 function onGearAdd(gear) |
149 function onGearAdd(gear) |
147 if GetGearType(gear) == gtHedgehog then |
150 if GetGearType(gear) == gtHedgehog then |
148 hhs[numhhs] = gear |
151 hhs[numhhs] = gear |
149 times[numhhs] = 0 |
152 times[numhhs] = 0 |
150 numhhs = numhhs + 1 |
153 numhhs = numhhs + 1 |
151 elseif GetGearType(gear) == gtRope then -- rope is shot |
|
152 |
|
153 end |
154 end |
|
155 -- elseif GetGearType(gear) == gtRope then -- rope is shot |
154 end |
156 end |
155 |
157 |
156 function onGearDelete(gear) |
158 --function onGearDelete(gear) |
157 if GetGearType(gear) == gtRope then -- rope deletion - hog didn't manage to rerope |
159 -- if GetGearType(gear) == gtRope then -- rope deletion - hog didn't manage to rerope |
158 --TurnTimeLeft = 0 -- end turn or not? hm... |
160 -- --TurnTimeLeft = 0 -- end turn or not? hm... |
159 lasthog = CurrentHedgehog |
161 -- lasthog = CurrentHedgehog |
160 |
162 -- |
161 end |
163 -- end |
162 end |
164 --end |