-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchristmas_tree.lua
More file actions
163 lines (152 loc) · 4.97 KB
/
christmas_tree.lua
File metadata and controls
163 lines (152 loc) · 4.97 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
--[[
X Farming. Extends Luanti farming mod with new plants, crops and ice fishing.
Copyright (C) 2025 SaKeL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to juraj.vajda@gmail.com
--]]
local S = core.get_translator(core.get_current_modname())
core.register_node('x_farming:christmas_tree_sapling', {
description = S('Christmas Tree Sapling') .. '\n' .. S('Compost chance') .. ': 30%',
short_description = S('Christmas Tree Sapling'),
drawtype = 'plantlike',
tiles = { 'x_farming_christmas_tree_sapling.png' },
inventory_image = 'x_farming_christmas_tree_sapling.png',
wield_image = 'x_farming_christmas_tree_sapling.png',
paramtype = 'light',
sunlight_propagates = true,
walkable = false,
on_timer = x_farming.grow_sapling,
selection_box = {
type = 'fixed',
fixed = { -4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16 }
},
groups = {
-- MTG
snappy = 2,
-- MCL
plant = 1,
non_mycelium_plant = 1,
deco_block = 1,
dig_by_water = 1,
dig_by_piston = 1,
destroy_by_lava_flow = 1,
compostability = 30,
-- ALL
dig_immediate = 3,
flammable = 3,
attached_node = 1,
sapling = 1
},
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
sounds = x_farming.node_sound_leaves_defaults(),
on_construct = function(pos)
core.get_node_timer(pos):start(math.random(300, 1500))
end,
on_place = function(itemstack, placer, pointed_thing)
itemstack = x_farming.sapling_on_place(itemstack, placer, pointed_thing,
'x_farming:christmas_tree_sapling',
-- minp, maxp to be checked, relative to sapling pos
-- minp_relative.y = 1 because sapling pos has been checked
{ x = -2, y = 1, z = -2 },
{ x = 2, y = 14, z = 2 },
-- maximum interval of interior volume check
4)
return itemstack
end,
})
-- Decorated Pine Leaves
core.register_node('x_farming:christmas_tree_leaves', {
description = S('Decorated Pine Leaves') .. '\n' .. S('Compost chance') .. ': 30%',
short_description = S('Decorated Pine Leaves'),
drawtype = 'allfaces_optional',
tiles = {
{
-- Animated, 'blinking lights' version. ~ LazyJ
name = 'x_farming_christmas_tree_leaves_animated.png',
animation = {
type = 'vertical_frames',
aspect_w = 16,
aspect_h = 16,
length = 20.0
},
}
},
waving = 0,
paramtype = 'light',
is_ground_content = false,
groups = {
-- MTG
snappy = 3,
leafdecay = 3,
-- MCL
handy = 1,
hoey = 1,
shearsy = 1,
swordy = 1,
dig_by_piston = 1,
fire_encouragement = 30,
fire_flammability = 60,
deco_block = 1,
compostability = 30,
-- ALL
flammable = 2,
leaves = 1,
},
_mcl_shears_drop = true,
_mcl_blast_resistance = 0.2,
_mcl_hardness = 0.2,
_mcl_silk_touch_drop = true,
sounds = x_farming.node_sound_leaves_defaults(),
after_place_node = x_farming.after_place_leaves,
light_source = 5,
})
-- Star
core.register_node('x_farming:christmas_tree_star', {
description = S('Christmas Tree Star'),
tiles = { 'x_farming_christmas_tree_star.png' },
inventory_image = 'x_farming_christmas_tree_star.png',
wield_image = 'x_farming_christmas_tree_star.png',
drawtype = 'plantlike',
paramtype = 'light',
walkable = false,
groups = {
-- MTG
cracky = 1,
crumbly = 1,
choppy = 1,
oddly_breakable_by_hand = 1,
not_in_creative_inventory = 1,
leafdecay = 3,
leafdecay_drop = 1,
-- MCL
handy = 1,
glass = 1,
building_block = 1,
material_glass = 1
},
_mcl_blast_resistance = 0.3,
_mcl_hardness = 0.3,
sounds = x_farming.node_sound_thin_glass_defaults(),
light_source = 5,
})
x_farming.register_leafdecay({
trunks = { 'x_farming:pine_nut_tree' },
leaves = {
'x_farming:christmas_tree_leaves',
'x_farming:christmas_tree_star',
-- since christmas tree is loaded after pine_nut_tree
-- we are including pine_nut_leaves here
'x_farming:pine_nut',
'x_farming:pine_nut_leaves',
},
radius = 3,
})