mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-31 04:51:40 +09:00
Warp improvements
* Fixed that it clears table every warp update. * Dirty fix unknown signal icon, it gets replaced by the old icon
This commit is contained in:
@@ -359,6 +359,11 @@ Warps.update_warp(warp_id, 'My Warp', 'iron-plate', game.player.name)
|
|||||||
]]
|
]]
|
||||||
function Warps.update_warp(warp_id, new_name, new_icon, player_name)
|
function Warps.update_warp(warp_id, new_name, new_icon, player_name)
|
||||||
WrapData:update(warp_id, function(_, warp)
|
WrapData:update(warp_id, function(_, warp)
|
||||||
|
-- If the icon is not valid then replace with the old icon
|
||||||
|
if new_icon and not new_icon.name or not new_icon.type then
|
||||||
|
new_icon = warp.icon
|
||||||
|
end
|
||||||
|
|
||||||
warp.last_edit_name = player_name or '<server>'
|
warp.last_edit_name = player_name or '<server>'
|
||||||
warp.last_edit_time = game.tick
|
warp.last_edit_time = game.tick
|
||||||
warp.name = new_name or warp.name
|
warp.name = new_name or warp.name
|
||||||
|
|||||||
@@ -550,9 +550,18 @@ local function update_warp(player, warp_table, warp_id)
|
|||||||
else
|
else
|
||||||
-- Set the icon elements visibility
|
-- Set the icon elements visibility
|
||||||
warp_icon_element.visible = true
|
warp_icon_element.visible = true
|
||||||
|
-- The SpritePath type is not the same as the SignalID type
|
||||||
|
local sprite = warp.icon.type .. '/' ..warp.icon.name
|
||||||
|
if warp.icon.type == 'virtual' then
|
||||||
|
sprite = 'virtual-signal/' ..warp.icon.name
|
||||||
|
end
|
||||||
|
warp_icon_element.sprite = sprite
|
||||||
|
-- Set icon edit to the warps icon
|
||||||
|
warp_icon_edit_element.elem_value = warp.icon
|
||||||
warp_icon_edit_element.visible = false
|
warp_icon_edit_element.visible = false
|
||||||
-- Set the name elements visibility
|
-- Set the name elements visibility
|
||||||
label_element.visible = true
|
label_element.visible = true
|
||||||
|
label_element.caption = warp.name
|
||||||
textfield_element.visible = false
|
textfield_element.visible = false
|
||||||
-- Set the edit buttons
|
-- Set the edit buttons
|
||||||
cancel_edit_element.visible = false
|
cancel_edit_element.visible = false
|
||||||
@@ -585,7 +594,6 @@ local function update_all_warp_force(force)
|
|||||||
local frame = Gui.get_left_element(player, warp_list_container)
|
local frame = Gui.get_left_element(player, warp_list_container)
|
||||||
local warp_table = frame.container.scroll.table
|
local warp_table = frame.container.scroll.table
|
||||||
|
|
||||||
warp_table.clear()
|
|
||||||
for _, warp_id in ipairs(warp_ids) do
|
for _, warp_id in ipairs(warp_ids) do
|
||||||
update_warp(player, warp_table, warp_id)
|
update_warp(player, warp_table, warp_id)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user