updated code

This commit is contained in:
Chr1Z93 2024-11-19 17:44:47 +01:00
parent de28157e1c
commit 60f3b9dd08

View File

@ -1109,20 +1109,19 @@ end
-- changes the UI state and the internal variable for the togglebuttons
function onClick_toggleOption(player, clickType, id)
updateMessageColor(player.color)
local state = optionPanelData[id]
local newState = not state
applyOptionPanelChange(id, newState, clickType)
self.UI.setAttribute(id, "image", newState and "option_on" or "option_off")
applyOptionPanelChange(id, not optionPanelData[id], clickType)
end
function applyOptionPanelChange(id, state, clickType)
optionPanelData[id] = state
if clickType == "-1" then -- left-clicked
optionPanelData[id] = state
self.UI.setAttribute(id, "image", state and "option_on" or "option_off")
end
if id == "slotEditing" then
if clickType == "-2" then -- right-clicked
if currentlyEditingSlots and clickType == "-2" then -- right-clicked
resetSlotSymbols()
elseif clickType == "-3" then -- middle-clicked
elseif currentlyEditingSlots and clickType == "-3" then -- middle-clicked
resetSlotSymbols(true)
else
toggleSlotEditing()
@ -1150,9 +1149,10 @@ function toggleSlotEditing()
updateSlotSymbols()
if currentlyEditingSlots then
broadcastToColor("Click on a slot symbol (or an empty slot) to edit it. " ..
broadcastToColor("Check chat for instructions", messageColor, "Orange")
printToColor("Click on a slot symbol (or an empty slot) to edit it. " ..
"Right-click the 'Slot-Edit' button to return to the default slots. " ..
"Middle-click the 'Slot-Edit' button to remove all slot symbols.", messageColor, "Orange")
"Middle-click the 'Slot-Edit' button to remove all slot symbols.", messageColor, "White")
else
updateSave()
end