Code Monkey home page Code Monkey logo

Comments (4)

sofar avatar sofar commented on June 15, 2024

This doesn't seem to be the same version of the code as in master right now.

I suspect they are putting in a non-tool item into the tool slot.

from xdecor.

 avatar commented on June 15, 2024

screenshot_20160715_133224

Ps. Piecing it together, it's got to be the 3d_armor mod. I can place a chest in there fine when it's present, but I haven't yet made it crash. I put debugging info in, so maybe I'll spot something. The enchanting.lua in dcb and on Amhi is about the same.

diff --git a/home/james/.minetest/mods/xdecor/enchanting.lua b/mods/xdecor/enchanting.lua
index a3c8e5a..3878d95 100644
--- a/home/james/.minetest/mods/xdecor/enchanting.lua
+++ b/mods/xdecor/enchanting.lua
@@ -12,11 +12,15 @@ enchanting.strength = 1.2  -- Armor strength (3d_armor only)
 enchanting.speed    = 0.2  -- Player speed (3d_armor only)
 enchanting.jump     = 0.2  -- Player jumping (3d_armor only)

+local function debug(pos, listname, stack, player, name)
+   minetest.log("action", name .. ", " .. listname .. ": " .. player:get_player_name() .. " with " ..
+       stack:get_name() .. " at " .. minetest.pos_to_string(pos))
+end
+
 function enchanting.formspec(pos, num)
    local meta = minetest.get_meta(pos)
    local formspec = [[ size[9,9;]
-           bgcolor[#080808BB;true]
-           background[0,0;9,9;ench_ui.png]
+           background[0,0;9,9;ench_ui.png;true]
            list[context;tool;0.9,2.9;1,1;]
            list[context;mese;2,2.9;1,1;]
            list[current_player;main;0.5,4.5;8,4;]
@@ -41,7 +45,8 @@ function enchanting.formspec(pos, num)
    meta:set_string("formspec", formspec)
 end

-function enchanting.on_put(pos, listname, _, stack)
+function enchanting.on_put(pos, listname, index, stack, player)
+   debug(pos, listname, stack, player, "on_put")
    if listname == "tool" then
        local stackname = stack:get_name()
        local tool_groups = {
@@ -58,7 +63,11 @@ function enchanting.on_put(pos, listname, _, stack)
    end
 end

-function enchanting.fields(pos, _, fields, sender)
+function enchanting.fields(pos, formname, fields, sender)
+   minetest.log("action", sender:get_player_name() .. " at " ..
+           minetest.pos_to_string(pos) ..
+           " sends the following fields:")
+   minetest.log("action", "\n" .. dump(fields))
    if fields.quit then return end
    local inv = minetest.get_meta(pos):get_inventory()
    local tool = inv:get_stack("tool", 1)
@@ -89,7 +98,8 @@ local function allowed(tool)
    return false
 end

-function enchanting.put(_, listname, _, stack)
+function enchanting.put(pos, listname, index, stack, player)
+   debug(pos, listname, stack, player, "put")
    local item = stack:get_name():match("[^:]+$")
    if listname == "mese" and item == "mese_crystal" then
        return stack:get_count()
@@ -99,7 +109,8 @@ function enchanting.put(_, listname, _, stack)
    return 0
 end

-function enchanting.on_take(pos, listname)
+function enchanting.on_take(pos, listname, index, stack, player)
+   debug(pos, listname, stack, player, "on_take")
    if listname == "tool" then enchanting.formspec(pos, nil) end
 end

@@ -230,6 +241,7 @@ function enchanting:register_tools(mod, def)
                    full_punch_interval = full_punch_interval, max_drop_level = max_drop_level
                }
            })
+           minetest.register_alias("xdecor:enchanted_"..tool.."_"..material.."_"..enchant, mod..":enchanted_"..tool.."_"..material.."_"..enchant)
        end

        if mod == "3d_armor" then

from xdecor.

 avatar commented on June 15, 2024

Probably related: minetest/minetest#4321

from xdecor.

t4im avatar t4im commented on June 15, 2024

4c06f81 should fix that crash. But it won't fix the underlying upstream issue you found there in minetest/minetest#4321

My guess is, that some unknown node was, what caused the match to return nil.
Now it will simply be disallowed.

from xdecor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.