You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Network cache building currently begins from master cable which decides network id. This id is later used to find master node location in world. This whole thing was left there to keep some behavior closer to previous when caching, network and switching station stuff were refactored in #96
This master node is currently also used to check for switching station when network is executed through technic globalstep handler.
This check was left there to follow old behavior but I don't really see reason to check for switching station node at all, after network is started it could just stay active as long as its TTL is positive and ignore switching stations completely.
Keeping master node was more just easy way to drop switching stations from network and allow switching stations to only reset TTL instead of actually running networks.
Network ID could of course be based on node position but network ID should not be guaranteed or ever used to find network position. Instead it should be just ID to get node tables and network itself should not have any master positions, it is just unnecessary and complicates things.
This network master node however is both useless and practically makes one of switching station more important/significant than others. For example while all connected switching stations are only resetting network TTL removing one that is immediately above master cable node will reset that network while removing any other switching station will not affect caches.
-- Remove network when switching station is removed, if
-- there's another switching station network will be rebuilt.
localnetwork_id=technic.sw_pos2network(pos)
iftechnic.networks[network_id] then
technic.remove_network(network_id)
end
This ^^ is probably biggest problem here: decide whether there's still other switching stations in network when switching station is removed, should network be stopped or not.
Reference counters could be used but unfortunately nodes can easily disappear from world without any callbacks to Lua side... and removal of switching station is often intentional action and it is expected that machines stop immediately when last switching station is removed.
The text was updated successfully, but these errors were encountered:
Not having this legacy crap makes everything easier to manage and will be overall improvement for technical implementation making feature development a lot simpler.
Comments / concerns / ideas for solutions?
Not having this legacy crap makes everything easier to manage and will be overall improvement for technical implementation making feature development a lot simpler.
I'm getting to the same conclusion in a few other mods too, but yeah: removing old and unneeded stuff is always good in terms of maintainability 👍
Comments / concerns / ideas for solutions?
Can't contribute on that one, haven't touched this code in a while :/
Network cache building currently begins from master cable which decides network id. This id is later used to find master node location in world. This whole thing was left there to keep some behavior closer to previous when caching, network and switching station stuff were refactored in #96
This master node is currently also used to check for switching station when network is executed through technic globalstep handler.
This check was left there to follow old behavior but I don't really see reason to check for switching station node at all, after network is started it could just stay active as long as its TTL is positive and ignore switching stations completely.
technic/technic/machines/switching_station_globalstep.lua
Lines 51 to 58 in ec3a52c
Keeping master node was more just easy way to drop switching stations from network and allow switching stations to only reset TTL instead of actually running networks.
Network ID could of course be based on node position but network ID should not be guaranteed or ever used to find network position. Instead it should be just ID to get node tables and network itself should not have any master positions, it is just unnecessary and complicates things.
This network master node however is both useless and practically makes one of switching station more important/significant than others. For example while all connected switching stations are only resetting network TTL removing one that is immediately above master cable node will reset that network while removing any other switching station will not affect caches.
technic/technic/machines/switching_station.lua
Lines 58 to 63 in ec3a52c
This ^^ is probably biggest problem here: decide whether there's still other switching stations in network when switching station is removed, should network be stopped or not.
Reference counters could be used but unfortunately nodes can easily disappear from world without any callbacks to Lua side... and removal of switching station is often intentional action and it is expected that machines stop immediately when last switching station is removed.
The text was updated successfully, but these errors were encountered: