-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WorldviewCommandModeTableStreamline #6585
base: develop
Are you sure you want to change the base?
WorldviewCommandModeTableStreamline #6585
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionally it makes sense.
It is possible to dirty the command mode table and then that would get used by other UI elements looking for the command mode, but that was already possible before (get table -> change table -> yield -> someone else gets the table and resets your changes) without issues so I don't think it'll become a problem. Perhaps a simple warning that the table shouldn't be modified would be suitable?
@@ -635,7 +633,7 @@ WorldView = ClassUI(moho.UIWorldView, Control) { | |||
local cursor = self.Cursor | |||
cursor[1], cursor[2], cursor[3], cursor[4], cursor[5] = UIUtil.GetCursor(identifier) | |||
self:ApplyCursor() | |||
CommandMode.GetCommandMode()[2].reticle = TeleportReticle(self) | |||
commandModeTable[2].reticle = TeleportReticle(self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels wrong to stuff data into the commad mode data that is UI related. Imagine if this is a script command with a reticle and we pass unserializable userdata inside a table: the game would immediately crash (as I discovered when annotating script tasks, and I doubt that LuaParams gets passed with any other orders, as it is logically not necessary).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that line can just be taken out; originally I had the idea that the command mode table was a good vehicle for different UI elements to get access to the reticle (or anything) but it doesn't apply in this case.
(believe I said this before)
controls/worldview.lua
to callGetCommandMode
once and store as a local table.commandmode.lua
to only update thecommandModeTable
(what's returned byGetCommandMode
) when the command mode changes.