pandorabox-io / in-game

Random code and stuff for in-game things
MIT License
3 stars 0 forks source link

Digibuilder improvements #331

Open Klaranth opened 1 year ago

Klaranth commented 1 year ago

MCLV it would be so nice if the digibuilder could get information on the inventory of a scanned item

BuckarooBanzai Interesting, so you want to read chest-contents from afar, right? Something like this?

digiline_send("digibuilder", {
  command = "getnode",
  pos = { x=1, y=0, z=0 }
})

if event.type == "digiline" and event.channel == "digibuilder" then
  event.msg = {
    pos = { x=1, y=0, z=0 },
    name = "default:chest",
    param2 = 0,
    inventories = {
      main = {
        "default:stone 50",
        "",
        ...
      }
    }
  }
end

Not sure about the performance though 🤔

SX I guess performance would be somewhat similar to digiline chests, not good but still usable for some tasks. Would it be better to create another mod for that, some digiline metadata reader mod? Reasoning: There's a lot of things to consider when making decision if it is okay to return contents and if successful then it is possible that there will be a lot of custom handling for certain things. For example locked wooden chests wont normally reveal contents to other players and been utilized to keep some things hidden. (might even be such mod out there already)

MCLV Anything that would allow players to mechanically read metadata whilst respecting privacy would be a good thing to have, rather yesterday than today in my opinion. Using a CSM, I've already been able to do it, but if I could build machines to do it that would open up a lot of possibilities and improve efficiency of a lot of new machine builds

SX CSM still cannot read private metadata unless you wire it to server side mod.

MCLV uhuh. normally indeed you can't. pretty safe imo

SX Because metadata marked as private never leaves server without it being explicitly sent out-

MCLV oh, really

SX But thing is that most mods do not mark their metadata as private. There however has been suggestion for engine to make private mode default, but that would probably cause many other issues (which would anyway be fixable in mod code). I think lua controller memory is private.

MCLV yes, that could very well explain why I can't see that

SX https://github.com/minetest-mods/mesecons/blob/master/mesecons_luacontroller/init.lua#L611 But like said most mods do not use that and many modders do not even know it exists...

MCLV Would it be an idea to create some new node that works like the node detector, but reads meta data ? doesn't sound too hard to do. but I'm not really a modder just yet

SX I think probably that would be best but also more work... after all it is very simple to read metadata and send it out. A lot harder to handle all special cases... Well, you could just take some simple digiline component like some memory chip from digistuff mod and dump fairly simple metadata reader there. Then maybe change some textures...

Basics for inventory: meta = core.get_meta({x=0,y=0,z=0}); inv = meta:get_inventory(); lists = inv:get_lists(); lists["main"][0] == ItemStack("mod:item") (there can be multiple inventory lists, to get all loop is needed but often same name for containers) Basics for other metadata meta = core.get_meta({x=0,y=0,z=0}); meta:get_string("owner") == "MCLV"; meta:to_table() == { ... eveything including private stuff ... } And complete API: https://raw.githubusercontent.com/minetest/minetest/5.7.0/doc/lua_api.txt

Klaranth commented 1 year ago

Huhhila BuckarooBanzai: Digibuilder setnode response message could mention any resulting items like trellis, beanpole, technic cans, empty buckets etc.

OgelGames commented 1 year ago

I feel like that functionality would be better suited in a separate "inventory scanner" node...

SwissalpS commented 1 year ago

slightly related https://github.com/BuckarooBanzay/digibuilder/issues/14

Klaranth commented 1 year ago

MCLV What if... when the digibuilder is instructed to place a pickaxe, it instead digs the node at that location

Klaranth commented 7 months ago

birdlover32767 make digibuilder churn 1024 nodes per second def not a lag machine

et ok but seriously, buff it to like 3 nodes/0.5s

OgelGames commented 7 months ago

You could just use more digibuilders :)

Also https://github.com/BuckarooBanzay/digibuilder/issues/16