-
Notifications
You must be signed in to change notification settings - Fork 20
chore: 105009: code cleanup - update some instances of objGetProperties to new obj@ alias #255
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
base: master
Are you sure you want to change the base?
Conversation
… before properties
|
Aren't properties supposed to be replacing the older objData and equivalents? If you've decided that properties just don't work and want to revert back to objData then we need a clear statement in the style guide or similar I can see why you might want to have objData taking priority certain situations at the moment, but I think it could be very confusing in practice. In all(?) other cases where something might be either a property or data it is the legacy code that used objData, and the property will take priority if it is set. I'd be worried you might get a situation where objData is now overriding properties which are overriding objData... Is it possible to achieve the same just using properties?
|
|
The ability for external code to inject data from the side is mandatory for chronicles, and not all objects are going to have awareness of this. Because typData/objData is 100% flexible, and is immune to certain problems with accessing it during onGlobalTypesInit (though that is less relevant to this specific change, as the player is not looking at dockscreens there), it is absolutely critical that we maintain it as an a last-ditch override for expansions and mods. |
|
I have made a ticket for converting the inappropriate use of |
|
Are you saying:
If it’s one of the first two then fair enough... For example:
1b) If it if preferable to keep properties and data separate, then do we need another property type "runtime" which basically works like the current objData
I don’t think anyone has requested this before (being able to access "old" objData via As far as I remember the 'data property was implemented to meet a user request for a way to access all the data currently stored on an object. It was not required for core, and core code has no reason to use it. |
I would agree for the current use of properties on ships / stations - i.e. check military ID / check radioactive. However, a lot (most?) of the use of properties has been in missions, RPG membership types. Here I think you might cause a lot of problems by recommending use of data or global. e.g. there is very little you can safely do to modify the rankTables. You can't add extra levels without significant changes to the rest of the Type, so would have to write a complete Type override anyway. You could possibly adjust the xpNeeded for each level, but that doesn't seem very useful With most missions I would not want the definitions / constants / variants to be easily modified by external code as it's likely to break the logic and may require modifying the language / events too. In this case it would be better to just create a new version of the mission (possibly inheriting from the first) which changes the script as required.
|
Its definitely broken, and some parts cant be fixed, but I dont think we should wholesale move back. I believe its fine to continue promoting the use of properties, with some exceptions (particularly for dynamic data in early-load code, where its likely not possible to change due to the order in which things need to be initialized)
Yes, specifically in that Chronicles/Sandbox have some early-load code that must use typData due to the aforementioned limitations, AND they need to override properties that aren't set, or are Constant/Definition. However the suggested override option which secretly uses typ/obj data behind the scenes is adequate for overriding properties that aren't set. I think if we transparently set the names to "core.properties.override.[name]" in typ/instance data it should be safe. We would need *Override@Keys though to retrieve those keys without having to specifically parse the data keys, but thats a 'nice to have' and not immediately needed. The ability to make unsafe changes using explicit override functionality (ex,
Outside of early-load code, pretty much this. Early-load code still requires
Thats fine w/ an override function so that if you are confident you know what you are doing, you can override it. |
I think I finally get what you mean - is this about extremely old code that gets things like I think forcing a special key on overrides will prevent any collision, as mentioned above |
|
Working on a dedicated implementation for overrides here: #262 Going to convert this branch into just an update to the new property functions |
… system, turning this branch into just a code maintenance update, moving to the more modern obj@ rather than objGetProperty


Also updates a bunch of old objGetProperty calls to obj@