1 local S
= minetest
.get_translator("hades_torches")
5 hades_torches
.register_torch
= function(id
, def
)
6 local light
= def
.light_source
8 light
= minetest
.LIGHT_MAX
- 1
11 minetest
.register_node("hades_torches:"..id
, {
12 description
= def
.description
,
14 mesh
= "hades_torches_torch_floor.obj",
15 inventory_image
= def
.inventory_image
,
16 wield_image
= def
.wield_image
,
18 use_texture_alpha
= true,
20 paramtype2
= "wallmounted",
21 sunlight_propagates
= true,
23 liquids_pointable
= false,
25 groups
= {choppy
=2, dig_immediate
=3, flammable
=1, attached_node
=1, torch
=1},
28 wall_bottom
= {-1/8, -1/2, -1/8, 1/8, 2/16, 1/8},
30 sounds
= hades_sounds
.node_sound_wood_defaults(),
31 on_place
= function(itemstack
, placer
, pointed_thing
)
32 local under
= pointed_thing
.under
33 local node
= minetest
.get_node(under
)
34 local def
= minetest
.registered_nodes
[node
.name
]
35 if def
and def
.on_rightclick
and
36 ((not placer
) or (placer
and not placer
:get_player_control().sneak
)) then
37 return def
.on_rightclick(under
, node
, placer
, itemstack
,
38 pointed_thing
) or itemstack
41 local above
= pointed_thing
.above
42 local wdir
= minetest
.dir_to_wallmounted(vector
.subtract(under
, above
))
43 local fakestack
= itemstack
45 fakestack
:set_name("hades_torches:"..id
.."_ceiling")
47 fakestack
:set_name("hades_torches:"..id
)
49 fakestack
:set_name("hades_torches:"..id
.."_wall")
52 itemstack
= minetest
.item_place(fakestack
, placer
, pointed_thing
, wdir
)
53 itemstack
:set_name("hades_torches:"..id
)
60 minetest
.register_node("hades_torches:"..id
.."_wall", {
62 mesh
= "hades_torches_torch_wall.obj",
64 use_texture_alpha
= true,
66 paramtype2
= "wallmounted",
67 sunlight_propagates
= true,
70 groups
= {choppy
=2, dig_immediate
=3, flammable
=1, not_in_creative_inventory
=1, attached_node
=1, torch
=1},
71 drop
= "hades_torches:"..id
,
74 wall_side
= {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8},
76 sounds
= hades_sounds
.node_sound_wood_defaults(),
80 minetest
.register_node("hades_torches:"..id
.."_ceiling", {
82 mesh
= "hades_torches_torch_ceiling.obj",
84 use_texture_alpha
= true,
86 paramtype2
= "wallmounted",
87 sunlight_propagates
= true,
90 groups
= {choppy
=2, dig_immediate
=3, flammable
=1, not_in_creative_inventory
=1, attached_node
=1, torch
=1},
91 drop
= "hades_torches:"..id
,
94 wall_top
= {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8},
96 sounds
= hades_sounds
.node_sound_wood_defaults(),
102 hades_torches
.register_torch("torch", {
103 description
= S("Bright Torch"),
104 light_source
= minetest
.LIGHT_MAX
- 1,
105 inventory_image
= "default_torch_on_floor.png",
106 wield_image
= "default_torch_on_floor.png",
108 name
= "default_torch_on_floor_animated.png",
109 animation
= {type = "vertical_frames", aspect_w
= 16, aspect_h
= 16, length
= 3.3}
113 hades_torches
.register_torch("torch_low", {
114 description
= S("Weak Torch"),
116 inventory_image
= "default_torchlow_on_floor.png",
117 wield_image
= "default_torchlow_on_floor.png",
119 name
= "default_torchlow_on_floor_animated.png",
120 animation
= {type = "vertical_frames", aspect_w
= 16, aspect_h
= 16, length
= 3.3}
124 minetest
.register_craft({
125 output
= 'hades_torches:torch_low 4',
127 {'hades_core:coal_lump'},
132 minetest
.register_craft({
133 output
= 'hades_torches:torch',
136 {'hades_torches:torch_low'},
140 minetest
.register_craft({
142 recipe
= "hades_torches:torch",