Overview
| Comment: | moretrees compat |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
641c89175442c76615dbb1c6d2858373 |
| User & Date: | lexi on 2021-07-07 12:57:28 |
| Other Links: | manifest | tags |
Context
|
2021-07-07
| ||
| 13:08 | fug bixes check-in: b9235d8bfa user: lexi tags: trunk | |
| 12:57 | moretrees compat check-in: 641c891754 user: lexi tags: trunk | |
| 12:05 | update harvest god gifts check-in: 18f3f28aa2 user: lexi tags: trunk | |
Changes
Modified data/trees.lua from [4c4b931a13] to [33057bf9f3].
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
leaves = 'default:acacia_leaves';
sap = 'Acacia Sap';
color = {217, 51, 22};
sapglow = 7;
};
jungle = {
desc = 'Jungle';
node = 'default:jungletree';
sapling = 'default:junglesapling';
leaves = 'default:jungleleaves';
sap = 'Tropical Syrup';
color = {86, 39, 71};
imgvariant = 'dull';
};
}
|
> | > > |
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
leaves = 'default:acacia_leaves';
sap = 'Acacia Sap';
color = {217, 51, 22};
sapglow = 7;
};
jungle = {
desc = 'Jungle';
node = {
'default:jungletree';
'moretrees:jungletree_trunk';
};
sapling = 'default:junglesapling';
leaves = 'default:jungleleaves';
sap = 'Tropical Syrup';
color = {86, 39, 71};
imgvariant = 'dull';
};
}
|
Modified lib/node.lua from [3d99ab5529] to [a6a32274e7].
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
--
-- UPDATE: in pratice this is way too expensive to be functional, and causes servers to hang. we're replacing it with a simpler version
local treetype = force(pos).name
if minetest.get_item_group(treetype, 'tree') == 0 then -- sir this is not a tree
return nil -- 無
end
local treedef = sorcery.lib.tbl.select(sorcery.data.trees, 'node', treetype)
local leaftype = treedef and treedef.leaves or nil
if not leaftype then return false end
local uppermost, lowermost
local found_leaves = false
local treemap, treenodes = amass(pos,function(node, where)
|
| > > |
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
-- -- UPDATE: in pratice this is way too expensive to be functional, and causes servers to hang. we're replacing it with a simpler version local treetype = force(pos).name if minetest.get_item_group(treetype, 'tree') == 0 then -- sir this is not a tree return nil -- 無 end local treedef = sorcery.lib.tbl.select(sorcery.data.trees, function(ent) return sorcery.lib.tbl.strmatch(ent.node, treetype) end) local leaftype = treedef and treedef.leaves or nil if not leaftype then return false end local uppermost, lowermost local found_leaves = false local treemap, treenodes = amass(pos,function(node, where) |
Modified lib/tbl.lua from [0fb14e1ea3] to [c7882ede1c].
200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
end fn.cond = function(exp, c) for i, v in ipairs(c) do if c[1](exp) then return c[2](exp) end end end fn.select = function(tbl, prop, ...) local keycache local check if type(prop) == 'function' then check = prop keycache = ... else |
> > > > > > |
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
end fn.cond = function(exp, c) for i, v in ipairs(c) do if c[1](exp) then return c[2](exp) end end end fn.strmatch = function(tbl, str) if tbl == str then return true end if type(tbl) == 'string' then return false end return fn.has(tbl, str) end fn.select = function(tbl, prop, ...) local keycache local check if type(prop) == 'function' then check = prop keycache = ... else |
Modified tap.lua from [eb69eaaf9d] to [451ab2dcbd].
1 2 3 4 5 6 7 8 9 .. 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 .. 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ... 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 ... 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
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';
................................................................................
if vector.subtract(where.under,where.above).y ~= 0 then return end
minetest.set_node(where.above, {
name = 'sorcery:tap';
param2 = minetest.dir_to_wallmounted(vector.subtract(where.under,where.above))
})
if sorcery.lib.node.tree_is_live(where.under) then
-- start dripping immediately to indicate the tree is alive
tapdrip(tree.def.sapliq, where.above)
end
stack:take_item(1)
return stack
end;
................................................................................
abm_cache_time = now
end
local tpos = vector.add(pos,minetest.wallmounted_to_dir(node.param2))
local tnode = minetest.get_node(tpos)
if tnode.name == 'air' then return end --pathological case
local tree
for id,t in pairs(sorcery.data.trees) do
if t.node == tnode.name then
tree = t
goto found
end
end do
return
end ::found::
................................................................................
live = true
local c = abm_cache.treehash[tposhash]
-- mass_leaves = c.mass_leaves
mass_trunk = c.mass_trunk
prevalidate = true
else
local tbody
live, tbody = sorcery.lib.node.tree_is_live(tpos)
if live then
should_cache = tbody.nodes[tbody.trunk]
-- mass_leaves = #(tbody.nodes[tbody.leaves])
mass_trunk = #(tbody.nodes[tbody.trunk]) * 12
topnode = tbody.topnode
end
end
................................................................................
-- if minetest.get_natural_light(vector.offset(topnode,0,1,0), 0.5) < 13
-- then return false end
-- end
-- FIXME
for i=1,8 do
local at = vector.offset(pos, 0,-i,0)
if sorcery.lib.node.is_air(at) then goto skip end
local trough = minetest.get_node(at)
if minetest.get_item_group(trough.name, 'sorcery_trough') ~= 0 then
local n = minetest.registered_nodes[trough.name]
local l = sorcery.register.liquid.db[tree.sapliq]
local C = sorcery.liquid.constants
if n._sorcery and n._sorcery.container then
|
> | | | | |
1 2 3 4 5 6 7 8 9 10 .. 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 .. 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ... 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 ... 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
local log = sorcery.logger('tap')
local sap_interval = 60;
local L=sorcery.lib
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';
................................................................................
if vector.subtract(where.under,where.above).y ~= 0 then return end
minetest.set_node(where.above, {
name = 'sorcery:tap';
param2 = minetest.dir_to_wallmounted(vector.subtract(where.under,where.above))
})
if L.node.tree_is_live(where.under) then
-- start dripping immediately to indicate the tree is alive
tapdrip(tree.def.sapliq, where.above)
end
stack:take_item(1)
return stack
end;
................................................................................
abm_cache_time = now
end
local tpos = vector.add(pos,minetest.wallmounted_to_dir(node.param2))
local tnode = minetest.get_node(tpos)
if tnode.name == 'air' then return end --pathological case
local tree
for id,t in pairs(sorcery.data.trees) do
if L.tbl.strmatch(t.node, tnode.name) then
tree = t
goto found
end
end do
return
end ::found::
................................................................................
live = true
local c = abm_cache.treehash[tposhash]
-- mass_leaves = c.mass_leaves
mass_trunk = c.mass_trunk
prevalidate = true
else
local tbody
live, tbody = L.node.tree_is_live(tpos)
if live then
should_cache = tbody.nodes[tbody.trunk]
-- mass_leaves = #(tbody.nodes[tbody.leaves])
mass_trunk = #(tbody.nodes[tbody.trunk]) * 12
topnode = tbody.topnode
end
end
................................................................................
-- if minetest.get_natural_light(vector.offset(topnode,0,1,0), 0.5) < 13
-- then return false end
-- end
-- FIXME
for i=1,8 do
local at = vector.offset(pos, 0,-i,0)
if L.node.is_air(at) then goto skip end
local trough = minetest.get_node(at)
if minetest.get_item_group(trough.name, 'sorcery_trough') ~= 0 then
local n = minetest.registered_nodes[trough.name]
local l = sorcery.register.liquid.db[tree.sapliq]
local C = sorcery.liquid.constants
if n._sorcery and n._sorcery.container then
|
Modified tree.lua from [9824222a51] to [e98976a563].
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
..
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
}
local log = sorcery.logger('tree')
local L = sorcery.lib
sorcery.register.trees.foreach('sorcery:treesetup', {}, function(id, t)
-- generates sap and hooks handlers appropriately
if t.node then
local def = minetest.registered_nodes[t.node]
local nextfn = def.on_place
minetest.override_item(t.node, { on_place = function(stack, who, pointed, ...)
if nextfn then nextfn(stack, who, pointed, ...) end
if who ~= nil and pointed.type == 'node' then
-- local pos = pointed.above
-- local _, counts = minetest.find_nodes_in_area(
-- vector.offset(pos, -1,-1,-1),
-- vector.offset(pos, 1, 1, 1),
-- t.leaves or 'group:leaves', false)
-- if counts[next(counts)] > 0 then
local n = minetest.get_node(pointed.above)
n.param1 = 1
minetest.swap_node(pointed.above, n)
-- end
end
end })
end
if t.sap == false then return end
if not t.sapliq then
t.sapliq = string.format('sorcery:sap_%s', id)
local sapdesc = t.sap or (t.desc .. ' Tree Sap')
sorcery.liquid.register {
................................................................................
name = what
else
pos = what
name = sorcery.lib.node.force(what).name
end
for tn, def in pairs(sorcery.data.trees) do
if def.node == name then
return {
tree = tn;
def = def;
pos = pos;
node = name;
}
end
|
>
>
>
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
|
|
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
..
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
}
local log = sorcery.logger('tree')
local L = sorcery.lib
sorcery.register.trees.foreach('sorcery:treesetup', {}, function(id, t)
-- generates sap and hooks handlers appropriately
if t.node then
local nodes = t.node
if type(nodes) == 'string' then nodes = {nodes} end
for _, node in pairs(nodes) do
local def = minetest.registered_nodes[node]
if def then
local nextfn = def.on_place
minetest.override_item(node, { on_place = function(stack, who, pointed, ...)
if nextfn then nextfn(stack, who, pointed, ...) end
if who ~= nil and pointed.type == 'node' then
-- local pos = pointed.above
-- local _, counts = minetest.find_nodes_in_area(
-- vector.offset(pos, -1,-1,-1),
-- vector.offset(pos, 1, 1, 1),
-- t.leaves or 'group:leaves', false)
-- if counts[next(counts)] > 0 then
local n = minetest.get_node(pointed.above)
n.param1 = 1
minetest.swap_node(pointed.above, n)
-- end
end
end })
end
end
end
if t.sap == false then return end
if not t.sapliq then
t.sapliq = string.format('sorcery:sap_%s', id)
local sapdesc = t.sap or (t.desc .. ' Tree Sap')
sorcery.liquid.register {
................................................................................
name = what
else
pos = what
name = sorcery.lib.node.force(what).name
end
for tn, def in pairs(sorcery.data.trees) do
if L.tbl.strmatch(def.node, name) then
return {
tree = tn;
def = def;
pos = pos;
node = name;
}
end
|