masks mod added(incomplete)

master
D00Med 2017-01-01 08:23:19 +10:00
parent 557fc945e8
commit c00d1e076d
6 changed files with 47 additions and 0 deletions

View File

@ -22,6 +22,7 @@ local bones_formspec =
default.get_hotbar_bg(0,4.85)
local share_bones_time = tonumber(minetest.setting_get("share_bones_time")) or 1200
local delete_bones_time = 2500
local share_bones_time_early = tonumber(minetest.setting_get("share_bones_time_early")) or share_bones_time / 4
minetest.register_node("bones:bones", {
@ -113,6 +114,8 @@ minetest.register_node("bones:bones", {
if time >= share_bones_time then
meta:set_string("infotext", meta:get_string("owner") .. "'s old bones")
meta:set_string("owner", "")
elseif time >= delete_bones_time then
minetest.env:remove_node(pos)
else
meta:set_int("time", time)
return true

Binary file not shown.

44
mods/masks/init.lua Normal file
View File

@ -0,0 +1,44 @@
minetest.register_on_leaveplayer(function(player)
local pos = player:getpos()
local objs = minetest.env:get_objects_inside_radius(pos, 1)
for _,obj in ipairs(objs) do
if obj:get_luaentity() ~= nil and obj:get_luaentity().name == "masks:deku" then
obj:remove()
end
end
end)
minetest.register_entity("masks:deku", {
visual = "mesh",
physical = false,
hp_max = 1,
mesh = "dekumask.b3d",
textures = {"masks_deku.png"},
collisionbox = {0,0,0,0,0,0},
})
minetest.register_craftitem("masks:deku_item", {
description = "Deku Mask",
inventory_image = "masks_deku_inv.png",
on_use = function(itemstack, placer, pointed_thing)
local pos = placer:getpos()
-- local objs = minetest.env:get_objects_inside_radius(pos, 1)
-- for _,obj in ipairs(objs) do
-- if obj:get_luaentity() ~= nil and obj:get_luaentity().name == "masks:deku" then
-- obj:remove()
-- end
-- end
local ent = minetest.env:add_entity(pos, "masks:deku")
ent:set_attach(placer, "", {x=0, y=0, z=0}, {x=0, y=0, z=0})
end,
on_place = function(itemstack, placer, pointed_thing)
local pos = placer:getpos()
local objs = minetest.env:get_objects_inside_radius(pos, 1)
for _,obj in ipairs(objs) do
if obj:get_luaentity() ~= nil and obj:get_luaentity().name == "masks:deku" then
obj:remove()
end
end
end
})

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B