Advertisement
Guest User

Terraform_Test

a guest
Oct 3rd, 2015
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.10 KB | None | 0 0
  1. function widget:GetInfo()
  2.   return {
  3.     name      = "Terraform Test",
  4.     desc      = "understanding terraform commands",
  5.     author    = "AutoWar",
  6.     date      = "2015",
  7.     license   = "GNU GPL, v2 or later",
  8.     layer     = 9999,
  9.     enabled   = true
  10.   }
  11. end
  12.  
  13. -----------------------------------------------------------------
  14.  
  15. local spEcho                = Spring.Echo
  16. local spGiveOrderToUnit     = Spring.GiveOrderToUnit
  17. local myTeamID              = Spring.GetMyTeamID()
  18.  
  19. -----------------------------------------------------------------
  20.  
  21. local CMD_RAMP = 39734
  22. local CMD_LEVEL = 39736
  23. local CMD_RAISE = 39737
  24. local CMD_SMOOTH = 39738
  25. local CMD_RESTORE = 39739
  26. local CMD_BUMPY = 39740
  27. local CMD_TERRAFORM_INTERNAL = 39801
  28. --Spring.GiveOrderToUnit(constructor[1], CMD_TERRAFORM_INTERNAL, {terraform_type,team,loop,terraformHeight,points,#constructor,volumeSelection,x1,z1,x2,z2,constructor[1]}, {"shift"})
  29.  
  30.  
  31. function widget:UnitCreated(unitID, unitDefID, unitTeam, builderID)
  32. local terraformParametersArray = {}
  33.     if unitTeam==myTeamID then
  34.         terraformParametersArray[1] = (2) -- = terraform_type -- 1 = level, 2 = raise, 3 = smooth, 4 = ramp, 5 = restore
  35.         terraformParametersArray[2] = myTeamID -- = team -- teamID of the team doing the terraform
  36.         terraformParametersArray[3] = (1) -- = loop -- true (1) or false (0) --need to be closed
  37.         terraformParametersArray[4] = (100) --height (of the terraform order???)
  38.         terraformParametersArray[5] = (4) -- how many points there are in the rectangle/lasso
  39.         terraformParametersArray[6] = (1) -- how many constructors are working on it
  40.         terraformParametersArray[7] = (0) -- = volumeSelection -- 0 = none, 1 = only raise, 2 = only lower
  41.         terraformParametersArray[8] = (100) -- first coordinate point x
  42.         terraformParametersArray[9] = (100) -- first coordinate point z
  43.         terraformParametersArray[10] =(200) -- second coordinate point x
  44.         terraformParametersArray[11] =(200) -- second coordinate point z
  45.         terraformParametersArray[12] =(builderID) -- constructor unitID
  46.         spGiveOrderToUnit(builderID, CMD_TERRAFORM_INTERNAL, terraformParametersArray, {"shift"})
  47.     end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement