Guest User

knorke knock trees

a guest
Apr 14th, 2011
88
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. GADGET:
  2.  
  3. function gadget:GetInfo()
  4.   return {
  5.     name      = "feature exploder",
  6.     desc      = "on destruction features are replaced with a unit that plays a fall over animation or w/e",
  7.     author    = "knorke",
  8.     date      = "April 2011, 2011",
  9.     license   = "horse has fallen over",
  10.     layer     = -3,
  11.     enabled   = true
  12.   }
  13. end
  14.  
  15. function gadget:FeatureDestroyed(featureID, allyTeam)
  16.     Spring.Echo ("feature " .. featureID .. " was destroyed")
  17.     local x,y,z = Spring.GetFeaturePosition (featureID)
  18.     Spring.Echo (x .." " .. y .. " " .. z)
  19.     local u = Spring.CreateUnit ("tptree",x,y,z, 0,0)
  20.     Spring.SetUnitBlocking (u, false)
  21. end
  22.  
  23.  
  24. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  25. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  26.  
  27.  
  28. UNITSCRIPT:
  29. local base = piece "base"
  30.  
  31. function script.Create()
  32.     --Spring.Echo ("unit " .. unitID .. " was created!")
  33.     Turn (base, y_axis, math.rad(math.random(0,360)))
  34.     Turn (base, x_axis, math.rad (90),math.rad(90))
  35.     WaitForTurn (base,x_axis)  
  36.     Move (base, y_axis, -50, 20)
  37.     WaitForMove (base,y_axis)
  38.     Spring.DestroyUnit (unitID)
  39. end
  40.  
  41. function script.FireWeapon1()
  42.     Sleep(30)
  43. end
  44.  
  45. function script.Killed(recentDamage, maxHealth)
  46.     Sleep(30)
  47. end
RAW Paste Data