Advertisement
Guest User

spring rts : air attack safety distance gadget example

a guest
Apr 25th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. function gadget:GetInfo()
  2. return {
  3. name = "Attack Safety distance setter",
  4. desc = "Sets attack safety distance for fighter/bomber aircraft",
  5. author = "raaar",
  6. date = "2015",
  7. license = "PD",
  8. layer = 3,
  9. enabled = true
  10. }
  11. end
  12.  
  13.  
  14. local specialCases = {
  15. aven_ace = 9999.0
  16. }
  17.  
  18. local DEFAULT_DISTANCE = 350.0
  19.  
  20.  
  21. if (gadgetHandler:IsSyncedCode()) then
  22.  
  23. function gadget:UnitCreated(unitID, unitDefID, unitTeam)
  24. if (UnitDefs[unitDefID].canFly and UnitDefs[unitDefID].isStrafingAirUnit and not UnitDefs[unitDefID].hoverAttack) then
  25. local dist = DEFAULT_DISTANCE
  26. local name = UnitDefs[unitDefID].name
  27. if specialCases[name] then
  28. dist = specialCases[name]
  29. end
  30.  
  31. Spring.MoveCtrl.SetAirMoveTypeData(unitID,{attackSafetyDistance=dist})
  32. end
  33. end
  34.  
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement