Closed ahyangyi closed 1 year ago
Looking at this PR, there are many more things to consider, like:
Not allowing to split callbacks that don't have both parts:
callbacks = {
'graphics': 0xE0,
'purchase_text': {
'default': 1234,
'purchase': 5678,
}
}
Handling graphics/purchase graphics in the same way.
Accessing and changing callbacks via object properties. I.e. train.callbacks.properties.cargo_capacity.default = ...
I need some time to think how to handle it the best and will probably end up implementing it myself.
Yeah, and I think the need for object properties could also help eliminate the code smell that is the passing dictionaries everywhere (and having different behaviors depending on types).
Superseded by b388165e8e0860e1f6bd44902a32606e4a0c73b3 Look into https://github.com/citymania-org/grf-py/blob/main/tests/test_lib_callback_manager.py for usage examples.
Yeah... I know the implementation looks like a bit WET. Feel free to reorganize the things a bit. Needed that interface though.