Number of bug fixes

This commit is contained in:
Cooldude2606
2020-04-08 15:32:41 +01:00
parent 9214cc5239
commit b04d7fe040
5 changed files with 41 additions and 10 deletions

View File

@@ -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',

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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)