Page 1 of 1

Make maximum_wire_distance optional when placing wire in script

Posted: Wed Jul 24, 2019 9:56 pm
by TheFunnySide
"maximum_wire_distance" currently has a limit of 64 which is fine most of the time.
But sometimes you want to connect entities far beyond the normal ranges.
I propose a change to LuaEntity.connect_neighbour(target).
Add the optional parameter bool::ignore_maximum_wire_distance

Re: Make maximum_wire_distance optional when placing wire in script

Posted: Wed Jul 24, 2019 10:00 pm
by DaveMcW
As a workaround, you can teleport the entity close, connect the wire, then teleport it back.

Re: Make maximum_wire_distance optional when placing wire in script

Posted: Wed Jul 24, 2019 10:03 pm
by TheFunnySide
Thank you i was not aware of that. If my proposal goes nowhere then i will do that

edit: "Surface teleport can only be done for players at the moment."
edit2:Yes , it works when you leave out the surface

Re: Make maximum_wire_distance optional when placing wire in script

Posted: Wed Jul 24, 2019 10:49 pm
by Boodals
TheFunnySide wrote: Wed Jul 24, 2019 10:03 pm edit: "Surface teleport can only be done for players at the moment."
That means you were trying to teleport it between surfaces. Wires most likely can't go between surfaces.
I think it errors if you give any surface into the function call, even if its already on that surface.

Re: Make maximum_wire_distance optional when placing wire in script

Posted: Fri Jul 26, 2019 9:11 pm
by slippycheeze
DaveMcW wrote: Wed Jul 24, 2019 10:00 pm As a workaround, you can teleport the entity close, connect the wire, then teleport it back.
O_o today I learned a wonderfully awful hack, and shall have to find an excuse to use it. Are there any conditions that, aside from human intervention, would break the connection?

Re: Make maximum_wire_distance optional when placing wire in script

Posted: Sun Jul 28, 2019 6:27 pm
by Rseding91
But why? Letting script logic do things which the player normally does - but the player can't reproduce - doesn't seem like a good idea. From the players perspective if they ever disconnect a wire in that state they can't reconnect it because the game will tell them it's invalid.

The only reason the game doesn't force disconnect wires after teleporting is it would add a lot of overhead to every teleport action to check if wire(s) are all still in reach and wouldn't allow things like batch teleporting where after *some other* teleports the wires will be correct.

Re: Make maximum_wire_distance optional when placing wire in script

Posted: Sun Jul 28, 2019 8:07 pm
by darkfrei
Rseding91 wrote: Sun Jul 28, 2019 6:27 pm But why? Letting script logic do things which the player normally does - but the player can't reproduce - doesn't seem like a good idea. From the players perspective if they ever disconnect a wire in that state they can't reconnect it because the game will tell them it's invalid.

The only reason the game doesn't force disconnect wires after teleporting is it would add a lot of overhead to every teleport action to check if wire(s) are all still in reach and wouldn't allow things like batch teleporting where after *some other* teleports the wires will be correct.
Some prototypes are not available for the player, here are hidden entities with hidden copper/red/green wires.

In this way we can make "radio" signal transmission (and even radio energy transmission!), that cost no UPS.