Better Linked Chest


Linked chest with Dropdown to set the Chest inventory.

1 year, 4 months ago
1.1
409
Circuit network Storage Cheats

g Doesn't work with Forces/Teams

2 months ago
(updated 2 months ago)

I have 13 players on my Brave New Oarc server, and we're trying out Better Linked Chests mod. I love the ability to add a name to the address, but you keep a single array of each name/address all players. That only works if you are playing with one force. You would need to change:

global.name_id_table={}

You could do a few things to fix this - one of which is to use the first address for the index of the force.
The next is to keep a list of names/address based on each force.

if not global.name_id_table[player.force.name] then
    global.name_id_table[player.force.name] = {}
end

Then everywhere you use global.name_id_table you would add the players force.name

Linked-Chests base code makes sure that each force only has access to the contents of boxes, even with the same address, for each force. You would change to track the names that each team assigns to the address. Every team can use 1:0:0:0 for different contents, without their contents being shared between teams.

If this is not clear, I can show you after logging back into a game I host with 13 players, that my steel box is now named plastic, and every other name is messed up - but the contents are good, and not mixed up with other teams.

I have modified how Ender-Linked-Chests work to add addressing and logistic wire within my Brave New Oarc code. If you don't want to address this, I can just add the address helper UI to that. I did modify Alien Modules to work for Forces, so that would be a good example that is not too much code to view how the single array was modified to support something like global.name_id_table[player.force.name]

Let me know if there is something I can do to help, this is a nice addition to Oarc, if you fix the naming. For now I have to list it as not supported.

2 months ago

If you add this - when a new player joins - they may form a new team, easiest way to support this is to simply validate with above check and initialization of the new team array - prior to use of that variable. In on_gui_opened you would add the above if block to initialize the new team, if it was new. And your use of global.name_id_table would change to : global.name_id_table[player.force.name]

Also since the game may be hosted by a server, it may start with zero players. The global.name_id_table is initialized in on_init, but not for each team. So you would need to add the above initialization check for each team in on_player_created, and on_player_joined

This is a fairly straight forward change, and I could help you test. Please feel free to contact me on my discord.
My guys have linked me to a thread that shows the same info but using an index to address the force. I prefer the name of the team for easier debugging.
That link here:
https://cdn.discordapp.com/attachments/926385864802697226/1256422217974157322/screencapture-claude-ai-chat-987ce206-53ea-4c13-bec2-344161bd39eb-2024-06-28-18_32_18.png?ex=66815e9f&is=66800d1f&hm=9819e4fdd3403f2419f8c1502eee5a3817b7845a27880968078e46ca0917f759&

My discord here:
https://discord.gg/w6Nansvb

New response