mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Merge branch 'patch/6.0.5'
This commit is contained in:
9
config/inventory_clear.lua
Normal file
9
config/inventory_clear.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
--- Config to control when players items are removed, this is a list of event names that will trigger inventory clear
|
||||
-- @config inventory_clear
|
||||
|
||||
local events = defines.events
|
||||
return {
|
||||
events.on_player_banned,
|
||||
events.on_player_kicked,
|
||||
--events.on_player_left_game
|
||||
}
|
||||
15
modules/addons/inventory-clear.lua
Normal file
15
modules/addons/inventory-clear.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
--- Will move players items to spawn when they are banned or kicked, option to clear on leave
|
||||
-- @addon Inventory-Clear
|
||||
|
||||
local Event = require 'utils.event' --- @dep utils.event
|
||||
local events = require 'config.inventory_clear' --- @dep config.inventory_clear
|
||||
local move_items = _C.move_items --- @dep expcore.common
|
||||
|
||||
local function clear_items(event)
|
||||
local player = game.players[event.player_index]
|
||||
local inv = player.get_main_inventory()
|
||||
move_items(inv.get_contents())
|
||||
inv.clear()
|
||||
end
|
||||
|
||||
for _, event_name in ipairs(events) do Event.add(event_name, clear_items) end
|
||||
@@ -270,7 +270,8 @@ end
|
||||
local function update_build_progress(parent,progress_data)
|
||||
local show_message = true
|
||||
for _, silo_data in ipairs(progress_data) do
|
||||
parent.no_silos.visible = false
|
||||
parent.parent.no_silos.visible = false
|
||||
parent.visible = true
|
||||
local silo_name = silo_data.silo_name
|
||||
local progress_label = parent[silo_name]
|
||||
if silo_data.remove then
|
||||
@@ -310,7 +311,7 @@ local function update_build_progress(parent,progress_data)
|
||||
end
|
||||
end
|
||||
end
|
||||
if show_message then parent.no_silos.visible = true end
|
||||
if show_message then parent.parent.no_silos.visible = true parent.visible = false end
|
||||
end
|
||||
|
||||
--- Gets the label data for all the different stats
|
||||
@@ -494,13 +495,13 @@ Gui.element(function(event_trigger,parent)
|
||||
if check_player_permissions(player,'toggle_active') then col_count = col_count+1 end
|
||||
local progress = section(container,'progress',col_count)
|
||||
-- Label used when there are no active silos
|
||||
local no_silos = progress.add{
|
||||
local no_silos = progress.parent.add{
|
||||
type = 'label',
|
||||
name = 'no_silos',
|
||||
caption = {'rocket-info.progress-no-silos'}
|
||||
}
|
||||
no_silos.style.padding = {1,2}
|
||||
update_build_progress(progress,get_progress_data(force_name))
|
||||
update_build_progress(progress, get_progress_data(force_name))
|
||||
end
|
||||
|
||||
-- Return the exteral container
|
||||
@@ -580,23 +581,22 @@ Event.add(defines.events.on_robot_built_entity,on_built)
|
||||
|
||||
--- Redraw the progress section on role change
|
||||
local function role_update_event(event)
|
||||
if not config.progress.show_progress then return end
|
||||
local player = game.players[event.player_index]
|
||||
local container = Gui.get_left_element(player,rocket_list_container).container
|
||||
local progress = container.progress
|
||||
if config.progress.show_progress then
|
||||
progress.destroy()
|
||||
local col_count = 3
|
||||
if check_player_permissions(player,'remote_launch') then col_count = col_count+1 end
|
||||
if check_player_permissions(player,'toggle_active') then col_count = col_count+1 end
|
||||
progress = section(container,'progress',col_count)
|
||||
-- Label used when there are no active silos
|
||||
progress.add{
|
||||
type = 'label',
|
||||
name = 'no_silos',
|
||||
caption = {'rocket-info.progress-no-silos'}
|
||||
}
|
||||
update_build_progress(progress,get_progress_data(player.force.name))
|
||||
end
|
||||
local progress_scroll = container.progress
|
||||
Gui.destroy_if_valid(progress_scroll.table)
|
||||
|
||||
local col_count = 3
|
||||
if check_player_permissions(player,'remote_launch') then col_count = col_count+1 end
|
||||
if check_player_permissions(player,'toggle_active') then col_count = col_count+1 end
|
||||
local progress = progress_scroll.add{
|
||||
type = 'table',
|
||||
name = 'table',
|
||||
column_count = col_count
|
||||
}
|
||||
|
||||
update_build_progress(progress, get_progress_data(player.force.name))
|
||||
end
|
||||
|
||||
Event.add(Roles.events.on_role_assigned,role_update_event)
|
||||
|
||||
Reference in New Issue
Block a user