Add an on_burn callback.
This commit is contained in:
		
							parent
							
								
									45bc0b245f
								
							
						
					
					
						commit
						a5ad30748d
					
				| 
						 | 
					@ -176,6 +176,14 @@ The farming API allows you to easily register plants and hoes.
 | 
				
			||||||
		maxlight = default.LIGHT_MAX           -- Maximum light to grow
 | 
							maxlight = default.LIGHT_MAX           -- Maximum light to grow
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Fire API
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`on_burn(pos)`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * Called when fire attempts to remove a burning node.
 | 
				
			||||||
 | 
					 * `pos` Position of the burning node.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Screwdriver API
 | 
					Screwdriver API
 | 
				
			||||||
---------------
 | 
					---------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -235,10 +235,16 @@ else
 | 
				
			||||||
				-- remove flammable nodes around flame
 | 
									-- remove flammable nodes around flame
 | 
				
			||||||
				local p = minetest.find_node_near(p0, 1, {"group:flammable"})
 | 
									local p = minetest.find_node_near(p0, 1, {"group:flammable"})
 | 
				
			||||||
				if p then
 | 
									if p then
 | 
				
			||||||
 | 
										local node = minetest.get_node(p)
 | 
				
			||||||
 | 
										local def = minetest.registered_nodes[node.name]
 | 
				
			||||||
 | 
										if def.on_burn then
 | 
				
			||||||
 | 
											def.on_burn(p)
 | 
				
			||||||
 | 
										else 
 | 
				
			||||||
						minetest.remove_node(p)
 | 
											minetest.remove_node(p)
 | 
				
			||||||
						nodeupdate(p)
 | 
											nodeupdate(p)
 | 
				
			||||||
					end
 | 
										end
 | 
				
			||||||
				end
 | 
									end
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
		end,
 | 
							end,
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue