1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-20 03:29:47 +02:00

fix for glitched map camera when rejoining

This commit is contained in:
MewMew 2020-04-29 10:11:37 +02:00
parent 32d4869e8a
commit 85784fcbb1
2 changed files with 8 additions and 13 deletions

View File

@ -324,7 +324,7 @@ function Public.create_wagon_room(icw, wagon)
if wagon.entity.type == "cargo-wagon" then
local vectors = {{0, -1}, {0, 1}, {-1, 0}, {1, 0}}
local v = vectors[math_random(1, 4)]
local position = {math_random(area.left_top.x + 4, area.right_bottom.x - 4), math_random(area.left_top.y + 6, area.right_bottom.y - 6)}
local position = {math_random(area.left_top.x + 2, area.right_bottom.x - 3), math_random(area.left_top.y + 5, area.right_bottom.y - 6)}
local e = surface.create_entity({
name = "logistic-chest-requester",
@ -431,7 +431,7 @@ function Public.use_cargo_wagon_door(icw, player, door)
end
end
function Public.move_room_to_train(icw, train, wagon)
local function move_room_to_train(icw, train, wagon)
if not wagon then return end
table_insert(train.wagons, wagon.entity.unit_number)
@ -504,7 +504,7 @@ function Public.construct_train(icw, carriages)
icw.trains[unit_number] = train
for k, carriage in pairs(carriages) do
Public.move_room_to_train(icw, train, icw.wagons[carriage.unit_number])
move_room_to_train(icw, train, icw.wagons[carriage.unit_number])
end
end

View File

@ -66,16 +66,11 @@ local function on_player_driving_changed_state(event)
local player = game.players[event.player_index]
Functions.use_cargo_wagon_door(icw, player, event.entity)
end
--[[
local function on_player_created(event)
local player = game.players[event.player_index]
player.insert({name = "cargo-wagon", count = 5})
player.insert({name = "artillery-wagon", count = 5})
player.insert({name = "fluid-wagon", count = 5})
player.insert({name = "locomotive", count = 5})
player.insert({name = "rail", count = 100})
local function on_player_left_game(event)
Functions.kill_minimap(game.players[event.player_index])
end
]]
local function on_gui_closed(event)
local entity = event.entity
if not entity then return end
@ -138,7 +133,7 @@ Event.add(defines.events.on_built_entity, on_built_entity)
Event.add(defines.events.on_train_created, on_train_created)
Event.add(defines.events.on_robot_built_entity, on_robot_built_entity)
Event.add(defines.events.on_player_died, on_player_died)
--Event.add(defines.events.on_player_created, on_player_created)
Event.add(defines.events.on_player_left_game, on_player_left_game)
Event.add(defines.events.on_gui_click, on_gui_click)
Event.add(defines.events.on_gui_closed, on_gui_closed)
Event.add(defines.events.on_gui_opened, on_gui_opened)