Activate waving=1 for more plants
[minetest_hades/hades_revisited.git] / mods / hades_torches / init.lua
bloba75957951bc48398752b308a842751bcdb2f0021
1 local S = minetest.get_translator("hades_torches")
3 hades_torches = {}
5 hades_torches.register_torch = function(id, def)
6 local light = def.light_source
7 if not light then
8 light = minetest.LIGHT_MAX - 1
9 end
11 minetest.register_node("hades_torches:"..id, {
12 description = def.description,
13 drawtype = "mesh",
14 mesh = "hades_torches_torch_floor.obj",
15 inventory_image = def.inventory_image,
16 wield_image = def.wield_image,
17 tiles = def.tiles,
18 use_texture_alpha = true,
19 paramtype = "light",
20 paramtype2 = "wallmounted",
21 sunlight_propagates = true,
22 walkable = false,
23 liquids_pointable = false,
24 light_source = light,
25 groups = {choppy=2, dig_immediate=3, flammable=1, attached_node=1, torch=1},
26 selection_box = {
27 type = "wallmounted",
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
39 end
41 local above = pointed_thing.above
42 local wdir = minetest.dir_to_wallmounted(vector.subtract(under, above))
43 local fakestack = itemstack
44 if wdir == 0 then
45 fakestack:set_name("hades_torches:"..id.."_ceiling")
46 elseif wdir == 1 then
47 fakestack:set_name("hades_torches:"..id)
48 else
49 fakestack:set_name("hades_torches:"..id.."_wall")
50 end
52 itemstack = minetest.item_place(fakestack, placer, pointed_thing, wdir)
53 itemstack:set_name("hades_torches:"..id)
55 return itemstack
56 end,
57 on_rotate = false,
60 minetest.register_node("hades_torches:"..id.."_wall", {
61 drawtype = "mesh",
62 mesh = "hades_torches_torch_wall.obj",
63 tiles = def.tiles,
64 use_texture_alpha = true,
65 paramtype = "light",
66 paramtype2 = "wallmounted",
67 sunlight_propagates = true,
68 walkable = false,
69 light_source = light,
70 groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1},
71 drop = "hades_torches:"..id,
72 selection_box = {
73 type = "wallmounted",
74 wall_side = {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8},
76 sounds = hades_sounds.node_sound_wood_defaults(),
77 on_rotate = false,
80 minetest.register_node("hades_torches:"..id.."_ceiling", {
81 drawtype = "mesh",
82 mesh = "hades_torches_torch_ceiling.obj",
83 tiles = def.tiles,
84 use_texture_alpha = true,
85 paramtype = "light",
86 paramtype2 = "wallmounted",
87 sunlight_propagates = true,
88 walkable = false,
89 light_source = light,
90 groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1},
91 drop = "hades_torches:"..id,
92 selection_box = {
93 type = "wallmounted",
94 wall_top = {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8},
96 sounds = hades_sounds.node_sound_wood_defaults(),
97 on_rotate = false,
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",
107 tiles = {{
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"),
115 light_source = 8,
116 inventory_image = "default_torchlow_on_floor.png",
117 wield_image = "default_torchlow_on_floor.png",
118 tiles = {{
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',
126 recipe = {
127 {'hades_core:coal_lump'},
128 {'group:stick'},
132 minetest.register_craft({
133 output = 'hades_torches:torch',
134 recipe = {
135 {'farming:string'},
136 {'hades_torches:torch_low'},
140 minetest.register_craft({
141 type = "fuel",
142 recipe = "hades_torches:torch",
143 burntime = 4,