Page 1 of 1

Fire Digs Node

Posted: Mon Sep 17, 2018 20:19
by Nota
I have fire spreading set to off.

I have a custom weapon that shoots an "arrow" that then creates a fire node. All works well - unless I'm firing downwards onto a node at my feet or directly in front. This destroys the node - even protected ones! Obviously this is a bug because it could be used to destroy anything.

I'm trying to find the code that does this, checked all over. I've tried removing the flames from the "groups" it was in, didn't work.

Interestingly, if I go up just one node and fire down, it works perfectly. So something about the time/distance/firing direction is messing it up.

Re: Fire Digs Node

Posted: Wed Sep 19, 2018 22:41
by paramat
Could you post your weapon code or link to somewhere we can see the code?

Re: Fire Digs Node

Posted: Thu Sep 20, 2018 01:56
by Nota
Actually, in trying to answer your question, I seem to have found the problem in code I never thought to look at.

Here's the relevant code, it's the third line down that's doing it. Normally it does not replace the node with fire, but ADDS fire to the node above it. But when you fire downwards at your feet, it's replacing the actual node with fire. Not sure what the best way to fix it is.

Code: Select all

if self.lastpos.x ~= nil then
			if ~= "air" and ~= "lottthrowing:light" then
				minetest.set_node(self.lastpos, {name=firetype})
			if math.floor(self.lastpos.x+0.5) ~= math.floor(pos.x+0.5) 
			or math.floor(self.lastpos.y+0.5) ~= math.floor(pos.y+0.5) 
			or math.floor(self.lastpos.z+0.5) ~= math.floor(pos.z+0.5) 
				if minetest.get_node(self.lastpos).name == "lottthrowing:light" then
				if minetest.get_node(pos).name == "air" then
					minetest.set_node(pos, {name="lottthrowing:light"})