Skip to content
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

Mesecon and digiline functionality of switching station #346

Open
OgelGames opened this issue Feb 10, 2024 · 6 comments
Open

Mesecon and digiline functionality of switching station #346

OgelGames opened this issue Feb 10, 2024 · 6 comments
Labels
Enhancement New feature or request

Comments

@OgelGames
Copy link
Contributor

OgelGames commented Feb 10, 2024

Currently the switching station uses mesecons to enable "notification" messages being sent via digilines. Maybe that toggle could be moved to a checkbox in the formspec, so mesecons can be used to turn the network on and off.

-- If mesecon signal enabled and power supply or demand changed then send them via digilines.
if mesecons_path and digilines_path and mesecon.is_powered(pos) then
local network = technic.networks[network_id]
if meta:get_int("supply") ~= network.supply or meta:get_int("demand") ~= network.demand then
meta:set_int("supply", network.supply)
meta:set_int("demand", network.demand)
local channel = meta:get_string("channel")
digilines.receptor_send(pos, technic.digilines.rules, channel, {
supply = network.supply,
demand = network.demand
})
end
end

@OgelGames OgelGames added the Enhancement New feature or request label Feb 10, 2024
@BuckarooBanzay
Copy link
Member

IMO: the mesecons-toggle is pretty weird, 👍 for a formspec solution (maybe even put demand/supply-fields and an enabled-button into it 😏)

@S-S-X
Copy link
Member

S-S-X commented Feb 10, 2024

This would have to be network wide synced configuration for all connected switching stations. Metadata could be used for this but doesn't really sound like a good way to do it.
Currently networks are stateless between restarts, probably would need to have some kind of network wide storage.
There's many ways to mess it up so best to plan it well, just simple global storage might sound like a good solution but there's some issues also with that.

@S-S-X
Copy link
Member

S-S-X commented Feb 10, 2024

Well, simple option could of course be to make it just switching station specific thing, ignore multi switch stuff and just let (possible) other switching stations to override it.
Then multi switch networks at first might seem to work bit weird but probably wouldn't be too bad or too hard to learn.
Important thing would be that switching station would be turned off so it wouldn't attempt to actively shut down the network while possible other switch would keep fighting it. So just shut it down once when player hits button/checkbox and disable nodetimer until player enables it again.

That should be possible by simply setting network ttl to zero and turning off nodetimer.

@FeXoR-o-Illuria
Copy link

I agree with @OgelGames that the behavior is at least untypical.

I don't use this feature but could at least imagine some use cases.

I also agree a checkbox in the formspec would be a more obvious way.

If this is to replace the current mesecons toggle that possibility would be gone - though if the node isn't stateless between restarts any longer I guess a digiline toggle could be added, too

@S-S-X
Copy link
Member

S-S-X commented Feb 10, 2024

though if the node isn't stateless between restarts any longer I guess a digiline toggle could be added, too

Networks being stateless is mostly issue with multi switch networks, keeping a node state will work just fine with single switch networks no issue with that. Would only affect multi switch networks. So single switch is straightforward but multi switch might be a bit confusing at first but still fairly easy to learn through trial and error.

@S-S-X
Copy link
Member

S-S-X commented Feb 10, 2024

Could be interestin if digicables / digiline connection would be used to sync switch configuration. So without actual connection they would not sync but if connected it would sync automatically, actual digiline message could be used to achieve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants