-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.lua
More file actions
47 lines (39 loc) · 1.8 KB
/
functions.lua
File metadata and controls
47 lines (39 loc) · 1.8 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
--[[
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 pos 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
--]]
-- Activate timers on bees which were spawned without starting the timer (bug was fixed in 5d04f7fdc5cb43e7573438a864c3730e05cff608)
core.register_lbm({
-- Descriptive label for profiling purposes (optional).
-- Definitions with identical labels will be listed as one.
label = 'x_farming_bee_timers',
-- Identifier of the LBM, should follow the modname:<whatever> convention
name = 'x_farming:bee_timers',
-- List of node names to trigger the LBM on.
-- Names of non-registered nodes and groups (as group:groupname)
-- will work as well.
nodenames = {
'x_farming:bee',
'x_farming:lotus_flower_purple',
'x_farming:lotus_flower_pink'
},
-- Function triggered for each qualifying node.
-- `dtime_s` is the in-game time (in seconds) elapsed since the block
-- was last active
action = function(pos, node, dtime_s)
local timer = core.get_node_timer(pos)
if not timer:is_started() then
core.get_node_timer(pos):start(1)
end
end
})