Broken Loot Chests

Home Forums MeseCraft Discussion Support Broken Loot Chests

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
  • #3924

      I’ve noticed that loot chests in some dungeons have no inventory.  I don’t mean they’re empty, I mean, they don’t even have inventory slots.  Just a big blank grey area where the precious loot should be.  I even had one dungeon with 3 chests, all of them bugged.  Fbt WiTT reports them to be default:chest, and if I dig one and rebuild it, it works properly (though empty).  I haven’t had any issues yet with chests in pyramids.

      Playing in singleplayer
      Windows 10
      Minetest 5.7.0
      Mesecraft 17654

      debug.txt (relevant line)
      2023-09-04 21:50:07: WARNING[Main]: GUIInventoryList::draw(): The inventory location “nodemeta:882,-171,1855” doesn’t exist

      Basket is the only mod that I think could conceivably have any effect here, but I don’t think it’s the culprit.  Other mods installed: Digtron, Encylopedia, Lookup Tool, Ftb Witt, Treecapitator.

      I’m going to keep poking at this, and see if I can work out the cause.  If I find anything, is it better if I put it here, or on the issue tracker on github?


        Where I’m at so far…

        I think the problem is the Geomoria mod, as included in Mesecraft.  I’m not 100% positive, but I think it’s creating chests using a voxel manipulator without calling the chest constructor.  This leaves the node without associated inventory meta data.  I have no idea what code is supposed to fill the chest with loot, but I suspect that it chokes on the missing inventory meta.  Perhaps that code (if I can find it) could also use a patch (might be the simpler fix, actually).

        (I’m not playing on a “potato”, but not that far off.  If I’m wrong about the cause of the bug, it could be some race condition brought about by limited RAM or the speed of my aging processor.)


        “The purpose of [VoxelManip] is for fast, low-level, bulk access to reading and writing Map content. As such, setting map nodes through VoxelManip will lack many of the higher level features and concepts you may be used to with other methods of setting nodes. For example, nodes will not have their construction and destruction callbacks run, and no rollback information is logged.”
        From the intro at —

        • init.lua:33 – defines local treasure_chest = ‘default:chest’
        • plans.lua defines geomoria_mod.plans which specifies where “treasure” might be located
        • mapgen.lua:63 creates local vm, emin, emax = minetest.get_mapgen_object(“voxelmanip”)
        • mapgen.lua:71 creates local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
        • mapgen.lua:128 calls geomorph, which reads and implements the plans.  It passes area as a parameter, along with a table named data.
          local write, wetness = geomoria_mod.geomorph(minp, maxp, data, p2data, area, node, heightmap)
        • geomorph.lua:221 Decides randomly whether to create treasure, based on the value in the plan
        • geomorph.lua:225 Takes a detour back to init.lua for geomoria_mod.treasure_chest_hook(…) — this should be a no-op, but might get froggy if another mod uses this hook.  I don’t think so.  A search doesn’t show any other references to it in the mesecraft folder.
        • geomorph.lua:228 records an area:index in the table named data (created in mapgen.lua) pointing to the content id of treasure_chest (aka default:chest; see mapgen.lua:29-38 for “node”)
        • mapgen.lua:188 writes changes from data to the vm– vm:set_data(data)

        I’m speculating that stepping through the data table after mapgen.lua:188 looking for chests and calling  the constructor might solve this.  minetest.registered_nodes[“default:chest”].on_construct(pos)

        On second thought, the call to geomorph could carry another table with locations of nodes that need their constructors called.  That might provide solutions to other node types besides chests if further bugs are found, and would be a lot more efficient than iterating through the entirety of the data table looking for the odd chest here or there.

        Continuing my exploration…


          Suspicions partially confirmed…

          I started a new game in vanilla minetest with geomoria and moreblocks copied from Mesecraft.  The chests here are bugged (no inventory slots, just grey area).

          2023-09-05 16:48:45: WARNING[Main]: GUIInventoryList::draw(): The inventory location “nodemeta:-1038,-171,-534” doesn’t exist


            Relatively minor, possibly related issue:

            Double doors aren’t paired properly.  You know how if you put down two doors, and you put the left door down first, the right door automatically puts its hinge on the right, away from it’s partner?  Yeah.  Geomoria doesn’t do that.  One of the doors always has a hinge in the middle.

            This one isn’t a big deal in terms of gameplay, but it comes across to the player as sloppy.  I’m guessing it’s the same issue.  The door constructor isn’t getting called, and the doors are just defaulting to one hinge orientation.

            (I’ve placed several dozen doors now, looking at different combinations.  It looks like the door, when placed, blindly looks to the node on its left, sees if it’s a door, and orients its hinge accordingly.)


              Breakthrough.  I have a partial fix.  It’s ugly as sin.  It needs to be formatted and subjected to code review.

              Fundamentally, I’m using __index and __newindex to intercept all access to the data table except when the vm is directly involved.  (I’m letting it have the raw, underlying table for performance and for predictable behavior.)  Any node getting set that has a constructor gets thrown into a queue.  Constructors are called after the changes are committed to the map.  This should broadly fix all constructor issues, should any other nodes require it.

              The problem that remains: The chests are no longer buggy… but they are still empty.  I’m guessing that there’s some sort of lootchest mod registration that needs to take place?  Maybe this is an area that just hasn’t been worked on at all?

              Apparently the door thing is a different, unrelated issue.  plans.lua uses ‘doors:door_steel_a’ all the time, when half the time it should be using ‘doors:door_steel_b’.  Fixing that is going to be… bothersome.  It should be fixed, but I’m not sure how without accidentally getting ‘a’ and ‘b’ mixed up half the time.  (How did this happen in the first place?)


                I can confirm that I have seen these same chests online in geomoria. Not sure if I have ever seen them anywhere else.


                  Found This:

                  Short version, this was not considered a bug, and was never going to be fixed.  It was always the plan for someone else to replace chests with a loot container (like lootchest mod).  I’m guessing Mesecraft just hasn’t gotten around to integrating the two mods (alpha release, etc).

                  I say that it still is a bug, if anyone ever forks and expands this project.  If any future “plans” involve nodes with constructors, those constructors need to be called.  If Mesecraft intends to keep Geomoria, I’m guessing the mod will eventually be customized.  (The fountains really don’t work with dynamic liquid…)

                  Trying to work out now how to get lootchests to fill Geomoria.  I suspect it’s going to be straightforward.  The hard part is going to be: Filled with what?  (game balance is a can of worms)


                    Loot that would be expected would be on par with what you can find in villages, with the occasional gold bar, gemstone, or dwarven food. If you really wanted to break it, toss in a magic mirror or two 😁


                      Anything I submit is going to need to get through the dev team.  lol

                      Here are my thoughts:  Why would a player even bother with Geomoria?  Why wander the corridors dodging arrows and fending off zombies?  Why not just keep digging?  The loot needs to be somewhat better than what the player could make on their own at this point, but not so good as to be game-breaking.  I’m still new enough to Minetest that I only have a vague idea what this might entail.  Not mese, but maybe the rare find of something made with mese shards?  Maybe an item or two that the player ought to have made, but might not have known about?

                      I have lootchests mostly working now.  I think loading up the loot table is the biggest remaining hurdle… before I start making pull requests.


                        At this point Geomoria are fairly useless to explore, as there is basically no loot, unless you need steel doors. But I’m not a fan of putting too much loot in them either, since they are at a depth where you can’t even really find iron. I’d suggest thinking of Geomoria as underground cities and keeping any loot equivalent to what is found in a surface village. If the Geomoria were deeper, say -1000 then I’d go with some mese or mese tools. Even then, I’d offer the corpses in the underworld as a comparison. There you find mese and diamond tools as loot, but that’s -3000. So for Geomoria at -200 the loot shouldn’t be equal to the underworld.


                          Ok, I’ve submitted a pull request.  Fingers crossed.  Let’s see what the dev team does with it.  Several unrelated bugs that keep the unstable branch from running, a fix for pre-existing buggy chests…  It’s been a bit of a journey.  I stuck to mostly bronze and steel stuff, seeds, with a few goodies thrown in.  No Mese, no magic materials.  You can find rare lightposts in ruins on the surface, for example, so I don’t feel bad about that.

                          Numbers are maximums.  The average will be about half that.  Average 16 item stacks.  I expect someone will pare this back a bit before it gets merged in.  The goal is to get players to hesitate before skipping past Geomoria.  Chests in Geomoria aren’t that common, though there are hidden chests if you already know where to look.

                          loot_table = {
                          {“default:coal_lump”, 40},
                          {“default:stick”, 99},
                          {“default:torch”, 90},
                          {“candles:candle”, 5},
                          {“pigiron:iron_ingot”, 12},
                          {“default:steel_ingot”, 8},
                          {“default:copper_ingot”, 16},
                          {“default:tin_ingot”, 16},
                          {“default:bronze_ingot”, 14},
                          {“moreores:silver_ingot”, 6},
                          {“default:gold_ingot”, 2},
                          {“default:mese_post_light”, 2},
                          {“df_trees:goblin_cap_wood_mese_light”, 2},
                          {“moreblocks:glow_glass”, 1},
                          {“death_compass:inactive”, 2},
                          {“bees:bottle_honey”, 1},
                          {“bees:wax”, 10},
                          {“farming:seed_barley”, 10},
                          {“farming:seed_cotton”, 10},
                          {“farming:seed_mint”, 10},
                          {“farming:seed_oat”, 10},
                          {“farming:seed_rice”, 10},
                          {“farming:seed_rye”, 10},
                          {“farming:seed_wheat”, 10},
                          {“farming:string”, 6},
                          {“bweapons_bows_pack:arrow”, 50},
                          {“bweapons_bows_pack:bolt”, 50},
                          {“ropes:wood1rope_block”, 2},
                          {“tnt:gunpowder”, 10},
                          {“vessels:glass_bottle”, 3},
                          {“vessels:glass_fragments”, 20},


                            Thank you! I’ll review asap

                          Viewing 12 posts - 1 through 12 (of 12 total)
                          • You must be logged in to reply to this topic.