Merge pull request 'Piston-breakable nodes don't fill up the push limit, items properly drop' (#3813) from seventeenthShulker/MineClone2:piston_digs_properly into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3813
This commit is contained in:
the-real-herowl 2023-11-06 19:50:31 +00:00
commit 5a069af072
12 changed files with 162 additions and 117 deletions

@ -741,12 +741,14 @@ if minetest.is_creative_enabled("") then
for _, item in ipairs(drops) do
minetest.add_item(pos, item)
end
end
local inv = digger:get_inventory()
if inv then
for _, item in ipairs(drops) do
if not inv:contains_item("main", item, true) then
inv:add_item("main", item)
else
-- If there is a player
local inv = digger:get_inventory()
if inv then
for _, item in ipairs(drops) do
if not inv:contains_item("main", item, true) then
inv:add_item("main", item)
end
end
end
end

@ -246,6 +246,15 @@ function mesecon.mergetable(source, dest)
return rval
end
--
function mesecon.join_table(t1, t2)
local rval = mesecon.tablecopy(t2)
for i, v in ipairs(t1) do
table.insert(rval, mesecon.tablecopy(v))
end
return rval
end
function mesecon.register_node(name, spec_common, spec_off, spec_on)
spec_common.drop = spec_common.drop or name .. "_off"
spec_common.on_blast = spec_common.on_blast or mesecon.on_blastnode

@ -211,6 +211,11 @@ function mesecon.register_button(basename, description, texture, recipeitem, sou
output = "mesecons_button:button_"..basename.."_off",
recipe = {{ recipeitem }},
})
if minetest.get_modpath("mesecons_mvps") then
mesecon.register_mvps_unsticky("mesecons_button:button_"..basename.."_off")
mesecon.register_mvps_unsticky("mesecons_button:button_"..basename.."_on")
end
end
mesecon.register_button(

@ -117,7 +117,7 @@ local function is_available(pos)
return false, n
end
if minetest.registered_nodes[name] then
return minetest.registered_nodes[name].buildable_to, n or false, n
return minetest.registered_nodes[name].buildable_to or minetest.get_item_group(name, "dig_by_piston") == 1, n or false, n
end
return false, n
end
@ -126,6 +126,7 @@ end
function mesecon.mvps_get_stack(pos, dir, maximum, piston_pos)
-- determine the number of nodes to be pushed
local nodes = {}
local dig_nodes = {}
local frontiers = {pos}
while #frontiers > 0 do
@ -140,47 +141,50 @@ function mesecon.mvps_get_stack(pos, dir, maximum, piston_pos)
return
end
if not node_replaceable(nn.name) then
if #nodes >= maximum then return nil, false end
table.insert(nodes, {node = nn, pos = {x=np.x, y=np.y, z=np.z}})
-- add connected nodes to frontiers, connected is a vector list
-- the vectors must be absolute positions
local connected = {}
local has_loop
if minetest.registered_nodes[nn.name]
and minetest.registered_nodes[nn.name].mvps_sticky then
connected, has_loop = minetest.registered_nodes[nn.name].mvps_sticky(np, nn, piston_pos)
if has_loop then
return {}, true
end
end
table.insert(connected, vector.add(np, dir))
-- Make sure there are no duplicates in frontiers / nodes before
-- adding nodes in "connected" to frontiers
for _, cp in ipairs(connected) do
local duplicate = false
for _, rp in ipairs(nodes) do
if vector.equals(cp, rp.pos) then
duplicate = true
if minetest.get_item_group(nn.name, "dig_by_piston") == 1 then
-- if we want the node to drop, e.g. sugar cane, do not count towards push limit
table.insert(dig_nodes, {node = nn, pos = {x=np.x, y=np.y, z=np.z}})
else
if not node_replaceable(nn.name) then
table.insert(nodes, {node = nn, pos = {x=np.x, y=np.y, z=np.z}})
if #nodes > maximum then return nil, nil, false, true end
-- add connected nodes to frontiers, connected is a vector list
-- the vectors must be absolute positions
local connected = {}
local has_loop
if minetest.registered_nodes[nn.name] and minetest.registered_nodes[nn.name].mvps_sticky then
connected, has_loop = minetest.registered_nodes[nn.name].mvps_sticky(np, nn, piston_pos)
if has_loop then
return {}, {}, true, false
end
end
for _, fp in ipairs(frontiers) do
if vector.equals(cp, fp) then
duplicate = true
table.insert(connected, vector.add(np, dir))
-- Make sure there are no duplicates in frontiers / nodes before
-- adding nodes in "connected" to frontiers
for _, cp in ipairs(connected) do
local duplicate = false
for _, rp in ipairs(nodes) do
if vector.equals(cp, rp.pos) then
duplicate = true
end
end
for _, fp in ipairs(frontiers) do
if vector.equals(cp, fp) then
duplicate = true
end
end
if not duplicate and not mesecon.is_mvps_stopper(minetest.get_node(cp)) and minetest.get_item_group(nn.name, "dig_by_piston") == 0 then
table.insert(frontiers, cp)
end
end
if not duplicate and not mesecon.is_mvps_stopper(minetest.get_node(cp)) then
table.insert(frontiers, cp)
end
end
end
table.remove(frontiers, 1)
end
return nodes, false
return nodes, dig_nodes, false, false
end
function mesecon.mvps_set_owner(pos, placer)
@ -203,6 +207,11 @@ local function are_protected(nodes, player_name)
end
function mesecon.mvps_push(pos, dir, maximum, player_name, piston_pos)
-- check if the node in front of the piston is protected against player_name (to prevent replacing air)
if minetest.is_protected(pos, player_name) then
return false
end
return mesecon.mvps_push_or_pull(pos, dir, dir, maximum, player_name, piston_pos)
end
@ -222,9 +231,9 @@ end
-- movedir: direction of actual movement
-- maximum: maximum nodes to be pushed
function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, player_name, piston_pos)
local nodes, has_loop = mesecon.mvps_get_stack(pos, movedir, maximum, piston_pos)
local nodes, dig_nodes, has_loop, too_many = mesecon.mvps_get_stack(pos, movedir, maximum, piston_pos)
if has_loop then
if has_loop or too_many then
return false
end
@ -237,6 +246,9 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, player_name,
if (newpos[i].x == piston_pos.x) and (newpos[i].y == piston_pos.y) and (newpos[i].z == piston_pos.z) then
return
end
if minetest.is_protected(newpos[i], player_name) then
return
end
if not is_available(newpos[i]) then
local available = false
for j in ipairs(nodes) do
@ -253,18 +265,35 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, player_name,
end
end
if are_protected(nodes, player_name) then
local all_nodes = nodes
if dig_nodes and #dig_nodes > 0 then all_nodes = mesecon.join_table(dig_nodes, nodes) end
if are_protected(all_nodes, player_name) then
return
end
local first_dropper = nil
-- remove all nodes
for id, n in ipairs(nodes) do
for id, n in ipairs(all_nodes) do
n.meta = minetest.get_meta(n.pos):to_table()
local is_dropper = mesecon.is_mvps_dropper(n.node, movedir, nodes, id)
local is_dropper = mesecon.is_mvps_dropper(n.node, movedir, all_nodes, id)
if is_dropper then
--local drops = minetest.get_node_drops(n.node.name, "")
minetest.dig_node(n.pos)
-- if current node has already been destroyed (e.g. chain reaction of sugar cane breaking), skip it
if minetest.get_node(n.pos).name == n.node.name then
-- simulate dig_node using handle_node_drops
local drops = minetest.get_node_drops(n.node.name, "")
local counted_drops = {}
minetest.remove_node(n.pos)
for _, callback in pairs(minetest.registered_on_dignodes) do
callback(n.pos, n)
end
for _, item in ipairs(drops) do
if type(item) ~= "string" then
item = item:get_name() .. item:get_count()
end
table.insert(counted_drops, item)
end
minetest.handle_node_drops(n.pos, counted_drops)
end
else
minetest.remove_node(n.pos)
local node_timer = minetest.get_node_timer(n.pos)
@ -273,13 +302,13 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, player_name,
end
end
if is_dropper then
first_dropper = id
break
-- get id of the first dropper, but we still let everything else drop, so don't break here
if not first_dropper then first_dropper = id end
end
end
-- update mesecons for removed nodes ( has to be done after all nodes have been removed )
for id, n in ipairs(nodes) do
for id, n in ipairs(all_nodes) do
if first_dropper and id >= first_dropper then
break
end
@ -287,7 +316,7 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, player_name,
end
-- add nodes
for id, n in ipairs(nodes) do
for id, n in ipairs(all_nodes) do
if first_dropper and id >= first_dropper then
break
end
@ -394,6 +423,7 @@ mesecon.register_mvps_stopper("mcl_core:realm_barrier")
mesecon.register_mvps_stopper("mcl_core:void")
mesecon.register_mvps_stopper("mcl_core:bedrock")
mesecon.register_mvps_stopper("mcl_core:obsidian")
mesecon.register_mvps_stopper("mcl_core:crying_obsidian")
mesecon.register_mvps_stopper("mcl_chests:ender_chest")
mesecon.register_mvps_stopper("mcl_chests:ender_chest_small")
mesecon.register_mvps_stopper("mcl_mobspawners:spawner")
@ -411,10 +441,9 @@ mesecon.register_mvps_stopper("mesecons_solarpanel:solar_panel_inverted_on")
mesecon.register_mvps_stopper("mesecons_solarpanel:solar_panel_inverted_off")
mesecon.register_mvps_stopper("mcl_banners:hanging_banner")
mesecon.register_mvps_stopper("mcl_banners:standing_banner")
mesecon.register_mvps_stopper("mcl_campfires:campfire")
mesecon.register_mvps_stopper("mcl_campfires:campfire_lit")
mesecon.register_mvps_stopper("mcl_campfires:soul_campfire")
mesecon.register_mvps_stopper("mcl_campfires:soul_campfire_lit")
mesecon.register_mvps_stopper("mcl_beehives:bee_nest")
mesecon.register_mvps_stopper("mcl_beehives:beehive")
mesecon.register_mvps_stopper("mcl_compass:lodestone")
-- Unmovable by technical restrictions.
-- Open formspec would screw up if node is destroyed (minor problem)
@ -445,13 +474,14 @@ mesecon.register_mvps_stopper("mcl_chests:trapped_chest")
mesecon.register_mvps_stopper("mcl_chests:trapped_chest_small")
mesecon.register_mvps_stopper("mcl_chests:trapped_chest_left")
mesecon.register_mvps_stopper("mcl_chests:trapped_chest_right")
mesecon.register_mvps_stopper("mcl_signs:wall_sign")
mesecon.register_mvps_stopper("mcl_signs:standing_sign")
mesecon.register_mvps_stopper("mcl_signs:standing_sign22_5")
mesecon.register_mvps_stopper("mcl_signs:standing_sign45")
mesecon.register_mvps_stopper("mcl_signs:standing_sign67_5")
mesecon.register_mvps_stopper("mcl_barrels:barrel_open")
mesecon.register_mvps_stopper("mcl_barrels:barrel_closed")
mesecon.register_mvps_stopper("mcl_campfires:campfire")
mesecon.register_mvps_stopper("mcl_campfires:campfire_lit")
mesecon.register_mvps_stopper("mcl_campfires:soul_campfire")
mesecon.register_mvps_stopper("mcl_campfires:soul_campfire_lit")
mesecon.register_mvps_stopper("mcl_lectern:lectern")
mesecon.register_mvps_stopper("mcl_grindstone:grindstone")
-- Unmovable by design: objects
@ -495,8 +525,6 @@ mesecon.register_mvps_unsticky("mcl_bamboo:bamboo_2")
mesecon.register_mvps_unsticky("mcl_bamboo:bamboo_3")
mesecon.register_mvps_unsticky("mcl_bamboo:bamboo_door")
mesecon.register_mvps_unsticky("mcl_bamboo:bamboo_trapdoor")
mesecon.register_mvps_unsticky("mcl_signs:wall_sign_bamboo")
mesecon.register_mvps_unsticky("mcl_bamboo:scaffolding")
-- Beds
@ -532,21 +560,6 @@ mesecon.register_mvps_unsticky("mcl_beds:bed_white_top")
mesecon.register_mvps_unsticky("mcl_beds:bed_white_bottom")
mesecon.register_mvps_unsticky("mcl_beds:bed_yellow_top")
mesecon.register_mvps_unsticky("mcl_beds:bed_yellow_bottom")
-- Buttons
mesecon.register_mvps_unsticky("mesecons_button:button_stone_off")
mesecon.register_mvps_unsticky("mesecons_button:button_stone_on")
mesecon.register_mvps_unsticky("mesecons_button:button_wood_off")
mesecon.register_mvps_unsticky("mesecons_button:button_wood_on")
mesecon.register_mvps_unsticky("mesecons_button:button_acaciawood_off")
mesecon.register_mvps_unsticky("mesecons_button:button_acaciawood_on")
mesecon.register_mvps_unsticky("mesecons_button:button_birchwood_off")
mesecon.register_mvps_unsticky("mesecons_button:button_birchwood_on")
mesecon.register_mvps_unsticky("mesecons_button:button_darkwood_off")
mesecon.register_mvps_unsticky("mesecons_button:button_darkwood_on")
mesecon.register_mvps_unsticky("mesecons_button:button_sprucewood_off")
mesecon.register_mvps_unsticky("mesecons_button:button_sprucewood_on")
mesecon.register_mvps_unsticky("mesecons_button:button_junglewood_off")
mesecon.register_mvps_unsticky("mesecons_button:button_junglewood_on")
-- Cactus, Sugarcane & Vines
mesecon.register_mvps_unsticky("mcl_core:cactus")
mesecon.register_mvps_unsticky("mcl_core:reeds")
@ -559,23 +572,6 @@ mesecon.register_mvps_unsticky("mcl_cake:cake_4")
mesecon.register_mvps_unsticky("mcl_cake:cake_5")
mesecon.register_mvps_unsticky("mcl_cake:cake_6")
mesecon.register_mvps_unsticky("mcl_cake:cake")
-- Carpet
mesecon.register_mvps_unsticky("mcl_wool:black_carpet")
mesecon.register_mvps_unsticky("mcl_wool:blue_carpet")
mesecon.register_mvps_unsticky("mcl_wool:brown_carpet")
mesecon.register_mvps_unsticky("mcl_wool:cyan_carpet")
mesecon.register_mvps_unsticky("mcl_wool:green_carpet")
mesecon.register_mvps_unsticky("mcl_wool:grey_carpet")
mesecon.register_mvps_unsticky("mcl_wool:light_blue_carpet")
mesecon.register_mvps_unsticky("mcl_wool:lime_carpet")
mesecon.register_mvps_unsticky("mcl_wool:orange_carpet")
mesecon.register_mvps_unsticky("mcl_wool:magenta_carpet")
mesecon.register_mvps_unsticky("mcl_wool:pink_carpet")
mesecon.register_mvps_unsticky("mcl_wool:purple_carpet")
mesecon.register_mvps_unsticky("mcl_wool:red_carpet")
mesecon.register_mvps_unsticky("mcl_wool:silver_carpet")
mesecon.register_mvps_unsticky("mcl_wool:white_carpet")
mesecon.register_mvps_unsticky("mcl_wool:yellow_carpet")
-- Carved & Jack O'Lantern Pumpkins, Pumpkin & Melon
mesecon.register_mvps_unsticky("mcl_farming:pumpkin_face")
mesecon.register_mvps_unsticky("mcl_farming:pumpkin_face_light")
@ -907,16 +903,16 @@ mesecon.register_mvps_unsticky("mcl_chests:black_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:blue_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:brown_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:cyan_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:dark_green_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:dark_grey_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:lightblue_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:green_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:grey_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:light_blue_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:lime_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:orange_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:magenta_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:pink_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:purple_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:violet_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:red_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:silver_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:grey_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:white_shulker_box_small")
mesecon.register_mvps_unsticky("mcl_chests:yellow_shulker_box_small")
-- Snow

@ -138,14 +138,12 @@ local function piston_off(pos, node)
end
local function piston_orientate(pos, placer)
mesecon.mvps_set_owner(pos, placer)
-- not placed by player
if not placer then return end
-- placer pitch in degrees
local pitch = placer:get_look_vertical() * (180 / math.pi)
local node = minetest.get_node(pos)
local pistonspec = minetest.registered_nodes[node.name].mesecons_piston
if pitch > 55 then
@ -153,6 +151,9 @@ local function piston_orientate(pos, placer)
elseif pitch < -55 then
minetest.add_node(pos, {name=pistonspec.piston_down})
end
-- set owner meta after setting node, or it will not keep
mesecon.mvps_set_owner(pos, placer)
end

@ -251,7 +251,7 @@ local bamboo_def = {
minetest.register_node(BAMBOO, bamboo_def)
local bamboo_top = table.copy(bamboo_def)
bamboo_top.groups = {not_in_creative_inventory = 1, handy = 1, axey = 1, choppy = 1, flammable = 3}
bamboo_top.groups = {not_in_creative_inventory = 1, handy = 1, axey = 1, choppy = 1, dig_by_piston = 1, plant = 1, non_mycelium_plant = 1, flammable = 3}
bamboo_top.tiles = {"mcl_bamboo_endcap.png"}
bamboo_top.drawtype = "plantlike_rooted" --"plantlike"
--bamboo_top.paramtype2 = "meshoptions"
@ -361,7 +361,7 @@ bamboo_one_def.selection_box = {
{-0.05, -0.5, 0.285, -0.275, 0.5, 0.06},
}
}
bamboo_one_def.groups = {not_in_creative_inventory = 1, handy = 1, axey = 1, choppy = 1, flammable = 3}
bamboo_one_def.groups = {not_in_creative_inventory = 1, handy = 1, axey = 1, choppy = 1, dig_by_piston = 1, plant = 1, non_mycelium_plant = 1, flammable = 3}
mcl_bamboo.mcl_log(dump(mcl_bamboo.bamboo_index))
minetest.register_node(mcl_bamboo.bamboo_index[2], bamboo_one_def)
local bamboo_two_def = table.copy(bamboo_def)
@ -385,7 +385,7 @@ bamboo_two_def.selection_box = {
{0.25, -0.5, 0.325, 0.025, 0.5, 0.100},
}
}
bamboo_two_def.groups = {not_in_creative_inventory = 1, handy = 1, axey = 1, choppy = 1, flammable = 3}
bamboo_two_def.groups = {not_in_creative_inventory = 1, handy = 1, axey = 1, choppy = 1, dig_by_piston = 1, plant = 1, non_mycelium_plant = 1, flammable = 3}
minetest.register_node(mcl_bamboo.bamboo_index[3], bamboo_two_def)
local bamboo_three_def = table.copy(bamboo_def)
@ -408,5 +408,5 @@ bamboo_three_def.selection_box = {
{-0.125, -0.5, 0.125, -0.3125, 0.5, 0.3125},
}
}
bamboo_three_def.groups = {not_in_creative_inventory = 1, handy = 1, axey = 1, choppy = 1, flammable = 3}
bamboo_three_def.groups = {not_in_creative_inventory = 1, handy = 1, axey = 1, choppy = 1, dig_by_piston = 1, plant = 1, non_mycelium_plant = 1, flammable = 3}
minetest.register_node(mcl_bamboo.bamboo_index[4], bamboo_three_def)

@ -67,7 +67,7 @@ end
local BAMBOO_ENDCAP_NAME = "mcl_bamboo:bamboo_endcap"
-- For when I learn more about the pistons...
-- check if supporting block is broken. pistons now break the bamboo plant.
function mcl_bamboo.break_orphaned(pos)
mcl_bamboo.mcl_log("Break_Orphaned called.")
local node_below = minetest.get_node(vector.offset(pos, 0, -1, 0))

@ -33,7 +33,7 @@ minetest.register_node("mcl_bells:bell", {
"mcl_bells_bell_side.png",
},
is_ground_content = false,
groups = {pickaxey=2, deco_block=1 },
groups = {pickaxey=2, deco_block=1, dig_by_piston=1 },
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 5,
_mcl_hardness = 5,

@ -139,8 +139,8 @@ minetest.register_node("mcl_core:deadbush", {
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {handy = 1, shearsy = 1, flammable = 3, attached_node = 1, plant = 1, non_mycelium_plant = 1, dig_by_water = 1,
destroy_by_lava_flow = 1, deco_block = 1, fire_encouragement = 60, fire_flammability = 100},
groups = {handy = 1, shearsy = 1, flammable = 3, attached_node = 1, plant = 1, non_mycelium_plant = 1, dig_by_piston = 1,
dig_by_water = 1, destroy_by_lava_flow = 1, deco_block = 1, fire_encouragement = 60, fire_flammability = 100},
drop = {
max_items = 1,
items = {

@ -128,8 +128,6 @@ local fortune_wheat_seed_drop = {
overwrite = true,
}
-- CHECKME: How does tall grass behave when pushed by a piston?
--- Tall Grass ---
local def_tallgrass = {
description = S("Tall Grass"),
@ -155,7 +153,7 @@ local def_tallgrass = {
groups = {
handy = 1, shearsy = 1, attached_node = 1, deco_block = 1,
plant = 1, place_flowerlike = 2, non_mycelium_plant = 1,
flammable = 3, fire_encouragement = 60, fire_flammability = 100,
flammable = 3, fire_encouragement = 60, fire_flammability = 10, dig_by_piston = 1,
dig_by_water = 1, destroy_by_lava_flow = 1, compostability = 30, grass_palette = 1
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
@ -252,7 +250,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
paramtype2 = paramtype2,
palette = palette,
walkable = false,
buildable_to = true,
buildable_to = false,
drop = drop_bottom,
_mcl_shears_drop = shears_drop,
_mcl_fortune_drop = fortune_drop,
@ -354,7 +352,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
paramtype2 = paramtype2,
palette = palette,
walkable = false,
buildable_to = true,
buildable_to = false,
selection_box = {
type = "fixed",
fixed = { -selbox_radius, -0.5, -selbox_radius, selbox_radius, selbox_top_height, selbox_radius },

@ -118,7 +118,7 @@ function mcl_lanterns.register_lantern(name, def)
node_placement_prediction = "",
sunlight_propagates = true,
light_source = def.light_level,
groups = {pickaxey = 1, attached_node = 1, deco_block = 1, lantern = 1},
groups = {pickaxey = 1, attached_node = 1, deco_block = 1, lantern = 1, dig_by_piston=1},
selection_box = {
type = "fixed",
fixed = {

@ -85,7 +85,7 @@ end
mcl_signs = {}
-- GLOBALS
mcl_signs.sign_groups = { handy = 1, axey = 1, deco_block = 1, material_wood = 1, attached_node = 1, dig_by_piston = 1, flammable = -1 }
mcl_signs.sign_groups = { handy = 1, axey = 1, deco_block = 1, material_wood = 1, attached_node = 1, flammable = -1 }
--- colors used for wools.
mcl_signs.mcl_wool_colors = {
unicolor_white = "#FFFFFF",
@ -764,6 +764,15 @@ function mcl_signs.register_sign (modname, color, _name, ttsign)
table.insert(mcl_signs.standing_rotation_levels, { "mcl_signs:standing_sign22_5" .. _name, 1 })
table.insert(mcl_signs.standing_rotation_levels, { "mcl_signs:standing_sign45" .. _name, 2 })
table.insert(mcl_signs.standing_rotation_levels, { "mcl_signs:standing_sign67_5" .. _name, 3 })
-- register as unpushable
if minetest.get_modpath("mesecons_mvps") then
mesecon.register_mvps_stopper("mcl_signs:wall_sign" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign22_5" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign45" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign67_5" .. _name)
end
end
--- The same as register_sign, except caller defines the textures. Note, there is a greyscale version of the sign,
@ -1002,6 +1011,14 @@ function mcl_signs.register_sign_custom (modname, _name, tiles, color, inventory
table.insert(mcl_signs.standing_rotation_levels, { "mcl_signs:standing_sign45" .. _name, 2 })
table.insert(mcl_signs.standing_rotation_levels, { "mcl_signs:standing_sign67_5" .. _name, 3 })
-- register as unpushable
if minetest.get_modpath("mesecons_mvps") then
mesecon.register_mvps_stopper("mcl_signs:wall_sign" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign22_5" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign45" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign67_5" .. _name)
end
end
--- Override an existing sign, tint the textures, and gives it an unique node name. Creates both wall and standing signs.
@ -1234,6 +1251,15 @@ function mcl_signs.reregister_sign (modname, color, _name, ttsign)
table.insert(mcl_signs.standing_rotation_levels, { "mcl_signs:standing_sign22_5" .. _name, 1 })
table.insert(mcl_signs.standing_rotation_levels, { "mcl_signs:standing_sign45" .. _name, 2 })
table.insert(mcl_signs.standing_rotation_levels, { "mcl_signs:standing_sign67_5" .. _name, 3 })
-- register as unpushable
if minetest.get_modpath("mesecons_mvps") then
mesecon.register_mvps_stopper("mcl_signs:wall_sign" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign22_5" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign45" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign67_5" .. _name)
end
end
--- The same as reregister_sign, except caller defines the textures. Note, there is a greyscale version of the sign,
@ -1469,6 +1495,14 @@ function mcl_signs.reregister_sign_custom (modname, _name, tiles, color, invento
table.insert(mcl_signs.standing_rotation_levels, { "mcl_signs:standing_sign45" .. _name, 2 })
table.insert(mcl_signs.standing_rotation_levels, { "mcl_signs:standing_sign67_5" .. _name, 3 })
-- register as unpushable
if minetest.get_modpath("mesecons_mvps") then
mesecon.register_mvps_stopper("mcl_signs:wall_sign" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign22_5" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign45" .. _name)
mesecon.register_mvps_stopper("mcl_signs:standing_sign67_5" .. _name)
end
end
--- Usage: Call this with the mod's name, the wood's item string (for the planks), and with the sign's suffix.