forked from CasimirKaPazi/stoneage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nodes.lua
127 lines (118 loc) · 3.95 KB
/
nodes.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
minetest.register_node("stoneage:torch_unlit", {
description = "Torch",
drawtype = "torchlike",
tiles = {"stoneage_torch_unlit_on_floor.png", "stoneage_torch_unlit_on_ceiling.png", "stoneage_torch_unlit_on_wall.png"},
inventory_image = "stoneage_torch_unlit_on_floor.png",
wield_image = "stoneage_torch_unlit_on_floor.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "wallmounted",
wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1},
wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
},
groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1},
-- lighting a placed torch when hit by a buring one
after_dig_node = function(pos, node, oldmetadata, puncher)
local wield = puncher:get_wielded_item():get_name()
if wield == "default:torch" then
node.name = "default:torch"
minetest.env:set_node(pos, node)
local inv = puncher:get_inventory()
inv:remove_item("main", "stoneage:torch_unlit")
end
end,
-- lighting the torch in hand when hitting a buring one
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type == "node" then
local n = minetest.env:get_node(pointed_thing.under)
if minetest.get_item_group(n.name, "igniter") ~= 0 or n.name == "default:torch" or n.name == "default:furnace_active" then
local torch_count = user:get_wielded_item():get_count()
itemstack:replace("default:torch "..torch_count.."")
return itemstack
else
minetest.env:punch_node(pointed_thing.under)
end
else
return
end
end,
sounds = default.node_sound_defaults(),
})
minetest.register_node("stoneage:bonfire_unlit", {
description = "Bonfire",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"stoneage_bonfire_unlit.png"},
inventory_image = "stoneage_bonfire_unlit.png",
wield_image = "stoneage_bonfire_unlit.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
groups = {snappy=3,flammable=2,attached_node=1},
sounds = default.node_sound_defaults(),
selection_box = {
type = "fixed",
fixed = {-1/3, -1/2, -1/3, 1/3, 1/6, 1/3},
},
})
minetest.register_node("stoneage:bonfire", {
description = "Bonfire",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {
{name="stoneage_bonfire_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}}
},
inventory_image = "stoneage_bonfire_unlit.png",
wield_image = "stoneage_bonfire_unlit.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
drop = "",
damage_per_second = 1,
light_source = LIGHT_MAX-1,
groups = {dig_immediate=3,igniter=1,attached_node=1},
after_dig_node = function(pos, node, oldmetadata, puncher)
node.name = "stoneage:bonfire_unlit"
minetest.env:set_node(pos, node)
end,
sounds = default.node_sound_defaults(),
selection_box = {
type = "fixed",
fixed = {-1/3, -1/2, -1/3, 1/3, 1/6, 1/3},
},
})
--
-- ores
--
minetest.register_node("stoneage:grass_with_silex", {
description = "Silex",
tiles = {"default_grass.png^stoneage_silex_ore.png", "default_dirt.png^stoneage_silex_ore.png", "default_dirt.png^default_grass_side.png^stoneage_silex_ore.png"},
is_ground_content = true,
groups = {crumbly=3,soil=1},
drop = 'stoneage:silex',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
})
minetest.register_node("stoneage:dirt_with_silex", {
description = "Silex",
tiles = {"default_dirt.png^stoneage_silex_ore.png"},
is_ground_content = true,
groups = {crumbly=3,soil=1},
drop = 'stoneage:silex',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
})
minetest.register_node("stoneage:sand_with_silex", {
description = "Silex",
tiles = {"default_sand.png^stoneage_silex_ore.png"},
is_ground_content = true,
groups = {crumbly=3, falling_node=1},
drop = 'stoneage:silex',
sounds = default.node_sound_sand_defaults(),
})