Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function AddLootToEntity(entityType, entityName, itemName, probability, countMin, countMax)
- if data.raw[entityType] then
- if data.raw[entityType][entityName] then
- if data.raw[entityType][entityName].loot == nil then
- data.raw[entityType][entityName].loot = {}
- end
- table.insert(data.raw[entityType][entityName].loot, { item = itemName, probability = probability, count_min = countMin, count_max = countMax })
- end
- end
- end
- if data.raw.module["Mega-module-1"] then
- -- PROBABILITY --
- local Consumption = 0.003
- local Productivity2 = 0.002
- local Productivity = 0.002
- local pollution = 0.003
- local Speed = 0.01
- local Mega = 0.0001
- local Speed_ITEM_NAME = "Basic-Speed-module-1"
- local Consumption_ITEM_NAME = "Basic-Consumption-module-1"
- local Productivity_ITEM_NAME = "Basic-Productivity-module-1"
- local pollution_ITEM_NAME = "Basic-pollution-module-1"
- local Mega_ITEM_NAME = "Mega-module-1"
- local Productivity2_ITEM_NAME = "Rare-Productivity-module-1"
- for k,v in pairs(data.raw.unit) do
- local ratio = math.pow(math.log10(v.max_health),1)
- local maxdrop = ratio
- if v.max_health>100000 then -- BOSS
- ratio = math.pow(ratio,3)
- maxdrop = math.pow(maxdrop,2.5)
- end
- if string.find(v.name, "spitter") then
- ratio = ratio*1.5
- end
- AddLootToEntity(v.type, v.name, Speed_ITEM_NAME, Speed*ratio, 1, maxdrop)
- AddLootToEntity(v.type, v.name, Consumption_ITEM_NAME, Consumption*ratio, 1, maxdrop)
- AddLootToEntity(v.type, v.name, Productivity_ITEM_NAME, Productivity*ratio, 1, maxdrop)
- AddLootToEntity(v.type, v.name, pollution_ITEM_NAME, pollution*ratio, 1, maxdrop)
- AddLootToEntity(v.type, v.name, Mega_ITEM_NAME, Mega*ratio, 1, maxdrop)
- if v.max_health > 1000 then
- AddLootToEntity(v.type, v.name, Productivity2_ITEM_NAME, Productivity2*ratio, 1, maxdrop)
- end
- end
- for k,v in pairs(data.raw["unit-spawner"]) do
- local ratio = math.pow(math.log10(v.max_health),1)
- local maxdrop = ratio*ratio
- if string.find(v.name, "spitter") then
- ratio = ratio*1.5
- end
- AddLootToEntity(v.type, v.name, Speed_ITEM_NAME, Speed*ratio, 1, maxdrop)
- AddLootToEntity(v.type, v.name, Consumption_ITEM_NAME, Consumption*ratio, 1, maxdrop)
- AddLootToEntity(v.type, v.name, Productivity_ITEM_NAME, Productivity*ratio, 1, maxdrop)
- AddLootToEntity(v.type, v.name, pollution_ITEM_NAME, pollution*ratio, 1, maxdrop)
- AddLootToEntity(v.type, v.name, Mega_ITEM_NAME, Mega*ratio, 1, maxdrop)
- if v.max_health > 1000 then
- AddLootToEntity(v.type, v.name, Productivity2_ITEM_NAME, Productivity2*ratio, 1, maxdrop)
- end
- end
- for k,v in pairs(data.raw.turret) do
- if string.find(v.name, "worm-turret") then
- local ratio = math.pow(math.log10(v.max_health),1)
- local maxdrop = ratio*ratio
- if string.find(v.name, "spitter") then
- ratio = ratio*1.5
- end
- AddLootToEntity(v.type, v.name, Speed_ITEM_NAME, Speed*ratio, 1, maxdrop)
- AddLootToEntity(v.type, v.name, Consumption_ITEM_NAME, Consumption*ratio, 1, maxdrop)
- AddLootToEntity(v.type, v.name, Productivity_ITEM_NAME, Productivity*ratio, 1, maxdrop)
- AddLootToEntity(v.type, v.name, pollution_ITEM_NAME, pollution*ratio, 1, maxdrop)
- AddLootToEntity(v.type, v.name, Mega_ITEM_NAME, Mega*ratio, 1, maxdrop)
- if v.max_health > 1000 then
- AddLootToEntity(v.type, v.name, Productivity2_ITEM_NAME, Productivity2*ratio, 1, maxdrop)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement