mirror of
https://github.com/HybridDog/riesenpilz.git
synced 2025-01-09 09:20:27 +01:00
add a setting to completely disallow growing a mushroom if some node intersects
This commit is contained in:
parent
c26e59d432
commit
84941ca103
38
init.lua
38
init.lua
@ -36,18 +36,36 @@ local function replacing_allowed(id)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_vm_nodes(manip, pznodes)
|
local set_vm_nodes
|
||||||
local nodes = manip:get_data()
|
if riesenpilz.giant_restrict_area then
|
||||||
for vi,id in pairs(pznodes) do
|
function set_vm_nodes(manip, pznodes)
|
||||||
if replacing_allowed(nodes[vi]) then
|
local nodes = manip:get_data()
|
||||||
|
for vi,id in pairs(pznodes) do
|
||||||
|
if not replacing_allowed(nodes[vi]) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
nodes[vi] = id
|
nodes[vi] = id
|
||||||
end
|
end
|
||||||
|
manip:set_data(nodes)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
function set_vm_nodes(manip, pznodes)
|
||||||
|
local nodes = manip:get_data()
|
||||||
|
for vi,id in pairs(pznodes) do
|
||||||
|
if replacing_allowed(nodes[vi]) then
|
||||||
|
nodes[vi] = id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
manip:set_data(nodes)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
manip:set_data(nodes)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_vm_data(manip, pznodes, pos, t1, name)
|
local function set_vm_data(manip, pznodes, pos, t1, name)
|
||||||
set_vm_nodes(manip, pznodes)
|
if not set_vm_nodes(manip, pznodes) then
|
||||||
|
return
|
||||||
|
end
|
||||||
manip:write_to_map()
|
manip:write_to_map()
|
||||||
riesenpilz.inform("a giant "..name.." mushroom grew at "..vector.pos_to_string(pos), 3, t1)
|
riesenpilz.inform("a giant "..name.." mushroom grew at "..vector.pos_to_string(pos), 3, t1)
|
||||||
local t1 = os.clock()
|
local t1 = os.clock()
|
||||||
@ -167,7 +185,9 @@ local function riesenpilz_minecraft_fliegenpilz(pos)
|
|||||||
local pznodes = {}
|
local pznodes = {}
|
||||||
riesenpilz.fly_agaric(pos, pznodes, area, param2s)
|
riesenpilz.fly_agaric(pos, pznodes, area, param2s)
|
||||||
|
|
||||||
set_vm_nodes(manip, pznodes)
|
if not set_vm_nodes(manip, pznodes) then
|
||||||
|
return
|
||||||
|
end
|
||||||
manip:set_param2_data(param2s)
|
manip:set_param2_data(param2s)
|
||||||
manip:write_to_map()
|
manip:write_to_map()
|
||||||
manip:update_map()
|
manip:update_map()
|
||||||
@ -477,7 +497,9 @@ local function riesenpilz_apple(pos)
|
|||||||
local pznodes = {}
|
local pznodes = {}
|
||||||
riesenpilz.apple(pos, pznodes, area)
|
riesenpilz.apple(pos, pznodes, area)
|
||||||
|
|
||||||
set_vm_nodes(manip, pznodes)
|
if not set_vm_nodes(manip, pznodes) then
|
||||||
|
return
|
||||||
|
end
|
||||||
manip:write_to_map()
|
manip:write_to_map()
|
||||||
riesenpilz.inform("an apple grew at "..vector.pos_to_string(pos), 3, t1)
|
riesenpilz.inform("an apple grew at "..vector.pos_to_string(pos), 3, t1)
|
||||||
manip:update_map()
|
manip:update_map()
|
||||||
|
@ -28,3 +28,6 @@ riesenpilz.max_spam = 2
|
|||||||
|
|
||||||
--3d apple
|
--3d apple
|
||||||
riesenpilz.change_apple = true
|
riesenpilz.change_apple = true
|
||||||
|
|
||||||
|
--disallows growing a mushroom if it not every node would have a free place
|
||||||
|
riesenpilz.giant_restrict_area = false
|
||||||
|
Loading…
Reference in New Issue
Block a user