Fire Digs Node

Post Reply
Nota
Member
Posts: 34
Joined: Wed Feb 14, 2018 07:49

Fire Digs Node

by Nota » Post

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.

User avatar
paramat
Developer
Posts: 3662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Fire Digs Node

by paramat » Post

Could you post your weapon code or link to somewhere we can see the code?

Nota
Member
Posts: 34
Joined: Wed Feb 14, 2018 07:49

Re: Fire Digs Node

by Nota » Post

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 node.name ~= "air" and node.name ~= "lottthrowing:light" then
				minetest.set_node(self.lastpos, {name=firetype})
				self.object:remove()
			end
			
			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) 
			then
			
				if minetest.get_node(self.lastpos).name == "lottthrowing:light" then
					minetest.remove_node(self.lastpos)
				end
				
				if minetest.get_node(pos).name == "air" then
					minetest.set_node(pos, {name="lottthrowing:light"})
				end
				
			end
		end

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests