1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
..
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
local log = sorcery.logger('tap')
local sap_interval = 50;
local function tapdrip(liq, pos)
return sorcery.vfx.drip(liq, vector.offset(pos, 0, -0.3, 0), math.random(5,12), sap_interval, 2)
end
minetest.register_node('sorcery:tap',{
description = 'Tree Tap';
drawtype = 'mesh';
mesh = 'sorcery-tap.obj';
inventory_image = 'sorcery_tap_inv.png';
tiles = {
'default_copper_block.png';
'default_steel_block.png';
};
................................................................................
local abm_cache
local abm_cache_time
minetest.register_abm {
label = 'Sap drip';
nodenames = {'sorcery:tap'};
neighbors = {'group:tree'};
interval = sap_interval;
chance = 4;
catch_up = true;
action = function(pos, node)
local now = os.time()
if abm_cache_time == nil or now > abm_cache_time + (sap_interval-1) then
abm_cache = { treehash = {} }
abm_cache_time = now
end
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
..
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
local log = sorcery.logger('tap')
local sap_interval = 60;
local function tapdrip(liq, pos)
return sorcery.vfx.drip(liq, vector.offset(pos, 0, -0.3, 0), math.random(5,12), sap_interval, 2)
end
minetest.register_node('sorcery:tap',{
description = 'Tap';
drawtype = 'mesh';
mesh = 'sorcery-tap.obj';
inventory_image = 'sorcery_tap_inv.png';
tiles = {
'default_copper_block.png';
'default_steel_block.png';
};
................................................................................
local abm_cache
local abm_cache_time
minetest.register_abm {
label = 'Sap drip';
nodenames = {'sorcery:tap'};
neighbors = {'group:tree'};
interval = sap_interval;
chance = 5;
catch_up = true;
action = function(pos, node)
local now = os.time()
if abm_cache_time == nil or now > abm_cache_time + (sap_interval-1) then
abm_cache = { treehash = {} }
abm_cache_time = now
end
|