forked from PilzAdam/farming_plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweed.lua
More file actions
61 lines (57 loc) · 1.24 KB
/
weed.lua
File metadata and controls
61 lines (57 loc) · 1.24 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
-- main `S` code in init.lua
local S = farming.S
core.register_node(':farming:weed', {
description = S('Weed'),
paramtype = 'light',
sunlight_propagates = true,
walkable = false,
drawtype = "plantlike",
waving = 1,
is_ground_content = true,
buildable_to = true,
tiles = { 'farming_weed.png' },
inventory_image = "farming_weed.png",
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
groups = {
attached_node=1,
flammable=3,
flora=1,
not_in_creative_inventory=1,
snappy=3
},
stack_max = 495,
sounds = default.node_sound_leaves_defaults()
})
-- decay weed after some time
core.register_abm({
nodenames = { 'farming:weed' },
interval = 50,
chance = 200,
action = function( pos )
core.remove_node( pos )
end
})
core.register_abm({
nodenames = {"farming:soil_wet", "farming:soil"},
interval = 50,
chance = 20,
action = function(pos, node)
if core.find_node_near(pos, 4, {"farming:scarecrow", "farming:scarecrow_light"}) ~= nil then
return
end
pos.y = pos.y+1
if core.get_node(pos).name == "air" then
node.name = "farming:weed"
core.set_node(pos, node)
end
end
})
-- ========= FUEL =========
core.register_craft({
type = "fuel",
recipe = "farming:weed",
burntime = 1
})