Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.44 KB | None | 0 0
  1. TOOL.Category = "Mineral Mining";
  2. TOOL.Name = "Mining Storage";
  3.  
  4. TOOL.DeviceName = "Mining Storage Device"
  5. TOOL.DeviceNamePlural = "Mining Storage Devices"
  6. TOOL.ClassName = "mining_storage_tool"
  7.  
  8. TOOL.DevSelect = true
  9. TOOL.CCVar_type = "storage_ore"
  10. TOOL.CCVar_sub_type = "ore_storage"
  11. TOOL.CCVar_model = "models/mandrac/ore_container/ore_large.mdl"
  12.  
  13. TOOL.Limited = true
  14. TOOL.LimitName = "mining_storage_limit"
  15. TOOL.Limit = 30
  16.  
  17. CAFToolSetup.SetLang("Mining Storage Devices","Create Mining Storage Devices attached to any surface.","Left-Click: Spawn a Mining Storage Device.")
  18.  
  19. if (CLIENT and GetConVarNumber("CAF_UseTab") == 1) then TOOL.Tab = "Custom Addon Framework" end
  20.  
  21. function TOOL.EnableFunc()
  22. if not CAF then
  23. return false;
  24. end
  25. if not CAF.GetAddon("Resource Distribution") or not CAF.GetAddon("Resource Distribution").GetStatus() then
  26. return false;
  27. end
  28. return true;
  29. end
  30.  
  31. TOOL.ExtraCCVars = {
  32. }
  33.  
  34. function TOOL.ExtraCCVarsCP( tool, panel )
  35. end
  36.  
  37. function TOOL:GetExtraCCVars()
  38. local Extra_Data = {}
  39. return Extra_Data
  40. end
  41.  
  42. local function ore_func(ent,type,sub_type,devinfo,Extra_Data,ent_extras)
  43. local volume_mul = 1
  44. local base_volume = 600
  45. local base_mass = 5
  46. local base_health = 200
  47. local phys = ent:GetPhysicsObject()
  48. if phys:IsValid() and phys.GetVolume then
  49. local vol = phys:GetVolume()
  50. vol = math.Round(vol)
  51. volume_mul = vol/base_volume
  52. end
  53. CAF.GetAddon("Resource Distribution").AddResource(ent, "Ore", math.Round(3600 * volume_mul))
  54. ent.MAXRESOURCE = math.Round(3600 * volume_mul)
  55. local mass = math.Round(base_mass * volume_mul)
  56. ent.mass = mass
  57. local maxhealth = math.Round(base_health * volume_mul)
  58. return mass, maxhealth
  59. end
  60.  
  61. local function crystal_func(ent,type,sub_type,devinfo,Extra_Data,ent_extras)
  62. local volume_mul = 1
  63. local base_volume = 600
  64. local base_mass = 5
  65. local base_health = 200
  66. local phys = ent:GetPhysicsObject()
  67. if phys:IsValid() and phys.GetVolume then
  68. local vol = phys:GetVolume()
  69. vol = math.Round(vol)
  70. volume_mul = vol/base_volume
  71. end
  72. CAF.GetAddon("Resource Distribution").AddResource(ent, "Crystals", math.Round(3600 * volume_mul))
  73. ent.MAXRESOURCE = math.Round(3600 * volume_mul)
  74. local mass = math.Round(base_mass * volume_mul)
  75. ent.mass = mass
  76. local maxhealth = math.Round(base_health * volume_mul)
  77. return mass, maxhealth
  78. end
  79.  
  80. local function pnfuel_func(ent,type,sub_type,devinfo,Extra_Data,ent_extras)
  81. local volume_mul = 1
  82. local base_volume = 8671.24
  83. local base_mass = 5
  84. local base_health = 200
  85. local phys = ent:GetPhysicsObject()
  86.  
  87. if phys:IsValid() and phys.GetVolume then
  88. local vol = phys:GetVolume()
  89. vol = math.Round(vol)
  90. volume_mul = math.Clamp(vol,0,867124)/base_volume
  91. end
  92.  
  93. local PAmount = 0
  94.  
  95. if ent:GetModel() == "models/ce_ls3additional/resource_tanks/resource_tank_tiny.mdl" then
  96. PAmount = 10000
  97. elseif ent:GetModel() == "models/ce_ls3additional/resource_tanks/resource_tank_small.mdl" then
  98. PAmount = 30000
  99. elseif ent:GetModel() == "models/ce_ls3additional/resource_tanks/resource_tank_medium.mdl" then
  100. PAmount = 100000
  101. elseif ent:GetModel() == "models/ce_ls3additional/resource_tanks/resource_tank_large.mdl" then
  102. PAmount = 500000
  103. end
  104.  
  105. CAF.GetAddon("Resource Distribution").AddResource(ent, "PN-Fuel", PAmount)
  106.  
  107. local mass = math.Round(base_mass * volume_mul)
  108. ent.mass = mass
  109. local maxhealth = math.Round(base_health * volume_mul)
  110. return mass, maxhealth
  111. end
  112.  
  113. TOOL.Devices = {
  114. /*
  115. storage_ore = {
  116. Name = "Ore Container",
  117. type = "storage_ore",
  118. class = "storage_ore",
  119. func = ore_func,
  120. devices = {
  121. ore_storage = {
  122. Name = "Ore Container ",
  123. model = "models/mandrac/ore_container/ore_large.mdl",
  124. skin = 0,
  125. res = { Ore = 1500000 },
  126. mass = 300,
  127. legacy = false, --these two vars must be defined per ent as the old tanks (defined in external file) require different values
  128. }
  129. }
  130. },
  131.  
  132. storage_crystals = {
  133. Name = "Crystal Container",
  134. type = "storage_crystals",
  135. class = "storage_crystals",
  136. func = crystal_func,
  137. devices = {
  138. ore_storage = {
  139. Name = "Crystal Container ",
  140. model = "models/mandrac/ore_container/ore_medium.mdl",
  141. skin = 0,
  142. res = { Crystals = 100000 },
  143. mass = 200,
  144. legacy = false,
  145. }
  146. }
  147. },
  148. */
  149. storage_pnfuel = {
  150. Name = "PN-Fuel Tanks",
  151. type = "storage_pnfuel",
  152. class = "storage_pnfuel",
  153. func = pnfuel_func,
  154. devices = {
  155. pnfuel_storage_small = {
  156. Name = "Small PN-Fuel Tank ",
  157. model = "models/ce_ls3additional/resource_tanks/resource_tank_tiny.mdl",
  158. skin = 0,
  159. res = {},
  160. mass = 200,
  161. ent_extras = { TankPoints = 1 },
  162. legacy = false,
  163. },
  164. pnfuel_storage_medium = {
  165. Name = "Medium PN-Fuel Tank ",
  166. model = "models/ce_ls3additional/resource_tanks/resource_tank_small.mdl",
  167. skin = 0,
  168. res = {},
  169. mass = 600,
  170. ent_extras = { TankPoints = 3 },
  171. legacy = false,
  172. },
  173. pnfuel_storage_large = {
  174. Name = "Large PN-Fuel Tank ",
  175. model = "models/ce_ls3additional/resource_tanks/resource_tank_medium.mdl",
  176. skin = 0,
  177. res = {},
  178. mass = 1500,
  179. ent_extras = { TankPoints = 6 },
  180. legacy = false,
  181. },
  182. pnfuel_storage_station = {
  183. Name = "Station PN-Fuel Tank ",
  184. model = "models/ce_ls3additional/resource_tanks/resource_tank_large.mdl",
  185. skin = 0,
  186. res = {},
  187. mass = 5000,
  188. ent_extras = { TankPoints = 20 },
  189. legacy = false,
  190. }
  191. }
  192. }
  193. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement