mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-16 02:47:48 +02:00
minor tweaks
This commit is contained in:
parent
0bcd113d1f
commit
5a49113958
@ -48,7 +48,7 @@ local STD_BASE_CONTROL = 'lua52c+factorio+factorio_control+factorio_defines+fact
|
||||
--[Assume Factorio Control stage as default]--
|
||||
-------------------------------------------------------------------------------
|
||||
std = STD_CONTROL
|
||||
globals = {'print', '_DEBUG', '_CHEATS', '_DUMP_ENV', 'ServerCommands', 'Debug', '_LIFECYCLE', '_STAGE', 'get_game_version'}
|
||||
globals = {'print', '_DEBUG', '_CHEATS', '_DUMP_ENV', 'ServerCommands', 'Debug', '_LIFECYCLE', '_STAGE', 'get_game_version', 'is_loaded'}
|
||||
max_line_length = LINE_LENGTH
|
||||
|
||||
not_globals = NOT_GLOBALS
|
||||
|
@ -160,7 +160,7 @@ local poll_function = {
|
||||
end
|
||||
end,
|
||||
['comfy_panel_poll_no_notify_toggle'] = function(event)
|
||||
local poll = package.loaded['comfy_panel.poll']
|
||||
local poll = is_loaded('comfy_panel.poll')
|
||||
local poll_table = poll.get_no_notify_players()
|
||||
if event.element.switch_state == 'left' then
|
||||
poll_table[event.player_index] = false
|
||||
@ -186,7 +186,7 @@ local antigrief_functions = {
|
||||
|
||||
local fortress_functions = {
|
||||
['comfy_panel_disable_fullness'] = function(event)
|
||||
local Fullness = package.loaded['modules.check_fullness']
|
||||
local Fullness = is_loaded('modules.check_fullness')
|
||||
local this = Fullness.get()
|
||||
if event.element.switch_state == 'left' then
|
||||
this.fullness_enabled = true
|
||||
@ -197,7 +197,7 @@ local fortress_functions = {
|
||||
end
|
||||
end,
|
||||
['comfy_panel_offline_players'] = function(event)
|
||||
local WPT = package.loaded['maps.mountain_fortress_v3.table']
|
||||
local WPT = is_loaded('maps.mountain_fortress_v3.table')
|
||||
local this = WPT.get()
|
||||
if event.element.switch_state == 'left' then
|
||||
this.offline_players_enabled = true
|
||||
@ -208,7 +208,7 @@ local fortress_functions = {
|
||||
end
|
||||
end,
|
||||
['comfy_panel_collapse_grace'] = function(event)
|
||||
local WPT = package.loaded['maps.mountain_fortress_v3.table']
|
||||
local WPT = is_loaded('maps.mountain_fortress_v3.table')
|
||||
local this = WPT.get()
|
||||
if event.element.switch_state == 'left' then
|
||||
this.collapse_grace = true
|
||||
@ -219,7 +219,7 @@ local fortress_functions = {
|
||||
end
|
||||
end,
|
||||
['comfy_panel_spill_items_to_surface'] = function(event)
|
||||
local WPT = package.loaded['maps.mountain_fortress_v3.table']
|
||||
local WPT = is_loaded('maps.mountain_fortress_v3.table')
|
||||
local this = WPT.get()
|
||||
if event.element.switch_state == 'left' then
|
||||
this.spill_items_to_surface = true
|
||||
@ -230,7 +230,7 @@ local fortress_functions = {
|
||||
end
|
||||
end,
|
||||
['comfy_panel_void_or_tile'] = function(event)
|
||||
local WPT = package.loaded['maps.mountain_fortress_v3.table']
|
||||
local WPT = is_loaded('maps.mountain_fortress_v3.table')
|
||||
local this = WPT.get()
|
||||
if event.element.switch_state == 'left' then
|
||||
this.void_or_tile = 'out-of-map'
|
||||
@ -241,7 +241,7 @@ local fortress_functions = {
|
||||
end
|
||||
end,
|
||||
['comfy_panel_trusted_only_car_tanks'] = function(event)
|
||||
local WPT = package.loaded['maps.mountain_fortress_v3.table']
|
||||
local WPT = is_loaded('maps.mountain_fortress_v3.table')
|
||||
local this = WPT.get()
|
||||
if event.element.switch_state == 'left' then
|
||||
this.trusted_only_car_tanks = true
|
||||
@ -337,8 +337,8 @@ local build_config_gui = (function(player, frame)
|
||||
scroll_pane.add({type = 'line'})
|
||||
end
|
||||
|
||||
if package.loaded['comfy_panel.poll'] then
|
||||
local poll = package.loaded['comfy_panel.poll']
|
||||
local poll = is_loaded('comfy_panel.poll')
|
||||
if poll then
|
||||
local poll_table = poll.get_no_notify_players()
|
||||
switch_state = 'right'
|
||||
if not poll_table[player.index] then
|
||||
@ -380,7 +380,7 @@ local build_config_gui = (function(player, frame)
|
||||
'Disables the Logistic System research.\nRequester, buffer or active-provider containers can not be built.'
|
||||
)
|
||||
|
||||
if package.loaded['comfy_panel.poll'] then
|
||||
if poll then
|
||||
scroll_pane.add({type = 'line'})
|
||||
switch_state = 'right'
|
||||
if global.comfy_panel_config.poll_trusted then
|
||||
@ -407,7 +407,7 @@ local build_config_gui = (function(player, frame)
|
||||
add_switch(scroll_pane, switch_state, 'comfy_panel_disable_antigrief', 'Antigrief', 'Left = Enables antigrief / Right = Disables antigrief')
|
||||
scroll_pane.add({type = 'line'})
|
||||
|
||||
if package.loaded['maps.biter_battles_v2.main'] then
|
||||
if is_loaded('maps.biter_battles_v2.main') then
|
||||
label = scroll_pane.add({type = 'label', caption = 'Biter Battles Settings'})
|
||||
label.style.font = 'default-bold'
|
||||
label.style.padding = 0
|
||||
@ -450,7 +450,7 @@ local build_config_gui = (function(player, frame)
|
||||
scroll_pane.add({type = 'line'})
|
||||
end
|
||||
|
||||
if package.loaded['maps.mountain_fortress_v3.main'] then
|
||||
if is_loaded('maps.mountain_fortress_v3.main') then
|
||||
label = scroll_pane.add({type = 'label', caption = 'Mountain Fortress Settings'})
|
||||
label.style.font = 'default-bold'
|
||||
label.style.padding = 0
|
||||
@ -460,7 +460,7 @@ local build_config_gui = (function(player, frame)
|
||||
label.style.vertical_align = 'bottom'
|
||||
label.style.font_color = Color.green
|
||||
|
||||
local Fullness = package.loaded['modules.check_fullness']
|
||||
local Fullness = is_loaded('modules.check_fullness')
|
||||
local full = Fullness.get()
|
||||
switch_state = 'right'
|
||||
if full.fullness_enabled then
|
||||
@ -470,7 +470,7 @@ local build_config_gui = (function(player, frame)
|
||||
|
||||
scroll_pane.add({type = 'line'})
|
||||
|
||||
local WPT = package.loaded['maps.mountain_fortress_v3.table']
|
||||
local WPT = is_loaded('maps.mountain_fortress_v3.table')
|
||||
local this = WPT.get()
|
||||
switch_state = 'right'
|
||||
if this.offline_players_enabled then
|
||||
@ -576,7 +576,7 @@ local function on_gui_switch_state_changed(event)
|
||||
end
|
||||
fortress_functions[event.element.name](event)
|
||||
return
|
||||
elseif package.loaded['comfy_panel.poll'] then
|
||||
elseif is_loaded('comfy_panel.poll') then
|
||||
local is_spamming = SpamProtection.is_spamming(player)
|
||||
if is_spamming then
|
||||
return
|
||||
|
@ -11,6 +11,7 @@ draw_map_scores would be a function with the player and the frame as arguments
|
||||
]]
|
||||
local Event = require 'utils.event'
|
||||
local Server = require 'utils.server'
|
||||
local CommandFrame = require 'commands.misc'
|
||||
local SpamProtection = require 'utils.spam_protection'
|
||||
|
||||
comfy_panel_tabs = {}
|
||||
@ -35,7 +36,9 @@ end
|
||||
|
||||
function Public.comfy_panel_clear_screen_gui(player)
|
||||
for _, child in pairs(player.gui.screen.children) do
|
||||
child.visible = false
|
||||
if child.name ~= CommandFrame.bottom_guis_frame then
|
||||
child.visible = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ Global.register(
|
||||
|
||||
local Public = {}
|
||||
|
||||
local clear_corpse_main_button_name = Gui.uid_name()
|
||||
local bottom_guis_frame = Gui.uid_name()
|
||||
local clear_corpse_button_name = Gui.uid_name()
|
||||
local bottom_quickbar_button_name = Gui.uid_name()
|
||||
|
||||
@ -509,7 +509,7 @@ end
|
||||
|
||||
local function create_frame(player, rebuild)
|
||||
local gui = player.gui
|
||||
local frame = gui.screen[clear_corpse_main_button_name]
|
||||
local frame = gui.screen[bottom_guis_frame]
|
||||
if frame and frame.valid then
|
||||
if rebuild then
|
||||
frame.destroy()
|
||||
@ -521,7 +521,7 @@ local function create_frame(player, rebuild)
|
||||
frame =
|
||||
player.gui.screen.add {
|
||||
type = 'frame',
|
||||
name = clear_corpse_main_button_name,
|
||||
name = bottom_guis_frame,
|
||||
direction = 'vertical'
|
||||
}
|
||||
frame.style.padding = 3
|
||||
@ -650,7 +650,7 @@ Event.add(
|
||||
function(event)
|
||||
local player = game.get_player(event.player_index)
|
||||
if this.activate_custom_buttons then
|
||||
local frame = player.gui.screen[clear_corpse_main_button_name]
|
||||
local frame = player.gui.screen[bottom_guis_frame]
|
||||
if frame and frame.valid then
|
||||
frame.destroy()
|
||||
end
|
||||
@ -668,4 +668,6 @@ Event.add(
|
||||
end
|
||||
)
|
||||
|
||||
Public.bottom_guis_frame = bottom_guis_frame
|
||||
|
||||
return Public
|
||||
|
@ -12,7 +12,7 @@ local entity_types = {
|
||||
["unit-spawner"] = true,
|
||||
}
|
||||
|
||||
if package.loaded['maps.biter_hatchery.terrain'] then entity_types["unit-spawner"] = nil end
|
||||
if is_loaded('maps.biter_hatchery.terrain') then entity_types["unit-spawner"] = nil end
|
||||
|
||||
local function clean_table()
|
||||
--Perform a table cleanup every 1000 boosts
|
||||
@ -84,7 +84,7 @@ local function on_entity_damaged(event)
|
||||
local biter = event.entity
|
||||
if not (biter and biter.valid) then return end
|
||||
if not entity_types[biter.type] then return end
|
||||
|
||||
|
||||
local biter_health_boost_units = global.biter_health_boost_units
|
||||
|
||||
local unit_number = biter.unit_number
|
||||
@ -111,7 +111,7 @@ local function on_entity_damaged(event)
|
||||
|
||||
--Reduce health pool
|
||||
health_pool[1] = health_pool[1] - event.final_damage_amount
|
||||
|
||||
|
||||
--Set entity health relative to health pool
|
||||
biter.health = health_pool[1] * health_pool[2]
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
local event = require 'utils.event'
|
||||
|
||||
local function on_console_chat(event)
|
||||
if not event.message then return end
|
||||
if not event.player_index then return end
|
||||
if not event.message then return end
|
||||
if not event.player_index then return end
|
||||
local player = game.players[event.player_index]
|
||||
if not player.character then return end
|
||||
|
||||
|
||||
local y_offset = -4
|
||||
if package.loaded['modules.rpg'] then y_offset = -4.5 end
|
||||
|
||||
if is_loaded('modules.rpg') then y_offset = -4.5 end
|
||||
|
||||
if global.player_floaty_chat[player.index] then
|
||||
rendering.destroy(global.player_floaty_chat[player.index])
|
||||
global.player_floaty_chat[player.index] = nil
|
||||
end
|
||||
|
||||
|
||||
local players = {}
|
||||
for _, p in pairs(game.connected_players) do
|
||||
if player.force.index == p.force.index then
|
||||
@ -21,7 +21,7 @@ local function on_console_chat(event)
|
||||
end
|
||||
end
|
||||
if #players == 0 then return end
|
||||
|
||||
|
||||
global.player_floaty_chat[player.index] = rendering.draw_text{
|
||||
text = event.message,
|
||||
surface = player.surface,
|
||||
@ -47,4 +47,4 @@ local function on_init(event)
|
||||
end
|
||||
|
||||
event.on_init(on_init)
|
||||
event.add(defines.events.on_console_chat, on_console_chat)
|
||||
event.add(defines.events.on_console_chat, on_console_chat)
|
||||
|
@ -100,7 +100,7 @@ end
|
||||
|
||||
local function level_up(player)
|
||||
local rpg_t = RPG.get('rpg_t')
|
||||
local RPG_GUI = package.loaded['modules.rpg.gui']
|
||||
local RPG_GUI = is_loaded('modules.rpg.gui')
|
||||
local names = RPG.auto_allocate_nodes_func
|
||||
|
||||
local distribute_points_gain = 0
|
||||
@ -476,7 +476,7 @@ function Public.rpg_reset_player(player, one_time_reset)
|
||||
player.set_controller({type = defines.controllers.god})
|
||||
player.create_character()
|
||||
end
|
||||
local RPG_GUI = package.loaded['modules.rpg.gui']
|
||||
local RPG_GUI = is_loaded('modules.rpg.gui')
|
||||
local rpg_t = RPG.get('rpg_t')
|
||||
local rpg_extra = RPG.get('rpg_extra')
|
||||
if one_time_reset then
|
||||
|
@ -485,10 +485,10 @@ end
|
||||
|
||||
local function increase_biter_damage()
|
||||
local Difficulty
|
||||
if package.loaded['modules.difficulty_vote_by_amount'] then
|
||||
Difficulty = require 'modules.difficulty_vote_by_amount'
|
||||
elseif package.loaded['modules.difficulty_vote'] then
|
||||
Difficulty = require 'modules.difficulty_vote'
|
||||
if is_loaded('modules.difficulty_vote_by_amount') then
|
||||
Difficulty = is_loaded('modules.difficulty_vote_by_amount')
|
||||
elseif is_loaded('modules.difficulty_vote') then
|
||||
Difficulty = is_loaded('modules.difficulty_vote')
|
||||
end
|
||||
if not Difficulty then
|
||||
return
|
||||
|
@ -23,3 +23,12 @@ function get_game_version()
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function is_loaded(module)
|
||||
local res = package.loaded[module]
|
||||
if res then
|
||||
return res
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
@ -41,8 +41,7 @@ function Public.show(container)
|
||||
|
||||
for name, file in pairs(loaded) do
|
||||
if not ignore[name] then
|
||||
local file_label =
|
||||
left_panel.add({type = 'flow'}).add {type = 'label', name = file_label_name, caption = name}
|
||||
local file_label = left_panel.add({type = 'flow'}).add {type = 'label', name = file_label_name, caption = name}
|
||||
Gui.set_data(file_label, file)
|
||||
end
|
||||
end
|
||||
@ -107,8 +106,7 @@ Gui.on_click(
|
||||
|
||||
if file_type == 'table' then
|
||||
for k, v in pairs(file) do
|
||||
local label =
|
||||
top_panel.add({type = 'flow'}).add {type = 'label', name = variable_label_name, caption = k}
|
||||
local label = top_panel.add({type = 'flow'}).add {type = 'label', name = variable_label_name, caption = k}
|
||||
Gui.set_data(label, v)
|
||||
end
|
||||
elseif file_type == 'function' then
|
||||
@ -134,8 +132,7 @@ Gui.on_click(
|
||||
if variable_type == 'table' then
|
||||
Gui.clear(top_panel)
|
||||
for k, v in pairs(variable) do
|
||||
local label =
|
||||
top_panel.add({type = 'flow'}).add {type = 'label', name = variable_label_name, caption = k}
|
||||
local label = top_panel.add({type = 'flow'}).add {type = 'label', name = variable_label_name, caption = k}
|
||||
Gui.set_data(label, v)
|
||||
end
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user