changeset 12908 | 9abb04174323 |
parent 12906 | 4ea0691d0ad5 |
child 12971 | f306a0c2899c |
12907:7bf84ebc6389 | 12908:9abb04174323 |
---|---|
171 end |
171 end |
172 end |
172 end |
173 |
173 |
174 -- Display ammo icon above gear. i = offset (start at 1) |
174 -- Display ammo icon above gear. i = offset (start at 1) |
175 local function displayAmmoIcon(gear, ammoType, i) |
175 local function displayAmmoIcon(gear, ammoType, i) |
176 if not GetHealth(gear) then |
|
177 return |
|
178 end |
|
176 local x = GetX(gear) + 2 |
179 local x = GetX(gear) + 2 |
177 local y = GetY(gear) + 32 * i |
180 local y = GetY(gear) + 32 * i |
178 local vgear = AddVisualGear(x, y, vgtAmmo, 0, true) |
181 local vgear = AddVisualGear(x, y, vgtAmmo, 0, true) |
179 if vgear ~= nil then |
182 if vgear ~= nil then |
180 local vgtX,vgtY,vgtdX,vgtdY,vgtAngle,vgtFrame,vgtFrameTicks,vgtState,vgtTimer,vgtTint = GetVisualGearValues(vgear) |
183 local vgtX,vgtY,vgtdX,vgtdY,vgtAngle,vgtFrame,vgtFrameTicks,vgtState,vgtTimer,vgtTint = GetVisualGearValues(vgear) |
182 SetVisualGearValues(vgear,vgtX,vgtY,vgtdX,vgtdY,vgtAngle,vgtFrame,vgtFrameTicks,vgtState,vgtTimer,vgtTint) |
185 SetVisualGearValues(vgear,vgtX,vgtY,vgtdX,vgtdY,vgtAngle,vgtFrame,vgtFrameTicks,vgtState,vgtTimer,vgtTint) |
183 end |
186 end |
184 end |
187 end |
185 |
188 |
186 function onGearDelete(gear) |
189 function onGearDelete(gear) |
187 if (isHog(gear)) then |
190 if (isEnemyHog(gear) and GetHealth(hero.gear)) then |
188 local availableTeleports = GetAmmoCount(hero.gear,amTeleport) |
191 local availableTeleports = GetAmmoCount(hero.gear,amTeleport) |
189 local availableSniper = GetAmmoCount(hero.gear,amSniperRifle) |
192 local availableSniper = GetAmmoCount(hero.gear,amSniperRifle) |
190 local ammolist = "" |
193 local ammolist = "" |
191 local tele = false |
194 local tele = false |
192 if availableTeleports < 2 then |
195 if availableTeleports < 2 then |
306 end |
309 end |
307 end |
310 end |
308 end |
311 end |
309 end |
312 end |
310 |
313 |
311 function isHog(gear) |
314 function isEnemyHog(gear) |
312 local hog = false |
315 for i=1, table.getn(enemiesOdd) do |
313 for i=1,table.getn(enemiesOdd) do |
|
314 if gear == enemiesOdd[i].gear then |
316 if gear == enemiesOdd[i].gear then |
315 hog = true |
317 return true |
316 break |
318 end |
317 end |
319 end |
318 end |
320 for i=1, table.getn(enemiesEven) do |
319 if not hog then |
321 if gear == enemiesEven then |
320 for i=1,table.getn(enemiesEven) do |
322 return true |
321 if gear == enemiesEven then |
323 end |
322 hog = true |
324 end |
323 break |
325 return false |
324 end |
326 end |
325 end |
|
326 end |
|
327 return hog |
|
328 end |