mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-11 14:49:24 +02:00
tweaks and bugfixes
This commit is contained in:
parent
77544cc0b8
commit
2e30470025
@ -193,6 +193,11 @@ local function create_mini_camera_gui(player, caption, position, surface)
|
||||
end
|
||||
local frame = player.gui.center.add({type = 'frame', name = 'mini_camera', caption = caption})
|
||||
surface = tonumber(surface)
|
||||
surface = game.surfaces[surface]
|
||||
if not surface or not surface.valid then
|
||||
return
|
||||
end
|
||||
|
||||
local camera =
|
||||
frame.add(
|
||||
{
|
||||
|
@ -132,7 +132,11 @@ local function main_frame(player)
|
||||
local tabs = main_gui_tabs
|
||||
Public.comfy_panel_clear_left_gui(player)
|
||||
|
||||
local frame = player.gui.left.add({type = 'frame', name = 'comfy_panel'})
|
||||
local frame = player.gui.left.comfy_panel
|
||||
if not frame or not frame.valid then
|
||||
frame = player.gui.left.add({type = 'frame', name = 'comfy_panel'})
|
||||
end
|
||||
|
||||
frame.style.margin = 6
|
||||
|
||||
local tabbed_pane = frame.add({type = 'tabbed-pane', name = 'tabbed_pane'})
|
||||
|
@ -941,6 +941,9 @@ Gui.on_click(
|
||||
create_poll_clear_name,
|
||||
function(event)
|
||||
local data = Gui.get_data(event.element)
|
||||
if not data then
|
||||
return
|
||||
end
|
||||
|
||||
local slider = data.duration_slider
|
||||
slider.slider_value = math.floor(default_poll_duration * inv_tick_duration_step)
|
||||
|
@ -530,6 +530,9 @@ local function construct_doors(ic, car)
|
||||
local area = car.area
|
||||
local surface_index = car.surface
|
||||
local surface = game.surfaces[surface_index]
|
||||
if not surface or not surface.valid then
|
||||
return
|
||||
end
|
||||
|
||||
for _, x in pairs({area.left_top.x - 1.5, area.right_bottom.x + 1.5}) do
|
||||
local p = {x = x, y = area.left_top.y + ((area.right_bottom.y - area.left_top.y) * 0.5)}
|
||||
@ -551,6 +554,9 @@ local function construct_doors(ic, car)
|
||||
e.minable = false
|
||||
e.operable = false
|
||||
e.get_inventory(defines.inventory.fuel).insert({name = 'coal', count = 1})
|
||||
if type(car.entity) == 'boolean' then
|
||||
return
|
||||
end
|
||||
ic.doors[e.unit_number] = car.entity.unit_number
|
||||
car.doors[#car.doors + 1] = e
|
||||
end
|
||||
@ -653,8 +659,11 @@ function Public.kill_car(ic, entity)
|
||||
local owner = car.owner
|
||||
|
||||
if owner then
|
||||
if trust_system[owner.index] then
|
||||
trust_system[owner.index] = nil
|
||||
owner = game.get_player(owner)
|
||||
if owner and owner.valid then
|
||||
if trust_system[owner.index] then
|
||||
trust_system[owner.index] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -851,6 +860,10 @@ function Public.create_car(ic, event)
|
||||
return
|
||||
end
|
||||
|
||||
if type(ce) == 'boolean' then
|
||||
return
|
||||
end
|
||||
|
||||
local saved_surface = restore_surface(ic, player, ce)
|
||||
if saved_surface then
|
||||
return
|
||||
|
@ -460,6 +460,10 @@ local function set_carriages()
|
||||
return
|
||||
end
|
||||
|
||||
if not locomotive.train then
|
||||
return
|
||||
end
|
||||
|
||||
local carriages = locomotive.train.carriages
|
||||
local t = {}
|
||||
for i = 1, #carriages do
|
||||
|
@ -25,9 +25,15 @@ end
|
||||
|
||||
local function teleport_players(surface)
|
||||
game.forces.player.set_spawn_position({-27, 25}, surface)
|
||||
local position = game.forces.player.get_spawn_position(surface)
|
||||
|
||||
if not position then
|
||||
game.forces.player.set_spawn_position({-27, 25}, surface)
|
||||
position = game.forces.player.get_spawn_position(surface)
|
||||
end
|
||||
|
||||
for _, player in pairs(game.connected_players) do
|
||||
player.teleport(surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5), surface)
|
||||
player.teleport(surface.find_non_colliding_position('character', position, 3, 0, 5), surface)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -3,7 +3,7 @@ local WPT = require 'maps.mountain_fortress_v3.table'
|
||||
|
||||
local random = math.random
|
||||
|
||||
local tick_tacks = {'*tick*', '*tick*', '*tack*', '*tak*', '*tik*', '*tok*', '( ͡° ͜ʖ ͡°)'}
|
||||
local tick_tacks = {'*tick*', '*tick*', '*tack*', '*tak*', '*tik*', '*tok*', '*run*'}
|
||||
|
||||
local kaboom_weights = {
|
||||
{name = 'grenade', chance = 7},
|
||||
|
@ -244,7 +244,7 @@ local function on_entity_died(event)
|
||||
end
|
||||
|
||||
function Public.detonate_chest(entity)
|
||||
if not entity.valid then
|
||||
if not entity or not entity.valid then
|
||||
return false
|
||||
end
|
||||
if not valid_container_types[entity.type] then
|
||||
|
@ -64,6 +64,10 @@ function Public.close_alert(element)
|
||||
end
|
||||
|
||||
local data = Gui.get_data(alert)
|
||||
if not data then
|
||||
return
|
||||
end
|
||||
|
||||
active_alerts[data.alert_id] = nil
|
||||
Gui.destroy(alert)
|
||||
end
|
||||
|
@ -61,6 +61,10 @@ local set_data = Gui.set_data
|
||||
|
||||
-- Gets the Associated data with this LuaGuiElement if any.
|
||||
function Gui.get_data(element)
|
||||
if not element then
|
||||
return
|
||||
end
|
||||
|
||||
local player_index = element.player_index
|
||||
|
||||
local values = data[player_index]
|
||||
|
Loading…
x
Reference in New Issue
Block a user