Final Fixes

This commit is contained in:
Cooldude2606
2023-10-02 00:56:58 +01:00
parent edbfcd3afd
commit f7eb9c0c37
7 changed files with 73 additions and 68 deletions

View File

@@ -103,15 +103,17 @@ end
--- Label used to show that the player is following, also used to allow esc to stop following
-- @element follow_label
follow_label =
Gui.element(function(event_trigger, parent, target)
Gui.destroy_if_valid(parent[event_trigger])
Gui.element(function(definition, parent, target)
Gui.destroy_if_valid(parent[definition.name])
local label = parent.add{
name = event_trigger,
type = 'label',
style = 'heading_1_label',
caption = 'Following '..target.name..'.\nClick here or press esc to stop following.'
}
local label = definition:triggers_events(
parent.add{
type = 'label',
style = 'heading_1_label',
caption = 'Following '..target.name..'.\nClick here or press esc to stop following.',
name = definition.name
}
)
local player = Gui.get_player_from_element(parent)
local res = player.display_resolution
@@ -122,6 +124,7 @@ Gui.element(function(event_trigger, parent, target)
return label
end)
:static_name(Gui.unique_static_name)
:on_click(Public.stop_follow)
:on_close(function(player)
-- Don't call set_controller during on_close as it invalidates the controller

View File

@@ -54,14 +54,13 @@ end)
--- Toggle enitity button, used for toggling autofill for the specific entity
-- All entity autofill settings will be ignored if its disabled
-- @element entity_toggle
local entity_toggle = Gui.element(function(event_trigger, parent, entity_name)
return parent.add{
name = event_trigger,
local entity_toggle = Gui.element(function(definition, parent, entity_name)
return definition:triggers_events(parent.add{
type = 'sprite-button',
sprite = 'utility/confirm_slot',
tooltip = {'autofill.toggle-entity-tooltip', rich_img('item', entity_name)},
style = 'shortcut_bar_button_green'
}
})
end)
:style(Gui.sprite_style(22))
:on_click(function(player, element, _)