mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-17 20:58:13 +02:00
oil kill fix
This commit is contained in:
parent
610875070f
commit
2e93b031de
@ -1,3 +1,6 @@
|
||||
require "modules.sticky_landfill"
|
||||
require "modules.dynamic_player_spawn"
|
||||
|
||||
local math_random = math.random
|
||||
local math_floor = math.floor
|
||||
local table_insert = table.insert
|
||||
@ -80,6 +83,8 @@ local function set_commands(unit_group)
|
||||
end
|
||||
end
|
||||
|
||||
if #commands == 0 then return end
|
||||
|
||||
unit_group.set_command({
|
||||
type = defines.command.compound,
|
||||
structure_type = defines.compound_command.return_last,
|
||||
@ -172,12 +177,12 @@ local function draw_east_side(surface, left_top)
|
||||
end
|
||||
if left_top.x == -32 then
|
||||
local entity = surface.create_entity({name = "cargo-wagon", position = {-24, 0}, force = "player", direction = 2})
|
||||
entity.get_inventory(defines.inventory.cargo_wagon).insert({name = "firearm-magazine", count = 128})
|
||||
entity.get_inventory(defines.inventory.cargo_wagon).insert({name = "shotgun", count = 1})
|
||||
entity.get_inventory(defines.inventory.cargo_wagon).insert({name = "shotgun-shell", count = 16})
|
||||
entity.get_inventory(defines.inventory.cargo_wagon).insert({name = "light-armor", count = 2})
|
||||
entity.get_inventory(defines.inventory.cargo_wagon).insert({name = "grenade", count = 3})
|
||||
entity.get_inventory(defines.inventory.cargo_wagon).insert({name = "pistol", count = 5})
|
||||
entity.get_inventory(defines.inventory.cargo_wagon).insert({name = "firearm-magazine", count = 600})
|
||||
entity.get_inventory(defines.inventory.cargo_wagon).insert({name = "shotgun", count = 2})
|
||||
entity.get_inventory(defines.inventory.cargo_wagon).insert({name = "shotgun-shell", count = 64})
|
||||
entity.get_inventory(defines.inventory.cargo_wagon).insert({name = "light-armor", count = 5})
|
||||
entity.get_inventory(defines.inventory.cargo_wagon).insert({name = "grenade", count = 32})
|
||||
entity.get_inventory(defines.inventory.cargo_wagon).insert({name = "pistol", count = 10})
|
||||
end
|
||||
end
|
||||
|
||||
@ -356,7 +361,7 @@ local function on_init()
|
||||
|
||||
local force = game.forces.player
|
||||
|
||||
force.set_spawn_position({0, 0}, surface)
|
||||
force.set_spawn_position({-30, 0}, surface)
|
||||
|
||||
force.technologies["landfill"].researched = true
|
||||
force.technologies["railway"].researched = true
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
local event = require 'utils.event'
|
||||
|
||||
local valid_types = {"boiler", "container", "furnace", "generator", "logistic-container", "offshore-pump", "lab", "assembling-machine"}
|
||||
local valid_types = {"boiler", "furnace", "generator", "offshore-pump", "lab", "assembling-machine"}
|
||||
|
||||
local function on_built_entity(event)
|
||||
if not event.created_entity.valid then return end
|
||||
|
@ -38,16 +38,28 @@ end
|
||||
|
||||
local function sticky(surface, tiles, tile_name)
|
||||
local revert_tiles = {}
|
||||
local revert_entities = {}
|
||||
local i = 1
|
||||
local i2 = 1
|
||||
for _, placed_tile in pairs(tiles) do
|
||||
revert_tiles[i] = {name = placed_tile.old_tile.name, position = placed_tile.position}
|
||||
local resources = surface.find_entities_filtered({type = "resource", area = {{placed_tile.position.x - 1, placed_tile.position.y - 1}, {placed_tile.position.x + 1, placed_tile.position.y + 1}}})
|
||||
for _, resource in pairs(resources) do
|
||||
revert_entities[i2] = {name = resource.name, position = resource.position, amount = resource.amount}
|
||||
resource.destroy()
|
||||
i2 = i2 + 1
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
surface.set_tiles(revert_tiles, true)
|
||||
|
||||
for _, placed_tile in pairs(tiles) do
|
||||
move_tile(surface, tile_name, placed_tile.position)
|
||||
end
|
||||
end
|
||||
|
||||
for _, entity in pairs(revert_entities) do
|
||||
surface.create_entity(entity)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_player_built_tile(event)
|
||||
|
Loading…
x
Reference in New Issue
Block a user