Make maximum_wire_distance optional when placing wire in script

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
TheFunnySide
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Jun 08, 2019 1:19 pm
Contact:

Make maximum_wire_distance optional when placing wire in script

Post 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

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Make maximum_wire_distance optional when placing wire in script

Post by DaveMcW »

As a workaround, you can teleport the entity close, connect the wire, then teleport it back.

TheFunnySide
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Jun 08, 2019 1:19 pm
Contact:

Re: Make maximum_wire_distance optional when placing wire in script

Post 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
Last edited by TheFunnySide on Thu Jul 25, 2019 8:36 am, edited 1 time in total.

Boodals
Fast Inserter
Fast Inserter
Posts: 129
Joined: Sun Feb 11, 2018 7:10 pm
Contact:

Re: Make maximum_wire_distance optional when placing wire in script

Post 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.

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: Make maximum_wire_distance optional when placing wire in script

Post 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?

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Make maximum_wire_distance optional when placing wire in script

Post 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.
If you want to get ahold of me I'm almost always on Discord.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Make maximum_wire_distance optional when placing wire in script

Post 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.

Post Reply

Return to “Modding interface requests”