1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-14 10:13:13 +02:00
RedMew/map_gen/shared/wreck_items.lua

65 lines
2.1 KiB
Lua
Raw Normal View History

2017-09-28 12:45:10 +02:00
-- adds some wrecked items around the map, good for MP, reduces total resources pulled from factory, and adds incentive to push out
2018-11-26 03:07:03 +02:00
local Token = require 'utils.token'
2018-05-10 21:42:24 +02:00
local random = math.random
2018-05-10 21:42:24 +02:00
local wreck_item_pool = {
2018-11-21 15:35:47 +02:00
{name = 'iron-gear-wheel', count = 32},
{name = 'iron-plate', count = 64},
{name = 'rocket-control-unit', count = 1},
{name = 'atomic-bomb', count = 1},
{name = 'rocket-fuel', count = 7},
{name = 'coal', count = 8},
{name = 'rocket-launcher', count = 1},
{name = 'rocket', count = 32},
{name = 'copper-cable', count = 128},
{name = 'land-mine', count = 64},
{name = 'railgun', count = 1},
{name = 'railgun-dart', count = 128},
{name = 'fast-inserter', count = 8},
{name = 'stack-filter-inserter', count = 2},
{name = 'belt-immunity-equipment', count = 1},
{name = 'fusion-reactor-equipment', count = 1},
{name = 'electric-engine-unit', count = 8},
{name = 'exoskeleton-equipment', count = 1},
{name = 'rocket-fuel', count = 10},
{name = 'used-up-uranium-fuel-cell', count = 3},
{name = 'uranium-fuel-cell', count = 2},
{name = 'power-armor', count = 1},
{name = 'modular-armor', count = 1},
{name = 'water-barrel', count = 4},
{name = 'sulfuric-acid-barrel', count = 6},
{name = 'crude-oil-barrel', count = 8},
{name = 'energy-shield-equipment', count = 1},
{name = 'explosive-rocket', count = 32},
2018-05-10 21:42:24 +02:00
}
local entity_list = {
2018-11-21 15:35:47 +02:00
{name = 'big-ship-wreck-1', chance = 35000, force = 'player'},
{name = 'big-ship-wreck-2', chance = 45000, force = 'player'},
{name = 'big-ship-wreck-3', chance = 55000, force = 'player'},
2018-05-10 21:42:24 +02:00
}
local callback =
2018-11-21 15:35:47 +02:00
Token.register(
function(entity)
entity.health = math.random(entity.health)
entity.insert(wreck_item_pool[random(#wreck_item_pool)])
entity.insert(wreck_item_pool[random(#wreck_item_pool)])
entity.insert(wreck_item_pool[random(#wreck_item_pool)])
2018-11-21 15:35:47 +02:00
end
2018-05-10 21:42:24 +02:00
)
return function()
local ship = entity_list[random(#entity_list)]
2017-09-28 12:45:10 +02:00
2018-11-21 15:35:47 +02:00
if math.random(ship.chance) ~= 1 then
return nil
end
2018-11-21 15:35:47 +02:00
ship.callback = callback
2018-11-21 15:35:47 +02:00
return ship
2018-05-10 21:42:24 +02:00
end