Teleporter Mod?

Wonder if it is possible to make a teleporter mod? It would consist of two parts. A platform placed at each place, for instance a far away mining area and the other at your town. I know there is a teleport cheat already can that be used in a mod? I suppose the tricky bit would be getting them to path to it instead of making the long walk.

It could be collaborative construct of mason and herbalist.

1 Like

Unless the pathfinder is opened up, teleporters would probably require way too many pathfinding sessions to be viable.

1 Like

Yea, I thought the pathing would be a problem.

For Zulser, I did this weird hack where I was pathfinding from the unit to the nearest conveyor, then calculated the distance in a straight line to the drop off, then calculated from the drop-.off the way to the original target. This works (I’m amazed it did as well as it did, to be honest), but puts a lot of uneasy stress on the pathfinder.

I doubt you could do it with all the content that has been added since. Like, I’m certain it’s possible, but the performance would likely be bonkers.

3 Likes

How about a chest that is cloned? You set one at mining site and one at the town. The same items are accessed at each location.

1 Like

I’ve been playing with the idea of making a “manual” teleporter. Basically, you create a door that you pair with another door; any entity that enters one door, gets teleported to another (using essentially the same command that you saw in the “teleport cheat” from the debug tools). This way, you don’t have to interface with the pathfinder. And yes, I’ve checked; the pathfinder is closed, there’s not really much we can do with it. Usually I create new components by looking at how Radiant did an equivalent thing; there are no teleporters in the game right now. The closest thing we have are ladders, and those don’t really do what a teleporter should do.

With my idea, you would need to look which path hearthlings are usually taking, and put a teleporter in a spot you know they’ll always pass (ie a door in a surrounding wall). The pathfinder still calculates the full path, and prepares the hearthling for the entire journey; but as the hearthling passes the door, the door zips him over to the over door (where the hearthling’s destination would’ve been), the pathfinder quickly recalculates the path (which should be right by your exit portal), and bob’s your uncle.

It’s hacky, you can’t truly “wall” yourself off with it (the pathfinder must still be able to find a regular path for a hearthling to take to your destination, without the teleporter), and it’s nontrivial code if you want to do it right (UI for linking two teleporters, components, etc), but if you want to dive headfirst into modding SH with Lua to make a little prototype in microworld, go for it.

3 Likes

Smart! That would be easy to do in the a mine. Just put the door at the entrance.

This is a somewhat bad idea, because it messes up the pathfinder/the whole walk-along-a-path thing real good. In all likelihood, upon immediately teleporting, the entity either needs to A) re-evaluate a path, which is performance intensive or B) tries to walk to the next node in the path anyway, which will (likely) be beyond the portal.

In any case, you open up a can of worms if you try to do it, because the space between the two portals becomes a “closed space”. If you have a setup like [chest] - [portal] - [item], Units that try to get to the item will take the closest path (through the portal) and then end up somewhere completely else, probably ending up in a deadlock because they can never get to it.

I mean, it can work, depending on how the pathfinding and the walk-along-a-path is made, but the issue with the closed space persists. There’s no happy solution unless we can have proper influence to the pathfinder.

I think I’ve said this before, but the only API we’d actually need would be a way to create links between two arbitrary nodes and set their weight (plus maybe some callback if an entity arrives at it). Then we could easily have anything that uses transportation: Minecarts, trains, boats, teleporters, portals, …

1 Like

Indeed. I’ve written to the devs before asking about this problem, and was told I’m out of luck. I know some of the pitfalls with this method, but it’s the only way I could think of teleporting to work at all without talking to the pathfinder. Because of these issues, it was never a serious mod idea for me.

1 Like