From 71fb6f9e91ae188c994ad908f5f7a297dc2bb4d9 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Wed, 29 Oct 2014 18:06:01 -0400 Subject: [PATCH] fix facedir detection on coffee steam, increase ABM interval, fix indentation --- homedecor/misc-nodes.lua | 44 +++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/homedecor/misc-nodes.lua b/homedecor/misc-nodes.lua index 176ae71c..ace98b18 100644 --- a/homedecor/misc-nodes.lua +++ b/homedecor/misc-nodes.lua @@ -1182,28 +1182,40 @@ minetest.register_node("homedecor:coffee_maker", { } }) +local fdir_to_steampos = { + x = { 0.15, 0.275, -0.15, -0.275 }, + z = { 0.275, -0.15, -0.275, 0.15 } +} + minetest.register_abm({ nodenames = "homedecor:coffee_maker", - interval = 1, + interval = 2, chance = 1, action = function(pos, node) - minetest.add_particlespawner({ - amount = 1, - time = 1, - minpos = {x=pos.x-0.15, y=pos.y-0.35, z=pos.z-0.275}, - maxpos = {x=pos.x-0.15, y=pos.y-0.35, z=pos.z-0.275}, - minvel = {x=-0.003, y=0.01, z=-0.003}, - maxvel = {x=0.003, y=0.01, z=-0.003}, - minacc = {x=0.0,y=-0.0,z=-0.0}, - maxacc = {x=0.0,y=0.003,z=-0.0}, - minexptime = 2, - maxexptime = 5, - minsize = 1, - maxsize = 1.2, - collisiondetection = false, - texture = "homedecor_steam.png", + local fdir = node.param2 + if fdir and fdir < 4 then + + local steamx = fdir_to_steampos.x[fdir + 1] + local steamz = fdir_to_steampos.z[fdir + 1] + + minetest.add_particlespawner({ + amount = 1, + time = 1, + minpos = {x=pos.x - steamx, y=pos.y - 0.35, z=pos.z - steamz}, + maxpos = {x=pos.x - steamx, y=pos.y - 0.35, z=pos.z - steamz}, + minvel = {x=-0.003, y=0.01, z=-0.003}, + maxvel = {x=0.003, y=0.01, z=-0.003}, + minacc = {x=0.0,y=-0.0,z=-0.0}, + maxacc = {x=0.0,y=0.003,z=-0.0}, + minexptime = 2, + maxexptime = 5, + minsize = 1, + maxsize = 1.2, + collisiondetection = false, + texture = "homedecor_steam.png", }) end + end }) minetest.register_node("homedecor:dartboard", {