mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-08-13 00:45:11 +09:00
Fix gui element registration and iter removal
The top, left and relative element tables are keyed by the define, but the duplicate registration assert looked up `define.name`, so it never fired. GuiIter.remove_element indexed `registered_scopes` by player index instead of the scope elements it had just fetched, so it removed nothing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -90,13 +90,16 @@ function GuiData._metatable.__index(self, key)
|
||||
assert(type(key) == "userdata", "Index type '" .. ExpUtil.get_class_name(key) .. "' given to GuiData. Must be of type userdata.")
|
||||
local object_name = key.object_name --- @diagnostic disable-line assign-type-mismatch
|
||||
if object_name == "LuaGuiElement" then
|
||||
--- @cast key LuaGuiElement
|
||||
local data = self._raw.element_data
|
||||
local player_elements = data and data[key.player_index]
|
||||
return player_elements and player_elements[key.index]
|
||||
elseif object_name == "LuaPlayer" then
|
||||
--- @cast key LuaPlayer
|
||||
local data = self._raw.player_data
|
||||
return data and data[key.index]
|
||||
elseif object_name == "LuaForce" then
|
||||
--- @cast key LuaForce
|
||||
local data = self._raw.force_data
|
||||
return data and data[key.index]
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user