Advertisement
jessefjxm

Untitled

May 11th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1. function AddLootToEntity(entityType, entityName, itemName, probability, countMin, countMax)
  2. if data.raw[entityType] then
  3. if data.raw[entityType][entityName] then
  4. if data.raw[entityType][entityName].loot == nil then
  5. data.raw[entityType][entityName].loot = {}
  6. end
  7. table.insert(data.raw[entityType][entityName].loot, { item = itemName, probability = probability, count_min = countMin, count_max = countMax })
  8. end
  9. end
  10. end
  11.  
  12. if data.raw.module["Mega-module-1"] then
  13. -- PROBABILITY --
  14. local Consumption = 0.003
  15. local Productivity2 = 0.002
  16. local Productivity = 0.002
  17. local pollution = 0.003
  18. local Speed = 0.01
  19. local Mega = 0.0001
  20.  
  21. local Speed_ITEM_NAME = "Basic-Speed-module-1"
  22. local Consumption_ITEM_NAME = "Basic-Consumption-module-1"
  23. local Productivity_ITEM_NAME = "Basic-Productivity-module-1"
  24. local pollution_ITEM_NAME = "Basic-pollution-module-1"
  25. local Mega_ITEM_NAME = "Mega-module-1"
  26. local Productivity2_ITEM_NAME = "Rare-Productivity-module-1"
  27.  
  28. for k,v in pairs(data.raw.unit) do
  29. local ratio = math.pow(math.log10(v.max_health),1)
  30. local maxdrop = ratio
  31. if v.max_health>100000 then -- BOSS
  32. ratio = math.pow(ratio,3)
  33. maxdrop = math.pow(maxdrop,2.5)
  34. end
  35. if string.find(v.name, "spitter") then
  36. ratio = ratio*1.5
  37. end
  38. AddLootToEntity(v.type, v.name, Speed_ITEM_NAME, Speed*ratio, 1, maxdrop)
  39. AddLootToEntity(v.type, v.name, Consumption_ITEM_NAME, Consumption*ratio, 1, maxdrop)
  40. AddLootToEntity(v.type, v.name, Productivity_ITEM_NAME, Productivity*ratio, 1, maxdrop)
  41. AddLootToEntity(v.type, v.name, pollution_ITEM_NAME, pollution*ratio, 1, maxdrop)
  42. AddLootToEntity(v.type, v.name, Mega_ITEM_NAME, Mega*ratio, 1, maxdrop)
  43. if v.max_health > 1000 then
  44. AddLootToEntity(v.type, v.name, Productivity2_ITEM_NAME, Productivity2*ratio, 1, maxdrop)
  45. end
  46. end
  47.  
  48. for k,v in pairs(data.raw["unit-spawner"]) do
  49. local ratio = math.pow(math.log10(v.max_health),1)
  50. local maxdrop = ratio*ratio
  51. if string.find(v.name, "spitter") then
  52. ratio = ratio*1.5
  53. end
  54. AddLootToEntity(v.type, v.name, Speed_ITEM_NAME, Speed*ratio, 1, maxdrop)
  55. AddLootToEntity(v.type, v.name, Consumption_ITEM_NAME, Consumption*ratio, 1, maxdrop)
  56. AddLootToEntity(v.type, v.name, Productivity_ITEM_NAME, Productivity*ratio, 1, maxdrop)
  57. AddLootToEntity(v.type, v.name, pollution_ITEM_NAME, pollution*ratio, 1, maxdrop)
  58. AddLootToEntity(v.type, v.name, Mega_ITEM_NAME, Mega*ratio, 1, maxdrop)
  59. if v.max_health > 1000 then
  60. AddLootToEntity(v.type, v.name, Productivity2_ITEM_NAME, Productivity2*ratio, 1, maxdrop)
  61. end
  62. end
  63.  
  64. for k,v in pairs(data.raw.turret) do
  65. if string.find(v.name, "worm-turret") then
  66. local ratio = math.pow(math.log10(v.max_health),1)
  67. local maxdrop = ratio*ratio
  68. if string.find(v.name, "spitter") then
  69. ratio = ratio*1.5
  70. end
  71. AddLootToEntity(v.type, v.name, Speed_ITEM_NAME, Speed*ratio, 1, maxdrop)
  72. AddLootToEntity(v.type, v.name, Consumption_ITEM_NAME, Consumption*ratio, 1, maxdrop)
  73. AddLootToEntity(v.type, v.name, Productivity_ITEM_NAME, Productivity*ratio, 1, maxdrop)
  74. AddLootToEntity(v.type, v.name, pollution_ITEM_NAME, pollution*ratio, 1, maxdrop)
  75. AddLootToEntity(v.type, v.name, Mega_ITEM_NAME, Mega*ratio, 1, maxdrop)
  76. if v.max_health > 1000 then
  77. AddLootToEntity(v.type, v.name, Productivity2_ITEM_NAME, Productivity2*ratio, 1, maxdrop)
  78. end
  79. end
  80. end
  81. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement