mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Number of bug fixes
This commit is contained in:
@@ -85,7 +85,7 @@ Permission_Groups.new_group('Guest')
|
||||
'set_auto_launch_rocket',
|
||||
'change_programmable_speaker_parameters', -- guest
|
||||
'change_train_stop_station',
|
||||
'deconstruct',
|
||||
--'deconstruct',
|
||||
'remove_cables',
|
||||
'remove_train_station',
|
||||
'reset_assembling_machine',
|
||||
|
||||
@@ -197,6 +197,7 @@ Roles.new_role('Regular','Reg')
|
||||
'command/rainbow',
|
||||
'command/go-to-spawn',
|
||||
'command/me',
|
||||
'standard-decon'
|
||||
}
|
||||
:set_auto_assign_condition(function(player)
|
||||
if player.online_time > 3*216000 then
|
||||
|
||||
@@ -16,21 +16,37 @@ end)
|
||||
|
||||
-- Add trees to queue when marked, only allows simple entities and for players with role permission
|
||||
Event.add(defines.events.on_marked_for_deconstruction, function(event)
|
||||
-- Check the player is allowed fast decon
|
||||
local player = Game.get_player_by_index(event.player_index)
|
||||
if chache[player.name] ~= true and not Roles.player_allowed(player, 'fast-tree-decon') then
|
||||
chache[player.name] = false
|
||||
-- Check which type of decon a player is allowed
|
||||
local index = event.player_index
|
||||
if chache[index] == nil then
|
||||
local player = Game.get_player_by_index(index)
|
||||
if Roles.player_allowed(player, 'fast-tree-decon') then chache[index] = 'fast'
|
||||
elseif Roles.player_allowed(player, 'standard-decon') then chache[index] = 'standard'
|
||||
else chache[index] = player.force end
|
||||
end
|
||||
|
||||
-- Check what should happen to this entity
|
||||
local entity = event.entity
|
||||
local allow = chache[index]
|
||||
if not entity or not entity.valid then return end
|
||||
|
||||
-- Not allowed to decon this entity
|
||||
local last_user = entity.last_user
|
||||
if last_user and allow ~= 'standard' and allow ~= 'fast' then
|
||||
entity.cancel_deconstruction(allow)
|
||||
return
|
||||
end
|
||||
chache[player.name] = true
|
||||
|
||||
-- Check that the entity is allowed to be isntant deconed
|
||||
-- Allowed to decon this entity, but not fast
|
||||
if allow ~= 'fast' then return end
|
||||
|
||||
-- Allowed fast decon on this entity, just trees
|
||||
local head = tree_queue._head + 1
|
||||
local entity = event.entity
|
||||
if entity and entity.valid and not entity.last_user and entity.type ~= 'cliff' then
|
||||
if not last_user and entity.type ~= 'cliff' then
|
||||
tree_queue[head] = entity
|
||||
tree_queue._head = head
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
-- Remove trees at random till the queue is empty
|
||||
|
||||
@@ -94,7 +94,7 @@ Gui.element(function(event_trigger,parent,player_data)
|
||||
open_action_bar(toggle_action_bar_flow)
|
||||
|
||||
-- Add the player name
|
||||
local player_name_flow = parent.add{ type = 'flow', 'player-name-'..player_data.index }
|
||||
local player_name_flow = parent.add{ type = 'flow', name = 'player-name-'..player_data.index }
|
||||
local player_name = player_name_flow.add{
|
||||
type = 'label',
|
||||
name = event_trigger,
|
||||
@@ -364,6 +364,12 @@ Event.add(defines.events.on_player_left_game,function(event)
|
||||
local frame = Gui.get_left_element(player,player_list_container)
|
||||
local scroll_table = frame.container.scroll.table
|
||||
remove_player_base(scroll_table,remove_player)
|
||||
|
||||
local selected_player_name = Store.get(selected_player_store,player)
|
||||
if selected_player_name == remove_player.name then
|
||||
Store.clear(selected_player_store,player)
|
||||
Store.clear(selected_action_store,player)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -333,4 +333,12 @@ Event.add(defines.events.on_player_joined_game,function(event)
|
||||
if not player.opened then
|
||||
player.gui.center.clear()
|
||||
end
|
||||
end)
|
||||
|
||||
--- When a player respawns clear center unless the player has something open
|
||||
Event.add(defines.events.on_player_respawned,function(event)
|
||||
local player = Game.get_player_by_index(event.player_index)
|
||||
if not player.opened then
|
||||
player.gui.center.clear()
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user