[mod] Automated Storage & Retrieval System [asrs]
- TechnoWolfTV
- Member
- Posts: 72
- Joined: Wed Jan 29, 2020 20:04
- GitHub: TechnoWolfTV
- In-game: TechnoWolfTV
- Location: Wisconsin, USA
Re: [mod] Automated Storage & Retrieval System [asrs]
I think I've discovered a bug in the Remote Access pad. Is there a max distance imposed on the remote? I was working on a project about 300 nodes away from the base controller. The Remote Access pad exhibited the same issues I've recently described here. I returned to the base controller and tapped the remote on it to reconfig, and it worked fine in proximity to the base. I use TPad in my world, so I teleported back to the project and again the remote acted like my previous report. Thinking it might be TPad breaking it, I returned to the base controller and tapped the remote on it to reconfig, and it again worked fine in proximity to the base. This time I gave myself fly and fast and flew back to the project. Once again, the remote was not allowing search or item transfer so it apparently had nothing to do with teleporting. Distance perhaps?
- Nathan.S
- Member
- Posts: 1182
- Joined: Wed Sep 24, 2014 17:47
- GitHub: NathanSalapat
- Contact:
Re: [mod] Automated Storage & Retrieval System [asrs]
I don't impose a max distance, but it looks like Luanti must have started doing that. I get this error now if I'm about 13 nodes away.
It worked before, so I'm not sure what changed, or why..... I don't see an anti-cheat setting for it. I took a brief look through the open and closed issues on Github and don't see anything that immediately looks like something that would have effected this. I don't see anything in the .conf file or in the mod api that looks like this value can be changed. Nothing mentioned in breaking changes either. I'll have to ask around about this. I'm pretty positive it worked before, 'cause I remember having issues with getting the inventory to even display and had to do some workarounds for that.
Edit:
Maybe I'm just retarded and never actually tested that you could interact with the inventory... Not sure what the point of being able to see an inventory is if you are too far away to interact with it. Changing the range of the remote, that would be the pointing range, does change how far away I can be from the system and interact with the inventory. The trouble with setting that to something stupid high is anytime you wield it it calculates which node you are pointing at, which I think is computationally expensive, and not very recommended. I don't see any option available to change this on a per inventory basis. I would have to change to either player connected inventories and detached inventories, both of which would require reworking a large portion of the code. I'll try and look into some things, but I'm super busy with some commissioned work right now. (Actually some very similar to this, and I was using the same backend system, which now I need to change there because this clearly doesn't work)
Code: Select all
2026-04-23 20:18:15: ACTION[Server]: Player singleplayer tried to access inventory from too far: d=126.966, max_d=100; ignoring.
Edit:
Maybe I'm just retarded and never actually tested that you could interact with the inventory... Not sure what the point of being able to see an inventory is if you are too far away to interact with it. Changing the range of the remote, that would be the pointing range, does change how far away I can be from the system and interact with the inventory. The trouble with setting that to something stupid high is anytime you wield it it calculates which node you are pointing at, which I think is computationally expensive, and not very recommended. I don't see any option available to change this on a per inventory basis. I would have to change to either player connected inventories and detached inventories, both of which would require reworking a large portion of the code. I'll try and look into some things, but I'm super busy with some commissioned work right now. (Actually some very similar to this, and I was using the same backend system, which now I need to change there because this clearly doesn't work)
I record Luanti videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
Check out my website, and brand new Minetest Modding Course
Re: [mod] Automated Storage & Retrieval System [asrs]
Some three-minute bloviations:
I found src/network/serverpackethandler.cpp#L868
Where it checks the tool range of the node def. Perhaps you can experiment with adjusting the defined range of the tool. It does the check in C++ rather than lua, and maybe that will not be as un-performant as you fear?
Now, changing the "tool range" on your ASRS remote access pad means that you will be able to point to nodes this far away, which probably doesn't matter since the pad doesn't interact with nodes directly that you point to. But the selection bounding box could be off in the distance.
I found src/network/serverpackethandler.cpp#L868
Code: Select all
bool Server::checkInteractDistance(RemotePlayer *player, const f32 d, const std::string &what)
{
ItemStack selected_item, hand_item;
const ItemStack &tool_item = player->getWieldedItem(&selected_item, &hand_item);
f32 max_d = BS * getToolRange(tool_item, hand_item, m_itemdef);
// Cube diagonal * 1.5 for maximal supported node extents:
// sqrt(3) * 1.5 ≅ 2.6
if (d > max_d + 2.6f * BS) {
actionstream << "Player " << player->getName()
<< " tried to access " << what
<< " from too far: "
<< "d=" << d << ", max_d=" << max_d
<< "; ignoring." << std::endl;
// Call callbacks
m_script->on_cheat(player->getPlayerSAO(), "interacted_too_far");
return false;
}
return true;
}Now, changing the "tool range" on your ASRS remote access pad means that you will be able to point to nodes this far away, which probably doesn't matter since the pad doesn't interact with nodes directly that you point to. But the selection bounding box could be off in the distance.
cdb_5ea39b4225fd
- Nathan.S
- Member
- Posts: 1182
- Joined: Wed Sep 24, 2014 17:47
- GitHub: NathanSalapat
- Contact:
Re: [mod] Automated Storage & Retrieval System [asrs]
Ya, I seen that, although not directly in the C code. I seen the pull request that added the tool distance check to prevent cheating. I can, and did change the range, I think I remember reading that the pointed node uses raycast, and setting it to hundreds or thousands of nodes would become computationally expensive.
I feel like this should be a setting, so modders can decide if they want that 'anti-cheat' feature on a per-node basis. I can limit the nodes/objects that a tool can point at, but that only really changes whether the node get's highlighted, internally it's still running a raycast on everything, and there doing a table lookup to see if that node should be highlighted which probably makes it even worse. I do wonder if I could just use a chat command and pull up the inventory and be able to interact with it.
I feel like this should be a setting, so modders can decide if they want that 'anti-cheat' feature on a per-node basis. I can limit the nodes/objects that a tool can point at, but that only really changes whether the node get's highlighted, internally it's still running a raycast on everything, and there doing a table lookup to see if that node should be highlighted which probably makes it even worse. I do wonder if I could just use a chat command and pull up the inventory and be able to interact with it.
I record Luanti videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
Check out my website, and brand new Minetest Modding Course
Re: [mod] Automated Storage & Retrieval System [asrs]
Hm, that does like like a problem, if it's going to do that. Perhaps a detached inventory is the safest, even though it would involve rework.
I would love to see the pad stay useful as-is; that is, in-game, and not needing to type a command to pull up the inventory.
I would love to see the pad stay useful as-is; that is, in-game, and not needing to type a command to pull up the inventory.
cdb_5ea39b4225fd
- Nathan.S
- Member
- Posts: 1182
- Joined: Wed Sep 24, 2014 17:47
- GitHub: NathanSalapat
- Contact:
Re: [mod] Automated Storage & Retrieval System [asrs]
It turns out detached inventories don't persist after a restart, so I'm not sure what the solution here is.
Setting the range to something really large, 10,000 nodes did work, but the inventory didn't update when I took items or placed items. I couldn't get extra items and didn't loose items, but it looked broken, so that probably doesn't work either. I'm at a real loss as to how to solve this.
Setting the range to something really large, 10,000 nodes did work, but the inventory didn't update when I took items or placed items. I couldn't get extra items and didn't loose items, but it looked broken, so that probably doesn't work either. I'm at a real loss as to how to solve this.
I record Luanti videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
Check out my website, and brand new Minetest Modding Course
Re: [mod] Automated Storage & Retrieval System [asrs]
Mod inventory pouches (my branch has various fixes, including inventory loading) uses detached inventories, for an item carried by a player, and it saves at server exit and loads at server start.
cdb_5ea39b4225fd
Re: [mod] Automated Storage & Retrieval System [asrs]
I also had this problem before with my storage system mod that I never released, and in my inventorybags mod where opening remote chests with the Item Teleportation Bag doesn't work.
You are relying too much on the engines inventory system, just create a fake display inventory and manually move the items according to the inventory callbacks. My Storage Interface mod did this if you need an example, in fact it had both options, the real inventory and a fake one (and one using formspec buttons), but the mod is very outdated. viewtopic.php?t=18429
This has many other benefits, too. To some extent, you can for example make use of count_meta, see https://github.com/luanti-org/luanti/issues/15132
Also from my experience Luanti's inventories are quite slow if you use them extensively. In my unreleased storage system mod I didn't even use them to store the items, and only used them for player interaction. You may even want to use an external database.
Can your read this?
Who is online
Users browsing this forum: No registered users and 6 guests