Currently we always need to initialize @editable
fields, as they are only allowed in <concrete>
classes.
For example:
@editable Teleporter : teleporter_device = teleporter_device{}
This brings two problems:
- If the field value is not configured in editor, it might be hard to notice during debugging. Especially for custom devices, the default value might behave almost like a real device. E.g. it might do the same
Print
to console. - There seem to be cooking performance problems with these defaults, especially when these defaults create their own defaults and so on. See Session Launching is taking extremely long - #5 by Rory_REDGamesCo and Critical - Cooking a reasonably sized map takes more than 20 minutes and times out - #3 by djpixel
I suggest the following:
- Remove
<concrete>
from basecreative_device
- Allow non-initialized fields to be
@editable
- All non-initialized fields should become mandatory fields in the editor. If any device instance on the map does not have mandatory fields configured, map should fail validation.
Example:
# not initialized, mandatory field in the editor
@editable Teleporter : teleporter_device
Any initialized fields can continue as they are now: they will be optional in the editor, and will be set to default value if not configured.
Since both optional and mandatory fields will be guaranteed to have a value, code inside devices will not need any extra if
s.