Advertisement
ForbodingAngel

Untitled

Jul 28th, 2014
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. --Instagibb any features that are unlucky enough to be in the build radius of new construction projects
  2. function gadget:UnitCreated(uID, uDefID, uTeam, bID)
  3.  
  4. local uDef = UnitDefs[uDefID]
  5. if uDef.isBuilding or uDef.isFactory then
  6. local ux, uy, uz = Spring.GetUnitPosition(uID)
  7. local xr, zr
  8. if Spring.GetUnitBuildFacing(uID) % 2 == 0 then
  9. xr, zr = 4 * uDef.xsize, 4 * uDef.zsize
  10. end
  11.  
  12. local features = Spring.GetFeaturesInRectangle(ux-xr, uz-zr, ux+xr, uz+zr)
  13. for i = 1, #features do
  14. local fID = features[i]
  15. local fDefID = Spring.GetFeatureDefID(fID)
  16. local fDef = FeatureDefs[fDefID]
  17.  
  18. if (not fDef.geoThermal) and (fDef.name ~= 'geovent') then
  19. local fx, fy, fz = Spring.GetFeaturePosition(fID)
  20. Spring.DestroyFeature(fID)
  21. Spring.SpawnCEG('sparklegreen', fx, fy, fz)
  22. Spring.PlaySoundFile('sounds/reclaimed.wav', 1, fx, fy, fz)
  23. end
  24. end
  25. end
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement