Page 1 of 1

Add option for LuaControl:Opened() to ignore distance constraints.

Posted: Wed Jun 12, 2019 12:17 am
by Oarc
Add option for LuaControl:Opened() to ignore distance constraints.

Use case is that sometimes I want to open a chest or something that is outside of the reach range, for mod purposes.
Special chests, special inventories that can only be accessed under special conditions. But essentially it's still just a chest or inventory or something that you can open and disregard distance requirements.

I just want some way to be able to open inventories from across the map... of trains/entities/containers whatever.

Let me know if there is already a way to do this as well, I already asked around on discord and tried to find an easy way myself.

Re: Add option for LuaControl:Opened() to ignore distance constraints.

Posted: Wed Jun 12, 2019 1:24 am
by Rseding91
LuaControl::opened doesn't do any distance checks in the Lua API. It's simply a part of the game logic that a player can't open something they can't reach. There's no "override" behavior it's just baked into the logic of anything opened if it's out of reach it's closed.

So the answer to this request would be: it can't be done as an API request. If you want to ignore distance limits then just set the distance limits to unlimited in the prototype for the player.

Re: Add option for LuaControl:Opened() to ignore distance constraints.

Posted: Thu Jun 13, 2019 4:18 pm
by ratchetfreak
Rseding91 wrote:
Wed Jun 12, 2019 1:24 am
LuaControl::opened doesn't do any distance checks in the Lua API. It's simply a part of the game logic that a player can't open something they can't reach. There's no "override" behavior it's just baked into the logic of anything opened if it's out of reach it's closed.

So the answer to this request would be: it can't be done as an API request. If you want to ignore distance limits then just set the distance limits to unlimited in the prototype for the player.
But one of the mod ideas I've had mulling around is to mark objects with a tool and a construction bot will hover over it and let the player open the gui to interact with it remotely.

This is one of the issues with it, the other is how to prevent items from moving between the inventories and how to mark modules and such to be delivered and picked up/excess items to be moved as the recipe changes instead of appearing in the player inventory, etc.