Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesecon integration #11

Open
FaceDeer opened this issue Nov 10, 2019 · 20 comments
Open

Mesecon integration #11

FaceDeer opened this issue Nov 10, 2019 · 20 comments

Comments

@FaceDeer
Copy link
Member

Seems like it should be pretty straightforward to set these gates to be triggerable by mesecon signals, investigate that at some point (filing issue to myself to ensure I don't forget).

@ghost
Copy link

ghost commented Nov 11, 2019

Speaking of, wooden/steel levers would be cool for portcullises.

@FaceDeer
Copy link
Member Author

I just refreshed my familiarity with this mod's code (been a while since I did anything with it) and I suspect it'll be super easy - barely an inconvenience. All that's needed to operate a gate is to call

castle_gates.trigger_gate(pos, node, player)

on any node of the target gate, and the only reason "node" is a required parameter is so that you can assign this method to a gate node's on_rightclick and have it "just work". Having a lever do it is just a matter of coming up with some way for a player to assign the lever to one or more target positions in world, and then mesecon compatibility can be added to the lever.

I'm going to be out of the house for a few hours, and am busy getting my butt back in gear on dfcaverns, but even so I think I might be able to knock this together tonight. Thank you, past-me, for writing this mod with flexibility like this in mind. :)

@ghost
Copy link

ghost commented Nov 12, 2019

All that's needed to operate a gate is to call
castle_gates.trigger_gate(pos, node, player)
[...] so that you can assign this method to a gate node's on_rightclick [...]

Thus, if I understand it correctly, the lever node (generically, "the switch") must store the associated gate's coordinates.

Therefore one must have a way to get the gate's coords, and then to insert them into the switch. Two methods come in mind.

Method #1:
Requires a "GPS" node, i.e. a node that when placed on ground scans the nearby nodes (GPS.pos +1); if gate-node found then print its position in the chat, or store it into an "on mouse hover" label.
Next, the player should be able to insert the coords using a textfield-formspec displayed when placing the switch in-world.

Method #2:
Requires a "transceiver" node.

  • You place the switch, the switch on_place gives you the "transceiver" containing the switch coords.
  • You place the transceiver next to a gate, the transceiver adds the gate's coords to the associated switch and then deletes itself.

Thinking of your Sounding Line, you could apply it to both methods, making it look like a rope (for a wooden lever) or a wire (for a techy switch); beside the "cool effect" this would visually confirm that "Switch/Lever A" has been assigned to "Gate/Portcullis B" and not "Drawbridge C".

The lever node could reuse the default torches "on wall" shape, upside-down when in the opposite state; e.g. lever up = normal torch-on-wall; lever down = vertically flipped torch-on-wall.

[...] Thank you, past-me, for writing this mod with flexibility like this in mind. :)

Heh, I wish I could say the same! My coding skills have never been beyond the "hobbyst amateur" level, and after about one year of hiatus I hardly understand how I could write some of my mods.

@FaceDeer
Copy link
Member Author

Unfortunately, right after I committed to doing this real life came up and punched me in the throat with a plot twist. Huge sigh. But I've been dredging spare time back up again lately, and I've started into this. The branch is at https://github.com/minetest-mods/castle_gates/tree/switches

The approach I've taken is to create a "linkage" tool that you use on both the switch node and on the gate node. Click one and then the other, and it establishes the link between the two. It's a many-to-many relationship; you can have one switch connect up to multiple gates, and one gate can be controlled by many switches. The relationship is stored in a map that gets saved out to a file in the world folder.

I'm still working on the UI. The streamers of particles from switch to target gates sounds nice, I'll work on that next. For now I've got a thing that adds HUD waypoints to the target gate nodes when you right-click on the switch. Right now there's not enough feedback to the player as to what's going on when he's right-clicking and left-clicking on various things, I need to fancy that up some more.

@FaceDeer
Copy link
Member Author

Okay, I think I've got the user interface sorted out. The way this works:

  • Build a gate, build a switch, and craft a "linkage" tool.
  • Click on the switch with the linkage tool. This sets the linkage tool to that switch as the source.
  • Click on a gate with the linkage tool. This links the switch to that gate.
  • Click any other node with the linkage tool to show the linkages that the tool's current switch has.

The switch/gate linkage display times out in 30 seconds unless you refresh it by clicking some more with the linkage tool.

Does this seem intuitive and functional to you? If so, I think this is about ready to merge into master.

@ghost
Copy link

ghost commented Dec 28, 2019

Hey there!
Don't worry: real life happens.
I've tried the new branch in creative mode, I'm having some issues.

The first attempt: I've placed a 'steel_gate_edge_handle' on the floor, then a switch, and then linked the two by clicking them with 'linkage', first on the switch, then on the gate.

The link worked, it has shown the particles beam from the switch to the gate, but when I tried to use the switch it crashed with this message:

2019-12-28 14:12:36: ACTION[Server]: singleplayer places node castle_gates:steel_gate_edge_handle at (265,9,-285)
2019-12-28 14:12:36: ACTION[Server]: facedir: 2
2019-12-28 14:12:39: ACTION[Server]: singleplayer places node castle_gates:switch at (267,9,-285)
2019-12-28 14:12:39: ACTION[Server]: facedir: 2
2019-12-28 14:12:41: ACTION[Server]: singleplayer uses castle_gates:linkage, pointing at [node under=267,9,-285 above=267,10,-285]
2019-12-28 14:12:42: ACTION[Server]: singleplayer uses castle_gates:linkage, pointing at [node under=265,9,-285 above=265,9,-284]
2019-12-28 14:12:42: WARNING[Server]: Undeclared global variable "pos" accessed at .../Giochi/minetest/bin/../mods/castle_gates/switch.lua:392
2019-12-28 14:12:42: ACTION[Server]: singleplayer added a link from a switch at (267,9,-285) to a gate at (265,9,-285)
2019-12-28 14:12:50: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'default' in callback item_OnPlace(): invalid key to 'next'
2019-12-28 14:12:50: ERROR[Main]: stack traceback:
2019-12-28 14:12:50: ERROR[Main]: 	[C]: in function '(for generator)'
2019-12-28 14:12:50: ERROR[Main]: 	.../Giochi/minetest/bin/../mods/castle_gates/switch.lua:208: in function 'trigger_switch'
2019-12-28 14:12:50: ERROR[Main]: 	.../Giochi/minetest/bin/../mods/castle_gates/switch.lua:250: in function 'on_rightclick'
2019-12-28 14:12:50: ERROR[Main]: 	...ogrammi/Giochi/minetest/bin/../builtin/game/item.lua:417: in function <...ogrammi/Giochi/minetest/bin/../builtin/game/item.lua:410>
2019-12-28 14:12:50: ERROR[Main]: 	(tail call): ?
2019-12-28 14:12:50: ACTION[Server]: singleplayer leaves game. List of players: 
2019-12-28 14:12:50: ACTION[Main]: Server: Shutting down

Thus I thought that it might have been caused by the fact that there wasn't a wall next to the gate, thus I did this:

gates2

When I right clicked on whe switch, the lever moved, but nothing happened.
I tried again, it crashed with this message:

2019-12-28 14:15:21: ACTION[Server]: singleplayer takes default:brick from creative inventory
2019-12-28 14:15:23: ACTION[Server]: singleplayer places node default:brick at (266,9,-288)
2019-12-28 14:15:25: ACTION[Server]: singleplayer places node castle_gates:steel_gate_edge_handle at (265,9,-288)
2019-12-28 14:15:25: ACTION[Server]: facedir: 2
2019-12-28 14:15:32: ACTION[Server]: singleplayer places node default:brick at (264,9,-288)
2019-12-28 14:15:37: ACTION[Server]: singleplayer places node castle_gates:switch at (266,10,-288)
2019-12-28 14:15:37: ACTION[Server]: facedir: 2
2019-12-28 14:15:40: ACTION[Server]: singleplayer uses castle_gates:linkage, pointing at [node under=266,10,-288 above=265,10,-288]
2019-12-28 14:15:41: ACTION[Server]: singleplayer uses castle_gates:linkage, pointing at [node under=265,9,-288 above=265,9,-287]
2019-12-28 14:15:41: WARNING[Server]: Undeclared global variable "pos" accessed at .../Giochi/minetest/bin/../mods/castle_gates/switch.lua:392
2019-12-28 14:15:41: ACTION[Server]: singleplayer added a link from a switch at (266,10,-288) to a gate at (265,9,-288)
2019-12-28 14:16:46: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'default' in callback item_OnPlace(): invalid key to 'next'
2019-12-28 14:16:46: ERROR[Main]: stack traceback:
2019-12-28 14:16:46: ERROR[Main]: 	[C]: in function '(for generator)'
2019-12-28 14:16:46: ERROR[Main]: 	.../Giochi/minetest/bin/../mods/castle_gates/switch.lua:208: in function 'trigger_switch'
2019-12-28 14:16:46: ERROR[Main]: 	.../Giochi/minetest/bin/../mods/castle_gates/switch.lua:250: in function 'on_rightclick'
2019-12-28 14:16:46: ERROR[Main]: 	...ogrammi/Giochi/minetest/bin/../builtin/game/item.lua:417: in function <...ogrammi/Giochi/minetest/bin/../builtin/game/item.lua:410>
2019-12-28 14:16:46: ERROR[Main]: 	(tail call): ?
2019-12-28 14:16:46: ACTION[Server]: singleplayer leaves game. List of players: 
2019-12-28 14:16:46: ACTION[Main]: Server: Shutting down

And when I relogged the gate was floating 1 node above the ground, I tried to use the switch again and it did nothing except playing its sound:

gates4

Am I doing something wrong?

@FaceDeer
Copy link
Member Author

FaceDeer commented Dec 28, 2019

Well, the movement upward is actually correct - that's not a hinged door panel, so it'll be treated as a sliding door panel and the only way it could move is upward. And the very first time you click on a newly-built gate nothing will happen yet because it has to figure out that it is a gate and what directions are free, that's a known issue I've never got around to fixing (all subsequent clicks will work fine). So if you trigger that gate it'll slide upward into the sky. Looks like it managed to get that far before the crash happened, so something was going right. There's a fraction of a second delay between a switch-linked gate segment moving and the updated linkage being written to disk in the world directory for persistence, so the game probably crashed before that was able to be done. That'd explain why the switch linkage was lost.

I've been unable to reproduce the crash itself yet though. It's odd, I'm using Minetest 5.1 as well but line 410 of builtin\game\item.lua that your callstacks reference as part of the crash is a line of whitespace in between two functions in my copy. I haven't updated to the latest dev version of 5.1 in quite a while though, looks like my 5.1 is from mid July. I'll dig up the latest and try it with that.

Edit: I grabbed yesterday's 5.2 build from https://gitlab.com/minetest/minetest/pipelines and wasn't able to repro the crash on there either. This callstack baffles me, somehow the code is reaching item.on_place from inside the right-click callback of the switch node. I'll poke around a bit more.

@ghost
Copy link

ghost commented Dec 28, 2019

I've been unable to reproduce the crash itself yet though. It's odd, I'm using Minetest 5.1 as well but line 410 of builtin\game\item.lua that your callstacks reference as part of the crash is a line of whitespace in between two functions in my copy. I haven't updated to the latest dev version of 5.1 in quite a while though, looks like my 5.1 is from mid July. I'll dig up the latest and try it with that.

Oh Christ...
I thought that the Stable 5 branch was on freeze - 5.1.0, stop - and that they were pushing updates only on the Master branch.
Facepalms ...how can one build a game/test mods if they don't put on freeze the stable releases? There will always be version mismatch. Sigh

Anyway, I have just checked my builtin\game\item.lua and the one on the repository, they are different. EDIT: I have double-checked, my item.lua and the one on the stable branch are the same.

Their version is this item.lua @410
Mine is:

function core.item_place(itemstack, placer, pointed_thing, param2)
	-- Call on_rightclick if the pointed node defines it
	if pointed_thing.type == "node" and placer and
			not placer:get_player_control().sneak then
		local n = core.get_node(pointed_thing.under)
		local nn = n.name
		if core.registered_nodes[nn] and core.registered_nodes[nn].on_rightclick then
			return core.registered_nodes[nn].on_rightclick(pointed_thing.under, n,
					placer, itemstack, pointed_thing) or itemstack, false
		end
	end

	if itemstack:get_definition().type == "node" then
		return core.item_place_node(itemstack, placer, pointed_thing, param2)
	end
	return itemstack
end

However, at this point - granted that I was actually using the switch on the wrong node - I don't know what to say: there will always be someone using some older/newer version of the engine.
Thus if the crash is engine-related you should not spend your time on it: 5.2-dev or 5.1-"stable" will always produce issues... I know that it should not be like this, but if the code keeps changing every week, well...

EDIT: I have double-checked, my item.lua and the one on the stable branch are the same.

@FaceDeer
Copy link
Member Author

I've managed to hack cross-version compatibility issues in my mods before, maybe I'll be able to manage it for this one too. I've got to leave the house for a few hours now but when I get back I'll try this out on the stable branch. I really want to repro that crash if at all possible, even if I can't work around it I can at least add a note about compatibility to the documentation and add an option to disable switches for versions it doesn't work on.

@FaceDeer
Copy link
Member Author

Well, I downloaded the 5.1.0 release from https://www.minetest.net/downloads/, and I confirmed that its item.lua line 410 matched your line 410. Sadly, no crash for me. So I'm going to try a few "this shouldn't be a problem but I'll try 'fixing' it anyway" touch-ups to the code as a hail Mary.

What OS are you using, by the way? I'm on Windows 10, I'm assuming from your screenshot you're on Linux? That makes me think perhaps there's a problem with how I'm writing out the switch linkage map to a file in the world persistence, I ran into a bug with something similar on commoditymarket that only manifested on Linux (I was using the wrong path separators and Windows was helpfully pretending I was using the right ones). That doesn't seem to be the problem here, but maybe there's some other OS-specific thing biting me. Unfortunately I don't have a Linux machine handy to test on.

@ghost
Copy link

ghost commented Dec 29, 2019

I have downloaded this:

https://github.com/minetest/minetest/archive/stable-5.zip

Then I've run this (copy-pasted from README.md @ 145)

sudo apt install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev

My Debian10 O.S. told me:

build-essential è già alla versione più recente (12.6).
zlib1g-dev è già alla versione più recente (1:1.2.11.dfsg-1).
libpng-dev è già alla versione più recente (1.6.36-6).
libxxf86vm-dev è già alla versione più recente (1:1.1.4-1+b2).
libgl1-mesa-dev è già alla versione più recente (18.3.6-2).
cmake è già alla versione più recente (3.13.4-1).
libgmp-dev è già alla versione più recente (2:6.1.2+dfsg-4).
libjpeg-dev è già alla versione più recente (1:1.5.2-2).
libbz2-dev è già alla versione più recente (1.0.6-9.2~deb10u1).
libsqlite3-dev è già alla versione più recente (3.27.2-3).
libogg-dev è già alla versione più recente (1.3.2-1+b1).
libvorbis-dev è già alla versione più recente (1.3.6-2).
libcurl4-gnutls-dev è già alla versione più recente (7.64.0-4).
libopenal-dev è già alla versione più recente (1:1.19.1-1).
libjsoncpp-dev è già alla versione più recente (1.7.4-3).
libfreetype6-dev è già alla versione più recente (2.9.1-3+deb10u1).
libirrlicht-dev è già alla versione più recente (1.8.4+dfsg1-1.1).
0 aggiornati, 0 installati, 0 da rimuovere e 0 non aggiornati.
utente@debian:~/minetest$

Translated: "Everything is already at its most recent version; 0 updated, 0 installed, 0 to remove and 0 outdated."

cmake . -DRUN_IN_PLACE=TRUE

utente@debian:~/minetest$ cmake . -DRUN_IN_PLACE=TRUE
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- *** Will build version 5.1.0 ***
-- Found Irrlicht: /usr/lib/x86_64-linux-gnu/libIrrlicht.so  
-- Using GMP provided by system.
-- Found GMP: /usr/lib/x86_64-linux-gnu/libgmp.so  
-- Using bundled JSONCPP library.
-- Could NOT find LuaJit (missing: LUA_LIBRARY LUA_INCLUDE_DIR) 
-- LuaJIT not found, using bundled Lua.
-- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so  
-- cURL support enabled.
-- Found GetText: /usr/include  
-- GetText enabled; locales found: be;ca;cs;da;de;dv;el;eo;es;et;fil;fr;he;hu;id;it;ja;ja_KS;jbo;kk;kn;ko;ky;lo;lt;ms;my;nb;nl;nn;pl;pt;pt_BR;ro;ru;sl;sr_Cyrl;sv;sw;th;tr;uk;vi;zh_CN;zh_TW
-- Found OpenAL: /usr/lib/x86_64-linux-gnu/libopenal.so  
-- Found VORBIS: /usr/include  
-- Sound enabled.
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.9.1") 
-- Freetype enabled.
-- Looking for cbreak in /usr/lib/x86_64-linux-gnu/libncursesw.so
-- Looking for cbreak in /usr/lib/x86_64-linux-gnu/libncursesw.so - found
-- Found Ncursesw: /usr/lib/x86_64-linux-gnu/libncursesw.so  
-- ncurses console enabled.
-- Could NOT find PostgreSQL (missing: PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR) 
-- PostgreSQL not found!
-- LevelDB not found!
-- Redis not found!
-- Found SQLite3: /usr/lib/x86_64-linux-gnu/libsqlite3.so  
-- SpatialIndex not found!
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (found version "62") 
-- Found BZip2: /usr/lib/x86_64-linux-gnu/libbz2.so (found version "1.0.6") 
-- Looking for BZ2_bzCompressInit
-- Looking for BZ2_bzCompressInit - found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.36") 
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Looking for include file endian.h
-- Looking for include file endian.h - found
-- Locale blacklist applied; Locales used: ca;cs;da;de;dv;el;eo;es;et;fil;fr;hu;id;it;ja;ja_KS;jbo;kk;kn;lo;lt;ms;my;nb;nl;nn;pl;pt;pt_BR;ro;ru;sl;sr_Cyrl;sv;sw;th;tr;uk;vi
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/utente/minetest
utente@debian:~/minetest$

make -j4

utente@debian:~/minetest$ make -j4
Scanning dependencies of target translations
Scanning dependencies of target jsoncpp
Scanning dependencies of target lua
Scanning dependencies of target GenerateVersion
[  1%] mo-update [vi]: Creating locale directory.
[  1%] Building CXX object lib/jsoncpp/CMakeFiles/jsoncpp.dir/jsoncpp.cpp.o
[  1%] Building C object lib/lua/build/CMakeFiles/lua.dir/lapi.o
[  1%] Built target GenerateVersion
[  2%] Building C object lib/lua/build/CMakeFiles/lua.dir/lauxlib.o
[  3%] mo-update [ca]: Creating locale directory.
[  3%] mo-update [cs]: Creating locale directory.
[  3%] mo-update [da]: Creating locale directory.
[  3%] mo-update [de]: Creating locale directory.
[  4%] mo-update [dv]: Creating locale directory.
[  4%] mo-update [el]: Creating locale directory.
[  4%] mo-update [eo]: Creating locale directory.
[  4%] mo-update [es]: Creating locale directory.
[  5%] mo-update [et]: Creating locale directory.
[  5%] mo-update [fil]: Creating locale directory.
[  5%] mo-update [fr]: Creating locale directory.
[  5%] mo-update [hu]: Creating locale directory.
[  6%] mo-update [id]: Creating locale directory.
[  6%] mo-update [it]: Creating locale directory.
[  6%] mo-update [ja]: Creating locale directory.
[  7%] mo-update [ja_KS]: Creating locale directory.
[  7%] mo-update [jbo]: Creating locale directory.
[  7%] mo-update [kk]: Creating locale directory.
[  7%] mo-update [kn]: Creating locale directory.
[  8%] mo-update [lo]: Creating locale directory.
[  8%] mo-update [lt]: Creating locale directory.
[  8%] mo-update [ms]: Creating locale directory.
[  8%] mo-update [my]: Creating locale directory.
[  9%] mo-update [nb]: Creating locale directory.
/home/utente/minetest/lib/lua/src/lauxlib.c: In function ‘luaL_loadfile’:
/home/utente/minetest/lib/lua/src/lauxlib.c:577:4: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
    while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ;
    ^~~~~
/home/utente/minetest/lib/lua/src/lauxlib.c:578:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
     lf.extraline = 0;
     ^~
[  9%] mo-update [nl]: Creating locale directory.
[  9%] mo-update [nn]: Creating locale directory.
[  9%] mo-update [pl]: Creating locale directory.
[ 10%] mo-update [pt]: Creating locale directory.
[ 10%] mo-update [pt_BR]: Creating locale directory.
[ 10%] mo-update [ro]: Creating locale directory.
[ 10%] mo-update [ru]: Creating locale directory.
[ 11%] mo-update [sl]: Creating locale directory.
[ 11%] mo-update [sr_Cyrl]: Creating locale directory.
[ 11%] mo-update [sv]: Creating locale directory.
[ 11%] mo-update [sw]: Creating locale directory.
[ 12%] mo-update [th]: Creating locale directory.
[ 12%] mo-update [tr]: Creating locale directory.
[ 12%] mo-update [uk]: Creating locale directory.
[ 12%] mo-update [vi]: Creating mo file.
[ 12%] mo-update [ca]: Creating mo file.
[ 13%] mo-update [cs]: Creating mo file.
[ 13%] mo-update [da]: Creating mo file.
[ 13%] mo-update [de]: Creating mo file.
[ 13%] mo-update [dv]: Creating mo file.
[ 14%] mo-update [el]: Creating mo file.
[ 14%] Building C object lib/lua/build/CMakeFiles/lua.dir/lbaselib.o
[ 14%] Building C object lib/lua/build/CMakeFiles/lua.dir/lcode.o
[ 14%] mo-update [eo]: Creating mo file.
[ 14%] mo-update [es]: Creating mo file.
[ 15%] mo-update [et]: Creating mo file.
[ 15%] mo-update [fil]: Creating mo file.
[ 15%] mo-update [fr]: Creating mo file.
[ 15%] mo-update [hu]: Creating mo file.
[ 16%] mo-update [id]: Creating mo file.
[ 16%] mo-update [it]: Creating mo file.
[ 16%] mo-update [ja]: Creating mo file.
[ 16%] mo-update [ja_KS]: Creating mo file.
[ 17%] mo-update [jbo]: Creating mo file.
[ 17%] Building C object lib/lua/build/CMakeFiles/lua.dir/ldblib.o
[ 17%] mo-update [kk]: Creating mo file.
[ 17%] mo-update [kn]: Creating mo file.
[ 17%] mo-update [lo]: Creating mo file.
[ 18%] mo-update [lt]: Creating mo file.
[ 18%] mo-update [ms]: Creating mo file.
[ 18%] mo-update [my]: Creating mo file.
[ 19%] Building C object lib/lua/build/CMakeFiles/lua.dir/ldebug.o
[ 19%] mo-update [nb]: Creating mo file.
/home/utente/minetest/lib/lua/src/ldebug.c: In function ‘symbexec’:
/home/utente/minetest/lib/lua/src/ldebug.c:268:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
 #define check(x)  if (!(x)) return 0;
                      ^
/home/utente/minetest/lib/lua/src/ldebug.c:272:26: note: in expansion of macro ‘check’
 #define checkreg(pt,reg) check((reg) < (pt)->maxstacksize)
                          ^~~~~
/home/utente/minetest/lib/lua/src/ldebug.c:414:9: note: in expansion of macro ‘checkreg’
         checkreg(pt, a+3);
         ^~~~~~~~
/home/utente/minetest/lib/lua/src/ldebug.c:416:7: note: here
       case OP_JMP: {
       ^~~~
[ 20%] mo-update [nl]: Creating mo file.
[ 20%] Building C object lib/lua/build/CMakeFiles/lua.dir/ldo.o
[ 20%] mo-update [nn]: Creating mo file.
[ 20%] mo-update [pl]: Creating mo file.
[ 20%] mo-update [pt]: Creating mo file.
[ 21%] mo-update [pt_BR]: Creating mo file.
[ 21%] mo-update [ro]: Creating mo file.
[ 21%] mo-update [ru]: Creating mo file.
[ 21%] Building C object lib/lua/build/CMakeFiles/lua.dir/ldump.o
[ 21%] Building C object lib/lua/build/CMakeFiles/lua.dir/lfunc.o
[ 22%] mo-update [sl]: Creating mo file.
[ 22%] mo-update [sr_Cyrl]: Creating mo file.
[ 23%] Building C object lib/lua/build/CMakeFiles/lua.dir/lgc.o
[ 23%] mo-update [sv]: Creating mo file.
[ 23%] Building C object lib/lua/build/CMakeFiles/lua.dir/linit.o
[ 23%] mo-update [sw]: Creating mo file.
[ 23%] Building C object lib/lua/build/CMakeFiles/lua.dir/liolib.o
[ 24%] mo-update [th]: Creating mo file.
[ 24%] mo-update [tr]: Creating mo file.
[ 24%] mo-update [uk]: Creating mo file.
[ 24%] mo update
[ 24%] Built target translations
[ 24%] Building C object lib/lua/build/CMakeFiles/lua.dir/llex.o
[ 25%] Building C object lib/lua/build/CMakeFiles/lua.dir/lmathlib.o
/home/utente/minetest/lib/lua/src/llex.c: In function ‘llex’:
/home/utente/minetest/lib/lua/src/llex.c:375:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
         else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/utente/minetest/lib/lua/src/llex.c:377:7: note: here
       case '=': {
       ^~~~
[ 25%] Building C object lib/lua/build/CMakeFiles/lua.dir/lmem.o
[ 25%] Building C object lib/lua/build/CMakeFiles/lua.dir/loadlib.o
/home/utente/minetest/lib/lua/src/loadlib.c: In function ‘ll_sym’:
/home/utente/minetest/lib/lua/src/loadlib.c:76:21: warning: ISO C forbids conversion of object pointer to function pointer type [-Wpedantic]
   lua_CFunction f = (lua_CFunction)dlsym(lib, sym);
                     ^
[ 25%] Building C object lib/lua/build/CMakeFiles/lua.dir/lobject.o
[ 26%] Building C object lib/lua/build/CMakeFiles/lua.dir/lopcodes.o
[ 26%] Building C object lib/lua/build/CMakeFiles/lua.dir/loslib.o
[ 26%] Building C object lib/lua/build/CMakeFiles/lua.dir/lparser.o
[ 26%] Building C object lib/lua/build/CMakeFiles/lua.dir/lstate.o
[ 27%] Building C object lib/lua/build/CMakeFiles/lua.dir/lstring.o
[ 27%] Building C object lib/lua/build/CMakeFiles/lua.dir/lstrlib.o
[ 27%] Building C object lib/lua/build/CMakeFiles/lua.dir/ltable.o
/home/utente/minetest/lib/lua/src/ltable.c: In function ‘luaH_get’:
/home/utente/minetest/lib/lua/src/ltable.c:473:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
     case LUA_TNUMBER: {
                       ^
/home/utente/minetest/lib/lua/src/ltable.c:481:5: note: here
     default: {
     ^~~~~~~
[ 28%] Building C object lib/lua/build/CMakeFiles/lua.dir/ltablib.o
/home/utente/minetest/lib/lua/src/ltablib.c: In function ‘addfield’:
/home/utente/minetest/lib/lua/src/ltablib.c:137:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   if (!lua_isstring(L, -1))
   ^~
/home/utente/minetest/lib/lua/src/ltablib.c:140:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
     luaL_addvalue(b);
     ^~~~~~~~~~~~~
[ 28%] Building C object lib/lua/build/CMakeFiles/lua.dir/ltm.o
[ 28%] Building C object lib/lua/build/CMakeFiles/lua.dir/lundump.o
[ 28%] Building C object lib/lua/build/CMakeFiles/lua.dir/lvm.o
[ 29%] Building C object lib/lua/build/CMakeFiles/lua.dir/lzio.o
[ 29%] Linking C static library liblua.a
[ 29%] Built target lua
[ 29%] Linking CXX static library libjsoncpp.a
[ 29%] Built target jsoncpp
Scanning dependencies of target minetest
[ 29%] Building CXX object src/CMakeFiles/minetest.dir/client/activeobjectmgr.cpp.o
[ 29%] Building CXX object src/CMakeFiles/minetest.dir/client/camera.cpp.o
[ 29%] Building CXX object src/CMakeFiles/minetest.dir/client/clientenvironment.cpp.o
[ 30%] Building CXX object src/CMakeFiles/minetest.dir/client/client.cpp.o
[ 30%] Building CXX object src/CMakeFiles/minetest.dir/client/clientlauncher.cpp.o
[ 30%] Building CXX object src/CMakeFiles/minetest.dir/client/clientmap.cpp.o
[ 31%] Building CXX object src/CMakeFiles/minetest.dir/client/clientmedia.cpp.o
[ 31%] Building CXX object src/CMakeFiles/minetest.dir/client/clientobject.cpp.o
[ 31%] Building CXX object src/CMakeFiles/minetest.dir/client/clouds.cpp.o
[ 31%] Building CXX object src/CMakeFiles/minetest.dir/client/content_cao.cpp.o
[ 32%] Building CXX object src/CMakeFiles/minetest.dir/client/content_cso.cpp.o
[ 32%] Building CXX object src/CMakeFiles/minetest.dir/client/content_mapblock.cpp.o
[ 32%] Building CXX object src/CMakeFiles/minetest.dir/client/filecache.cpp.o
[ 32%] Building CXX object src/CMakeFiles/minetest.dir/client/fontengine.cpp.o
[ 33%] Building CXX object src/CMakeFiles/minetest.dir/client/game.cpp.o
[ 33%] Building CXX object src/CMakeFiles/minetest.dir/client/gameui.cpp.o
[ 33%] Building CXX object src/CMakeFiles/minetest.dir/client/guiscalingfilter.cpp.o
[ 34%] Building CXX object src/CMakeFiles/minetest.dir/client/hud.cpp.o
[ 34%] Building CXX object src/CMakeFiles/minetest.dir/client/imagefilters.cpp.o
[ 34%] Building CXX object src/CMakeFiles/minetest.dir/client/inputhandler.cpp.o
[ 34%] Building CXX object src/CMakeFiles/minetest.dir/client/joystick_controller.cpp.o
[ 35%] Building CXX object src/CMakeFiles/minetest.dir/client/keycode.cpp.o
[ 35%] Building CXX object src/CMakeFiles/minetest.dir/client/localplayer.cpp.o
[ 35%] Building CXX object src/CMakeFiles/minetest.dir/client/mapblock_mesh.cpp.o
[ 35%] Building CXX object src/CMakeFiles/minetest.dir/client/mesh.cpp.o
[ 36%] Building CXX object src/CMakeFiles/minetest.dir/client/mesh_generator_thread.cpp.o
[ 36%] Building CXX object src/CMakeFiles/minetest.dir/client/meshgen/collector.cpp.o
[ 36%] Building CXX object src/CMakeFiles/minetest.dir/client/minimap.cpp.o
[ 36%] Building CXX object src/CMakeFiles/minetest.dir/client/particles.cpp.o
[ 37%] Building CXX object src/CMakeFiles/minetest.dir/client/render/anaglyph.cpp.o
[ 37%] Building CXX object src/CMakeFiles/minetest.dir/client/render/core.cpp.o
[ 37%] Building CXX object src/CMakeFiles/minetest.dir/client/render/factory.cpp.o
[ 37%] Building CXX object src/CMakeFiles/minetest.dir/client/render/interlaced.cpp.o
[ 38%] Building CXX object src/CMakeFiles/minetest.dir/client/render/pageflip.cpp.o
[ 38%] Building CXX object src/CMakeFiles/minetest.dir/client/render/plain.cpp.o
[ 38%] Building CXX object src/CMakeFiles/minetest.dir/client/render/sidebyside.cpp.o
[ 38%] Building CXX object src/CMakeFiles/minetest.dir/client/render/stereo.cpp.o
[ 39%] Building CXX object src/CMakeFiles/minetest.dir/client/renderingengine.cpp.o
[ 39%] Building CXX object src/CMakeFiles/minetest.dir/client/shader.cpp.o
[ 39%] Building CXX object src/CMakeFiles/minetest.dir/client/sky.cpp.o
[ 40%] Building CXX object src/CMakeFiles/minetest.dir/client/sound.cpp.o
[ 40%] Building CXX object src/CMakeFiles/minetest.dir/client/sound_openal.cpp.o
[ 40%] Building CXX object src/CMakeFiles/minetest.dir/client/tile.cpp.o
[ 40%] Building CXX object src/CMakeFiles/minetest.dir/client/wieldmesh.cpp.o
[ 41%] Building CXX object src/CMakeFiles/minetest.dir/content/content.cpp.o
[ 41%] Building CXX object src/CMakeFiles/minetest.dir/content/mods.cpp.o
[ 41%] Building CXX object src/CMakeFiles/minetest.dir/content/packages.cpp.o
[ 41%] Building CXX object src/CMakeFiles/minetest.dir/content/subgames.cpp.o
[ 42%] Building CXX object src/CMakeFiles/minetest.dir/database/database-dummy.cpp.o
[ 42%] Building CXX object src/CMakeFiles/minetest.dir/database/database-files.cpp.o
[ 42%] Building CXX object src/CMakeFiles/minetest.dir/database/database-leveldb.cpp.o
[ 42%] Building CXX object src/CMakeFiles/minetest.dir/database/database-postgresql.cpp.o
[ 43%] Building CXX object src/CMakeFiles/minetest.dir/database/database-redis.cpp.o
[ 43%] Building CXX object src/CMakeFiles/minetest.dir/database/database-sqlite3.cpp.o
[ 43%] Building CXX object src/CMakeFiles/minetest.dir/database/database.cpp.o
[ 43%] Building CXX object src/CMakeFiles/minetest.dir/gui/guiButton.cpp.o
[ 44%] Building CXX object src/CMakeFiles/minetest.dir/gui/guiChatConsole.cpp.o
[ 44%] Building CXX object src/CMakeFiles/minetest.dir/gui/guiConfirmRegistration.cpp.o
[ 44%] Building CXX object src/CMakeFiles/minetest.dir/gui/guiEditBoxWithScrollbar.cpp.o
[ 44%] Building CXX object src/CMakeFiles/minetest.dir/gui/guiEngine.cpp.o
[ 45%] Building CXX object src/CMakeFiles/minetest.dir/gui/guiFormSpecMenu.cpp.o
[ 45%] Building CXX object src/CMakeFiles/minetest.dir/gui/guiKeyChangeMenu.cpp.o
[ 45%] Building CXX object src/CMakeFiles/minetest.dir/gui/guiPasswordChange.cpp.o
[ 46%] Building CXX object src/CMakeFiles/minetest.dir/gui/guiPathSelectMenu.cpp.o
[ 46%] Building CXX object src/CMakeFiles/minetest.dir/gui/guiScrollBar.cpp.o
[ 46%] Building CXX object src/CMakeFiles/minetest.dir/gui/guiSkin.cpp.o
[ 46%] Building CXX object src/CMakeFiles/minetest.dir/gui/guiTable.cpp.o
[ 47%] Building CXX object src/CMakeFiles/minetest.dir/gui/guiVolumeChange.cpp.o
[ 47%] Building CXX object src/CMakeFiles/minetest.dir/gui/intlGUIEditBox.cpp.o
[ 47%] Building CXX object src/CMakeFiles/minetest.dir/gui/modalMenu.cpp.o
[ 47%] Building CXX object src/CMakeFiles/minetest.dir/gui/profilergraph.cpp.o
[ 48%] Building CXX object src/CMakeFiles/minetest.dir/irrlicht_changes/CGUITTFont.cpp.o
[ 48%] Building CXX object src/CMakeFiles/minetest.dir/irrlicht_changes/static_text.cpp.o
[ 48%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/cavegen.cpp.o
[ 48%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/dungeongen.cpp.o
[ 49%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/mapgen.cpp.o
[ 49%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/mapgen_carpathian.cpp.o
[ 49%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/mapgen_flat.cpp.o
[ 49%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/mapgen_fractal.cpp.o
[ 50%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/mapgen_singlenode.cpp.o
[ 50%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/mapgen_v5.cpp.o
[ 50%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/mapgen_v6.cpp.o
[ 50%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/mapgen_v7.cpp.o
[ 51%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/mapgen_valleys.cpp.o
[ 51%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/mg_biome.cpp.o
[ 51%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/mg_decoration.cpp.o
[ 51%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/mg_ore.cpp.o
[ 52%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/mg_schematic.cpp.o
[ 52%] Building CXX object src/CMakeFiles/minetest.dir/mapgen/treegen.cpp.o
[ 52%] Building CXX object src/CMakeFiles/minetest.dir/network/address.cpp.o
[ 53%] Building CXX object src/CMakeFiles/minetest.dir/network/clientopcodes.cpp.o
[ 53%] Building CXX object src/CMakeFiles/minetest.dir/network/clientpackethandler.cpp.o
[ 53%] Building CXX object src/CMakeFiles/minetest.dir/network/connection.cpp.o
[ 53%] Building CXX object src/CMakeFiles/minetest.dir/network/connectionthreads.cpp.o
[ 54%] Building CXX object src/CMakeFiles/minetest.dir/network/networkpacket.cpp.o
[ 54%] Building CXX object src/CMakeFiles/minetest.dir/network/serveropcodes.cpp.o
[ 54%] Building CXX object src/CMakeFiles/minetest.dir/network/serverpackethandler.cpp.o
[ 54%] Building CXX object src/CMakeFiles/minetest.dir/network/socket.cpp.o
[ 55%] Building CXX object src/CMakeFiles/minetest.dir/script/common/c_content.cpp.o
[ 55%] Building CXX object src/CMakeFiles/minetest.dir/script/common/c_converter.cpp.o
[ 55%] Building CXX object src/CMakeFiles/minetest.dir/script/common/c_internal.cpp.o
[ 55%] Building CXX object src/CMakeFiles/minetest.dir/script/common/c_types.cpp.o
[ 56%] Building CXX object src/CMakeFiles/minetest.dir/script/common/helper.cpp.o
[ 56%] Building CXX object src/CMakeFiles/minetest.dir/script/cpp_api/s_async.cpp.o
[ 56%] Building CXX object src/CMakeFiles/minetest.dir/script/cpp_api/s_base.cpp.o
[ 56%] Building CXX object src/CMakeFiles/minetest.dir/script/cpp_api/s_client.cpp.o
[ 57%] Building CXX object src/CMakeFiles/minetest.dir/script/cpp_api/s_entity.cpp.o
[ 57%] Building CXX object src/CMakeFiles/minetest.dir/script/cpp_api/s_env.cpp.o
[ 57%] Building CXX object src/CMakeFiles/minetest.dir/script/cpp_api/s_inventory.cpp.o
[ 57%] Building CXX object src/CMakeFiles/minetest.dir/script/cpp_api/s_item.cpp.o
[ 58%] Building CXX object src/CMakeFiles/minetest.dir/script/cpp_api/s_mainmenu.cpp.o
[ 58%] Building CXX object src/CMakeFiles/minetest.dir/script/cpp_api/s_modchannels.cpp.o
[ 58%] Building CXX object src/CMakeFiles/minetest.dir/script/cpp_api/s_node.cpp.o
[ 59%] Building CXX object src/CMakeFiles/minetest.dir/script/cpp_api/s_nodemeta.cpp.o
[ 59%] Building CXX object src/CMakeFiles/minetest.dir/script/cpp_api/s_player.cpp.o
[ 59%] Building CXX object src/CMakeFiles/minetest.dir/script/cpp_api/s_security.cpp.o
[ 59%] Building CXX object src/CMakeFiles/minetest.dir/script/cpp_api/s_server.cpp.o
[ 60%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_areastore.cpp.o
[ 60%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_auth.cpp.o
[ 60%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_base.cpp.o
[ 60%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_camera.cpp.o
[ 61%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_client.cpp.o
[ 61%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_craft.cpp.o
[ 61%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_env.cpp.o
[ 61%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_http.cpp.o
[ 62%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_inventory.cpp.o
[ 62%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_item.cpp.o
[ 62%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_itemstackmeta.cpp.o
[ 62%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_localplayer.cpp.o
[ 63%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_mainmenu.cpp.o
[ 63%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_mapgen.cpp.o
[ 63%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_metadata.cpp.o
[ 63%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_minimap.cpp.o
[ 64%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_modchannels.cpp.o
[ 64%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_nodemeta.cpp.o
[ 64%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_nodetimer.cpp.o
[ 65%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_noise.cpp.o
[ 65%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_object.cpp.o
[ 65%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_particles.cpp.o
[ 65%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_particles_local.cpp.o
[ 66%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_playermeta.cpp.o
[ 66%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_rollback.cpp.o
[ 66%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_server.cpp.o
[ 66%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_settings.cpp.o
[ 67%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_sound.cpp.o
[ 67%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_storage.cpp.o
[ 67%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_util.cpp.o
[ 67%] Building CXX object src/CMakeFiles/minetest.dir/script/lua_api/l_vmanip.cpp.o
[ 68%] Building CXX object src/CMakeFiles/minetest.dir/script/scripting_client.cpp.o
[ 68%] Building CXX object src/CMakeFiles/minetest.dir/script/scripting_mainmenu.cpp.o
[ 68%] Building CXX object src/CMakeFiles/minetest.dir/script/scripting_server.cpp.o
[ 68%] Building CXX object src/CMakeFiles/minetest.dir/server/activeobjectmgr.cpp.o
[ 69%] Building CXX object src/CMakeFiles/minetest.dir/server/mods.cpp.o
[ 69%] Building CXX object src/CMakeFiles/minetest.dir/threading/event.cpp.o
[ 69%] Building CXX object src/CMakeFiles/minetest.dir/threading/semaphore.cpp.o
[ 69%] Building CXX object src/CMakeFiles/minetest.dir/threading/thread.cpp.o
[ 70%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test.cpp.o
[ 70%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_activeobject.cpp.o
[ 70%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_address.cpp.o
[ 71%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_areastore.cpp.o
[ 71%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_authdatabase.cpp.o
[ 71%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_ban.cpp.o
[ 71%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_clientactiveobjectmgr.cpp.o
[ 72%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_collision.cpp.o
[ 72%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_compression.cpp.o
[ 72%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_connection.cpp.o
[ 72%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_eventmanager.cpp.o
[ 73%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_filepath.cpp.o
[ 73%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_gameui.cpp.o
[ 73%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_inventory.cpp.o
[ 73%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_irrptr.cpp.o
[ 74%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_keycode.cpp.o
[ 74%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_map_settings_manager.cpp.o
[ 74%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_mapnode.cpp.o
[ 74%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_modchannels.cpp.o
[ 75%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_nodedef.cpp.o
[ 75%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_noderesolver.cpp.o
[ 75%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_noise.cpp.o
[ 75%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_objdef.cpp.o
[ 76%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_profiler.cpp.o
[ 76%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_player.cpp.o
[ 76%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_random.cpp.o
[ 76%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_schematic.cpp.o
[ 77%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_serialization.cpp.o
[ 77%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_server_shutdown_state.cpp.o
[ 77%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_serveractiveobjectmgr.cpp.o
[ 78%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_servermodmanager.cpp.o
[ 78%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_settings.cpp.o
[ 78%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_socket.cpp.o
[ 78%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_threading.cpp.o
[ 79%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_utilities.cpp.o
[ 79%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_voxelalgorithms.cpp.o
[ 79%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_voxelarea.cpp.o
[ 79%] Building CXX object src/CMakeFiles/minetest.dir/unittest/test_voxelmanipulator.cpp.o
[ 80%] Building CXX object src/CMakeFiles/minetest.dir/util/areastore.cpp.o
[ 80%] Building CXX object src/CMakeFiles/minetest.dir/util/auth.cpp.o
[ 80%] Building CXX object src/CMakeFiles/minetest.dir/util/base64.cpp.o
[ 80%] Building CXX object src/CMakeFiles/minetest.dir/util/directiontables.cpp.o
[ 81%] Building CXX object src/CMakeFiles/minetest.dir/util/enriched_string.cpp.o
[ 81%] Building CXX object src/CMakeFiles/minetest.dir/util/ieee_float.cpp.o
[ 81%] Building CXX object src/CMakeFiles/minetest.dir/util/numeric.cpp.o
[ 81%] Building CXX object src/CMakeFiles/minetest.dir/util/pointedthing.cpp.o
[ 82%] Building CXX object src/CMakeFiles/minetest.dir/util/quicktune.cpp.o
[ 82%] Building CXX object src/CMakeFiles/minetest.dir/util/serialize.cpp.o
[ 82%] Building CXX object src/CMakeFiles/minetest.dir/util/sha1.cpp.o
[ 82%] Building C object src/CMakeFiles/minetest.dir/util/sha256.c.o
[ 83%] Building CXX object src/CMakeFiles/minetest.dir/util/srp.cpp.o
In function ‘SRP_Result H_ns(__mpz_struct*, SRP_HashAlgorithm, const unsigned char*, size_t, const unsigned char*, uint32_t)’,
    inlined from ‘int calculate_x(__mpz_struct*, SRP_HashAlgorithm, const unsigned char*, size_t, const char*, const unsigned char*, size_t)’ at /home/utente/minetest/src/util/srp.cpp:455:13:
/home/utente/minetest/src/util/srp.cpp:432:8: warning: ‘void* memcpy(void*, const void*, size_t)’ forming offset [65, 4294967295] is out of the bounds [0, 64] of object ‘ucp_hash’ with type ‘unsigned char [64]’ [-Warray-bounds]
  memcpy(bin + len_n, bytes, len_bytes);
  ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/utente/minetest/src/util/srp.cpp: In function ‘int calculate_x(__mpz_struct*, SRP_HashAlgorithm, const unsigned char*, size_t, const char*, const unsigned char*, size_t)’:
/home/utente/minetest/src/util/srp.cpp:443:16: note: ‘ucp_hash’ declared here
  unsigned char ucp_hash[SHA512_DIGEST_LENGTH];
                ^~~~~~~~
[ 83%] Building CXX object src/CMakeFiles/minetest.dir/util/string.cpp.o
[ 83%] Building CXX object src/CMakeFiles/minetest.dir/util/timetaker.cpp.o
[ 84%] Building CXX object src/CMakeFiles/minetest.dir/ban.cpp.o
[ 84%] Building CXX object src/CMakeFiles/minetest.dir/chat.cpp.o
[ 84%] Building CXX object src/CMakeFiles/minetest.dir/clientiface.cpp.o
[ 84%] Building CXX object src/CMakeFiles/minetest.dir/collision.cpp.o
[ 85%] Building CXX object src/CMakeFiles/minetest.dir/content_mapnode.cpp.o
[ 85%] Building CXX object src/CMakeFiles/minetest.dir/content_nodemeta.cpp.o
[ 85%] Building CXX object src/CMakeFiles/minetest.dir/content_sao.cpp.o
[ 85%] Building CXX object src/CMakeFiles/minetest.dir/convert_json.cpp.o
[ 86%] Building CXX object src/CMakeFiles/minetest.dir/craftdef.cpp.o
[ 86%] Building CXX object src/CMakeFiles/minetest.dir/debug.cpp.o
[ 86%] Building CXX object src/CMakeFiles/minetest.dir/defaultsettings.cpp.o
[ 86%] Building CXX object src/CMakeFiles/minetest.dir/emerge.cpp.o
[ 87%] Building CXX object src/CMakeFiles/minetest.dir/environment.cpp.o
[ 87%] Building CXX object src/CMakeFiles/minetest.dir/face_position_cache.cpp.o
[ 87%] Building CXX object src/CMakeFiles/minetest.dir/filesys.cpp.o
[ 87%] Building CXX object src/CMakeFiles/minetest.dir/genericobject.cpp.o
[ 88%] Building CXX object src/CMakeFiles/minetest.dir/gettext.cpp.o
[ 88%] Building CXX object src/CMakeFiles/minetest.dir/httpfetch.cpp.o
[ 88%] Building CXX object src/CMakeFiles/minetest.dir/hud.cpp.o
[ 88%] Building CXX object src/CMakeFiles/minetest.dir/inventory.cpp.o
[ 89%] Building CXX object src/CMakeFiles/minetest.dir/inventorymanager.cpp.o
[ 89%] Building CXX object src/CMakeFiles/minetest.dir/itemdef.cpp.o
[ 89%] Building CXX object src/CMakeFiles/minetest.dir/itemstackmetadata.cpp.o
[ 90%] Building CXX object src/CMakeFiles/minetest.dir/light.cpp.o
[ 90%] Building CXX object src/CMakeFiles/minetest.dir/log.cpp.o
[ 90%] Building CXX object src/CMakeFiles/minetest.dir/main.cpp.o
[ 90%] Building CXX object src/CMakeFiles/minetest.dir/map.cpp.o
[ 91%] Building CXX object src/CMakeFiles/minetest.dir/map_settings_manager.cpp.o
[ 91%] Building CXX object src/CMakeFiles/minetest.dir/mapblock.cpp.o
[ 91%] Building CXX object src/CMakeFiles/minetest.dir/mapnode.cpp.o
[ 91%] Building CXX object src/CMakeFiles/minetest.dir/mapsector.cpp.o
[ 92%] Building CXX object src/CMakeFiles/minetest.dir/metadata.cpp.o
[ 92%] Building CXX object src/CMakeFiles/minetest.dir/modchannels.cpp.o
[ 92%] Building CXX object src/CMakeFiles/minetest.dir/nameidmapping.cpp.o
[ 92%] Building CXX object src/CMakeFiles/minetest.dir/nodedef.cpp.o
[ 93%] Building CXX object src/CMakeFiles/minetest.dir/nodemetadata.cpp.o
[ 93%] Building CXX object src/CMakeFiles/minetest.dir/nodetimer.cpp.o
[ 93%] Building CXX object src/CMakeFiles/minetest.dir/noise.cpp.o
/home/utente/minetest/src/noise.cpp: In constructor ‘Noise::Noise(NoiseParams*, irr::s32, irr::u32, irr::u32, irr::u32)’:
/home/utente/minetest/src/noise.cpp:432:29: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘struct NoiseParams’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
  memcpy(&np, np_, sizeof(np));
                             ^
In file included from /home/utente/minetest/src/noise.cpp:27:
/home/utente/minetest/src/noise.h:103:8: note: ‘struct NoiseParams’ declared here
 struct NoiseParams {
        ^~~~~~~~~~~
[ 93%] Building CXX object src/CMakeFiles/minetest.dir/objdef.cpp.o
[ 94%] Building CXX object src/CMakeFiles/minetest.dir/object_properties.cpp.o
[ 94%] Building CXX object src/CMakeFiles/minetest.dir/pathfinder.cpp.o
[ 94%] Building CXX object src/CMakeFiles/minetest.dir/player.cpp.o
[ 94%] Building CXX object src/CMakeFiles/minetest.dir/porting.cpp.o
[ 95%] Building CXX object src/CMakeFiles/minetest.dir/profiler.cpp.o
[ 95%] Building CXX object src/CMakeFiles/minetest.dir/raycast.cpp.o
[ 95%] Building CXX object src/CMakeFiles/minetest.dir/reflowscan.cpp.o
[ 96%] Building CXX object src/CMakeFiles/minetest.dir/remoteplayer.cpp.o
[ 96%] Building CXX object src/CMakeFiles/minetest.dir/rollback.cpp.o
[ 96%] Building CXX object src/CMakeFiles/minetest.dir/rollback_interface.cpp.o
[ 96%] Building CXX object src/CMakeFiles/minetest.dir/serialization.cpp.o
[ 97%] Building CXX object src/CMakeFiles/minetest.dir/server.cpp.o
[ 97%] Building CXX object src/CMakeFiles/minetest.dir/serverenvironment.cpp.o
[ 97%] Building CXX object src/CMakeFiles/minetest.dir/serverlist.cpp.o
[ 97%] Building CXX object src/CMakeFiles/minetest.dir/serverobject.cpp.o
[ 98%] Building CXX object src/CMakeFiles/minetest.dir/settings.cpp.o
[ 98%] Building CXX object src/CMakeFiles/minetest.dir/staticobject.cpp.o
[ 98%] Building CXX object src/CMakeFiles/minetest.dir/terminal_chat_console.cpp.o
[ 98%] Building CXX object src/CMakeFiles/minetest.dir/tileanimation.cpp.o
[ 99%] Building CXX object src/CMakeFiles/minetest.dir/tool.cpp.o
[ 99%] Building CXX object src/CMakeFiles/minetest.dir/translation.cpp.o
[ 99%] Building CXX object src/CMakeFiles/minetest.dir/version.cpp.o
[ 99%] Building CXX object src/CMakeFiles/minetest.dir/voxel.cpp.o
[100%] Building CXX object src/CMakeFiles/minetest.dir/voxelalgorithms.cpp.o
[100%] Linking CXX executable ../bin/minetest
[100%] Built target minetest
utente@debian:~/minetest$ 

Then I have downloaded this:

https://github.com/minetest/minetest_game/archive/stable-5.zip

And placed it into /home/utente/minetest/games/

And then I've downloaded this:

https://github.com/minetest-mods/castle_gates/archive/switches.zip

Inclusive of eb34743

And placed it into /home/utente/minetest/mods/

I've built this:

test1

When I right clicked the switch, it sent a chat message: "Gate triggered", the gate didn't moved, I've right-clicked the switch again and it crashed dumping this:

2019-12-29 13:28:07: ACTION[Server]: singleplayer [127.0.0.1] joins game. 
2019-12-29 13:28:07: ACTION[Server]: singleplayer joins game. List of players: singleplayer
2019-12-29 13:28:54: ACTION[Server]: singleplayer takes default:brick from creative inventory
2019-12-29 13:29:04: ACTION[Server]: singleplayer takes castle_gates:wood_gate_hinge from creative inventory
2019-12-29 13:29:07: ACTION[Server]: singleplayer takes castle_gates:switch from creative inventory
2019-12-29 13:29:12: ACTION[Server]: singleplayer takes castle_gates:linkage from creative inventory
2019-12-29 13:29:15: ACTION[Server]: singleplayer places node default:brick at (322,18,-192)
2019-12-29 13:29:16: ACTION[Server]: singleplayer places node default:brick at (322,18,-194)
2019-12-29 13:29:19: ACTION[Server]: singleplayer places node castle_gates:wood_gate_hinge at (322,18,-193)
2019-12-29 13:29:19: ACTION[Server]: facedir: 1
2019-12-29 13:29:22: ACTION[Server]: singleplayer places node castle_gates:switch at (322,19,-192)
2019-12-29 13:29:22: ACTION[Server]: facedir: 1
2019-12-29 13:29:24: ACTION[Server]: singleplayer uses castle_gates:linkage, pointing at [node under=322,19,-192 above=322,20,-192]
2019-12-29 13:29:26: ACTION[Server]: singleplayer uses castle_gates:linkage, pointing at [node under=322,18,-193 above=321,18,-193]
2019-12-29 13:29:26: ACTION[Server]: singleplayer added a link from a switch at (322,19,-192) to a gate at (322,18,-193)
2019-12-29 13:30:19: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'default' in callback item_OnPlace(): invalid key to 'next'
2019-12-29 13:30:19: ERROR[Main]: stack traceback:
2019-12-29 13:30:19: ERROR[Main]: 	[C]: in function '(for generator)'
2019-12-29 13:30:19: ERROR[Main]: 	.../utente/minetest/bin/../mods/castle_gates/switch.lua:209: in function 'trigger_switch'
2019-12-29 13:30:19: ERROR[Main]: 	.../utente/minetest/bin/../mods/castle_gates/switch.lua:251: in function 'on_rightclick'
2019-12-29 13:30:19: ERROR[Main]: 	/home/utente/minetest/bin/../builtin/game/item.lua:417: in function </home/utente/minetest/bin/../builtin/game/item.lua:410>
2019-12-29 13:30:19: ERROR[Main]: 	(tail call): ?
2019-12-29 13:30:19: ACTION[Server]: singleplayer leaves game. List of players: 
2019-12-29 13:30:19: ACTION[Main]: Server: Shutting down

When I relogged, the gate was open:

test2

Only God knows.

@FaceDeer
Copy link
Member Author

There actually is a useful bit of new information here; the fact that the switch reported "gate triggered" and did nothing the very first time the gate was triggered tells me that the switch code itself may not be the source of the crash. Not directly, anyway. As I mentioned in an earlier comment there's a known issue in this mod where the very first time you trigger a gate after it has been built will do nothing because the gate uses that opportunity to figure out what direction it's supposed to open in. So that tells me the switch went through its correct sequence of operation and sent the gate a "trigger now" command without crashing.

Then, the gate actually moved one step before the game crashed. That's useful information too. Down at the very bottom of the gate_functions.lua file there's some code wrapped in "if door_moved then" that's the code responsible for having a gate continue to move after it's been triggered. What it essentially does is call minetest.after() to do a one-second-delayed re-triggering of the gate to make it move again. So something goes wrong before minetest.after is able to trigger the gate a second time, or possibly during the second triggering (though not very far into the second triggering, since one of the very first things that triggering the gate does is erase the gate's existing nodes from the world).

The callstack still seems weird, though. It definitely implicates switch.lua somehow.

Hm... I'm still at a loss here. I think my best bet is to take this question to the forums to get a wider audience to help me troubleshoot this since I've no way of reproducing this for myself. I'll write it up later tonight and post an update here with a link when I've done so.

Thank you for going to such lengths to help me try to figure this out. It's frustrating to be so seemingly close to being able to merge this, but less frustrating than if I'd gone ahead and merged it and then been sent baffling bugs about it crashing this way. :)

@ghost
Copy link

ghost commented Dec 30, 2019

You're welcome! :)

I did some more screenshots to confirm the dynamic that you have described:

After crash:

test_switch

Relinking:

test_switch2

After the new crash:

test_switch3

What about filling the code of debugging statements?
print("step 1")
print("step 2")
print("step 3")
etc.

To narrow the suspected area, nail the point actually causing the crash and then check it for every possible error; maybe it's just a type mismatch, something so simple that one would never think about it.

@FaceDeer
Copy link
Member Author

I just submitted a change that adds a ton of debugging log statements to both the trigger_gate and trigger_switch sides of things, if nothing else it'll help narrow down exactly which chunk of code is crashing.

Haven't posted to the forum yet, I got waylaid last night with an idea for commoditymarket. :)

@ghost
Copy link

ghost commented Dec 30, 2019

Cool, I've tested it with the same building and here is the log:

2019-12-30 18:26:14: [Server]: castle_gates debugging: trigger_switch_with_sound
2019-12-30 18:26:14: [Server]: castle_gates debugging: triggering switch
2019-12-30 18:26:14: [Server]: castle_gates debugging: removed hud for player singleplayer
2019-12-30 18:26:15: ACTION[Server]: singleplayer uses castle_gates:linkage, pointing at [node under=322,19,-192 above=322,19,-193]
2019-12-30 18:26:15: [Server]: castle_gates debugging: linkage tool has a recorded switch at (322,19,-192)
2019-12-30 18:26:15: [Server]: castle_gates debugging: showing/updating hud for player singleplayer
2019-12-30 18:26:16: ACTION[Server]: singleplayer uses castle_gates:linkage, pointing at [node under=321,18,-193 above=321,18,-194]
2019-12-30 18:26:16: [Server]: castle_gates debugging: linkage tool has a recorded switch at (322,19,-192)
2019-12-30 18:26:16: [Server]: castle_gates debugging: showing/updating hud for player singleplayer
2019-12-30 18:26:16: [Server]: castle_gates debugging: delayed save switch data call
2019-12-30 18:26:16: ACTION[Server]: singleplayer added a link from a switch at (322,19,-192) to a gate at (321,18,-193)
2019-12-30 18:26:16: [Server]: castle_gates debugging: wrote to /home/utente/minetest/bin/../worlds/CastleGates/castle_gates_switch_map.lua
2019-12-30 18:26:16: [Server]: castle_gates debugging: closed /home/utente/minetest/bin/../worlds/CastleGates/castle_gates_switch_map.lua
2019-12-30 18:26:19: [Server]: castle_gates debugging: trigger_switch_with_sound
2019-12-30 18:26:19: [Server]: castle_gates debugging: triggering switch
2019-12-30 18:26:19: [Server]: castle_gates debugging: removed hud for player singleplayer
2019-12-30 18:26:19: [Server]: castle_gates debugging: switch is triggering gate node castle_gates:wood_gate_hinge at (321,18,-193)
2019-12-30 18:26:19: [Server]: castle_gates debugging: trigger_gate called
2019-12-30 18:26:19: [Server]: castle_gates debugging: getting door layout for (321,18,-193)
2019-12-30 18:26:19: [Server]: castle_gates debugging: door layout node reading finished
2019-12-30 18:26:19: [Server]: castle_gates debugging: rotating door
2019-12-30 18:26:19: [Server]: castle_gates debugging: finished door layout: {
	contains_protected_node = false,
	hinge = {
		placement = {
			y = 18,
			x = 321.5,
			z = -192.5
		},
		axis = "y"
	},
	swings = {
		true,
		[-1] = true
	},
	all = {
		[1.3991070836358e+14] = {
			param1 = 14,
			name = "castle_gates:wood_gate_hinge",
			param2 = 2
		}
	},
	previous_move = "widdershins",
	directions = {
		top = {
			y = 1,
			x = 0,
			z = 0
		},
		front = {
			y = -0,
			x = -0,
			z = 1
		},
		bottom = {
			y = -1,
			x = -0,
			z = -0
		},
		right = {
			y = 0,
			x = -1,
			z = 0
		},
		left = {
			y = -0,
			x = 1,
			z = -0
		},
		back = {
			y = 0,
			x = 0,
			z = -1
		}
	}
}
2019-12-30 18:26:19: [Server]: castle_gates debugging: cleared gate nodes
2019-12-30 18:26:19: [Server]: castle_gates debugging: rotating gate to new position
2019-12-30 18:26:19: [Server]: castle_gates debugging: update switch map location from (321,18,-193) to (322,18,-193)
2019-12-30 18:26:19: [Server]: castle_gates debugging: delayed save switch data call
2019-12-30 18:26:19: [Server]: castle_gates debugging: writing new gate nodes
2019-12-30 18:26:19: [Server]: castle_gates debugging: writing node castle_gates:wood_gate_hinge at (322,18,-193)
2019-12-30 18:26:19: [Server]: castle_gates debugging: door moved. Preparing to re-trigger
2019-12-30 18:26:19: [Server]: castle_gates debugging: calling minetest.after
2019-12-30 18:26:19: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'default' in callback item_OnPlace(): invalid key to 'next'
2019-12-30 18:26:19: ERROR[Main]: stack traceback:
2019-12-30 18:26:19: ERROR[Main]: 	[C]: in function '(for generator)'
2019-12-30 18:26:19: ERROR[Main]: 	.../utente/minetest/bin/../mods/castle_gates/switch.lua:223: in function 'trigger_switch'
2019-12-30 18:26:19: ERROR[Main]: 	.../utente/minetest/bin/../mods/castle_gates/switch.lua:270: in function 'on_rightclick'
2019-12-30 18:26:19: ERROR[Main]: 	/home/utente/minetest/bin/../builtin/game/item.lua:417: in function </home/utente/minetest/bin/../builtin/game/item.lua:410>
2019-12-30 18:26:19: ERROR[Main]: 	(tail call): ?
2019-12-30 18:26:19: ACTION[Server]: singleplayer leaves game. List of players: 
2019-12-30 18:26:20: ACTION[Main]: Server: Shutting down

@FaceDeer
Copy link
Member Author

Well, that confirms most of the narrative I figured out earlier. The switch triggers the gate, the gate successfully moves, and then the game crashes before it's able to attempt to trigger a second move to continue the gate's full swing.

in gate_functions.lua immediately after the print_debug("calling minetest.after") call that produces the last logged line before the crash is a call to minetest.after. This code:

minetest.after(1, function()
    print_debug("minetest.after call executing")
    for door_pos_hash in pairs(door_all) do
        triggered_already[door_pos_hash] = nil
    end
    local door_pos_hash, door_node = next(door_all)
    local door_pos = minetest.get_position_from_hash(door_pos_hash)
    castle_gates.trigger_gate(door_pos, door_node, player)
    end)

Try commenting that whole block out. The gate will only move a single step after being triggered and not move again until you restart the server (since the triggered_already entries will never be cleared), but if it doesn't crash afterward then that means there's definitely something about the minetest.after call that caused this. And we never see "minetest.after call executing" in the log, so whatever it is that kills Minetest is doing it before the delayed function call actually tries to execute.

If that's the case then I'm almost certain there's something engine-side going on here and I'll need to escalate this to the forum.

@ghost
Copy link

ghost commented Dec 30, 2019

Ok, I've commented it:

	if door_moved then
		print_debug("door moved. Preparing to re-trigger")
		local door_all = door.all
		for door_pos_hash in pairs(door_all) do
			-- list all door nodes in triggered_already, we don't know which ones will be incorporated
			-- into the next door set in which order
			triggered_already[door_pos_hash] = true
		end
		print_debug("calling minetest.after")
		--[[
		minetest.after(1, function()
			print_debug("minetest.after call executing")
			for door_pos_hash in pairs(door_all) do
				triggered_already[door_pos_hash] = nil
			end
			local door_pos_hash, door_node = next(door_all)
			local door_pos = minetest.get_position_from_hash(door_pos_hash)
			castle_gates.trigger_gate(door_pos, door_node, player)
			end)
		--]]
	end

Then:

  • logged in
  • deleted everything
  • rebuilt the same
  • linked the switch to the gate
  • triggered the switch twice

EDIT:
When I relogged the gate was open, unlinked to the switch.
I've repeated the linking process, triggered the switch and it crashed again.

this is the log:

2019-12-30 21:51:09: ACTION[Server]: singleplayer [127.0.0.1] joins game. 
2019-12-30 21:51:09: ACTION[Server]: singleplayer joins game. List of players: singleplayer
2019-12-30 21:51:13: ACTION[Server]: singleplayer places node default:brick at (322,18,-192)
2019-12-30 21:51:14: ACTION[Server]: singleplayer places node default:brick at (322,18,-194)
2019-12-30 21:51:17: ACTION[Server]: singleplayer places node castle_gates:wood_gate_hinge at (322,18,-193)
2019-12-30 21:51:17: ACTION[Server]: facedir: 1
2019-12-30 21:51:20: ACTION[Server]: singleplayer places node castle_gates:switch at (322,19,-192)
2019-12-30 21:51:20: ACTION[Server]: facedir: 1
2019-12-30 21:51:22: ACTION[Server]: singleplayer uses castle_gates:linkage, pointing at [node under=322,19,-192 above=322,20,-192]
2019-12-30 21:51:22: [Server]: castle_gates debugging: linkage tool has a recorded switch at (322,19,-192)
2019-12-30 21:51:22: [Server]: castle_gates debugging: showing/updating hud for player singleplayer
2019-12-30 21:51:24: ACTION[Server]: singleplayer uses castle_gates:linkage, pointing at [node under=322,18,-193 above=321,18,-193]
2019-12-30 21:51:24: [Server]: castle_gates debugging: linkage tool has a recorded switch at (322,19,-192)
2019-12-30 21:51:24: [Server]: castle_gates debugging: showing/updating hud for player singleplayer
2019-12-30 21:51:24: [Server]: castle_gates debugging: delayed save switch data call
2019-12-30 21:51:24: ACTION[Server]: singleplayer added a link from a switch at (322,19,-192) to a gate at (322,18,-193)
2019-12-30 21:51:24: [Server]: castle_gates debugging: wrote to /home/utente/minetest/bin/../worlds/CastleGates/castle_gates_switch_map.lua
2019-12-30 21:51:24: [Server]: castle_gates debugging: closed /home/utente/minetest/bin/../worlds/CastleGates/castle_gates_switch_map.lua
2019-12-30 21:51:27: [Server]: castle_gates debugging: trigger_switch_with_sound
2019-12-30 21:51:27: [Server]: castle_gates debugging: triggering switch
2019-12-30 21:51:27: [Server]: castle_gates debugging: removed hud for player singleplayer
2019-12-30 21:51:27: [Server]: castle_gates debugging: switch is triggering gate node castle_gates:wood_gate_hinge at (322,18,-193)
2019-12-30 21:51:27: [Server]: castle_gates debugging: trigger_gate called
2019-12-30 21:51:27: [Server]: castle_gates debugging: getting door layout for (322,18,-193)
2019-12-30 21:51:27: [Server]: castle_gates debugging: door layout node reading finished
2019-12-30 21:51:27: [Server]: castle_gates debugging: rotating door
2019-12-30 21:51:27: [Server]: castle_gates debugging: finished door layout: {
	contains_protected_node = false,
	hinge = {
		placement = {
			y = 18,
			x = 321.5,
			z = -192.5
		},
		axis = "y"
	},
	swings = {
		true,
		[-1] = false
	},
	all = {
		[1.3991070836359e+14] = {
			param1 = 14,
			name = "castle_gates:wood_gate_hinge",
			param2 = 1
		}
	},
	previous_move = "",
	directions = {
		top = {
			y = 1,
			x = 0,
			z = 0
		},
		front = {
			y = -0,
			x = -1,
			z = -0
		},
		bottom = {
			y = -1,
			x = -0,
			z = -0
		},
		right = {
			y = 0,
			x = 0,
			z = -1
		},
		left = {
			y = -0,
			x = -0,
			z = 1
		},
		back = {
			y = 0,
			x = 1,
			z = 0
		}
	}
}
2019-12-30 21:51:27: [Server]: castle_gates debugging: cleared gate nodes
2019-12-30 21:51:27: [Server]: castle_gates debugging: writing new gate nodes
2019-12-30 21:51:27: [Server]: castle_gates debugging: writing node castle_gates:wood_gate_hinge at (322,18,-193)
2019-12-30 21:51:27: [Server]: castle_gates debugging: swap switch for node castle_gates:switch
2019-12-30 21:51:29: [Server]: castle_gates debugging: trigger_switch_with_sound
2019-12-30 21:51:29: [Server]: castle_gates debugging: triggering switch
2019-12-30 21:51:29: [Server]: castle_gates debugging: removed hud for player singleplayer
2019-12-30 21:51:29: [Server]: castle_gates debugging: switch is triggering gate node castle_gates:wood_gate_hinge at (322,18,-193)
2019-12-30 21:51:29: [Server]: castle_gates debugging: trigger_gate called
2019-12-30 21:51:29: [Server]: castle_gates debugging: getting door layout for (322,18,-193)
2019-12-30 21:51:29: [Server]: castle_gates debugging: door layout node reading finished
2019-12-30 21:51:29: [Server]: castle_gates debugging: rotating door
2019-12-30 21:51:29: [Server]: castle_gates debugging: finished door layout: {
	contains_protected_node = false,
	hinge = {
		placement = {
			y = 18,
			x = 321.5,
			z = -192.5
		},
		axis = "y"
	},
	swings = {
		true,
		[-1] = false
	},
	all = {
		[1.3991070836359e+14] = {
			param1 = 14,
			name = "castle_gates:wood_gate_hinge",
			param2 = 1
		}
	},
	previous_move = "deosil",
	directions = {
		top = {
			y = 1,
			x = 0,
			z = 0
		},
		front = {
			y = -0,
			x = -1,
			z = -0
		},
		bottom = {
			y = -1,
			x = -0,
			z = -0
		},
		right = {
			y = 0,
			x = 0,
			z = -1
		},
		left = {
			y = -0,
			x = -0,
			z = 1
		},
		back = {
			y = 0,
			x = 1,
			z = 0
		}
	}
}
2019-12-30 21:51:29: [Server]: castle_gates debugging: cleared gate nodes
2019-12-30 21:51:29: [Server]: castle_gates debugging: rotating gate to new position
2019-12-30 21:51:29: [Server]: castle_gates debugging: update switch map location from (322,18,-193) to (321,18,-193)
2019-12-30 21:51:29: [Server]: castle_gates debugging: delayed save switch data call
2019-12-30 21:51:29: [Server]: castle_gates debugging: writing new gate nodes
2019-12-30 21:51:29: [Server]: castle_gates debugging: writing node castle_gates:wood_gate_hinge at (321,18,-193)
2019-12-30 21:51:29: [Server]: castle_gates debugging: door moved. Preparing to re-trigger
2019-12-30 21:51:29: [Server]: castle_gates debugging: calling minetest.after
2019-12-30 21:51:29: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'default' in callback item_OnPlace(): invalid key to 'next'
2019-12-30 21:51:29: ERROR[Main]: stack traceback:
2019-12-30 21:51:29: ERROR[Main]: 	[C]: in function '(for generator)'
2019-12-30 21:51:29: ERROR[Main]: 	.../utente/minetest/bin/../mods/castle_gates/switch.lua:223: in function 'trigger_switch'
2019-12-30 21:51:29: ERROR[Main]: 	.../utente/minetest/bin/../mods/castle_gates/switch.lua:270: in function 'on_rightclick'
2019-12-30 21:51:29: ERROR[Main]: 	/home/utente/minetest/bin/../builtin/game/item.lua:417: in function </home/utente/minetest/bin/../builtin/game/item.lua:410>
2019-12-30 21:51:29: ERROR[Main]: 	(tail call): ?
2019-12-30 21:51:29: ACTION[Server]: singleplayer leaves game. List of players: 
2019-12-30 21:51:30: ACTION[Main]: Server: Shutting down

@FaceDeer
Copy link
Member Author

Well... huh.

There is one other potential minetest.after call that could be involved in this, over in switch.lua there's this guy in the castle_gates.save_switch_data function. Its purpose is to delay writing out the switch-to-gate-position map to a file in the world folder, so that if multiple changes are made in rapid succession it won't do a whole bunch of disk writes. Maybe try commenting that out? The last time I ran into a linux-only bug it involved something going wrong with file writing, and while it's not the exact same problem here (I'm using the correct file path separators this time) filesystem stuff is definitely an area where you might see differences between Linux and Windows.

@ghost
Copy link

ghost commented Dec 30, 2019

Uhm, I've commented switch.lua @ 36:

	print_debug("delayed save switch data call")
	--[[
	minetest.after(0.1, function()
		dirty_data = false
		local file, e = io.open(filename, "w")
		if not file then
			print_debug("failed to write " .. filename)
			return
		end
		file:write(minetest.serialize(castle_gates.switch_map))
		print_debug("wrote to " .. filename)
		file:close()
		print_debug("closed " .. filename)
	end)
	--]]

Then I have:

  • deleted the world
  • created a new one (creative mode)
  • enabled castle_gates
  • built the usual structure

It crashed again, but look at the first line - is it expected since it is a new world, or is it wrong?
EDIT: I've just realized that the first line is due to the above code commenting...

2019-12-30 22:16:08: [Main]: castle_gates debugging: failed to load /home/utente/minetest/bin/../worlds/CastleGates/castle_gates_switch_map.lua
        .__               __                   __   
  _____ |__| ____   _____/  |_  ____   _______/  |_ 
 /     \|  |/    \_/ __ \   __\/ __ \ /  ___/\   __\
|  Y Y  \  |   |  \  ___/|  | \  ___/ \___ \  |  |  
|__|_|  /__|___|  /\___  >__|  \___  >____  > |__|  
      \/        \/     \/          \/     \/        
2019-12-30 22:16:08: ACTION[Main]: World at [/home/utente/minetest/bin/../worlds/CastleGates]
2019-12-30 22:16:08: ACTION[Main]: Server for gameid="minetest" listening on 0.0.0.0:60447.

2019-12-30 22:16:10: ACTION[Server]: singleplayer [127.0.0.1] joins game. 
2019-12-30 22:16:10: ACTION[Server]: singleplayer joins game. List of players: singleplayer
2019-12-30 22:16:17: ACTION[Server]: singleplayer takes default:brick from creative inventory
2019-12-30 22:16:27: ACTION[Server]: singleplayer takes castle_gates:wood_gate_hinge from creative inventory
2019-12-30 22:16:29: ACTION[Server]: singleplayer takes castle_gates:switch from creative inventory
2019-12-30 22:16:31: ACTION[Server]: singleplayer takes castle_gates:linkage from creative inventory
2019-12-30 22:16:37: ACTION[Server]: singleplayer places node default:brick at (61,3,132)
2019-12-30 22:16:38: ACTION[Server]: singleplayer places node default:brick at (63,3,132)
2019-12-30 22:16:40: ACTION[Server]: singleplayer places node castle_gates:wood_gate_hinge at (62,3,132)
2019-12-30 22:16:40: ACTION[Server]: facedir: 0
2019-12-30 22:16:42: ACTION[Server]: singleplayer places node castle_gates:switch at (61,4,132)
2019-12-30 22:16:42: ACTION[Server]: facedir: 0
2019-12-30 22:16:44: ACTION[Server]: singleplayer uses castle_gates:linkage, pointing at [node under=61,4,132 above=61,4,131]
2019-12-30 22:16:44: [Server]: castle_gates debugging: showing/updating hud for player singleplayer
2019-12-30 22:16:45: ACTION[Server]: singleplayer uses castle_gates:linkage, pointing at [node under=62,3,132 above=62,3,131]
2019-12-30 22:16:45: [Server]: castle_gates debugging: linkage tool has a recorded switch at (61,4,132)
2019-12-30 22:16:45: [Server]: castle_gates debugging: showing/updating hud for player singleplayer
2019-12-30 22:16:45: [Server]: castle_gates debugging: delayed save switch data call
2019-12-30 22:16:45: ACTION[Server]: singleplayer added a link from a switch at (61,4,132) to a gate at (62,3,132)
2019-12-30 22:16:48: [Server]: castle_gates debugging: trigger_switch_with_sound
2019-12-30 22:16:48: [Server]: castle_gates debugging: triggering switch
2019-12-30 22:16:48: [Server]: castle_gates debugging: removed hud for player singleplayer
2019-12-30 22:16:48: [Server]: castle_gates debugging: switch is triggering gate node castle_gates:wood_gate_hinge at (62,3,132)
2019-12-30 22:16:48: [Server]: castle_gates debugging: trigger_gate called
2019-12-30 22:16:48: [Server]: castle_gates debugging: getting door layout for (62,3,132)
2019-12-30 22:16:48: [Server]: castle_gates debugging: door layout node reading finished
2019-12-30 22:16:48: [Server]: castle_gates debugging: rotating door
2019-12-30 22:16:48: [Server]: castle_gates debugging: finished door layout: {
	contains_protected_node = false,
	hinge = {
		placement = {
			y = 3,
			x = 61.5,
			z = 131.5
		},
		axis = "y"
	},
	swings = {
		true,
		[-1] = false
	},
	all = {
		[1.4130657175149e+14] = {
			param1 = 14,
			name = "castle_gates:wood_gate_hinge",
			param2 = 0
		}
	},
	previous_move = "",
	directions = {
		top = {
			y = 1,
			x = 0,
			z = 0
		},
		front = {
			y = -0,
			x = -0,
			z = -1
		},
		bottom = {
			y = -1,
			x = -0,
			z = -0
		},
		right = {
			y = 0,
			x = 1,
			z = 0
		},
		left = {
			y = -0,
			x = -1,
			z = -0
		},
		back = {
			y = 0,
			x = 0,
			z = 1
		}
	}
}
2019-12-30 22:16:48: [Server]: castle_gates debugging: cleared gate nodes
2019-12-30 22:16:48: [Server]: castle_gates debugging: writing new gate nodes
2019-12-30 22:16:48: [Server]: castle_gates debugging: writing node castle_gates:wood_gate_hinge at (62,3,132)
2019-12-30 22:16:48: [Server]: castle_gates debugging: swap switch for node castle_gates:switch
2019-12-30 22:16:49: [Server]: castle_gates debugging: trigger_switch_with_sound
2019-12-30 22:16:49: [Server]: castle_gates debugging: triggering switch
2019-12-30 22:16:49: [Server]: castle_gates debugging: removed hud for player singleplayer
2019-12-30 22:16:49: [Server]: castle_gates debugging: switch is triggering gate node castle_gates:wood_gate_hinge at (62,3,132)
2019-12-30 22:16:49: [Server]: castle_gates debugging: trigger_gate called
2019-12-30 22:16:49: [Server]: castle_gates debugging: getting door layout for (62,3,132)
2019-12-30 22:16:49: [Server]: castle_gates debugging: door layout node reading finished
2019-12-30 22:16:49: [Server]: castle_gates debugging: rotating door
2019-12-30 22:16:49: [Server]: castle_gates debugging: finished door layout: {
	contains_protected_node = false,
	hinge = {
		placement = {
			y = 3,
			x = 61.5,
			z = 131.5
		},
		axis = "y"
	},
	swings = {
		true,
		[-1] = false
	},
	all = {
		[1.4130657175149e+14] = {
			param1 = 14,
			name = "castle_gates:wood_gate_hinge",
			param2 = 0
		}
	},
	previous_move = "deosil",
	directions = {
		top = {
			y = 1,
			x = 0,
			z = 0
		},
		front = {
			y = -0,
			x = -0,
			z = -1
		},
		bottom = {
			y = -1,
			x = -0,
			z = -0
		},
		right = {
			y = 0,
			x = 1,
			z = 0
		},
		left = {
			y = -0,
			x = -1,
			z = -0
		},
		back = {
			y = 0,
			x = 0,
			z = 1
		}
	}
}
2019-12-30 22:16:49: [Server]: castle_gates debugging: cleared gate nodes
2019-12-30 22:16:49: [Server]: castle_gates debugging: rotating gate to new position
2019-12-30 22:16:49: [Server]: castle_gates debugging: update switch map location from (62,3,132) to (62,3,131)
2019-12-30 22:16:49: [Server]: castle_gates debugging: writing new gate nodes
2019-12-30 22:16:49: [Server]: castle_gates debugging: writing node castle_gates:wood_gate_hinge at (62,3,131)
2019-12-30 22:16:49: [Server]: castle_gates debugging: door moved. Preparing to re-trigger
2019-12-30 22:16:49: [Server]: castle_gates debugging: calling minetest.after
2019-12-30 22:16:49: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'default' in callback item_OnPlace(): invalid key to 'next'
2019-12-30 22:16:49: ERROR[Main]: stack traceback:
2019-12-30 22:16:49: ERROR[Main]: 	[C]: in function '(for generator)'
2019-12-30 22:16:49: ERROR[Main]: 	.../utente/minetest/bin/../mods/castle_gates/switch.lua:225: in function 'trigger_switch'
2019-12-30 22:16:49: ERROR[Main]: 	.../utente/minetest/bin/../mods/castle_gates/switch.lua:272: in function 'on_rightclick'
2019-12-30 22:16:49: ERROR[Main]: 	/home/utente/minetest/bin/../builtin/game/item.lua:417: in function </home/utente/minetest/bin/../builtin/game/item.lua:410>
2019-12-30 22:16:49: ERROR[Main]: 	(tail call): ?
2019-12-30 22:16:49: ACTION[Server]: singleplayer leaves game. List of players: 
2019-12-30 22:16:49: ACTION[Main]: Server: Shutting down

@ghost
Copy link

ghost commented Dec 30, 2019

EDIT: never mind, it says "LOADED"... I'm getting blind. :D

I've just checked the debug.txt, that error was being thrown also in the old map, ever since you added the debug messages:

2019-12-30 18:20:22: [Main]: Automatically selecting world at [/home/utente/minetest/bin/../worlds/CastleGates]
2019-12-30 18:20:26: [Main]: castle_gates debugging: loaded /home/utente/minetest/bin/../worlds/CastleGates/castle_gates_switch_map.lua

I've overlooked it because generally prints are after the MINETEST ASCII art; I'm not a programmer but I guess that failing to find a piece of the program is not good - perhaps this is the root of the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant