bring back the original plantlike bell as an option
parent
017c8b9e8b
commit
972d761e28
158
init.lua
158
init.lua
|
@ -160,11 +160,75 @@ restore_bell_data()
|
|||
---------------------------------------------------------
|
||||
--- Node definitions
|
||||
|
||||
local bell_def = {
|
||||
description = S("Bell"),
|
||||
local bell_base = {
|
||||
paramtype = "light",
|
||||
description = S("Bell"),
|
||||
stack_max = 1,
|
||||
|
||||
on_punch = function (pos,node,puncher)
|
||||
ring_big_bell(pos)
|
||||
end,
|
||||
|
||||
on_construct = function(pos)
|
||||
-- remember that there is a bell at that position
|
||||
table.insert( bell_positions, pos )
|
||||
save_bell_positions()
|
||||
end,
|
||||
|
||||
on_destruct = function(pos)
|
||||
local found = 0
|
||||
-- actually remove the bell from the list
|
||||
for i,v in ipairs( bell_positions ) do
|
||||
if(v ~= nil and vector.equals(v, pos)) then
|
||||
table.remove( bell_positions, i)
|
||||
save_bell_positions()
|
||||
break
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
groups = {cracky=2},
|
||||
}
|
||||
|
||||
if minetest.get_modpath("mesecons") then
|
||||
bell_base.mesecons = {
|
||||
effector = {
|
||||
action_on = ring_big_bell,
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
local ring_small_bell = function(pos)
|
||||
minetest.sound_play( "bell_small",
|
||||
{ pos = pos, gain = 1.5, max_hear_distance = 60,})
|
||||
end
|
||||
|
||||
|
||||
local small_bell_base = {
|
||||
description = S("Small bell"),
|
||||
paramtype = "light",
|
||||
stack_max = 1,
|
||||
on_punch = function (pos,node,puncher)
|
||||
ring_small_bell(pos)
|
||||
end,
|
||||
groups = {cracky=2},
|
||||
}
|
||||
|
||||
if minetest.get_modpath("mesecons") then
|
||||
small_bell_base.mesecons = {
|
||||
effector = {
|
||||
action_on = ring_small_bell,
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
if minetest.settings:get_bool("bell_enable_model", true) then
|
||||
----------------
|
||||
-- Model-type bell
|
||||
local bell_def = {
|
||||
drawtype = "mesh",
|
||||
mesh = "bell_bell.obj",
|
||||
tiles = {
|
||||
|
@ -186,57 +250,16 @@ local bell_def = {
|
|||
},
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
|
||||
|
||||
on_punch = function (pos,node,puncher)
|
||||
ring_big_bell(pos)
|
||||
end,
|
||||
|
||||
on_construct = function(pos)
|
||||
-- remember that there is a bell at that position
|
||||
table.insert( bell_positions, pos )
|
||||
save_bell_positions()
|
||||
end,
|
||||
|
||||
on_destruct = function(pos)
|
||||
local found = 0
|
||||
-- actually remove the bell from the list
|
||||
for i,v in ipairs( bell_positions ) do
|
||||
if( v ~= nil and v.x == pos.x and v.y == pos.y and v.z == pos.z ) then
|
||||
found = i
|
||||
end
|
||||
end
|
||||
-- actually remove the bell
|
||||
if( found > 0 ) then
|
||||
table.remove( bell_positions, found )
|
||||
save_bell_positions()
|
||||
end
|
||||
end,
|
||||
|
||||
groups = {cracky=2},
|
||||
}
|
||||
|
||||
if minetest.get_modpath("mesecons") then
|
||||
bell_def.mesecons = {
|
||||
effector = {
|
||||
action_on = ring_big_bell,
|
||||
}
|
||||
}
|
||||
for k, v in pairs(bell_base) do
|
||||
bell_def[k] = v
|
||||
end
|
||||
|
||||
minetest.register_node("bell:bell", bell_def)
|
||||
|
||||
|
||||
local ring_small_bell = function(pos)
|
||||
minetest.sound_play( "bell_small",
|
||||
{ pos = pos, gain = 1.5, max_hear_distance = 60,})
|
||||
end
|
||||
|
||||
local small_bell_def = {
|
||||
description = S("Small bell"),
|
||||
stack_max = 1,
|
||||
|
||||
drawtype = "mesh",
|
||||
local small_bell_def =
|
||||
{ drawtype = "mesh",
|
||||
mesh = "bell_small_bell.obj",
|
||||
tiles = {
|
||||
{ name = "bell_hull.png", backface_culling = true }, --
|
||||
|
@ -257,23 +280,42 @@ local small_bell_def = {
|
|||
},
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
|
||||
on_punch = function (pos,node,puncher)
|
||||
ring_small_bell(pos)
|
||||
end,
|
||||
groups = {cracky=2},
|
||||
}
|
||||
|
||||
if minetest.get_modpath("mesecons") then
|
||||
small_bell_def.mesecons = {
|
||||
effector = {
|
||||
action_on = ring_small_bell,
|
||||
}
|
||||
}
|
||||
for k, v in pairs(small_bell_base) do
|
||||
small_bell_def[k] = v
|
||||
end
|
||||
|
||||
minetest.register_node("bell:bell_small", small_bell_def)
|
||||
|
||||
else
|
||||
--------------------
|
||||
-- Plantlike-type bell
|
||||
local bell_def = {
|
||||
tiles = {"bell_bell.png"},
|
||||
inventory_image = 'bell_bell.png',
|
||||
wield_image = 'bell_bell.png',
|
||||
drawtype = "plantlike",
|
||||
}
|
||||
for k, v in pairs(bell_base) do
|
||||
bell_def[k] = v
|
||||
end
|
||||
|
||||
minetest.register_node("bell:bell", bell_def)
|
||||
|
||||
local small_bell_def = {
|
||||
tiles = {"bell_bell.png"},
|
||||
inventory_image = 'bell_bell.png',
|
||||
wield_image = 'bell_bell.png',
|
||||
drawtype = "plantlike",
|
||||
}
|
||||
for k, v in pairs(small_bell_base) do
|
||||
small_bell_def[k] = v
|
||||
end
|
||||
|
||||
minetest.register_node("bell:bell_small", small_bell_def)
|
||||
end
|
||||
|
||||
---------------------------------------------------------
|
||||
--- Recipes
|
||||
|
||||
|
|
|
@ -13,3 +13,5 @@ bell_tolls_at_dusk (Bell tolls at dusk) int 0
|
|||
|
||||
#Bell tolls the number of hours (per the real-world server timezone) on the hour
|
||||
bell_tolls_at_server_hours (Bell tolls at server hours) bool true
|
||||
|
||||
bell_enable_model (Use model-based bell nodes) bool true
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 823 B |
|
@ -1 +1,3 @@
|
|||
bell_hull.png was created by FaceDeer and is released under the CC-0 public domain license
|
||||
|
||||
bell_bell.png was created by Sokomine and is released under the GPLv3 license
|
Loading…
Reference in New Issue