1
0
mirror of git://repo.or.cz/minetest_schemedit.git synced 2024-11-10 18:30:16 +01:00

Add schematic void for ignored nodes

This commit is contained in:
Wuzzy 2017-09-01 22:56:46 +02:00
parent 425274ae38
commit d7c8bedfa1
2 changed files with 58 additions and 23 deletions

View File

@ -298,7 +298,7 @@ advschem.add_form("prob", {
]]
else
form = form .. [[
label[1,0.2;Insert item in slot.]
label[1,0.2;Insert node in slot.]
]]
end
@ -668,7 +668,15 @@ minetest.register_on_shutdown(advschem.save)
minetest.register_on_placenode(function(pos, newnode, player, oldnode, itemstack)
local smeta = itemstack:get_meta():to_table().fields
local prob
if smeta.advschem_prob and tonumber(smeta.advschem_prob) then
prob = tonumber(smeta.advschem_prob)
elseif newnode.name == "advschem:void" then
prob = 0
else
return
end
local px, py, pz = pos.x, pos.y, pos.z
for strpos, r in pairs(marked) do
local ap1, ap2 = r.pos1, r.pos2
@ -683,21 +691,20 @@ minetest.register_on_placenode(function(pos, newnode, player, oldnode, itemstack
local prob_list = minetest.deserialize(meta:get_string("prob_list"))
local force_place = false
if smeta.advschem_force_place == "true" then
if newnode.name ~= "advschem:void" and smeta.advschem_force_place == "true" then
force_place = true
end
local ostrpos = minetest.pos_to_string(pos)
prob_list[ostrpos] = {
pos = pos,
prob = tonumber(smeta.advschem_prob),
prob = prob,
force_place = force_place,
}
meta:set_string("prob_list", minetest.serialize(prob_list))
end
end
end
end
end)
-- [event] Remove probability on break node
@ -802,6 +809,17 @@ minetest.register_node("advschem:creator", {
advschem.show_formspec(pos, player, "prob", true)
end
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if listname == "probability" then
local itemstring = stack:get_name()
if itemstring == "advschem:void" then
return 0
elseif minetest.registered_items[itemstring].type ~= "node" then
return 0
end
end
return stack:get_count()
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
if listname == "probability" then
advschem.show_formspec(pos, player, "prob", true)
@ -809,6 +827,23 @@ minetest.register_node("advschem:creator", {
end,
})
minetest.register_node("advschem:void", {
description = "Schematic Void",
tiles = { "advschem_void.png" },
drawtype = "nodebox",
is_ground_content = false,
paramtype = "light",
walkable = false,
sunlight_propagates = true,
node_box = {
type = "fixed",
fixed = {
{ -4/16, -4/16, -4/16, 4/16, 4/16, 4/16 },
},
},
groups = { dig_immediate = 3},
})
-- [entity] Display
minetest.register_entity("advschem:display", {
initial_properties = {

BIN
textures/advschem_void.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B