local time = 0
minetest.register_globalstep(function(dtime)
time = time + dtime
-- every 1 second
if time > 1 then
-- reset time for next check
time = 0
-- check players
for _,player in ipairs(minetest.get_connected_players()) do
-- where am I?
local pos = player:getpos()
-- am I near a block of uranium?
local near = minetest.find_node_near(pos, 1, "uranium:stone_with_uranium")
if near then
-- am I touching the uranium? if so it hurts
for _,object in ipairs(minetest.get_objects_inside_radius(near, 1.0)) do
if object:get_hp() > 0 then
object:set_hp(object:get_hp()-1)
end
end
end
end
end
end)Users browsing this forum: No registered users and 8 guests