Crash on rightclick on meshnode controller #2

Closed
opened 2021-08-20 19:18:45 +02:00 by erlehmann · 2 comments
Owner
How to reproduce
  1. Place meshnode controller
  2. Right click it
##### How to reproduce 1. Place meshnode controller 2. Right click it
Author
Owner

Hotfix that looks ugly but works:

diff --git a/init.lua b/init.lua
index d20dcec..199319e 100644
--- a/init.lua
+++ b/init.lua
@@ -58,6 +62,14 @@ local function has_privilege(name)
        return minetest.check_player_privs(name, {meshnode=true})
 end
 
+local function get_hotbar_bg(x,y)
+       local out = ""
+       for i=0,7,1 do
+               out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]"
+       end
+       return out
+end
+
 local function show_meshnode_formspec(pos, player)
        local name = player:get_player_name()
        if not has_privilege(name) then
@@ -69,10 +81,10 @@ local function show_meshnode_formspec(pos, player)
        local entity = meshnode.get_luaentity(id)
        local spos = pos.x..","..pos.y..","..pos.z
        local formspec = "size[8,8]"..
-               default.gui_bg..
-               default.gui_bg_img..
-               default.gui_slots..
-               default.get_hotbar_bg(0,4)..
+               ""..
+               ""..
+               ""..
+               get_hotbar_bg(0,4)..
                "list[current_player;main;0,4;8,1;]"..
                "list[current_player;main;0,5.25;8,3;8]"..
                "list[nodemeta:"..spos..";tool;0.5,1.5;1,1;]"

The solution is to fix the formspec ofc.

Hotfix that looks ugly but works: ``` diff --git a/init.lua b/init.lua index d20dcec..199319e 100644 --- a/init.lua +++ b/init.lua @@ -58,6 +62,14 @@ local function has_privilege(name) return minetest.check_player_privs(name, {meshnode=true}) end +local function get_hotbar_bg(x,y) + local out = "" + for i=0,7,1 do + out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]" + end + return out +end + local function show_meshnode_formspec(pos, player) local name = player:get_player_name() if not has_privilege(name) then @@ -69,10 +81,10 @@ local function show_meshnode_formspec(pos, player) local entity = meshnode.get_luaentity(id) local spos = pos.x..","..pos.y..","..pos.z local formspec = "size[8,8]".. - default.gui_bg.. - default.gui_bg_img.. - default.gui_slots.. - default.get_hotbar_bg(0,4).. + "".. + "".. + "".. + get_hotbar_bg(0,4).. "list[current_player;main;0,4;8,1;]".. "list[current_player;main;0,5.25;8,3;8]".. "list[nodemeta:"..spos..";tool;0.5,1.5;1,1;]" ``` The solution is to fix the formspec ofc.
Author
Owner

This does not crash right now.

This does not crash right now.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Mineclonia/mcl_meshnode#2
No description provided.