1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Lua interface for ActiveBlockModifier

This commit is contained in:
Perttu Ahola 2011-11-28 02:16:51 +02:00
parent 8924588511
commit 34bd1b3032
2 changed files with 165 additions and 30 deletions

View file

@ -1296,36 +1296,6 @@ end
register_falling_node("sand", "sand.png")
register_falling_node("gravel", "gravel.png")
--[[
minetest.register_entity("falling_sand", {
-- Definition
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
visual = "cube",
textures = {"sand.png","sand.png","sand.png","sand.png","sand.png","sand.png"},
-- State
fallspeed = 0,
-- Methods
on_step = function(self, dtime)
-- Apply gravity
self.fallspeed = self.fallspeed + dtime * 5
fp = self.object:getpos()
fp.y = fp.y - self.fallspeed * dtime
self.object:moveto(fp)
-- Turn to actual sand when collides to ground or just move
bcp = {x=fp.x, y=fp.y-0.5, z=fp.z} -- Position of bottom center point
bcn = minetest.env:get_node(bcp)
if bcn.name ~= "air" then
-- Turn to a sand node
np = {x=bcp.x, y=bcp.y+1, z=bcp.z}
minetest.env:add_node(np, {name="sand"})
self.object:remove()
else
-- Do nothing
end
end
})
--]]
--
-- Global callbacks
--
@ -1389,6 +1359,17 @@ minetest.register_on_chat_message(function(name, message)
end
end)
minetest.register_abm({
nodenames = {"TNT"},
interval = 10.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
print("TNT ABM action")
pos.y = pos.y + 1
minetest.env:add_node(pos, {name="papyrus"})
end,
})
--
-- Done, print some random stuff
--