Remove "master" node from networks
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 23
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
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.
https://github.com/mt-mods/technic/blob/ec3a52c668ec6786e925e197fc01d75bb7f5bb93/technic/machines/switching_station_globalstep.lua#L51-L58
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.
https://github.com/mt-mods/technic/blob/ec3a52c668ec6786e925e197fc01d75bb7f5bb93/technic/machines/switching_station.lua#L58-L63
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with technic/machines/switching_station_globalstep.lua around lines 51-58 and technic/machines/switching_station.lua around lines 58-63, then review the network and switching-station refactor from #96. Resolve how network identity, TTL handling, and removal of the last switching station should work without a master node; the issue is done when that behavior is implemented consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- game-dev
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100