1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

Merge pull request #695 from grilledham/crashsite_0.5

Crashsite 0.5
This commit is contained in:
Matthew 2019-01-27 12:40:03 -05:00 committed by GitHub
commit d5c168bc04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 1276 additions and 468 deletions

View File

@ -289,7 +289,8 @@ local function redraw_market_items(data)
end
if description then
insert(tooltip, '\n' .. item.description)
insert(tooltip, '\n')
insert(tooltip, item.description)
end
if disabled then

View File

@ -7,6 +7,8 @@ local b = require 'map_gen.shared.builders'
local Global = require('utils.global')
local Random = require 'map_gen.shared.random'
local OutpostBuilder = require 'map_gen.presets.crash_site.outpost_builder'
local Token = require 'utils.token'
local Task = require 'utils.task'
local math = require 'utils.math'
local ScenarioInfo = require 'features.gui.info'
local table = require 'utils.table'
@ -33,7 +35,7 @@ RS.set_map_gen_settings(
ScenarioInfo.set_map_name('Crashsite')
ScenarioInfo.set_map_description('Capture outposts and defend against the biters.')
ScenarioInfo.add_map_extra_info(
'- Outposts have enemy turrets defending them.\n- Outposts have loot and provide a steady stream of resources.\n- Outpost markets with different resources and at prices.\n- Capturing outposts increases evolution.\n- Reduced damage by all player weapons, turrets, and ammo.\n- Biters have more health and deal more damage.\n- Biters and spitters spawn on death of entities.'
'- Outposts have enemy turrets defending them.\n- Outposts have loot and provide a steady stream of resources.\n- Outpost markets to purchase items and outpost upgrades.\n- Capturing outposts increases evolution.\n- Reduced damage by all player weapons, turrets, and ammo.\n- Biters have more health and deal more damage.\n- Biters and spitters spawn on death of entities.'
)
global.config.market.enabled = false
@ -110,7 +112,24 @@ local mini_t1_production_factory = require 'map_gen.presets.crash_site.outpost_d
local mini_t2_energy_factory = require 'map_gen.presets.crash_site.outpost_data.mini_t2_energy_factory'
local mini_t1_train_factory = require 'map_gen.presets.crash_site.outpost_data.mini_t1_train_factory'
local spawn_callback_callback =
Token.register(
function(outpost_id)
OutpostBuilder.activate_market_upgrade(outpost_id)
end
)
local spawn_callback =
Token.register(
function(entity, data)
Token.get(OutpostBuilder.market_set_items_callback)(entity, data)
Task.set_timeout_in_ticks(1, spawn_callback_callback, data.outpost_id)
end
)
local function init()
local on_init = game ~= nil
local outpost_random = Random.new(outpost_seed, outpost_seed * 2)
local outpost_builder = OutpostBuilder.new(outpost_random)
@ -296,7 +315,7 @@ local function init()
local mini2_iter = itertor_builder(mini2, outpost_random)
local mini3_iter = itertor_builder(mini3, outpost_random)
local start_outpost = outpost_builder:do_outpost(thin_walls)
local start_outpost = outpost_builder:do_outpost(thin_walls, on_init)
start_outpost = b.change_tile(start_outpost, false, true)
start_outpost = b.change_map_gen_collision_tile(start_outpost, 'water-tile', 'grass-1')
@ -379,7 +398,7 @@ local function init()
local row = pattern[r]
local template = stage1a_iter()
local shape = outpost_builder:do_outpost(template)
local shape = outpost_builder:do_outpost(template, on_init)
local x = outpost_random:next_int(-outpost_offset, outpost_offset)
local y = outpost_random:next_int(-outpost_offset, outpost_offset)
@ -394,7 +413,7 @@ local function init()
local row = pattern[r]
local template = stage1b_iter()
local shape = outpost_builder:do_outpost(template)
local shape = outpost_builder:do_outpost(template, on_init)
local x = outpost_random:next_int(-outpost_offset, outpost_offset)
local y = outpost_random:next_int(-outpost_offset, outpost_offset)
@ -409,7 +428,7 @@ local function init()
local row = pattern[r]
local template = stage2_iter()
local shape = outpost_builder:do_outpost(template)
local shape = outpost_builder:do_outpost(template, on_init)
local x = outpost_random:next_int(-outpost_offset, outpost_offset)
local y = outpost_random:next_int(-outpost_offset, outpost_offset)
@ -423,7 +442,7 @@ local function init()
for c = 2, 8 do
if not row[c] then
local template = stage3_iter()
local shape = outpost_builder:do_outpost(template)
local shape = outpost_builder:do_outpost(template, on_init)
local x = outpost_random:next_int(-outpost_offset, outpost_offset)
local y = outpost_random:next_int(-outpost_offset, outpost_offset)
@ -439,7 +458,7 @@ local function init()
for c = 1, grid_number_of_blocks do
if not row[c] then
local template = stage4_iter()
local shape = outpost_builder:do_outpost(template)
local shape = outpost_builder:do_outpost(template, on_init)
local x = outpost_random:next_int(-outpost_offset, outpost_offset)
local y = outpost_random:next_int(-outpost_offset, outpost_offset)
@ -468,7 +487,7 @@ local function init()
for c = 8, 14 do
if not row[c] then
local template = mini1_iter()
local shape = outpost_builder:do_outpost(template)
local shape = outpost_builder:do_outpost(template, on_init)
local x = outpost_random:next_int(-mini_outpost_offset, mini_outpost_offset)
local y = outpost_random:next_int(-mini_outpost_offset, mini_outpost_offset)
@ -484,7 +503,7 @@ local function init()
for c = 6, 16 do
if not row[c] then
local template = mini2_iter()
local shape = outpost_builder:do_outpost(template)
local shape = outpost_builder:do_outpost(template, on_init)
local x = outpost_random:next_int(-mini_outpost_offset, mini_outpost_offset)
local y = outpost_random:next_int(-mini_outpost_offset, mini_outpost_offset)
@ -500,7 +519,7 @@ local function init()
for c = 1, mini_grid_number_of_blocks do
if not row[c] then
local template = mini3_iter()
local shape = outpost_builder:do_outpost(template)
local shape = outpost_builder:do_outpost(template, on_init)
local x = outpost_random:next_int(-mini_outpost_offset, mini_outpost_offset)
local y = outpost_random:next_int(-mini_outpost_offset, mini_outpost_offset)
@ -676,9 +695,12 @@ local function init()
map = b.apply_entity(map, ore_grid)
local market = {
callback = outpost_builder.market_set_items_callback,
callback = spawn_callback,
data = {
market_name = 'Spawn',
upgrade_rate = 0.5,
upgrade_base_cost = 500,
upgrade_cost_base = 2,
{name = 'raw-wood', price = 1},
{name = 'iron-plate', price = 2},
{name = 'stone', price = 2},
@ -720,7 +742,7 @@ local function init()
}
}
local spawn_shape = outpost_builder.to_shape(spawn)
local spawn_shape = outpost_builder.to_shape(spawn, 6, on_init)
spawn_shape = b.change_tile(spawn_shape, false, 'stone-path')
spawn_shape = b.change_map_gen_collision_hidden_tile(spawn_shape, 'water-tile', 'grass-1')
@ -749,13 +771,6 @@ Global.register_init(
end
)
--[[ local Event = require 'utils.event'
Event.add(
defines.events.on_player_joined_game,
function(event)
game.players[event.player_index].character = nil
end
) ]]
return function(x, y, world)
return map(x, y, world)
end

View File

@ -51,30 +51,32 @@ local entity_spawn_map = {
['behemoth-spitter'] = {name = 'big-worm-turret', count = 1, chance = 0.2},
['biter-spawner'] = {type = 'biter', count = 5, chance = 1},
['spitter-spawner'] = {type = 'spitter', count = 5, chance = 1},
['stone-furnace'] = {type = 'cause', count = 1, chance = 1},
['steel-furnace'] = {type = 'cause', count = 1, chance = 1},
['electric-furnace'] = {type = 'cause', count = 2, chance = 1},
['assembling-machine-1'] = {type = 'cause', count = 2, chance = 1},
['assembling-machine-2'] = {type = 'cause', count = 2, chance = 1},
['assembling-machine-3'] = {type = 'cause', count = 2, chance = 1},
['chemical-plant'] = {type = 'cause', count = 2, chance = 1},
['centrifuge'] = {type = 'cause', count = 3, chance = 1},
['oil-refinery'] = {type = 'cause', count = 4, chance = 1},
['offshore-pump'] = {type = 'cause', count = 1, chance = 1},
['boiler'] = {type = 'cause', count = 1, chance = 1},
['heat-exchanger'] = {type = 'cause', count = 2, chance = 1},
['steam-engine'] = {type = 'cause', count = 3, chance = 1},
['steam-turbine'] = {type = 'cause', count = 5, chance = 1},
['nuclear-reactor'] = {type = 'cause', count = 10, chance = 1},
['rocket-silo'] = {type = 'cause', count = 20, chance = 1},
['train-stop'] = {type = 'cause', count = 1, chance = 1},
['burner-mining-drill'] = {type = 'cause', count = 1, chance = 1},
['electric-mining-drill'] = {type = 'cause', count = 2, chance = 1},
['lab'] = {type = 'cause', count = 3, chance = 1},
['solar-panel'] = {type = 'cause', count = 2, chance = 1},
['accumulator'] = {type = 'cause', count = 1, chance = 1},
['beacon'] = {type = 'cause', count = 3, chance = 1},
['radar'] = {type = 'cause', count = 2, chance = 1}
['stone-furnace'] = {type = 'cause', count = 2, chance = 1},
['steel-furnace'] = {type = 'cause', count = 2, chance = 1},
['electric-furnace'] = {type = 'cause', count = 4, chance = 1},
['assembling-machine-1'] = {type = 'cause', count = 4, chance = 1},
['assembling-machine-2'] = {type = 'cause', count = 4, chance = 1},
['assembling-machine-3'] = {type = 'cause', count = 4, chance = 1},
['chemical-plant'] = {type = 'cause', count = 4, chance = 1},
['centrifuge'] = {type = 'cause', count = 6, chance = 1},
['pumpjack'] = {type = 'cause', count = 6, chance = 1},
['storage-tank'] = {type = 'cause', count = 4, chance = 1},
['oil-refinery'] = {type = 'cause', count = 8, chance = 1},
['offshore-pump'] = {type = 'cause', count = 2, chance = 1},
['boiler'] = {type = 'cause', count = 2, chance = 1},
['heat-exchanger'] = {type = 'cause', count = 4, chance = 1},
['steam-engine'] = {type = 'cause', count = 6, chance = 1},
['steam-turbine'] = {type = 'cause', count = 10, chance = 1},
['nuclear-reactor'] = {type = 'cause', count = 20, chance = 1},
['rocket-silo'] = {type = 'cause', count = 40, chance = 1},
['train-stop'] = {type = 'cause', count = 2, chance = 1},
['burner-mining-drill'] = {type = 'cause', count = 2, chance = 1},
['electric-mining-drill'] = {type = 'cause', count = 4, chance = 1},
['lab'] = {type = 'cause', count = 6, chance = 1},
['solar-panel'] = {type = 'cause', count = 4, chance = 1},
['accumulator'] = {type = 'cause', count = 2, chance = 1},
['beacon'] = {type = 'cause', count = 6, chance = 1},
['radar'] = {type = 'cause', count = 4, chance = 1}
}
local unit_levels = {

View File

@ -1,24 +1,34 @@
local Random = require 'map_gen.shared.random'
--local Random = require 'map_gen.shared.random'
local Token = require 'utils.token'
local Global = require 'utils.global'
local Event = require 'utils.event'
local Task = require 'utils.task'
local Retailer = require 'features.retailer'
local PlayerStats = require 'features.player_stats'
local RS = require 'map_gen.shared.redmew_surface'
local Server = require 'features.server'
local Color = require 'resources.color_presets'
local table = require 'utils.table'
--local next = next
local pairs = pairs
local concat = table.concat
local floor = math.floor
local format = string.format
local tostring = tostring
local b = require 'map_gen.shared.builders'
local direction_bit_mask = 0xc0000000
local section_bit_mask = 0x30000000
local level_bit_mask = 0x0fffffff
local not_level_bit_mask = 0xf0000000
--local not_level_bit_mask = 0xf0000000
local direction_bit_shift = 30
local section_bit_shift = 28
local section_straight = 0
local section_outer_corner = 1
local section_inner_corner = 2
--local section_straight = 0
--local section_outer_corner = 1
--local section_inner_corner = 2
local wall_north_straight = 0x00000001
local wall_east_straight = 0x40000001
@ -34,30 +44,41 @@ local wall_south_inner = 0xa0000001
local wall_west_inner = 0xe0000001
local default_part_size = 6
--local inv_part_size = 1 / part_size
local magic_crafters_per_tick = 3
local magic_fluid_crafters_per_tick = 8
local refill_turrets = {index = 1}
local power_sources = {}
local turret_to_outpost = {}
local magic_crafters = {index = 1}
local magic_fluid_crafters = {index = 1}
local outposts = {}
local outpost_count = 0
Global.register(
{
refil_turrets = refill_turrets,
power_sources = power_sources,
magic_crafters = magic_crafters
turret_to_outpost = turret_to_outpost,
magic_crafters = magic_crafters,
magic_fluid_crafters = magic_fluid_crafters,
outposts = outposts
},
function(tbl)
refill_turrets = tbl.refil_turrets
power_sources = tbl.power_sources
turret_to_outpost = tbl.turret_to_outpost
magic_crafters = tbl.magic_crafters
magic_fluid_crafters = tbl.magic_fluid_crafters
outposts = tbl.outposts
end
)
local function get_direction(part)
--[[ local function get_direction(part)
local dir = bit32.band(part, direction_bit_mask)
return bit32.rshift(dir, direction_bit_shift - 1)
end
end ]]
local function get_4_way_direction(part)
local dir = bit32.band(part, direction_bit_mask)
return bit32.rshift(dir, direction_bit_shift)
@ -72,7 +93,7 @@ local function get_level(part)
return bit32.band(part, level_bit_mask)
end
local function set_level(part, level)
--[[ local function set_level(part, level)
local not_level = bit32.band(part)
return not_level + level
end
@ -87,8 +108,7 @@ local function get_block(tbl, x, y)
return 0
end
return tbl[(y - 1) * size + x] or 0
end
end ]]
local function fast_remove(tbl, index)
local count = #tbl
if index > count then
@ -409,22 +429,22 @@ local function fill(blocks)
local y_offset = (size - 1) * size
for x = 1, size do
if blocks[x] == nil then
table.insert(anti_stack, {x = x, y = 1})
anti_stack[#anti_stack + 1] = {x = x, y = 1}
end
if blocks[x + y_offset] == nil then
table.insert(anti_stack, {x = x, y = size})
anti_stack[#anti_stack + 1] = {x = x, y = size}
end
end
for y = 2, size do
y_offset = (y - 1) * size
if blocks[y_offset + 1] == nil then
table.insert(anti_stack, {x = 1, y = y})
anti_stack[#anti_stack + 1] = {x = 1, y = y}
end
if blocks[y_offset + size] == nil then
table.insert(anti_stack, {x = size, y = y})
anti_stack[#anti_stack + 1] = {x = size, y = y}
end
end
@ -441,7 +461,7 @@ local function fill(blocks)
local offset2 = offset - 1
if not anti_set[offset2] and not blocks[offset2] then
table.insert(anti_stack, {x = x2, y = y})
anti_stack[#anti_stack + 1] = {x = x2, y = y}
end
end
if x < size then
@ -449,7 +469,7 @@ local function fill(blocks)
local offset2 = offset + 1
if not anti_set[offset2] and not blocks[offset2] then
table.insert(anti_stack, {x = x2, y = y})
anti_stack[#anti_stack + 1] = {x = x2, y = y}
end
end
if y > 1 then
@ -457,7 +477,7 @@ local function fill(blocks)
local offset2 = offset - size
if not anti_set[offset2] and not blocks[offset2] then
table.insert(anti_stack, {x = x, y = y2})
anti_stack[#anti_stack + 1] = {x = x, y = y2}
end
end
if y < size then
@ -465,7 +485,7 @@ local function fill(blocks)
local offset2 = offset + size
if not anti_set[offset2] and not blocks[offset2] then
table.insert(anti_stack, {x = x, y = y2})
anti_stack[#anti_stack + 1] = {x = x, y = y2}
end
end
end
@ -533,7 +553,9 @@ local function do_levels(blocks, max_level)
local block = blocks[i]
if block then
local l = get_level(block)
table.insert(levels[l], i)
local lvl = levels[l]
lvl[#lvl + 1] = i
end
end
end
@ -620,7 +642,8 @@ local function make_blocks(self, blocks, template)
blocks[i] = get_template(random, base_templates, base_template_count, counts)
end
else
for _, i in ipairs(level) do
for index = 1, #level do
local i = level[index]
blocks[i] = nil
end
end
@ -629,20 +652,38 @@ end
local remove_entity_types = {'tree', 'simple-entity'}
local function to_shape(blocks, part_size)
local function to_shape(blocks, part_size, on_init)
part_size = part_size or default_part_size
local inv_part_size = 1 / part_size
local size = blocks.size
local t_size = size * part_size
local half_t_size = t_size * 0.5
local outpost_id = outpost_count + 1
outpost_count = outpost_id
if on_init then
outposts[outpost_id] = {
outpost_id = outpost_id,
magic_crafters = {},
--magic_fluid_crafters = {},
turret_count = 0,
top_left = {nil, nil},
bottom_right = {nil, nil},
level = 1,
upgrade_rate = nil,
upgrade_base_cost = nil,
upgrade_cost_base = nil
}
end
local function shape(x, y, world)
x, y = math.floor(x + half_t_size), math.floor(y + half_t_size)
x, y = floor(x + half_t_size), floor(y + half_t_size)
if x < 0 or y < 0 or x >= t_size or y >= t_size then
return false
end
local x2, y2 = math.floor(x * inv_part_size), math.floor(y * inv_part_size)
local x2, y2 = floor(x * inv_part_size), floor(y * inv_part_size)
local template = blocks[y2 * size + x2 + 1]
if not template then
@ -650,14 +691,14 @@ local function to_shape(blocks, part_size)
end
local wx, wy = world.x, world.y
for _, e in ipairs(
world.surface.find_entities_filtered(
{
area = {{wx, wy}, {wx + 1, wy + 1}},
type = remove_entity_types
}
)
) do
local entities =
world.surface.find_entities_filtered {
area = {{wx, wy}, {wx + 1, wy + 1}},
type = remove_entity_types
}
for i = 1, #entities do
local e = entities[i]
e.destroy()
end
@ -676,11 +717,13 @@ local function to_shape(blocks, part_size)
local data
local callback = entity.callback
if callback then
data = {outpost_id = outpost_id}
local cd = template[callback]
callback = cd.callback
data = cd.data
data.callback_data = cd.data
end
return {
tile = tile,
entities = {
@ -703,7 +746,7 @@ end
Public.to_shape = to_shape
function Public:do_outpost(template)
function Public:do_outpost(template, on_init)
local settings = template.settings
local blocks = {size = settings.blocks}
@ -712,7 +755,7 @@ function Public:do_outpost(template)
do_levels(blocks, settings.max_level)
make_blocks(self, blocks, template)
return to_shape(blocks, settings.part_size)
return to_shape(blocks, settings.part_size, on_init)
end
local function change_direction(entity, new_dir)
@ -869,6 +912,141 @@ function Public.extend_walls(data, tbl)
return setmetatable(copy, base)
end
local function update_market_upgrade_description(outpost_data)
local outpost_id = outpost_data.outpost_id
local upgrade_rate = outpost_data.upgrade_rate
local upgrade_base_cost = outpost_data.upgrade_base_cost
local upgrade_cost_base = outpost_data.upgrade_cost_base
local level = outpost_data.level
local base_outputs = outpost_data.base_outputs
local outpost_magic_crafters = outpost_data.magic_crafters
local prototype = Retailer.get_items(outpost_id)['upgrade']
prototype.price = upgrade_base_cost * #outpost_magic_crafters * upgrade_cost_base ^ (level - 1)
prototype.name_label = 'Upgrade Outpost to level ' .. tostring(level + 1)
local str = {''}
for k, v in pairs(base_outputs) do
local base_rate = v * 60
local upgrade_per_level = base_rate * upgrade_rate
local current_rate = base_rate + (level - 1) * upgrade_per_level
local next_rate = current_rate + upgrade_per_level
local name = game.item_prototypes[k]
if name then
str[#str + 1] = name.localised_name
else
name = game.fluid_prototypes[k]
if name then
str[#str + 1] = name.localised_name
else
str[#str + 1] = k
end
end
str[#str + 1] = ': '
str[#str + 1] = format('%.2f', current_rate)
str[#str + 1] = ' -> '
str[#str + 1] = format('%.2f / sec', next_rate)
str[#str + 1] = '\n'
end
str[#str] = nil
prototype.description = str
prototype.disabled = false
Retailer.set_item(outpost_id, prototype)
end
local function do_outpost_upgrade(event)
if event.item.type ~= 'upgrade' then
return
end
local outpost_id = event.group_name
local outpost_data = outposts[outpost_id]
local outpost_magic_crafters = outpost_data.magic_crafters
local upgrade_rate = outpost_data.upgrade_rate
local level = outpost_data.level + 1
outpost_data.level = level
local message =
concat({'*** ', Retailer.get_market_group_label(outpost_id), ' has been upgraded to level ', level, ' ***'})
game.print(message, Color.lime_green)
Server.to_discord_bold(message)
for i = 1, #outpost_magic_crafters do
local crafter = outpost_magic_crafters[i]
local rate = crafter.rate
local upgrade_amount = upgrade_rate * crafter.base_rate
crafter.rate = rate + upgrade_amount
end
update_market_upgrade_description(outpost_data)
end
local function activate_market_upgrade(outpost_data)
local outpost_magic_crafters = outpost_data.magic_crafters
if #outpost_magic_crafters == 0 then
local outpost_id = outpost_data.outpost_id
local prototype = Retailer.get_items(outpost_id)['upgrade']
prototype.disabled_reason = 'No machines to upgrade.'
Retailer.set_item(outpost_id, prototype)
return
end
local base_outputs = {}
for i = 1, #outpost_magic_crafters do
local crafter = outpost_magic_crafters[i]
local item = crafter.item
local count = base_outputs[item] or 0
count = count + crafter.rate
base_outputs[item] = count
end
outpost_data.base_outputs = base_outputs
update_market_upgrade_description(outpost_data)
end
function Public.activate_market_upgrade(outpost_id)
local outpost_data = outposts[outpost_id]
activate_market_upgrade(outpost_data)
end
local function do_capture_outpost(outpost_data)
local area = {top_left = outpost_data.top_left, bottom_right = outpost_data.bottom_right}
local walls = RS.get_surface().find_entities_filtered {area = area, force = 'enemy', name = 'stone-wall'}
for i = 1, #walls do
walls[i].force = 'player'
end
local outpost_id = outpost_data.outpost_id
local name = Retailer.get_market_group_label(outpost_id)
if name == 'Market' then
return
end
game.print(concat({'*** ', 'Outpost captured: ' .. name, ' ***'}), Color.lime_green)
Server.to_discord_bold('Outpost captured: ' .. name)
activate_market_upgrade(outpost_data)
end
local function do_refill_turrets()
local index = refill_turrets.index
@ -877,8 +1055,8 @@ local function do_refill_turrets()
return
end
local data = refill_turrets[index]
local turret = data.turret
local turret_data = refill_turrets[index]
local turret = turret_data.turret
if not turret.valid then
fast_remove(refill_turrets, index)
@ -887,116 +1065,187 @@ local function do_refill_turrets()
refill_turrets.index = index + 1
local ammo = data.ammo
local data = turret_data.data
if data.liquid then
turret.fluidbox[1] = ammo
elseif ammo then
turret.insert(ammo)
turret.fluidbox[1] = data
elseif data then
turret.insert(data)
end
end
local function do_magic_crafters()
local limit = #magic_crafters
if limit == 0 then
return
end
local index = magic_crafters.index
if index > #magic_crafters then
magic_crafters.index = 1
return
end
local data = magic_crafters[index]
local entity = data.entity
if not entity.valid then
fast_remove(magic_crafters, index)
return
end
magic_crafters.index = index + 1
local tick = game.tick
local last_tick = data.last_tick
local rate = data.rate
local count = (tick - last_tick) * rate
local fcount = math.floor(count)
if fcount > 0 then
local fluidbox_index = data.fluidbox_index
if fluidbox_index then
local fb = entity.fluidbox
local fb_data = fb[fluidbox_index] or {name = data.item, amount = 0}
fb_data.amount = fb_data.amount + fcount
fb[fluidbox_index] = fb_data
else
entity.get_output_inventory().insert {name = data.item, count = fcount}
for i = 1, magic_crafters_per_tick do
if index > limit then
index = 1
end
local data = magic_crafters[index]
local entity = data.entity
if not entity.valid then
fast_remove(magic_crafters, index)
else
index = index + 1
local tick = game.tick
local last_tick = data.last_tick
local rate = data.rate
local count = (tick - last_tick) * rate
local fcount = floor(count)
if fcount > 0 then
entity.get_output_inventory().insert {name = data.item, count = fcount}
data.last_tick = tick - (count - fcount) / rate
end
end
data.last_tick = tick - (count - fcount) / rate
end
magic_crafters.index = index
end
local function do_magic_fluid_crafters()
local limit = #magic_fluid_crafters
if limit == 0 then
return
end
local index = magic_fluid_crafters.index
for i = 1, magic_fluid_crafters_per_tick do
if index > limit then
index = 1
end
local data = magic_fluid_crafters[index]
local entity = data.entity
if not entity.valid then
fast_remove(magic_fluid_crafters, index)
else
index = index + 1
local tick = game.tick
local last_tick = data.last_tick
local rate = data.rate
local count = (tick - last_tick) * rate
local fcount = floor(count)
if fcount > 0 then
local fluidbox_index = data.fluidbox_index
local fb = entity.fluidbox
local fb_data = fb[fluidbox_index] or {name = data.item, amount = 0}
fb_data.amount = fb_data.amount + fcount
fb[fluidbox_index] = fb_data
data.last_tick = tick - (count - fcount) / rate
end
end
end
magic_fluid_crafters.index = index
end
local function tick()
do_refill_turrets()
do_magic_crafters()
do_magic_fluid_crafters()
end
Public.refill_turret_callback =
Token.register(
function(turret, ammo)
table.insert(refill_turrets, {turret = turret, ammo = ammo})
function(turret, data)
local outpost_id = data.outpost_id
refill_turrets[#refill_turrets + 1] = {turret = turret, data = data.callback_data}
turret_to_outpost[turret.unit_number] = outpost_id
local outpost_data = outposts[outpost_id]
outpost_data.turret_count = outpost_data.turret_count + 1
end
)
Public.refill_liquid_turret_callback =
Token.register(
function(turret, ammo)
table.insert(refill_turrets, {turret = turret, ammo = ammo, liquid = true})
function(turret, data)
local callback_data = data.callback_data
callback_data.liquid = true
local outpost_id = data.outpost_id
refill_turrets[#refill_turrets + 1] = {turret = turret, data = callback_data}
turret_to_outpost[turret.unit_number] = outpost_id
local outpost_data = outposts[outpost_id]
outpost_data.turret_count = outpost_data.turret_count + 1
end
)
Public.power_source_callback =
Token.register(
function(entity, data)
function(turret, data)
local outpost_id = data.outpost_id
local callback_data = data.callback_data
local power_source =
entity.surface.create_entity {name = 'hidden-electric-energy-interface', position = entity.position}
power_source.electric_buffer_size = data.buffer_size
power_source.power_production = data.power_production
turret.surface.create_entity {name = 'hidden-electric-energy-interface', position = turret.position}
power_source.electric_buffer_size = callback_data.buffer_size
power_source.power_production = callback_data.power_production
power_source.destructible = false
power_sources[entity.unit_number] = power_source
power_sources[turret.unit_number] = {entity = power_source}
turret_to_outpost[turret.unit_number] = outpost_id
local outpost_data = outposts[outpost_id]
outpost_data.turret_count = outpost_data.turret_count + 1
end
)
Public.power_source_player_callback =
Public.worm_turret_callback =
Token.register(
function(entity, data)
local power_source =
entity.surface.create_entity {name = 'hidden-electric-energy-interface', position = entity.position}
power_source.electric_buffer_size = data.buffer_size
power_source.power_production = data.power_production
power_source.destructible = false
function(turret, data)
local outpost_id = data.outpost_id
power_sources[entity.unit_number] = power_source
turret_to_outpost[turret.unit_number] = outpost_id
entity.minable = false
entity.operable = false
entity.destructible = false
local outpost_data = outposts[outpost_id]
outpost_data.turret_count = outpost_data.turret_count + 1
end
)
local function add_magic_crafter_output(entity, output, distance)
local function add_magic_crafter_output(entity, output, distance, outpost_id)
local rate = output.min_rate + output.distance_factor * distance
table.insert(
magic_crafters,
{
entity = entity,
last_tick = game.tick,
rate = rate,
item = output.item,
fluidbox_index = output.fluidbox_index
}
)
local fluidbox_index = output.fluidbox_index
local data = {
entity = entity,
last_tick = game.tick,
base_rate = rate,
rate = rate,
item = output.item,
fluidbox_index = fluidbox_index
}
if fluidbox_index then
magic_fluid_crafters[#magic_fluid_crafters + 1] = data
else
magic_crafters[#magic_crafters + 1] = data
end
local outpost_magic_crafters = outposts[outpost_id].magic_crafters
outpost_magic_crafters[#outpost_magic_crafters + 1] = data
end
local set_inactive_token =
@ -1011,15 +1260,18 @@ local set_inactive_token =
Public.magic_item_crafting_callback =
Token.register(
function(entity, data)
local outpost_id = data.outpost_id
local callback_data = data.callback_data
entity.minable = false
entity.destructible = false
entity.operable = false
local recipe = data.recipe
local recipe = callback_data.recipe
if recipe then
entity.set_recipe(recipe)
else
local furance_item = data.furance_item
local furance_item = callback_data.furance_item
if furance_item then
local inv = entity.get_inventory(2) -- defines.inventory.furnace_source
inv.insert(furance_item)
@ -1030,21 +1282,111 @@ Public.magic_item_crafting_callback =
local x, y = p.x, p.y
local distance = math.sqrt(x * x + y * y)
local output = data.output
local output = callback_data.output
if #output == 0 then
add_magic_crafter_output(entity, output, distance)
add_magic_crafter_output(entity, output, distance, outpost_id)
else
for _, o in ipairs(data.output) do
add_magic_crafter_output(entity, o, distance)
for i = 1, #output do
local o = output[i]
add_magic_crafter_output(entity, o, distance, outpost_id)
end
end
if not data.keep_active then
if not callback_data.keep_active then
Task.set_timeout_in_ticks(2, set_inactive_token, entity) -- causes problems with refineries.
end
end
)
Public.magic_item_crafting_callback_weighted =
Token.register(
function(entity, data)
local outpost_id = data.outpost_id
local callback_data = data.callback_data
entity.minable = false
entity.destructible = false
entity.operable = false
local weights = callback_data.weights
local loot = callback_data.loot
local i = math.random() * weights.total
local index = table.binary_search(weights, i)
if (index < 0) then
index = bit32.bnot(index)
end
local stack = loot[index].stack
if not stack then
return
end
local recipe = stack.recipe
if recipe then
entity.set_recipe(recipe)
else
local furance_item = stack.furance_item
if furance_item then
local inv = entity.get_inventory(2) -- defines.inventory.furnace_source
inv.insert(furance_item)
end
end
local p = entity.position
local x, y = p.x, p.y
local distance = math.sqrt(x * x + y * y)
local output = stack.output
if #output == 0 then
add_magic_crafter_output(entity, output, distance, outpost_id)
else
for o_i = 1, #output do
local o = output[o_i]
add_magic_crafter_output(entity, o, distance, outpost_id)
end
end
if not callback_data.keep_active then
Task.set_timeout_in_ticks(2, set_inactive_token, entity) -- causes problems with refineries.
end
end
)
Public.wall_callback =
Token.register(
function(entity, data)
if not entity.valid then
return
end
local position = entity.position
local px, py = position.x, position.y
local outpost_id = data.outpost_id
local outpost_data = outposts[outpost_id]
local top_left = outpost_data.top_left
local bottom_right = outpost_data.bottom_right
local tx, ty = top_left.x, top_left.y
local bx, by = bottom_right.x, bottom_right.y
if not tx or px < tx then
top_left.x = px
end
if not ty or py < ty then
top_left.y = py
end
if not bx or px > bx then
bottom_right.x = px
end
if not by or py > by then
bottom_right.y = py
end
end
)
Public.deactivate_callback =
Token.register(
function(entity)
@ -1054,7 +1396,7 @@ Public.deactivate_callback =
end
)
local function remove_power_source(event)
local function turret_died(event)
local entity = event.entity
if not entity or not entity.valid then
return
@ -1065,11 +1407,27 @@ local function remove_power_source(event)
return
end
local ps = power_sources[number]
power_sources[number] = nil
local ps_data = power_sources[number]
if ps_data then
power_sources[number] = nil
if ps and ps.valid then
ps.destroy()
local ps_entity = ps_data.entity
if ps_entity and ps_entity.valid then
ps_entity.destroy()
end
end
local outpost_id = turret_to_outpost[number]
if outpost_id then
local outpost_data = outposts[outpost_id]
local turret_count = outpost_data.turret_count - 1
outpost_data.turret_count = turret_count
if turret_count == 0 then
do_capture_outpost(outpost_data)
end
end
end
@ -1080,17 +1438,42 @@ Public.market_set_items_callback =
return
end
local callback_data = data.callback_data
entity.destructible = false
local market_id = Retailer.generate_group_id()
local market_id = data.outpost_id
local outpost_data = outposts[market_id]
local upgrade_base_cost = callback_data.upgrade_base_cost or 0
outpost_data.upgrade_rate = callback_data.upgrade_rate
outpost_data.upgrade_base_cost = upgrade_base_cost
outpost_data.upgrade_cost_base = callback_data.upgrade_cost_base
Retailer.add_market(market_id, entity)
Retailer.set_market_group_label(market_id, data.market_name)
Retailer.set_market_group_label(market_id, callback_data.market_name)
Retailer.set_item(
market_id,
{
name = 'upgrade',
type = 'upgrade',
name_label = 'Upgrade Outpost',
sprite = 'item-group/production',
price = 0,
stack_limit = 1,
disabled = true,
disabled_reason = 'Outpost must be captured first.',
description = 'Increases output.'
}
)
local p = entity.position
local x, y = p.x, p.y
local d = math.sqrt(x * x + y * y)
for i = 1, #data do
local item = data[i]
for i = 1, #callback_data do
local item = callback_data[i]
local price = item.price
local df = item.distance_factor
@ -1121,9 +1504,10 @@ function Public.prepare_weighted_loot(loot)
local total = 0
local weights = {}
for _, v in ipairs(loot) do
for i = 1, #loot do
local v = loot[i]
total = total + v.weight
table.insert(weights, total)
weights[#weights + 1] = total
end
weights.total = total
@ -1247,7 +1631,7 @@ local function coin_mined(event)
end
Event.add(defines.events.on_tick, tick)
Event.add(defines.events.on_entity_died, remove_power_source)
Event.add(defines.events.on_entity_died, turret_died)
Event.on_init(
function()
@ -1257,4 +1641,6 @@ Event.on_init(
Event.add(defines.events.on_player_mined_item, coin_mined)
Event.add(Retailer.events.on_market_purchase, do_outpost_upgrade)
return Public

View File

@ -24,7 +24,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'piercing-rounds-magazine',
output = {min_rate = 3 / 60, distance_factor = 2 / 60 / 512, item = 'piercing-rounds-magazine'}
output = {min_rate = 1.5 / 60, distance_factor = 1 / 60 / 512, item = 'piercing-rounds-magazine'}
}
}
@ -32,7 +32,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'uranium-rounds-magazine',
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'uranium-rounds-magazine'}
output = {min_rate = 0.5 / 60, distance_factor = 0.5 / 60 / 512, item = 'uranium-rounds-magazine'}
}
}
@ -40,7 +40,7 @@ local factory_c = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'explosive-uranium-cannon-shell',
output = {min_rate = 1 / 2 / 60, distance_factor = 1 / 2 / 60 / 512, item = 'explosive-uranium-cannon-shell'}
output = {min_rate = 0.5 / 2 / 60, distance_factor = 0.5 / 2 / 60 / 512, item = 'explosive-uranium-cannon-shell'}
}
}
@ -48,6 +48,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Big Ammo Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 500,
upgrade_cost_base = 2,
{
name = 'firearm-magazine',
price = 0.5,

View File

@ -27,7 +27,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'plastic-bar',
output = {min_rate = 2.5 / 60, distance_factor = 2 / 60 / 512, item = 'plastic-bar'}
output = {min_rate = 1.25 / 60, distance_factor = 1 / 60 / 512, item = 'plastic-bar'}
}
}
@ -35,14 +35,14 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'sulfuric-acid',
output = {min_rate = 20 / 60, distance_factor = 20 / 60 / 512, item = 'sulfuric-acid', fluidbox_index = 2}
output = {min_rate = 10 / 60, distance_factor = 10 / 60 / 512, item = 'sulfuric-acid', fluidbox_index = 2}
}
}
local factory_c = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'rocket-fuel',
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'rocket-fuel'}
output = {min_rate = 0.5 / 60, distance_factor = 0.5 / 60 / 512, item = 'rocket-fuel'}
}
}
@ -50,6 +50,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Big Chemical Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 250,
upgrade_cost_base = 2,
{
name = 'coal',
price = 0.25,

View File

@ -24,7 +24,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'advanced-circuit',
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'advanced-circuit'}
output = {min_rate = 0.5 / 60, distance_factor = 0.5 / 60 / 512, item = 'advanced-circuit'}
}
}
@ -32,7 +32,7 @@ local factory_c = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'processing-unit',
output = {min_rate = 0.2 / 60, distance_factor = 0.2 / 60 / 512, item = 'processing-unit'}
output = {min_rate = 0.4 / 60, distance_factor = 0.4 / 60 / 512, item = 'processing-unit'}
}
}
@ -40,7 +40,7 @@ local factory_d = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'rocket-control-unit',
output = {min_rate = 0.1 / 60, distance_factor = 0.1 / 60 / 512, item = 'rocket-control-unit'}
output = {min_rate = 0.05 / 60, distance_factor = 0.05 / 60 / 512, item = 'rocket-control-unit'}
}
}
@ -48,6 +48,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Big Circuit Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 350,
upgrade_cost_base = 2,
{
name = 'copper-cable',
price = 0.25,

View File

@ -22,7 +22,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
furance_item = {name = 'copper-ore', count = 100},
output = {min_rate = 5 / 60, distance_factor = 2 / 60 / 512, item = 'copper-plate'}
output = {min_rate = 2.5 / 60, distance_factor = 2.5 / 60 / 512, item = 'copper-plate'}
}
}
@ -30,6 +30,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Big Copper Plate Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 250,
upgrade_cost_base = 2,
{
name = 'copper-cable',
price = 0.12,

View File

@ -29,7 +29,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'iron-gear-wheel',
output = {min_rate = 4 / 60, distance_factor = 4 / 60 / 512, item = 'iron-gear-wheel'}
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'iron-gear-wheel'}
}
}
@ -37,7 +37,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'engine-unit',
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'engine-unit'}
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'engine-unit'}
}
}
@ -45,7 +45,7 @@ local factory_c = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'electric-engine-unit',
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'electric-engine-unit'}
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'electric-engine-unit'}
}
}
@ -53,6 +53,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Big Gear Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 200,
upgrade_cost_base = 2,
{
name = 'iron-gear-wheel',
price = 0.5,

View File

@ -24,7 +24,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
furance_item = {name = 'iron-ore', count = 100},
output = {min_rate = 5 / 60, distance_factor = 2 / 60 / 512, item = 'iron-plate'}
output = {min_rate = 2.5 / 60, distance_factor = 2.5 / 60 / 512, item = 'iron-plate'}
}
}
@ -32,7 +32,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
furance_item = {name = 'iron-plate', count = 100},
output = {min_rate = 3 / 60, distance_factor = 1.5 / 60 / 512, item = 'steel-plate'}
output = {min_rate = 1.5 / 60, distance_factor = 1.5 / 60 / 512, item = 'steel-plate'}
}
}
@ -48,6 +48,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Big Iron Plate Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 250,
upgrade_cost_base = 2,
{
name = 'iron-plate',
price = 0.3,

View File

@ -41,9 +41,9 @@ local factory = {
recipe = 'advanced-oil-processing',
keep_active = true,
output = {
{min_rate = 5 / 60, distance_factor = 5 / 60 / 512, item = 'heavy-oil', fluidbox_index = 3},
{min_rate = 22.5 / 60, distance_factor = 22.5 / 60 / 512, item = 'light-oil', fluidbox_index = 4},
{min_rate = 27.5 / 60, distance_factor = 27.5 / 60 / 512, item = 'petroleum-gas', fluidbox_index = 5}
{min_rate = 1.25 / 60, distance_factor = 1.25 / 60 / 512, item = 'heavy-oil', fluidbox_index = 3},
{min_rate = 5.625/ 60, distance_factor = 5.625 / 60 / 512, item = 'light-oil', fluidbox_index = 4},
{min_rate = 6.875 / 60, distance_factor = 6.875 / 60 / 512, item = 'petroleum-gas', fluidbox_index = 5}
}
}
}
@ -52,41 +52,44 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Big Oil Refinery',
upgrade_rate = 0.5,
upgrade_base_cost = 150,
upgrade_cost_base = 2,
{
name = 'crude-oil-barrel',
price = 10,
price = 1,
distance_factor = 5 / 512,
min_price = 1
min_price = 0.1
},
{
name = 'heavy-oil-barrel',
price = 15,
price = 1.5,
distance_factor = 7.5 / 512,
min_price = 1.5
min_price = 0.15
},
{
name = 'light-oil-barrel',
price = 20,
price = 2,
distance_factor = 10 / 512,
min_price = 2
min_price = 0.2
},
{
name = 'petroleum-gas-barrel',
price = 25,
price = 2.5,
distance_factor = 12.5 / 512,
min_price = 2.5
min_price = 0.25
},
{
name = 'lubricant-barrel',
price = 15,
price = 1.5,
distance_factor = 7.5 / 512,
min_price = 1.5
min_price = 0.15
},
{
name = 'sulfuric-acid-barrel',
price = 40,
price = 4,
distance_factor = 20 / 512,
min_price = 4
min_price = 0.4
}
}
}

View File

@ -30,7 +30,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'uranium-processing',
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'uranium-238'}
output = {min_rate = 0.5 / 60, distance_factor = 0.5 / 60 / 512, item = 'uranium-238'}
}
}
@ -38,7 +38,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'uranium-fuel-cell',
output = {min_rate = 0.05 / 60, distance_factor = 0.05 / 60 / 512, item = 'uranium-fuel-cell'}
output = {min_rate = 0.025 / 60, distance_factor = 0.025 / 60 / 512, item = 'uranium-fuel-cell'}
}
}
@ -46,7 +46,7 @@ local factory_c = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'nuclear-fuel',
output = {min_rate = 0.05 / 60, distance_factor = 0.05 / 60 / 512, item = 'nuclear-fuel'}
output = {min_rate = 0.025 / 60, distance_factor = 0.025 / 60 / 512, item = 'nuclear-fuel'}
}
}
@ -54,6 +54,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Big Power Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 350,
upgrade_cost_base = 2,
{
name = 'coal',
price = 0.5,

View File

@ -25,7 +25,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'production-science-pack',
output = {min_rate = 0.125 / 60, distance_factor = 0.125 / 60 / 512, item = 'production-science-pack'}
output = {min_rate = 0.0625 / 60, distance_factor = 0.0625 / 60 / 512, item = 'production-science-pack'}
}
}
@ -33,7 +33,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'high-tech-science-pack',
output = {min_rate = 0.125 / 60, distance_factor = 0.125 / 60 / 512, item = 'high-tech-science-pack'}
output = {min_rate = 0.0625 / 60, distance_factor = 0.0625 / 60 / 512, item = 'high-tech-science-pack'}
}
}
@ -41,6 +41,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Big Science Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 500,
upgrade_cost_base = 2,
{
name = 'science-pack-1',
price = 10,

View File

@ -25,7 +25,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
furance_item = 'stone',
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'stone-brick'}
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'stone-brick'}
}
}
@ -33,15 +33,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'refined-concrete',
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'refined-concrete'}
}
}
local factory_c = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'electric-engine-unit',
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'electric-engine-unit'}
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'refined-concrete'}
}
}
@ -49,6 +41,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Big Stone Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 125,
upgrade_cost_base = 2,
{
name = 'stone',
price = 0.25,

View File

@ -30,7 +30,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'destroyer-capsule',
output = {min_rate = 0.05 / 60, distance_factor = 0.05 / 60 / 512, item = 'destroyer-capsule'}
output = {min_rate = 0.025 / 60, distance_factor = 0.025 / 60 / 512, item = 'destroyer-capsule'}
}
}
@ -38,7 +38,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'laser-turret',
output = {min_rate = 0.05 / 60, distance_factor = 0.05 / 60 / 512, item = 'laser-turret'}
output = {min_rate = 0.025 / 60, distance_factor = 0.025 / 60 / 512, item = 'laser-turret'}
}
}
@ -46,6 +46,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Big Weapon Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 500,
upgrade_cost_base = 2,
{
name = 'raw-fish',
price = 1,

View File

@ -2,6 +2,7 @@ local ob = require 'map_gen.presets.crash_site.outpost_builder'
return ob.make_walls {
ob.make_4_way {
turret = {callback = ob.worm_turret_callback},
[1] = {entity = {name = 'stone-wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
@ -22,7 +23,7 @@ return ob.make_walls {
[18] = {tile = 'stone-path'},
[19] = {tile = 'concrete'},
[20] = {tile = 'concrete'},
[21] = {entity = {name = 'big-worm-turret'}, tile = 'concrete'},
[21] = {entity = {name = 'big-worm-turret', callback = 'turret'}, tile = 'concrete'},
[22] = {tile = 'concrete'},
[23] = {tile = 'concrete'},
[24] = {tile = 'concrete'},
@ -40,7 +41,9 @@ return ob.make_walls {
[36] = {tile = 'stone-path'}
},
ob.make_4_way {
[1] = {entity = {name = 'stone-wall'}},
turret = {callback = ob.worm_turret_callback},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},
@ -61,7 +64,7 @@ return ob.make_walls {
[19] = {entity = {name = 'stone-wall'}},
[20] = {entity = {name = 'stone-wall'}},
[21] = {tile = 'stone-path'},
[22] = {entity = {name = 'big-worm-turret'}, tile = 'concrete'},
[22] = {entity = {name = 'big-worm-turret', callback = 'turret'}, tile = 'concrete'},
[23] = {tile = 'concrete'},
[24] = {tile = 'concrete'},
[25] = {entity = {name = 'stone-wall'}},
@ -78,6 +81,7 @@ return ob.make_walls {
[36] = {tile = 'stone-path'}
},
ob.make_4_way {
turret = {callback = ob.worm_turret_callback},
[1] = {entity = {name = 'stone-wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {tile = 'stone-path'},
@ -99,7 +103,7 @@ return ob.make_walls {
[19] = {tile = 'concrete'},
[20] = {tile = 'concrete'},
[21] = {tile = 'concrete'},
[22] = {entity = {name = 'big-worm-turret'}, tile = 'concrete'},
[22] = {entity = {name = 'big-worm-turret', callback = 'turret'}, tile = 'concrete'},
[23] = {tile = 'concrete'},
[24] = {tile = 'stone-path'},
[25] = {tile = 'concrete'},

View File

@ -53,7 +53,8 @@ return ob.make_walls{
ob.make_4_way {
flame_turret = {callback = ob.refill_liquid_turret_callback, data = ob.light_oil_ammo},
turret = {callback = ob.refill_turret_callback, data = ob.uranium_rounds_magazine_ammo},
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -42,7 +42,8 @@ return ob.make_walls{
},
ob.make_4_way {
turret = {callback = ob.refill_turret_callback, data = ob.uranium_rounds_magazine_ammo},
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -57,7 +57,8 @@ return ob.make_walls{
},
ob.make_4_way {
turret = {callback = ob.power_source_callback, data = ob.laser_turrent_power_source},
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -42,7 +42,8 @@ return ob.make_walls{
},
ob.make_4_way {
turret = {callback = ob.refill_liquid_turret_callback, data = ob.light_oil_ammo},
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -42,7 +42,8 @@ return ob.make_walls{
},
ob.make_4_way {
turret = {callback = ob.refill_turret_callback, data = ob.firearm_magazine_ammo},
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -42,7 +42,8 @@ return ob.make_walls{
},
ob.make_4_way {
turret = {callback = ob.power_source_callback, data = ob.laser_turrent_power_source},
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -26,7 +26,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'piercing-rounds-magazine',
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'piercing-rounds-magazine'}
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'piercing-rounds-magazine'}
}
}
@ -34,7 +34,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'explosive-cannon-shell',
output = {min_rate = 1 / 2 / 60, distance_factor = 1 / 2 / 60 / 512, item = 'explosive-cannon-shell'}
output = {min_rate = 0.5 / 2 / 60, distance_factor = 0.5 / 2 / 60 / 512, item = 'explosive-cannon-shell'}
}
}
@ -42,7 +42,7 @@ local factory_c = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'uranium-rounds-magazine',
output = {min_rate = 0.5 / 60, distance_factor = 0.5 / 60 / 512, item = 'uranium-rounds-magazine'}
output = {min_rate = 0.25 / 60, distance_factor = 0.25 / 60 / 512, item = 'uranium-rounds-magazine'}
}
}
@ -50,6 +50,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Medium Ammo Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 500,
upgrade_cost_base = 2,
{
name = 'firearm-magazine',
price = 1,

View File

@ -26,7 +26,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'battery',
output = {min_rate = 1.25 / 60, distance_factor = 1.25 / 60 / 512, item = 'battery'}
output = {min_rate = 0.75 / 60, distance_factor = 0.75 / 60 / 512, item = 'battery'}
}
}
@ -34,7 +34,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'explosives',
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'explosives'}
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'explosives'}
}
}
@ -42,6 +42,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Medium Checmical Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 250,
upgrade_cost_base = 2,
{
name = 'coal',
price = 0.25,

View File

@ -15,7 +15,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'electronic-circuit',
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'electronic-circuit'}
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'electronic-circuit'}
}
}
@ -23,7 +23,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'advanced-circuit',
output = {min_rate = 1 / 600, distance_factor = 1 / 600 / 512, item = 'advanced-circuit'}
output = {min_rate = 0.5 / 600, distance_factor = 0.5 / 600 / 512, item = 'advanced-circuit'}
}
}
@ -31,6 +31,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Medium Circuit Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 350,
upgrade_cost_base = 2,
{
name = 'copper-cable',
price = 0.25,

View File

@ -22,7 +22,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
furance_item = 'copper-ore',
output = {min_rate = 5 / 60, distance_factor = 2 / 60 / 512, item = 'copper-plate'}
output = {min_rate = 2.5 / 60, distance_factor = 2.5 / 60 / 512, item = 'copper-plate'}
}
}
@ -30,6 +30,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Medium Copper Plate Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 250,
upgrade_cost_base = 2,
{
name = 'copper-cable',
price = 0.12,

View File

@ -44,7 +44,8 @@ return ob.make_walls{
ob.make_4_way {
flame_turret = {callback = ob.refill_liquid_turret_callback, data = ob.light_oil_ammo},
turret = {callback = ob.refill_turret_callback, data = ob.piercing_rounds_magazine_ammo},
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -37,7 +37,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'engine-unit',
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'engine-unit'}
output = {min_rate = 0.5 / 60, distance_factor = 0.5 / 60 / 512, item = 'engine-unit'}
}
}
@ -45,7 +45,7 @@ local factory_c = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'electric-engine-unit',
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'electric-engine-unit'}
output = {min_rate = 0.5 / 60, distance_factor = 0.5 / 60 / 512, item = 'electric-engine-unit'}
}
}
@ -53,6 +53,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Medium Gear Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 200,
upgrade_cost_base = 2,
{
name = 'iron-gear-wheel',
price = 0.5,

View File

@ -42,7 +42,8 @@ return ob.make_walls{
},
ob.make_4_way {
turret = {callback = ob.refill_turret_callback, data = ob.piercing_rounds_magazine_ammo},
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -22,7 +22,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
furance_item = 'iron-ore',
output = {min_rate = 5 / 60, distance_factor = 2 / 60 / 512, item = 'iron-plate'}
output = {min_rate = 2.5 / 60, distance_factor = 2.5 / 60 / 512, item = 'iron-plate'}
}
}
@ -30,7 +30,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
furance_item = {name = 'iron-plate', count = 100},
output = {min_rate = 1.5 / 60, distance_factor = 1.5 / 60 / 512, item = 'steel-plate'}
output = {min_rate = 0.75 / 60, distance_factor = 0.75 / 60 / 512, item = 'steel-plate'}
}
}
@ -38,6 +38,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Medium Iron Plate Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 250,
upgrade_cost_base = 2,
{
name = 'iron-plate',
price = 0.3,

View File

@ -42,7 +42,8 @@ return ob.make_walls{
},
ob.make_4_way {
turret = {callback = ob.power_source_callback, data = ob.laser_turrent_power_source},
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -41,9 +41,9 @@ local factory = {
recipe = 'advanced-oil-processing',
keep_active = true,
output = {
{min_rate = 5 / 60, distance_factor = 51 / 60 / 512, item = 'heavy-oil', fluidbox_index = 3},
{min_rate = 22.5 / 60, distance_factor = 22.5 / 60 / 512, item = 'light-oil', fluidbox_index = 4},
{min_rate = 27.5 / 60, distance_factor = 27.5 / 60 / 512, item = 'petroleum-gas', fluidbox_index = 5}
{min_rate = 1.25 / 60, distance_factor = 1.25 / 60 / 512, item = 'heavy-oil', fluidbox_index = 3},
{min_rate = 5.625 / 60, distance_factor = 5.625 / 60 / 512, item = 'light-oil', fluidbox_index = 4},
{min_rate = 6.875 / 60, distance_factor = 6.875 / 60 / 512, item = 'petroleum-gas', fluidbox_index = 5}
}
}
}
@ -52,41 +52,44 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Medium Oil Refinery',
upgrade_rate = 0.5,
upgrade_base_cost = 150,
upgrade_cost_base = 2,
{
name = 'crude-oil-barrel',
price = 10,
price = 1,
distance_factor = 5 / 512,
min_price = 1
min_price = 0.1
},
{
name = 'heavy-oil-barrel',
price = 15,
price = 1.5,
distance_factor = 7.5 / 512,
min_price = 1.5
min_price = 0.15
},
{
name = 'light-oil-barrel',
price = 20,
price = 2,
distance_factor = 10 / 512,
min_price = 2
min_price = 0.2
},
{
name = 'petroleum-gas-barrel',
price = 25,
price = 2.5,
distance_factor = 12.5 / 512,
min_price = 2.5
min_price = 0.25
},
{
name = 'lubricant-barrel',
price = 15,
price = 1.5,
distance_factor = 7.5 / 512,
min_price = 1.5
min_price = 0.15
},
{
name = 'sulfuric-acid-barrel',
price = 40,
price = 4,
distance_factor = 20 / 512,
min_price = 4
min_price = 0.4
}
}
}

View File

@ -27,7 +27,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'accumulator',
output = {min_rate = 0.84 / 2 / 60, distance_factor = 0.84 / 2 / 60 / 512, item = 'accumulator'}
output = {min_rate = 0.42 / 2 / 60, distance_factor = 0.42 / 2 / 60 / 512, item = 'accumulator'}
}
}
@ -35,7 +35,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'solar-panel',
output = {min_rate = 1 / 2 / 60, distance_factor = 1 / 2 / 60 / 512, item = 'solar-panel'}
output = {min_rate = 0.5 / 2 / 60, distance_factor = 0.5 / 2 / 60 / 512, item = 'solar-panel'}
}
}
@ -43,6 +43,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Medium Power Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 250,
upgrade_cost_base = 2,
{
name = 'coal',
price = 0.5,

View File

@ -23,7 +23,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'military-science-pack',
output = {min_rate = 0.15 / 60, distance_factor = 0.125 / 60 / 512, item = 'military-science-pack'}
output = {min_rate = 0.075 / 60, distance_factor = 0.075 / 60 / 512, item = 'military-science-pack'}
}
}
@ -31,7 +31,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'science-pack-3',
output = {min_rate = 0.25 / 60, distance_factor = 0.15 / 60 / 512, item = 'science-pack-3'}
output = {min_rate = 0.125 / 60, distance_factor = 0.125 / 60 / 512, item = 'science-pack-3'}
}
}
@ -39,6 +39,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Medium Science Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 500,
upgrade_cost_base = 2,
{
name = 'science-pack-1',
price = 10,

View File

@ -24,7 +24,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
furance_item = 'stone',
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'stone-brick'}
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'stone-brick'}
}
}
@ -32,7 +32,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'concrete',
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'concrete'}
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'concrete'}
}
}
@ -40,6 +40,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Medium Stone Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 125,
upgrade_cost_base = 2,
{
name = 'stone',
price = 0.25,

View File

@ -35,7 +35,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'explosive-rocket',
output = {min_rate = 0.5 / 60, distance_factor = 0.5 / 60 / 512, item = 'explosive-rocket'}
output = {min_rate = 0.25 / 60, distance_factor = 0.25 / 60 / 512, item = 'explosive-rocket'}
}
}
@ -59,6 +59,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Medium Weapon Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 500,
upgrade_cost_base = 2,
{
name = 'raw-fish',
price = 1,

View File

@ -17,7 +17,8 @@ return ob.make_walls {
ob.make_4_way {
part_size = 3,
turret = {callback = ob.refill_turret_callback, data = ob.firearm_magazine_ammo},
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -15,7 +15,8 @@ return ob.make_walls {
},
ob.make_4_way {
part_size = 3,
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},
@ -29,7 +30,7 @@ return ob.make_walls {
part_size = 3,
[1] = {entity = {name = 'stone-wall'}},
[2] = {tile = 'hazard-concrete-left'},
[3] = {entity = {name = 'iron-chest'}, tile = 'stone-path'},
[3] = {entity = {name = 'iron-chest', force = 'neutral', callback = 'loot'}, tile = 'stone-path'},
[4] = {tile = 'hazard-concrete-left'},
[5] = {entity = {name = 'medium-electric-pole'}, tile = 'hazard-concrete-left'},
[6] = {entity = {name = 'iron-chest', force = 'neutral', callback = 'loot'}, tile = 'stone-path'},

View File

@ -15,7 +15,8 @@ return ob.make_walls {
},
ob.make_4_way {
part_size = 3,
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -17,7 +17,8 @@ return ob.make_walls {
ob.make_4_way {
part_size = 3,
turret = {callback = ob.power_source_callback, data = ob.laser_turrent_power_source},
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -24,20 +24,45 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'piercing-rounds-magazine', count = 200, distance_factor = 0}, weight = 10},
{stack = {name = 'rocket', count = 50, distance_factor = 1 / 8}, weight = 5},
{stack = {name = 'cannon-shell', count = 50, distance_factor = 1 / 8}, weight = 5},
{stack = {name = 'cluster-grenade', count = 10, distance_factor = 1 / 16}, weight = 5}
{
stack = {
recipe = 'piercing-rounds-magazine',
output = {item = 'piercing-rounds-magazine', min_rate = 1 / 3 / 60, distance_factor = 1 / 3 / 60 / 512}
},
weight = 10
},
{
stack = {
recipe = 'rocket',
output = {item = 'rocket', min_rate = 0.5 / 8 / 60, distance_factor = 1 / 8 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'cannon-shell',
output = {item = 'cannon-shell', min_rate = 0.5 / 8 / 60, distance_factor = 1 / 8 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'cluster-grenade',
output = {item = 'cluster-grenade', min_rate = 0.1 / 8 / 60, distance_factor = 1 / 8 / 60 / 512}
},
weight = 5
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret'
@ -49,7 +74,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local gun_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun = ob.extend_1_way(gun_turret_block, {fallback = factory})
return {

View File

@ -19,19 +19,38 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'effectivity-module', count = 25, distance_factor = 1 / 5}, weight = 5},
{stack = {name = 'speed-module', count = 15, distance_factor = 1 / 5}, weight = 5},
{stack = {name = 'productivity-module', count = 15, distance_factor = 1 / 5}, weight = 5}
{
stack = {
recipe = 'effectivity-module',
output = {item = 'effectivity-module', min_rate = 0.5 / 15 / 60, distance_factor = 0.5 / 15 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'speed-module',
output = {item = 'speed-module', min_rate = 0.5 / 15 / 60, distance_factor = 0.5 / 15 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'productivity-module',
output = {item = 'productivity-module', min_rate = 0.5 / 15 / 60, distance_factor = 0.5 / 15 / 60 / 512}
},
weight = 5
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret'
@ -51,7 +70,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local gun_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun =
ob.extend_1_way(
gun_turret_block,

View File

@ -21,20 +21,45 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'steel-furnace', count = 50, distance_factor = 1}, weight = 3},
{stack = {name = 'electric-mining-drill', count = 50, distance_factor = 1}, weight = 3},
{stack = {name = 'pumpjack', count = 5, distance_factor = 1 / 32}, weight = 2},
{stack = {name = 'oil-refinery', count = 3, distance_factor = 1 / 32}, weight = 1}
{
stack = {
recipe = 'steel-furnace',
output = {item = 'steel-furnace', min_rate = 1 / 6 / 60, distance_factor = 1 / 6 / 60 / 512}
},
weight = 3
},
{
stack = {
recipe = 'electric-mining-drill',
output = {item = 'electric-mining-drill', min_rate = 1 / 3 / 60, distance_factor = 1 / 3 / 60 / 512}
},
weight = 3
},
{
stack = {
recipe = 'pumpjack',
output = {item = 'pumpjack', min_rate = 1 / 20 / 60, distance_factor = 1 / 20 / 60 / 512}
},
weight = 2
},
{
stack = {
recipe = 'oil-refinery',
output = {item = 'oil-refinery', min_rate = 1 / 40 / 60, distance_factor = 1 / 40 / 60 / 512}
},
weight = 1
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret'
@ -46,7 +71,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local gun_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun = ob.extend_1_way(gun_turret_block, {fallback = factory})
return {

View File

@ -24,17 +24,38 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'roboport', count = 10, distance_factor = 1 / 16}, weight = 1}
{
stack = {
recipe = 'construction-robot',
output = {item = 'construction-robot', min_rate = 1 / 4 / 60, distance_factor = 1 / 4 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'logistic-robot',
output = {item = 'logistic-robot', min_rate = 1 / 4 / 60, distance_factor = 1 / 4 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'roboport',
output = {item = 'roboport', min_rate = 1 / 20 / 60, distance_factor = 1 / 20 / 60 / 512}
},
weight = 5
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret'
@ -54,7 +75,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local gun_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun =
ob.extend_1_way(
gun_turret_block,

View File

@ -18,18 +18,30 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'science-pack-1', count = 75, distance_factor = 1 / 2}, weight = 5},
{stack = {name = 'science-pack-2', count = 50, distance_factor = 1 / 2}, weight = 5}
{
stack = {
recipe = 'science-pack-1',
output = {item = 'science-pack-1', min_rate = 1 / 5 / 60, distance_factor = 1 / 5 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'science-pack-2',
output = {item = 'science-pack-2', min_rate = 1 / 6 / 60, distance_factor = 1 / 6 / 60 / 512}
},
weight = 5
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret'
@ -49,7 +61,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local gun_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun =
ob.extend_1_way(
gun_turret_block,

View File

@ -23,17 +23,24 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'rail', count = 100, distance_factor = 0}, weight = 5}
{
stack = {
recipe = 'rail',
output = {item = 'rail', min_rate = 1 / 1 / 60, distance_factor = 1 / 1 / 60 / 512}
},
weight = 5
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret'
@ -45,7 +52,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local gun_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun = ob.extend_1_way(gun_turret_block, {fallback = factory})
return {

View File

@ -23,18 +23,31 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'piercing-shotgun-shell', count = 200, distance_factor = 0}, weight = 1},
{stack = {name = 'gun-turret', count = 50, distance_factor = 0}, weight = 1}
{
stack = {
recipe = 'piercing-shotgun-shell',
output = {item = 'piercing-shotgun-shell', min_rate = 0.75 / 8 / 60, distance_factor = 1 / 8 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'gun-turret',
output = {item = 'gun-turret', min_rate = 0.5 / 15 / 60, distance_factor = 0.5 / 15 / 60 / 512}
},
weight = 5
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret'
@ -46,7 +59,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local gun_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun = ob.extend_1_way(gun_turret_block, {fallback = factory})
return {

View File

@ -7,7 +7,7 @@ local loot = {
{stack = {name = 'piercing-rounds-magazine', count = 125, distance_factor = 1 / 4}, weight = 5},
{stack = {name = 'uranium-rounds-magazine', count = 25, distance_factor = 1 / 8}, weight = 5},
{stack = {name = 'grenade', count = 100, distance_factor = 1 / 16}, weight = 1},
{stack = {name = 'land-mine', count = 200, distance_factor = 1/2}, weight = 1},
{stack = {name = 'land-mine', count = 200, distance_factor = 1 / 2}, weight = 1},
{stack = {name = 'cannon-shell', count = 50, distance_factor = 1 / 32}, weight = 2},
{stack = {name = 'explosive-cannon-shell', count = 25, distance_factor = 1 / 32}, weight = 1},
{stack = {name = 'cluster-grenade', count = 25, distance_factor = 1 / 32}, weight = 1}
@ -23,19 +23,38 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'uranium-rounds-magazine', count = 200, distance_factor = 0}, weight = 5},
{stack = {name = 'uranium-cannon-shell', count = 200, distance_factor = 0}, weight = 5},
{stack = {name = 'poison-capsule', count = 100, distance_factor = 0}, weight = 5}
{
stack = {
recipe = 'uranium-rounds-magazine',
output = {item = 'uranium-rounds-magazine', min_rate = 1 / 10 / 60, distance_factor = 1 / 10 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'uranium-cannon-shell',
output = {item = 'uranium-cannon-shell', min_rate = 0.25 / 12 / 60, distance_factor = 0.5 / 12 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'poison-capsule',
output = {item = 'poison-capsule', min_rate = 0.5 / 8 / 60, distance_factor = 1 / 8 / 60 / 512}
},
weight = 5
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret'
@ -55,7 +74,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local gun_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun =
ob.extend_1_way(
gun_turret_block,

View File

@ -21,18 +21,31 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'solar-panel', count = 25, distance_factor = 1 / 25}, weight = 3},
{stack = {name = 'accumulator', count = 21, distance_factor = 1 / 21}, weight = 3}
{
stack = {
recipe = 'solar-panel',
output = {item = 'solar-panel', min_rate = 0.25 / 4 / 60, distance_factor = 0.25 / 4 / 60 / 512}
},
weight = 3
},
{
stack = {
recipe = 'accumulator',
output = {item = 'accumulator', min_rate = 0.21 / 4 / 60, distance_factor = 0.21 / 4 / 60 / 512}
},
weight = 3
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret'
@ -52,7 +65,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local gun_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun =
ob.extend_1_way(
gun_turret_block,

View File

@ -21,21 +21,52 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'fast-transport-belt', count = 100, distance_factor = 0}, weight = 5},
{stack = {name = 'fast-underground-belt', count = 50, distance_factor = 0}, weight = 5},
{stack = {name = 'fast-splitter', count = 25, distance_factor = 1 / 32}, weight = 5},
{stack = {name = 'fast-inserter', count = 50, distance_factor = 0}, weight = 5},
{stack = {name = 'assembling-machine-2', count = 25, distance_factor = 1 / 32}, weight = 5}
{
stack = {
recipe = 'fast-transport-belt',
output = {item = 'fast-transport-belt', min_rate = 1 / 2 / 60, distance_factor = 1 / 2 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'fast-underground-belt',
output = {item = 'fast-underground-belt', min_rate = 1 / 8 / 60, distance_factor = 1 / 8 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'fast-splitter',
output = {item = 'fast-splitter', min_rate = 1 / 8 / 60, distance_factor = 1 / 8 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'fast-inserter',
output = {item = 'fast-inserter', min_rate = 1 / 2 / 60, distance_factor = 1 / 2 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'assembling-machine-2',
output = {item = 'assembling-machine-2', min_rate = 1 / 4 / 60, distance_factor = 1 / 4 / 60 / 512}
},
weight = 5
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret'
@ -47,7 +78,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local gun_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun = ob.extend_1_way(gun_turret_block, {fallback = factory})
return {

View File

@ -19,19 +19,38 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'effectivity-module-2', count = 25, distance_factor = 1 / 5}, weight = 5},
{stack = {name = 'speed-module-2', count = 15, distance_factor = 1 / 5}, weight = 5},
{stack = {name = 'productivity-module-2', count = 15, distance_factor = 1 / 5}, weight = 5}
{
stack = {
recipe = 'effectivity-module-2',
output = {item = 'effectivity-module-2', min_rate = 0.5 / 30 / 60, distance_factor = 0.5 / 30 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'speed-module-2',
output = {item = 'speed-module-2', min_rate = 0.5 / 30 / 60, distance_factor = 0.5 / 30 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'productivity-module-2',
output = {item = 'productivity-module-2', min_rate = 0.5 / 30 / 60, distance_factor = 0.5 / 30 / 60 / 512}
},
weight = 5
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_hazard_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_laser_turret'
@ -43,7 +62,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local laser_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_laser_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun = ob.extend_1_way(laser_turret_block, {fallback = factory})
return {

View File

@ -18,18 +18,31 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'military-science-pack', count = 50, distance_factor = 1 / 5}, weight = 5},
{stack = {name = 'science-pack-3', count = 50, distance_factor = 1 / 5}, weight = 5}
{
stack = {
recipe = 'military-science-pack',
output = {item = 'military-science-pack', min_rate = 2 / 10 / 60, distance_factor = 1 / 10 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'science-pack-3',
output = {item = 'science-pack-3', min_rate = 1 / 12 / 60, distance_factor = 1 / 12 / 60 / 512}
},
weight = 5
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_hazard_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_laser_turret'
@ -41,7 +54,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local laser_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_laser_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun = ob.extend_1_way(laser_turret_block, {fallback = factory})
return {

View File

@ -29,18 +29,31 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'laser-turret', count = 25, distance_factor = 1 / 32}, weight = 1},
{stack = {name = 'flamethrower-turret', count = 25, distance_factor = 1 / 32}, weight = 1}
{
stack = {
recipe = 'laser-turret',
output = {item = 'laser-turret', min_rate = 1 / 20 / 60, distance_factor = 1 / 20 / 60 / 512}
},
weight = 1
},
{
stack = {
recipe = 'flamethrower-turret',
output = {item = 'flamethrower-turret', min_rate = 1 / 20 / 60, distance_factor = 1 / 20 / 60 / 512}
},
weight = 1
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret'
@ -60,7 +73,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local gun_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun =
ob.extend_1_way(
gun_turret_block,

View File

@ -21,21 +21,52 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'express-transport-belt', count = 100, distance_factor = 0}, weight = 5},
{stack = {name = 'express-underground-belt', count = 50, distance_factor = 0}, weight = 5},
{stack = {name = 'express-splitter', count = 25, distance_factor = 1 / 32}, weight = 5},
{stack = {name = 'stack-inserter', count = 50, distance_factor = 0}, weight = 5},
{stack = {name = 'assembling-machine-3', count = 25, distance_factor = 1 / 32}, weight = 5}
{
stack = {
recipe = 'express-transport-belt',
output = {item = 'express-transport-belt', min_rate = 1 / 2 / 60, distance_factor = 1 / 2 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'express-underground-belt',
output = {item = 'express-underground-belt', min_rate = 1 / 8 / 60, distance_factor = 1 / 8 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'express-splitter',
output = {item = 'express-splitter', min_rate = 1 / 8 / 60, distance_factor = 1 / 8 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'stack-inserter',
output = {item = 'stack-inserter', min_rate = 1 / 2 / 60, distance_factor = 1 / 2 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'assembling-machine-3',
output = {item = 'assembling-machine-3', min_rate = 1 / 4 / 60, distance_factor = 1 / 4 / 60 / 512}
},
weight = 5
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret'
@ -55,7 +86,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local gun_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_gun_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun =
ob.extend_1_way(
gun_turret_block,

View File

@ -19,19 +19,38 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'effectivity-module-3', count = 10, distance_factor = 1 / 16}, weight = 5},
{stack = {name = 'speed-module-3', count = 7, distance_factor = 1 / 16}, weight = 5},
{stack = {name = 'productivity-module-3', count = 7, distance_factor = 1 / 16}, weight = 5}
{
stack = {
recipe = 'effectivity-module-3',
output = {item = 'effectivity-module-3', min_rate = 0.5 / 60 / 60, distance_factor = 0.5 / 60 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'speed-module-3',
output = {item = 'speed-module-3', min_rate = 0.5 / 60 / 60, distance_factor = 0.5 / 60 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'productivity-module-3',
output = {item = 'productivity-module-3', min_rate = 0.5 / 60 / 60, distance_factor = 0.5 / 60 / 60 / 512}
},
weight = 5
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_hazard_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_laser_turret'
@ -43,7 +62,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local laser_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_laser_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun = ob.extend_1_way(laser_turret_block, {fallback = factory})
return {

View File

@ -18,18 +18,31 @@ local loot_callback =
)
local factory_loot = {
{stack = {name = 'production-science-pack', count = 75, distance_factor = 1 / 2}, weight = 5},
{stack = {name = 'high-tech-science-pack', count = 75, distance_factor = 1 / 2}, weight = 5}
{
stack = {
recipe = 'production-science-pack',
output = {item = 'production-science-pack', min_rate = 2 / 14 / 60, distance_factor = 1 / 14 / 60 / 512}
},
weight = 5
},
{
stack = {
recipe = 'high-tech-science-pack',
output = {item = 'high-tech-science-pack', min_rate = 2 / 14 / 60, distance_factor = 1 / 14 / 60 / 512}
},
weight = 5
}
}
local factory_weights = ob.prepare_weighted_loot(factory_loot)
local factory_callback =
Token.register(
function(factory)
ob.do_factory_loot(factory, factory_weights, factory_loot)
end
)
local factory_callback = {
callback = ob.magic_item_crafting_callback_weighted,
data = {
loot = factory_loot,
weights = factory_weights
}
}
local wall_chests = require 'map_gen.presets.crash_site.outpost_data.mini_hazard_wall_chests'
local turret = require 'map_gen.presets.crash_site.outpost_data.mini_laser_turret'
@ -41,7 +54,7 @@ local blank = require 'map_gen.presets.crash_site.outpost_data.mini_blank'
local base_factory = require 'map_gen.presets.crash_site.outpost_data.mini_factory'
local laser_turret_block = require 'map_gen.presets.crash_site.outpost_data.mini_laser_turret_block'
local factory = ob.extend_1_way(base_factory, {factory = {callback = factory_callback}, fallback = blank})
local factory = ob.extend_1_way(base_factory, {factory = factory_callback, fallback = blank})
local gun = ob.extend_1_way(laser_turret_block, {fallback = factory})
return {

View File

@ -15,7 +15,8 @@ return ob.make_walls {
},
ob.make_4_way {
part_size = 3,
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -15,7 +15,8 @@ return ob.make_walls {
},
ob.make_4_way {
part_size = 3,
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -27,7 +27,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'firearm-magazine',
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'firearm-magazine'}
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'firearm-magazine'}
}
}
@ -35,7 +35,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'piercing-rounds-magazine',
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'piercing-rounds-magazine'}
output = {min_rate = 0.5 / 60, distance_factor = 0.5 / 60 / 512, item = 'piercing-rounds-magazine'}
}
}
@ -43,6 +43,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Small Ammo Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 500,
upgrade_cost_base = 2,
{
name = 'firearm-magazine',
price = 1,

View File

@ -24,7 +24,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'sulfur',
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'sulfur'}
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'sulfur'}
}
}
@ -32,7 +32,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'plastic-bar',
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'plastic-bar'}
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'plastic-bar'}
}
}
@ -40,6 +40,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Small Chemical Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 250,
upgrade_cost_base = 2,
{
name = 'coal',
price = 0.25,

View File

@ -15,7 +15,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'electronic-circuit',
output = {min_rate = 1.5 / 60, distance_factor = 1.5 / 60 / 512, item = 'electronic-circuit'}
output = {min_rate = 0.75 / 60, distance_factor = 0.75 / 60 / 512, item = 'electronic-circuit'}
}
}
@ -23,6 +23,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Small Circuit Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 350,
upgrade_cost_base = 2,
{
name = 'copper-cable',
price = 0.25,

View File

@ -22,7 +22,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
furance_item = 'copper-ore',
output = {min_rate = 4 / 60, distance_factor = 1.75 / 60 / 512, item = 'copper-plate'}
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'copper-plate'}
}
}
@ -30,6 +30,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Small Copper Plate Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 250,
upgrade_cost_base = 2,
{
name = 'copper-cable',
price = 0.12,

View File

@ -27,7 +27,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'iron-gear-wheel',
output = {min_rate = 1.5 / 60, distance_factor = 1.5 / 60 / 512, item = 'iron-gear-wheel'}
output = {min_rate = 0.75 / 60, distance_factor = 0.75 / 60 / 512, item = 'iron-gear-wheel'}
}
}
@ -35,7 +35,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'engine-unit',
output = {min_rate = 0.5 / 60, distance_factor = 0.5 / 60 / 512, item = 'engine-unit'}
output = {min_rate = 0.25 / 60, distance_factor = 0.25 / 60 / 512, item = 'engine-unit'}
}
}
@ -43,6 +43,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Small Gear Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 200,
upgrade_cost_base = 2,
{
name = 'iron-gear-wheel',
price = 0.5,

View File

@ -22,7 +22,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
furance_item = 'iron-ore',
output = {min_rate = 4 / 60, distance_factor = 1.75 / 60 / 512, item = 'iron-plate'}
output = {min_rate = 2 / 60, distance_factor = 2 / 60 / 512, item = 'iron-plate'}
}
}
@ -30,6 +30,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Small Iron Plate Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 250,
upgrade_cost_base = 2,
{
name = 'iron-plate',
price = 0.3,

View File

@ -41,9 +41,9 @@ local factory = {
recipe = 'basic-oil-processing',
keep_active = true,
output = {
{min_rate = 15 / 60, distance_factor = 15 / 60 / 512, item = 'heavy-oil', fluidbox_index = 2},
{min_rate = 15 / 60, distance_factor = 15 / 60 / 512, item = 'light-oil', fluidbox_index = 3},
{min_rate = 20 / 60, distance_factor = 20 / 60 / 512, item = 'petroleum-gas', fluidbox_index = 4}
{min_rate = 3.75 / 60, distance_factor = 3.75 / 60 / 512, item = 'heavy-oil', fluidbox_index = 2},
{min_rate = 3.75 / 60, distance_factor = 3.75 / 60 / 512, item = 'light-oil', fluidbox_index = 3},
{min_rate = 5 / 60, distance_factor = 5 / 60 / 512, item = 'petroleum-gas', fluidbox_index = 4}
}
}
}
@ -52,41 +52,44 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Small Oil Refinery',
upgrade_rate = 0.5,
upgrade_base_cost = 150,
upgrade_cost_base = 2,
{
name = 'crude-oil-barrel',
price = 10,
price = 1,
distance_factor = 5 / 512,
min_price = 1
min_price = 0.1
},
{
name = 'heavy-oil-barrel',
price = 15,
price = 1.5,
distance_factor = 7.5 / 512,
min_price = 1.5
min_price = 0.15
},
{
name = 'light-oil-barrel',
price = 20,
price = 2,
distance_factor = 10 / 512,
min_price = 2
min_price = 0.2
},
{
name = 'petroleum-gas-barrel',
price = 25,
price = 2.5,
distance_factor = 12.5 / 512,
min_price = 2.5
min_price = 0.25
},
{
name = 'lubricant-barrel',
price = 15,
price = 1.5,
distance_factor = 7.5 / 512,
min_price = 1.5
min_price = 0.15
},
{
name = 'sulfuric-acid-barrel',
price = 40,
price = 4,
distance_factor = 20 / 512,
min_price = 4
min_price = 0.4
}
}
}

View File

@ -26,7 +26,7 @@ local loot_callback =
local factory = {
callback = ob.magic_item_crafting_callback,
data = {
output = {min_rate = 1.5 / 60, distance_factor = 1.5 / 60 / 512, item = 'coal'}
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'coal'}
}
}
@ -34,7 +34,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'solid-fuel-from-light-oil',
output = {min_rate = 0.75 / 60, distance_factor = 0.75 / 60 / 512, item = 'solid-fuel'}
output = {min_rate = 0.5 / 60, distance_factor = 0.5 / 60 / 512, item = 'solid-fuel'}
}
}
@ -42,6 +42,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Small Power Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 200,
upgrade_cost_base = 2,
{
name = 'coal',
price = 0.5,

View File

@ -21,7 +21,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'science-pack-1',
output = {min_rate = 0.35 / 60, distance_factor = 0.35 / 60 / 512, item = 'science-pack-1'}
output = {min_rate = 0.175 / 60, distance_factor = 0.175 / 60 / 512, item = 'science-pack-1'}
}
}
@ -29,7 +29,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'science-pack-2',
output = {min_rate = 0.35 / 60, distance_factor = 0.35 / 60 / 512, item = 'science-pack-2'}
output = {min_rate = 0.175 / 60, distance_factor = 0.175 / 60 / 512, item = 'science-pack-2'}
}
}
@ -37,6 +37,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Small Science Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 350,
upgrade_cost_base = 2,
{
name = 'science-pack-1',
price = 10,

View File

@ -23,7 +23,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
furance_item = 'stone',
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'stone-brick'}
output = {min_rate = 0.5 / 60, distance_factor = 0.5 / 60 / 512, item = 'stone-brick'}
}
}
@ -31,7 +31,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'stone-wall',
output = {min_rate = 1 / 60, distance_factor = 1 / 60 / 512, item = 'stone-wall'}
output = {min_rate = 0.1 / 60, distance_factor = 0.1 / 60 / 512, item = 'stone-wall'}
}
}
@ -39,6 +39,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Small Stone Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 125,
upgrade_cost_base = 2,
{
name = 'stone',
price = 0.25,

View File

@ -35,7 +35,7 @@ local factory = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'piercing-shotgun-shell',
output = {min_rate = 0.25 / 60, distance_factor = 0.25 / 60 / 512, item = 'piercing-shotgun-shell'}
output = {min_rate = 0.125 / 60, distance_factor = 0.125 / 60 / 512, item = 'piercing-shotgun-shell'}
}
}
@ -43,7 +43,7 @@ local factory_b = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'rocket',
output = {min_rate = 0.2 / 60, distance_factor = 0.2 / 60 / 512, item = 'rocket'}
output = {min_rate = 0.1 / 60, distance_factor = 0.1 / 60 / 512, item = 'rocket'}
}
}
@ -51,7 +51,7 @@ local factory_c = {
callback = ob.magic_item_crafting_callback,
data = {
recipe = 'gun-turret',
output = {min_rate = 0.1 / 60, distance_factor = 0.1 / 60 / 512, item = 'gun-turret'}
output = {min_rate = 0.05 / 60, distance_factor = 0.05 / 60 / 512, item = 'gun-turret'}
}
}
@ -59,6 +59,9 @@ local market = {
callback = ob.market_set_items_callback,
data = {
market_name = 'Small Weapon Factory',
upgrade_rate = 0.5,
upgrade_base_cost = 350,
upgrade_cost_base = 2,
{
name = 'raw-fish',
price = 1,

View File

@ -1,6 +1,6 @@
local ob = require 'map_gen.presets.crash_site.outpost_builder'
return ob.make_walls{
return ob.make_walls {
ob.make_4_way {
[1] = {entity = {name = 'stone-wall'}},
[2] = {entity = {name = 'stone-wall'}},
@ -40,7 +40,8 @@ return ob.make_walls{
[36] = {tile = 'stone-path'}
},
ob.make_4_way {
[1] = {entity = {name = 'stone-wall'}},
wall = {callback = ob.wall_callback},
[1] = {entity = {name = 'stone-wall', callback = 'wall'}},
[2] = {entity = {name = 'stone-wall'}},
[3] = {entity = {name = 'stone-wall'}},
[4] = {entity = {name = 'stone-wall'}},

View File

@ -4,7 +4,7 @@ local Event = require 'utils.event'
local player_ammo_starting_modifiers = {
['artillery-shell'] = -0.75,
['biological'] = -0.5,
['bullet'] = -0.20,
['bullet'] = -0.25,
['cannon-shell'] = -0.75,
['capsule'] = -0.5,
['combat-robot-beam'] = -0.5,
@ -12,9 +12,9 @@ local player_ammo_starting_modifiers = {
['electric'] = -0.5,
['flamethrower'] = -0.75,
['grenade'] = -0.5,
['landmine'] = 0,
['landmine'] = -0.33,
['laser-turret'] = -0.75,
['melee'] = 0,
['melee'] = 1,
['railgun'] = 0,
['rocket'] = -0.5,
['shotgun-shell'] = -0.20