From 507f14c317e87a1da58aa0a9664001a91746cc03 Mon Sep 17 00:00:00 2001 From: anarquimico Date: Tue, 15 Nov 2022 00:01:28 -0300 Subject: [PATCH 01/47] Modified function and ABM --- mods/ITEMS/mcl_hoppers/init.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_hoppers/init.lua b/mods/ITEMS/mcl_hoppers/init.lua index 10f37afb40..c204071a9e 100644 --- a/mods/ITEMS/mcl_hoppers/init.lua +++ b/mods/ITEMS/mcl_hoppers/init.lua @@ -338,8 +338,8 @@ minetest.register_node("mcl_hoppers:hopper_side_disabled", def_hopper_side_disab --[[ END OF NODE DEFINITIONS ]] -local function hopper_pull_from_mc (mc_ent, dest_pos) - local inv = mcl_entity_invs.load_inv(mc_ent,5) +local function hopper_pull_from_mc (mc_ent, dest_pos, inv_size) + local inv = mcl_entity_invs.load_inv(mc_ent, inv_size) if not inv then mcl_log("No inv") return false @@ -382,7 +382,7 @@ end --[[ BEGIN OF ABM DEFINITONS ]] minetest.register_abm({ - label = "Hoppers pull from minecart hoppers", + label = "Hoppers pull from minecart", nodenames = {"mcl_hoppers:hopper","mcl_hoppers:hopper_side"}, interval = 0.5, chance = 1, @@ -396,9 +396,9 @@ minetest.register_abm({ if entity and entity.name then --mcl_log("Name of object near: " .. tostring(entity.name)) - if entity.name == "mcl_minecarts:hopper_minecart" then + if entity.name == "mcl_minecarts:hopper_minecart" or entity.name == "mcl_minecarts:chest_minecart"then local hm_pos = entity.object:get_pos() - mcl_log("We have a hopper minecart close: ".. minetest.pos_to_string(hm_pos)) + mcl_log("We have a minecart with inventory close: ".. minetest.pos_to_string(hm_pos)) --if hm_pos.y == pos.y + 1 then mcl_log("y is correct") end --if (hm_pos.x >= pos.x - DIST_FROM_MC and hm_pos.x <= pos.x + DIST_FROM_MC) then mcl_log("x is within range") end @@ -409,7 +409,11 @@ minetest.register_abm({ and (hm_pos.x >= pos.x - DIST_FROM_MC and hm_pos.x <= pos.x + DIST_FROM_MC) and (hm_pos.z >= pos.z - DIST_FROM_MC and hm_pos.z <= pos.z + DIST_FROM_MC) then mcl_log("Minecart close enough") - hopper_pull_from_mc (entity, pos) + if entity.name == "mcl_minecarts:hopper_minecart" then + hopper_pull_from_mc(entity, pos, 5) + elseif entity.name == "mcl_minecarts:chest_minecart" then + hopper_pull_from_mc(entity, pos, 27) + end end end else @@ -620,10 +624,10 @@ minetest.register_abm({ end end end - end + end if compchance > 0 then itemcomp[hslot]:take_item() - inv:set_list("main", itemcomp) + inv:set_list("main", itemcomp) local rand = math.random(0,100) if compchance >= rand then local level = 0 From ce724ee926170d24367a2ca6c8bd96c406bf9e69 Mon Sep 17 00:00:00 2001 From: epCode Date: Mon, 14 Nov 2022 14:42:33 -0800 Subject: [PATCH 02/47] make sky color change when submerged --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index a4108598fd..66f5c93634 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -1,6 +1,8 @@ local mods_loaded = false local NIGHT_VISION_RATIO = 0.45 +water_color = "#0b4880" + function mcl_weather.set_sky_box_clear(player) player:set_sky({ type = "regular", @@ -96,7 +98,19 @@ mcl_weather.skycolor = { local pos = player:get_pos() local dim = mcl_worlds.pos_to_dimension(pos) local has_weather = (mcl_worlds.has_weather(pos) and (mcl_weather.state == "snow" or mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_snow(pos)) or ((mcl_weather.state =="rain" or mcl_weather.state == "thunder") and mcl_weather.has_rain(pos)) - if dim == "overworld" then + if minetest.get_item_group(minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name, "water") ~= 0 then + player:set_sky({ type = "regular", + sky_color = { + day_sky = water_color, + day_horizon = water_color, + dawn_sky = water_color, + dawn_horizon = water_color, + night_sky = water_color, + night_horizon = water_color, + }, + clouds = true, + }) + elseif dim == "overworld" then if (mcl_weather.state == "none") then -- Clear weather mcl_weather.set_sky_box_clear(player) From a5eb1d240ed369a374616b7c15ebde2b5bd704f8 Mon Sep 17 00:00:00 2001 From: epCode Date: Mon, 14 Nov 2022 14:43:13 -0800 Subject: [PATCH 03/47] add deeper = darker --- mods/ITEMS/mcl_core/nodes_liquid.lua | 4 +- mods/PLAYER/mcl_playerplus/init.lua | 57 ++++++++++++++++++++++++---- 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes_liquid.lua b/mods/ITEMS/mcl_core/nodes_liquid.lua index 68ae4a8299..081f1978a5 100644 --- a/mods/ITEMS/mcl_core/nodes_liquid.lua +++ b/mods/ITEMS/mcl_core/nodes_liquid.lua @@ -50,7 +50,7 @@ minetest.register_node("mcl_core:water_flowing", { liquid_viscosity = WATER_VISC, liquid_range = 7, waving = 3, - post_effect_color = {a=209, r=0x03, g=0x3C, b=0x5C}, + post_effect_color = {a=20, r=0x03, g=0x3C, b=0x5C}, groups = { water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=1, dig_by_piston=1}, _mcl_blast_resistance = 100, -- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode @@ -95,7 +95,7 @@ S("• When water is directly below lava, the water turns into stone."), liquid_alternative_source = "mcl_core:water_source", liquid_viscosity = WATER_VISC, liquid_range = 7, - post_effect_color = {a=209, r=0x03, g=0x3C, b=0x5C}, + post_effect_color = {a=60, r=0x03, g=0x3C, b=0x5C}, stack_max = 64, groups = { water=3, liquid=3, puts_out_fire=1, freezes=1, not_in_creative_inventory=1, dig_by_piston=1}, _mcl_blast_resistance = 100, diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 3d3e5f129f..47edacdecc 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -3,6 +3,8 @@ mcl_playerplus = { is_pressing_jump = {}, } +local hud_water = {} + local get_connected_players = minetest.get_connected_players local dir_to_yaw = minetest.dir_to_yaw local get_item_group = minetest.get_item_group @@ -25,6 +27,26 @@ local mcl_playerplus_internal = {} local time = 0 local look_pitch = 0 + +local function calculate_water_depth(pos) + for i=1, 50 do + if get_item_group(minetest.get_node(vector.new(pos.x,pos.y+i,pos.z)).name, "water") == 0 then + return i + end + end + return 50 +end + +local function remove_water_hud(player) + if hud_water[player] then + mcl_weather.skycolor.update_sky_color() + for i=1, #hud_water[player] do + player:hud_remove(hud_water[player][i]) + end + hud_water[player] = nil + end +end + local function player_collision(player) local pos = player:get_pos() @@ -349,16 +371,16 @@ minetest.register_globalstep(function(dtime) -- set head pitch and yaw when flying local head_rot = vector.new(pitch - degrees(dir_to_pitch(player_velocity)) + 50, player_vel_yaw - yaw, 0) set_bone_pos(player,"Head_Control", nil, head_rot) - + -- sets eye height, and nametag color accordingly set_properties(player, player_props_elytra) - + -- control body bone when flying local body_rot = vector.new((75 - degrees(dir_to_pitch(player_velocity))), -player_vel_yaw + yaw, 0) set_bone_pos(player, "Body_Control", nil, body_rot) elseif parent then set_properties(player, player_props_riding) - + local parent_yaw = degrees(parent:get_yaw()) local head_rot = vector.new(pitch, -limit_vel_yaw(yaw, parent_yaw) + parent_yaw, 0) set_bone_pos(player, "Head_Control", nil, head_rot) @@ -367,10 +389,10 @@ minetest.register_globalstep(function(dtime) -- controls head pitch when sneaking local head_rot = vector.new(pitch, player_vel_yaw - yaw, player_vel_yaw - yaw) set_bone_pos(player, "Head_Control", nil, head_rot) - + -- sets eye height, and nametag color accordingly set_properties(player, player_props_sneaking) - + -- sneaking body conrols set_bone_pos(player, "Body_Control", nil, vector.new(0, -player_vel_yaw + yaw, 0)) elseif get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and is_sprinting(name) == true then @@ -378,10 +400,10 @@ minetest.register_globalstep(function(dtime) is_swimming = true local head_rot = vector.new(pitch - degrees(dir_to_pitch(player_velocity)) + 20, player_vel_yaw - yaw, 0) set_bone_pos(player, "Head_Control", nil, head_rot) - + -- sets eye height, and nametag color accordingly set_properties(player, player_props_swimming) - + -- control body bone when swimming local body_rot = vector.new((75 + degrees(dir_to_pitch(player_velocity))), player_vel_yaw - yaw, 180) set_bone_pos(player,"Body_Control", nil, body_rot) @@ -395,6 +417,25 @@ minetest.register_globalstep(function(dtime) set_bone_pos(player,"Body_Control", nil, vector.new(0, -player_vel_yaw + yaw, 0)) end + if get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 then + if not hud_water[player] or hud_water[player] and calculate_water_depth(player:get_pos()) ~= #hud_water[player] then + remove_water_hud(player) + hud_water[player] = {} + for i=1, calculate_water_depth(player:get_pos()) do + table.insert(hud_water[player], player:hud_add({ + hud_elem_type = "image", + text = "mcl_playerplus_water.png", + position = {x = 0.5, y = 0.5}, + scale = {x = 8, y = 4}, + offset = {x = 0, y = 0}, + z_index = -1002, + })) + end + end + else + remove_water_hud(player) + end + elytra.last_yaw = player:get_look_horizontal() -- Update jump status immediately since we need this info in real time. -- WARNING: This section is HACKY as hell since it is all just based on heuristics. @@ -639,7 +680,7 @@ minetest.register_on_joinplayer(function(player) jump_cooldown = -1, -- Cooldown timer for jumping, we need this to prevent the jump exhaustion to increase rapidly } mcl_playerplus.elytra[player] = {active = false, rocketing = 0, speed = 0} - + -- Minetest bug: get_bone_position() returns all zeros vectors. -- Workaround: call set_bone_position() one time first. player:set_bone_position("Head_Control", vector.new(0, 6.75, 0)) From 3f8f6f8e44861be896437dee5400a3cf5db91c83 Mon Sep 17 00:00:00 2001 From: epCode Date: Mon, 14 Nov 2022 14:47:02 -0800 Subject: [PATCH 04/47] deeper-darker image --- mods/PLAYER/mcl_playerplus/init.lua | 2 +- .../textures/mcl_playerplus_water.png | Bin 0 -> 9421 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 mods/PLAYER/mcl_playerplus/textures/mcl_playerplus_water.png diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 47edacdecc..0faa9c53f7 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -426,7 +426,7 @@ minetest.register_globalstep(function(dtime) hud_elem_type = "image", text = "mcl_playerplus_water.png", position = {x = 0.5, y = 0.5}, - scale = {x = 8, y = 4}, + scale = {x = 32, y = 16}, offset = {x = 0, y = 0}, z_index = -1002, })) diff --git a/mods/PLAYER/mcl_playerplus/textures/mcl_playerplus_water.png b/mods/PLAYER/mcl_playerplus/textures/mcl_playerplus_water.png new file mode 100644 index 0000000000000000000000000000000000000000..0524ce8d692852c626f5818d9160d069f0e86b2d GIT binary patch literal 9421 zcmV;;Br@BHP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1e?a>ghQ{Ld-&2q50a!C+VI4d(dUEn&xBl9`>U znmDmRU|ZcS2^@F+@!!k+2R~AycPZCadMO@1si!UjjppsA>pA$OXZ^W{(EqTzXFymvpaeO?I&jG|%{{d(JUDs;YbsD;n3K%Ur zqP)A=;XRmmfbyuf6&w|R8SSb^$I<-o6XGmC{efeK9t5gfE~K!+2v<1uI>UsENlvM_ zicE=WYq3g~8BHe~;X-2cxMG8nQ%)Bn%<}jW^u1l*H$%glSHM&Wcvw*R|KxCgHTX{s zcU_Yd1>YX7;FmCR;RcoC8M7crxVCOt3BHdlzkkIKLKO;TrMUs%@P|F($l)utqUszm zFXL)i5nNsS0iX!)&Ts}Pkb*BE=1_vKA~gi?*dWk==Yrfgpg_o37Mv7hMiEz~3Ez!- zYS6ior3lTaO%Ni-5-YUnaX_q;GUBJEh8P+-=9F_Tx#s3_&!fbWN-m|;!Xh_ntf}T& zYOSsII$CV0Q;SwX0v_QEjXG zHZDn9HjfH+b^muu5(irvn(X1J|g?T61;HI z#zJWV%it30$pOUd;fnxbHg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MGSohSa zRKVOyX>s$JEgqec{Aa*#6rcxqjs&812h+|A(&=A*@J0}!^#fsAc+ngRq*(ng%04sc z@1ot(C#r;XdhAQk`{2LRQZEDlTLJ9#73XWskid5gMH(mueR?&p@ZgEzWM5M=g1K1! zq3!~fN+3Wl9tcVKVC=U8K0f91C&AxS!0Rg};&~F(y#fsT^{C3qln9(``HuSklMjIq z@8zJYiedbekhQ3{N5J1(!LKjv#-1dBh`7$3x0Qk|DgqZ2;+_wXlSEl44#hlz@Z=Qt zV93R&SG|Q*@OuSVC4mGh|qtT8rPM*4nY((pAY;5@FVcE$KZ{@H#7S`C)a3f T Date: Tue, 15 Nov 2022 14:33:33 -0800 Subject: [PATCH 05/47] localize var/fix weather not changing brightness while underwater. --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 25 ++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 66f5c93634..6fb8ab56c3 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -1,9 +1,11 @@ local mods_loaded = false local NIGHT_VISION_RATIO = 0.45 -water_color = "#0b4880" +local water_color = "#0b4880" function mcl_weather.set_sky_box_clear(player) + local pos = player:get_pos() + if minetest.get_item_group(minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name, "water") ~= 0 then return end player:set_sky({ type = "regular", sky_color = { @@ -18,6 +20,16 @@ function mcl_weather.set_sky_box_clear(player) }) end +function mcl_weather.set_sky_color(player, def) + local pos = player:get_pos() + if minetest.get_item_group(minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name, "water") ~= 0 then return end + player:set_sky({ + type = def.type, + sky_color = def.sky_color, + clouds = def.clouds, + }) +end + mcl_weather.skycolor = { -- Should be activated before do any effect. active = true, @@ -110,7 +122,8 @@ mcl_weather.skycolor = { }, clouds = true, }) - elseif dim == "overworld" then + end + if dim == "overworld" then if (mcl_weather.state == "none") then -- Clear weather mcl_weather.set_sky_box_clear(player) @@ -122,7 +135,8 @@ mcl_weather.skycolor = { local day_color = mcl_weather.skycolor.get_sky_layer_color(0.15) local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.27) local night_color = mcl_weather.skycolor.get_sky_layer_color(0.1) - player:set_sky({ type = "regular", + mcl_weather.set_sky_color(player, { + type = "regular", sky_color = { day_sky = day_color, day_horizon = day_color, @@ -141,7 +155,8 @@ mcl_weather.skycolor = { local day_color = mcl_weather.skycolor.get_sky_layer_color(0.5) local dawn_color = mcl_weather.skycolor.get_sky_layer_color(0.75) local night_color = mcl_weather.skycolor.get_sky_layer_color(0) - player:set_sky({ type = "regular", + mcl_weather.set_sky_color(player, { + type = "regular", sky_color = { day_sky = day_color, day_horizon = day_color, @@ -192,7 +207,7 @@ mcl_weather.skycolor = { } local biometint = nether_sky[minetest.get_biome_name(minetest.get_biome_data(player:get_pos()).biome)] - player:set_sky({ + mcl_weather.set_sky_color(player, { type = "regular", sky_color = { day_sky = "#300808", From eeecc52ff86557d425ecd608b2957ac1dcc72ec9 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 11 Nov 2022 03:15:09 +0100 Subject: [PATCH 06/47] Fix crash when trying to place meshhand --- mods/PLAYER/mcl_meshhand/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/PLAYER/mcl_meshhand/init.lua b/mods/PLAYER/mcl_meshhand/init.lua index 0d4bf091db..904ffa533f 100644 --- a/mods/PLAYER/mcl_meshhand/init.lua +++ b/mods/PLAYER/mcl_meshhand/init.lua @@ -10,7 +10,7 @@ local node_def = { drawtype = "mesh", node_placement_prediction = "", on_construct = function(pos) - local name = get_node(pos).name + local name = minetest.get_node(pos).name local message = "[mcl_meshhand] Trying to construct " .. name .. " at " .. minetest.pos_to_string(pos) minetest.log("error", message) minetest.remove_node(pos) From 99a7df7ce69ee380be041f4749f20a04e1340b4c Mon Sep 17 00:00:00 2001 From: Michieal Date: Wed, 16 Nov 2022 12:17:51 +0000 Subject: [PATCH 07/47] Fix the Pumpkin/Melon grass position. Also, updated the license. --- mods/ITEMS/mcl_farming/README.txt | 28 +--- mods/ITEMS/mcl_farming/shared_functions.lua | 152 ++++++++++---------- 2 files changed, 85 insertions(+), 95 deletions(-) diff --git a/mods/ITEMS/mcl_farming/README.txt b/mods/ITEMS/mcl_farming/README.txt index 5779d70356..02cdaf93a6 100644 --- a/mods/ITEMS/mcl_farming/README.txt +++ b/mods/ITEMS/mcl_farming/README.txt @@ -1,16 +1,12 @@ ===FARMING MOD for MINETEST-C55=== by PilzAdam +Modified heavily by MineClone 2 Dev Team. + Introduction: This mod adds farming to Minetest. -How to install: -Unzip the archive an place it in minetest-base-directory/mods/minetest/ -if you have a windows client or a linux run-in-place client. If you have -a linux system-wide instalation place it in ~/.minetest/mods/minetest/. -If you want to install this mod only in one world create the folder -worldmods/ in your worlddirectory. -For further information or help see: +How to install see: http://wiki.minetest.com/wiki/Installing_Mods How to use the mod: @@ -25,22 +21,8 @@ For further information or help see: http://minetest.net/forum/viewtopic.php?id=2787 License: -Sourcecode: WTFPL (see below) -Graphics: WTFPL (see below) +Sourcecode: CC-BY-SA 4 (see below) +Graphics: CC-BY-SA 4 (see below) See also: http://minetest.net/ - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - - Copyright (C) 2004 Sam Hocevar - - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index 7b9784503a..e2e42dd259 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -69,7 +69,7 @@ function mcl_farming:add_plant(identifier, full_grown, names, interval, chance) interval = interval, chance = chance, action = function(pos, node) - local low_speed = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name ~= "mcl_farming:soil_wet" + local low_speed = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z }).name ~= "mcl_farming:soil_wet" mcl_farming:grow_plant(identifier, pos, node, false, false, low_speed) end, }) @@ -130,7 +130,7 @@ function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light, low stages = 1 end stages = stages + math.ceil(intervals_counter) - local new_node = {name = plant_info.names[step+stages]} + local new_node = { name = plant_info.names[step + stages] } if new_node.name == nil then new_node.name = plant_info.full_grown end @@ -157,14 +157,14 @@ function mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname) end end - local pos = {x=pt.above.x, y=pt.above.y-1, z=pt.above.z} + local pos = { x = pt.above.x, y = pt.above.y - 1, z = pt.above.z } local farmland = minetest.get_node(pos) - pos= {x=pt.above.x, y=pt.above.y, z=pt.above.z} + pos = { x = pt.above.x, y = pt.above.y, z = pt.above.z } local place_s = minetest.get_node(pos) - if string.find(farmland.name, "mcl_farming:soil") and string.find(place_s.name, "air") then - minetest.sound_play(minetest.registered_nodes[plantname].sounds.place, {pos = pos}, true) - minetest.add_node(pos, {name=plantname, param2 = minetest.registered_nodes[plantname].place_param2}) + if string.find(farmland.name, "mcl_farming:soil") and string.find(place_s.name, "air") then + minetest.sound_play(minetest.registered_nodes[plantname].sounds.place, { pos = pos }, true) + minetest.add_node(pos, { name = plantname, param2 = minetest.registered_nodes[plantname].place_param2 }) --local intervals_counter = get_intervals_counter(pos, 1, 1) else return @@ -179,7 +179,7 @@ end --[[ Helper function to create a gourd (e.g. melon, pumpkin), the connected stem nodes as -- full_unconnected_stem: itemstring of the full-grown but unconnceted stem node. This node must already be done +- full_unconnected_stem: itemstring of the full-grown but unconnected stem node. This node must already be done - connected_stem_basename: prefix of the itemstrings used for the 4 connected stem nodes to create - stem_itemstring: Desired itemstring of the fully-grown unconnected stem node - stem_def: Partial node definition of the fully-grown unconnected stem node. Many fields are already defined. You need to add `tiles` and `description` at minimum. Don't define on_construct without good reason @@ -202,10 +202,10 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s } local neighbors = { - { x=-1, y=0, z=0 }, - { x=1, y=0, z=0 }, - { x=0, y=0, z=-1 }, - { x=0, y=0, z=1 }, + { x = -1, y = 0, z = 0 }, + { x = 1, y = 0, z = 0 }, + { x = 0, y = 0, z = -1 }, + { x = 0, y = 0, z = 1 }, } -- Connect the stem at stempos to the first neighboring gourd block. @@ -215,19 +215,19 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s if stem.name ~= full_unconnected_stem then return false end - for n=1, #neighbors do + for n = 1, #neighbors do local offset = neighbors[n] local blockpos = vector.add(stempos, offset) local block = minetest.get_node(blockpos) if block.name == gourd_itemstring then if offset.x == 1 then - minetest.set_node(stempos, {name=connected_stem_names[1]}) + minetest.set_node(stempos, { name = connected_stem_names[1] }) elseif offset.x == -1 then - minetest.set_node(stempos, {name=connected_stem_names[2]}) + minetest.set_node(stempos, { name = connected_stem_names[2] }) elseif offset.z == 1 then - minetest.set_node(stempos, {name=connected_stem_names[3]}) + minetest.set_node(stempos, { name = connected_stem_names[3] }) elseif offset.z == -1 then - minetest.set_node(stempos, {name=connected_stem_names[4]}) + minetest.set_node(stempos, { name = connected_stem_names[4] }) end return true end @@ -238,13 +238,13 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s if not gourd_def.after_destruct then gourd_def.after_destruct = function(blockpos, oldnode) -- Disconnect any connected stems, turning them back to normal stems - for n=1, #neighbors do + for n = 1, #neighbors do local offset = neighbors[n] local expected_stem = connected_stem_names[n] local stempos = vector.add(blockpos, offset) local stem = minetest.get_node(stempos) if stem.name == expected_stem then - minetest.add_node(stempos, {name=full_unconnected_stem}) + minetest.add_node(stempos, { name = full_unconnected_stem }) try_connect_stem(stempos) end end @@ -253,7 +253,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s if not gourd_def.on_construct then function gourd_def.on_construct(blockpos) -- Connect all unconnected stems at full size - for n=1, #neighbors do + for n = 1, #neighbors do local stempos = vector.add(blockpos, neighbors[n]) try_connect_stem(stempos) end @@ -272,7 +272,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s stem_def.selection_box = { type = "fixed", fixed = { - {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15} + { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 } }, } end @@ -292,7 +292,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s stem_def.drop = stem_drop end if stem_def.groups == nil then - stem_def.groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,} + stem_def.groups = { dig_immediate = 3, not_in_creative_inventory = 1, plant = 1, attached_node = 1, dig_by_water = 1, destroy_by_lava_flow = 1, } end if stem_def.sounds == nil then stem_def.sounds = mcl_sounds.node_sound_leaves_defaults() @@ -310,48 +310,48 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s local connected_stem_tiles = { { "blank.png", --top - "blank.png", -- bottom - "blank.png", -- right - "blank.png", -- left - connected_stem_texture, -- back - connected_stem_texture.."^[transformFX90" --front + "blank.png", -- bottom + "blank.png", -- right + "blank.png", -- left + connected_stem_texture, -- back + connected_stem_texture .. "^[transformFX90" --front }, { "blank.png", --top - "blank.png", -- bottom - "blank.png", -- right - "blank.png", -- left - connected_stem_texture.."^[transformFX90", --back - connected_stem_texture, -- front + "blank.png", -- bottom + "blank.png", -- right + "blank.png", -- left + connected_stem_texture .. "^[transformFX90", --back + connected_stem_texture, -- front }, { "blank.png", --top - "blank.png", -- bottom - connected_stem_texture.."^[transformFX90", -- right - connected_stem_texture, -- left - "blank.png", --back - "blank.png", -- front + "blank.png", -- bottom + connected_stem_texture .. "^[transformFX90", -- right + connected_stem_texture, -- left + "blank.png", --back + "blank.png", -- front }, { "blank.png", --top - "blank.png", -- bottom - connected_stem_texture, -- right - connected_stem_texture.."^[transformFX90", -- left - "blank.png", --back - "blank.png", -- front + "blank.png", -- bottom + connected_stem_texture, -- right + connected_stem_texture .. "^[transformFX90", -- left + "blank.png", --back + "blank.png", -- front } } local connected_stem_nodebox = { - {-0.5, -0.5, 0, 0.5, 0.5, 0}, - {-0.5, -0.5, 0, 0.5, 0.5, 0}, - {0, -0.5, -0.5, 0, 0.5, 0.5}, - {0, -0.5, -0.5, 0, 0.5, 0.5}, + { -0.5, -0.5, 0, 0.5, 0.5, 0 }, + { -0.5, -0.5, 0, 0.5, 0.5, 0 }, + { 0, -0.5, -0.5, 0, 0.5, 0.5 }, + { 0, -0.5, -0.5, 0, 0.5, 0.5 }, } local connected_stem_selectionbox = { - {-0.1, -0.5, -0.1, 0.5, 0.2, 0.1}, - {-0.5, -0.5, -0.1, 0.1, 0.2, 0.1}, - {-0.1, -0.5, -0.1, 0.1, 0.2, 0.5}, - {-0.1, -0.5, -0.5, 0.1, 0.2, 0.1}, + { -0.1, -0.5, -0.1, 0.5, 0.2, 0.1 }, + { -0.5, -0.5, -0.1, 0.1, 0.2, 0.1 }, + { -0.1, -0.5, -0.1, 0.1, 0.2, 0.5 }, + { -0.1, -0.5, -0.5, 0.1, 0.2, 0.1 }, } - for i=1, 4 do + for i = 1, 4 do minetest.register_node(connected_stem_names[i], { _doc_items_create_entry = false, paramtype = "light", @@ -369,7 +369,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s }, tiles = connected_stem_tiles[i], use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true, - groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,}, + groups = { dig_immediate = 3, not_in_creative_inventory = 1, plant = 1, attached_node = 1, dig_by_water = 1, destroy_by_lava_flow = 1, }, sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, }) @@ -380,9 +380,9 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s end minetest.register_abm({ - label = "Grow gourd stem to gourd ("..full_unconnected_stem.." → "..gourd_itemstring..")", - nodenames = {full_unconnected_stem}, - neighbors = {"air"}, + label = "Grow gourd stem to gourd (" .. full_unconnected_stem .. " → " .. gourd_itemstring .. ")", + nodenames = { full_unconnected_stem }, + neighbors = { "air" }, interval = grow_interval, chance = grow_chance, action = function(stempos) @@ -390,20 +390,20 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s if light and light > 10 then -- Check the four neighbors and filter out neighbors where gourds can't grow local neighbors = { - { x=-1, y=0, z=0 }, - { x=1, y=0, z=0 }, - { x=0, y=0, z=-1 }, - { x=0, y=0, z=1 }, + { x = -1, y = 0, z = 0 }, + { x = 1, y = 0, z = 0 }, + { x = 0, y = 0, z = -1 }, + { x = 0, y = 0, z = 1 }, } local floorpos, floor - for n=#neighbors, 1, -1 do + for n = #neighbors, 1, -1 do local offset = neighbors[n] local blockpos = vector.add(stempos, offset) - floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z } + floorpos = vector.offset (blockpos, 0, -1,0) -- replaces { x = blockpos.x, y = blockpos.y - 1, z = blockpos.z } floor = minetest.get_node(floorpos) local block = minetest.get_node(blockpos) local soilgroup = minetest.get_item_group(floor.name, "soil") - if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name=="mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then + if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name == "mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then table.remove(neighbors, n) end end @@ -416,27 +416,35 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s local blockpos = vector.add(stempos, offset) local p2 if offset.x == 1 then - minetest.set_node(stempos, {name=connected_stem_names[1]}) + minetest.set_node(stempos, { name = connected_stem_names[1] }) p2 = 3 elseif offset.x == -1 then - minetest.set_node(stempos, {name=connected_stem_names[2]}) + minetest.set_node(stempos, { name = connected_stem_names[2] }) p2 = 1 elseif offset.z == 1 then - minetest.set_node(stempos, {name=connected_stem_names[3]}) + minetest.set_node(stempos, { name = connected_stem_names[3] }) p2 = 2 elseif offset.z == -1 then - minetest.set_node(stempos, {name=connected_stem_names[4]}) + minetest.set_node(stempos, { name = connected_stem_names[4] }) p2 = 0 end -- Place the gourd if gourd_def.paramtype2 == "facedir" then - minetest.add_node(blockpos, {name=gourd_itemstring, param2=p2}) + minetest.add_node(blockpos, { name = gourd_itemstring, param2 = p2 }) else - minetest.add_node(blockpos, {name=gourd_itemstring}) + minetest.add_node(blockpos, { name = gourd_itemstring }) end + -- Reset farmland, etc. to dirt when the gourd grows on top + + -- FIXED: The following 2 lines were missing, and wasn't being set (outside of the above loop that + -- finds the neighbors.) + -- FYI - don't factor this out thinking that the loop above is setting the positions correctly. + floorpos = vector.offset (blockpos, 0, -1,0) -- replaces { x = blockpos.x, y = blockpos.y - 1, z = blockpos.z } + floor = minetest.get_node(floorpos) + -- END OF FIX ------------------------------------- if minetest.get_item_group(floor.name, "dirtifies_below_solid") == 1 then - minetest.set_node(floorpos, {name = "mcl_core:dirt"}) + minetest.set_node(floorpos, { name = "mcl_core:dirt" }) end end end @@ -452,7 +460,7 @@ end function mcl_farming:stem_color(startcolor, endcolor, step, step_count) local color = {} local function get_component(startt, endd, step, step_count) - return math.floor(math.max(0, math.min(255, (startt + (((step-1)/step_count) * endd))))) + return math.floor(math.max(0, math.min(255, (startt + (((step - 1) / step_count) * endd))))) end color.r = get_component(startcolor.r, endcolor.r, step, step_count) color.g = get_component(startcolor.g, endcolor.g, step, step_count) @@ -464,14 +472,14 @@ end minetest.register_lbm({ label = "Add growth for unloaded farming plants", name = "mcl_farming:growth", - nodenames = {"group:plant"}, + nodenames = { "group:plant" }, run_at_every_load = true, action = function(pos, node) local identifier = plant_nodename_to_id_list[node.name] if not identifier then return end - local low_speed = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name ~= "mcl_farming:soil_wet" + local low_speed = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z }).name ~= "mcl_farming:soil_wet" mcl_farming:grow_plant(identifier, pos, node, false, false, low_speed) end, }) From 1a670bc41b9c7ce66fe9ccb995442c92a5e8aa3b Mon Sep 17 00:00:00 2001 From: ancientmarinerdev Date: Tue, 15 Nov 2022 22:32:09 +0000 Subject: [PATCH 08/47] Allow villagers to resettle and not run back to job and and old bed --- mods/ENTITIES/mobs_mc/villager.lua | 52 +++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index a7b7d98522..f19ada233f 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -30,6 +30,8 @@ local DEFAULT_WALK_CHANCE = 33 -- chance to walk in percent, if no player nearby local PLAYER_SCAN_INTERVAL = 5 -- every X seconds, villager looks for players nearby local PLAYER_SCAN_RADIUS = 4 -- scan radius for looking for nearby players +local RESETTLE_DISTANCE = 100 -- If a mob is transported this far from home, it gives up bed and job and resettles + local PATHFINDING = "gowp" --[=======[ TRADING ]=======] @@ -1089,25 +1091,38 @@ local function retrieve_my_jobsite (self) return end +local function remove_job (self) + self._jobsite = nil + if not has_traded(self) then + mcl_log("Cannot retrieve my jobsite. I am now unemployed.") + self._profession = "unemployed" + self._trades = nil + set_textures(self) + else + mcl_log("Cannot retrieve my jobsite but I've traded so only remove jobsite.") + end +end + local function validate_jobsite(self) if self._profession == "unemployed" then return false end - if not retrieve_my_jobsite (self) then - self._jobsite = nil + local job_block = retrieve_my_jobsite (self) + if not job_block then if self.order == WORK then self.order = nil end - if not has_traded(self) then - mcl_log("Cannot retrieve my jobsite. I am now unemployed.") - self._profession = "unemployed" - self._trades = nil - set_textures(self) - else - mcl_log("Cannot retrieve my jobsite but I've traded so only remove jobsite.") - end + remove_job (self) return false else + local resettle = vector.distance(self.object:get_pos(),self._jobsite) > RESETTLE_DISTANCE + mcl_log("Jobsite far, so resettle: " .. tostring(resettle)) + if resettle then + local m = minetest.get_meta(self._jobsite) + m:set_string("villager", nil) + remove_job (self) + return false + end return true end end @@ -1222,6 +1237,17 @@ local function validate_bed(self) local bed_valid = true local m = minetest.get_meta(self._bed) + + local resettle = vector.distance(self.object:get_pos(),self._bed) > RESETTLE_DISTANCE + mcl_log("Bed far, so resettle: " .. tostring(resettle)) + if resettle then + mcl_log("Resettled. Ditch bed.") + m:set_string("villager", nil) + self._bed = nil + bed_valid = false + return false + end + local owned_by_player = m:get_string("player") mcl_log("Player owner: " .. owned_by_player) if owned_by_player ~= "" then @@ -1229,7 +1255,7 @@ local function validate_bed(self) m:set_string("villager", nil) self._bed = nil bed_valid = false - return + return false end if m:get_string("villager") ~= self._id then @@ -1245,6 +1271,10 @@ end local function do_activity (self) -- Maybe just check we're pathfinding first? + if self.following then + mcl_log("Following, so do not do activity.") + return + end if not validate_bed(self) and self.state ~= PATHFINDING then if self.order == SLEEP then self.order = nil end From a28f667b20aaa112e3a87c798d5e998f61c0d88b Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 16 Nov 2022 00:00:10 +0100 Subject: [PATCH 09/47] Villagers only summon golems when monsters are near --- mods/ENTITIES/mobs_mc/villager.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index f19ada233f..9c10c703d8 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -887,11 +887,18 @@ local function has_golem(pos) end end +local function monsters_near(self) + for _,o in pairs(minetest.get_objects_inside_radius(self.object:get_pos(),10)) do + local l = o:get_luaentity() + if l and l.type =="monster" then return true end + end +end + local function has_summon_participants(self) local r = 0 for _,o in pairs(minetest.get_objects_inside_radius(self.object:get_pos(),10)) do local l = o:get_luaentity() - --TODO check for panicking or gossiping + --TODO check for gossiping if l and l.name == "mobs_mc:villager" then r = r + 1 end end return r > 2 @@ -915,7 +922,8 @@ local function check_summon(self,dtime) if self._summon_timer and self._summon_timer > 30 then local pos = self.object:get_pos() self._summon_timer = 0 - if has_golem(pos) then return false end + if has_golem(pos) then return end + if not monsters_near(self) then return end if not has_summon_participants(self) then return end summon_golem(self) elseif self._summon_timer == nil then From 10a3a022b67d3f6a8d40407430111ab255f9c406 Mon Sep 17 00:00:00 2001 From: Michieal Date: Mon, 7 Nov 2022 17:14:16 +0000 Subject: [PATCH 12/47] fix frames to reset after /clearobjects --- mods/ITEMS/mcl_itemframes/item_frames_API.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_itemframes/item_frames_API.lua b/mods/ITEMS/mcl_itemframes/item_frames_API.lua index 741e6ce71f..36e49bf7fc 100644 --- a/mods/ITEMS/mcl_itemframes/item_frames_API.lua +++ b/mods/ITEMS/mcl_itemframes/item_frames_API.lua @@ -598,16 +598,21 @@ function mcl_itemframes.create_base_definitions() local inv = minetest.get_meta(pos):get_inventory() local stack = inv:get_stack("main", 1) local itemname = stack:get_name() + local node = {} if minetest.get_item_group(itemname, "clock") > 0 then local new_name = "mcl_clock:clock_" .. (mcl_worlds.clock_works(pos) and mcl_clock.old_time or mcl_clock.random_frame) if itemname ~= new_name then stack:set_name(new_name) inv:set_stack("main", 1, stack) - local node = minetest.get_node(pos) + node = minetest.get_node(pos) mcl_itemframes.update_item_entity(pos, node, node.param2) - end minetest.get_node_timer(pos):start(1.0) + else + -- fix for /ClearObjects + node = minetest.get_node(pos) + mcl_itemframes.update_item_entity(pos, node, node.param2) + minetest.get_node_timer(pos):start(40.0) end end, @@ -660,6 +665,8 @@ function mcl_itemframes.create_base_definitions() end if minetest.get_item_group(itemname, "clock") > 0 then minetest.get_node_timer(pos):start(1.0) + else + minetest.get_node_timer(pos):start(40.0) end inv:set_stack("main", 1, put_itemstack) From e67c6e1adadfc116a968ec79f549a7fc1f7c50b8 Mon Sep 17 00:00:00 2001 From: Michieal Date: Mon, 7 Nov 2022 17:16:07 +0000 Subject: [PATCH 13/47] fix signs to reset after /clearobjects Additionally, added in the register_hanging_sing_craft() for future use. --- mods/ITEMS/mcl_signs/signs_api.lua | 3060 ++++++++++++++-------------- 1 file changed, 1579 insertions(+), 1481 deletions(-) diff --git a/mods/ITEMS/mcl_signs/signs_api.lua b/mods/ITEMS/mcl_signs/signs_api.lua index 9d88b8ed1b..cb37669383 100644 --- a/mods/ITEMS/mcl_signs/signs_api.lua +++ b/mods/ITEMS/mcl_signs/signs_api.lua @@ -7,10 +7,9 @@ --local logging = minetest.settings:get_bool("mcl_logging_mcl_signs",true) local DEBUG = minetest.settings:get_bool("mcl_logging_mcl_signs", false) -- special debug setting. -local table = table -- copied from the original signs init file. if DEBUG then - minetest.log("action", "[mcl_signs] Signs API Loading") + minetest.log("action", "[mcl_signs] Signs API Loading") end -- LOCALIZATION @@ -30,11 +29,14 @@ local NUMBER_OF_LINES = 4 local LINE_HEIGHT = 14 local CHAR_WIDTH = 5 -- ----------------------- +-- CACHE LOCAL COPIES +local table = table +local string = string -- CACHE NODE_SOUNDS local node_sounds if minetest.get_modpath("mcl_sounds") then - node_sounds = mcl_sounds.node_sound_wood_defaults() + node_sounds = mcl_sounds.node_sound_wood_defaults() end -- SET UP THE CHARACTER MAPPING @@ -55,17 +57,17 @@ local chars_file = io.open(modpath .. "/characters.txt", "r") -- FIXME: Support more characters (many characters are missing). Currently ASCII and Latin-1 Supplement are supported. local charmap = {} if not chars_file then - minetest.log("error", "[mcl_signs] : character map file not found") + minetest.log("error", "[mcl_signs] : character map file not found") else - while true do - local char = chars_file:read("*l") - if char == nil then - break - end - local img = chars_file:read("*l") - chars_file:read("*l") - charmap[char] = img - end + while true do + local char = chars_file:read("*l") + if char == nil then + break + end + local img = chars_file:read("*l") + chars_file:read("*l") + charmap[char] = img + end end local pi = 3.1415926 -- enough accuracy, to build an engine for a car. @@ -75,7 +77,7 @@ local math = math -- locally cached copy of the official colors; this way, it updates as mcl_colors updates. local mcl_colors_official = mcl_colors if DEBUG then - minetest.log("verbose", "[mcl_signs]Official MCL_Colors:\n" .. dump(mcl_colors_official)) + minetest.log("verbose", "[mcl_signs]Official MCL_Colors:\n" .. dump(mcl_colors_official)) end -- INITIALIZE THE GLOBAL API FOR SIGNS. @@ -85,22 +87,22 @@ mcl_signs = {} mcl_signs.sign_groups = { handy = 1, axey = 1, deco_block = 1, material_wood = 1, attached_node = 1, dig_by_piston = 1, flammable = -1 } --- colors used for wools. mcl_signs.mcl_wool_colors = { - unicolor_white = "#FFFFFF", - unicolor_dark_orange = "#502A00", - unicolor_grey = "#5B5B5B", - unicolor_darkgrey = "#303030", - unicolor_blue = "#0000CC", - unicolor_dark_green = "#005000", - unicolor_green_or_lime = "#50CC00", - unicolor_violet_purple = "#5000CC", - unicolor_light_red_pink = "#FF5050", - unicolor_yellow = "#CCCC00", - unicolor_orange = "#CC5000", - unicolor_red = "#CC0000", - unicolor_cyan = "#00CCCC", - unicolor_red_violet_magenta = "#CC0050", - unicolor_black = "#000000", - unicolor_light_blue = "#5050FF", + unicolor_white = "#FFFFFF", + unicolor_dark_orange = "#502A00", + unicolor_grey = "#5B5B5B", + unicolor_darkgrey = "#303030", + unicolor_blue = "#0000CC", + unicolor_dark_green = "#005000", + unicolor_green_or_lime = "#50CC00", + unicolor_violet_purple = "#5000CC", + unicolor_light_red_pink = "#FF5050", + unicolor_yellow = "#CCCC00", + unicolor_orange = "#CC5000", + unicolor_red = "#CC0000", + unicolor_cyan = "#00CCCC", + unicolor_red_violet_magenta = "#CC0050", + unicolor_black = "#000000", + unicolor_light_blue = "#5050FF", } mcl_signs.signtext_info_wall = {} mcl_signs.signtext_info_standing = {} -- built in build_signs_info(). @@ -117,400 +119,429 @@ mcl_signs.wall_standard = {} -- initialize mcl_signs.standing_standard = {} -- initialize function mcl_signs.build_signs_info() - local n = 23 / 56 - 1 / 128 -- some required magic number from the original code. - local m = -1 / 16 + 1 / 64 -- " " " " " " " " + local n = 23 / 56 - 1 / 128 -- some required magic number from the original code. + local m = -1 / 16 + 1 / 64 -- " " " " " " " " - mcl_signs.signtext_info_wall = { - { delta = { x = 0, y = 0, z = n }, yaw = 0 }, - { delta = { x = n, y = 0, z = 0 }, yaw = pi / -2 }, - { delta = { x = 0, y = 0, z = -n }, yaw = pi }, - { delta = { x = -n, y = 0, z = 0 }, yaw = pi / 2 }, - } + mcl_signs.signtext_info_wall = { + { delta = { x = 0, y = 0, z = n }, yaw = 0 }, + { delta = { x = n, y = 0, z = 0 }, yaw = pi / -2 }, + { delta = { x = 0, y = 0, z = -n }, yaw = pi }, + { delta = { x = -n, y = 0, z = 0 }, yaw = pi / 2 }, + } - -- PLACE YAW VALUES INTO THE TABLE. - for rot = 0, 15 do - local yaw = pi * 2 - (((pi * 2) / 16) * rot) - local delta = vector.multiply(minetest.yaw_to_dir(yaw), m) - -- Offset because sign is a bit above node boundaries - delta.y = delta.y + 2 / 28 - table.insert(mcl_signs.signtext_info_standing, { delta = delta, yaw = yaw }) - end + -- PLACE YAW VALUES INTO THE TABLE. + for rot = 0, 15 do + local yaw = pi * 2 - (((pi * 2) / 16) * rot) + local delta = vector.multiply(minetest.yaw_to_dir(yaw), m) + -- Offset because sign is a bit above node boundaries + delta.y = delta.y + 2 / 28 + table.insert(mcl_signs.signtext_info_standing, { delta = delta, yaw = yaw }) + end end -- wall signs' & hanging signs' base (definition) mcl_signs.wall_standard = { - description = S("Sign"), - _tt_help = S("Can be written"), - _doc_items_longdesc = S("Signs can be written and come in two variants: Wall sign and sign on a sign post. Signs can be placed on the top and the sides of other blocks, but not below them."), - _doc_items_usagehelp = S("After placing the sign, you can write something on it. You have 4 lines of text with up to 15 characters for each line; anything beyond these limits is lost. Not all characters are supported. The text can not be changed once it has been written; you have to break and place the sign again. Can be colored and made to glow."), - inventory_image = "default_sign.png", - walkable = false, - is_ground_content = false, - wield_image = "default_sign.png", - node_placement_prediction = "", - paramtype = "light", - sunlight_propagates = true, - paramtype2 = "wallmounted", - drawtype = "mesh", - mesh = "mcl_signs_signonwallmount.obj", - selection_box = { type = "wallmounted", wall_side = { -0.5, -7 / 28, -0.5, -23 / 56, 7 / 28, 0.5 } }, - tiles = { "mcl_signs_sign.png" }, - use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, - groups = mcl_signs.sign_groups, - stack_max = 16, - sounds = node_sounds, + description = S("Sign"), + _tt_help = S("Can be written"), + _doc_items_longdesc = S("Signs can be written and come in two variants: Wall sign and sign on a sign post. Signs can be placed on the top and the sides of other blocks, but not below them."), + _doc_items_usagehelp = S("After placing the sign, you can write something on it. You have 4 lines of text with up to 15 characters for each line; anything beyond these limits is lost. Not all characters are supported. The text can not be changed once it has been written; you have to break and place the sign again. Can be colored and made to glow."), + inventory_image = "default_sign.png", + walkable = false, + is_ground_content = false, + wield_image = "default_sign.png", + node_placement_prediction = "", + paramtype = "light", + sunlight_propagates = true, + paramtype2 = "wallmounted", + drawtype = "mesh", + mesh = "mcl_signs_signonwallmount.obj", + selection_box = { type = "wallmounted", wall_side = { -0.5, -7 / 28, -0.5, -23 / 56, 7 / 28, 0.5 } }, + tiles = { "mcl_signs_sign.png" }, + use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, + groups = mcl_signs.sign_groups, + stack_max = 16, + sounds = node_sounds, - on_place = function(itemstack, placer, pointed_thing) - local above = pointed_thing.above - local under = pointed_thing.under + on_timer = function(pos) + -- fix for /ClearObjects + mcl_signs:update_sign(pos) + minetest.get_node_timer(pos):start(40.0) + end, - -- Use pointed node's on_rightclick function first, if present - local node_under = minetest.get_node(under) - if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then - return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack - end - end + on_place = function(itemstack, placer, pointed_thing) + local above = pointed_thing.above + local under = pointed_thing.under - local dir = vector.subtract(under, above) + local timer = minetest.get_node_timer(pos) + if timer:is_started() == false then + timer:start(40.0) + end - -- Only build when it's legal - local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] - if not abovenodedef or abovenodedef.buildable_to == false then - return itemstack - end + -- Use pointed node's on_rightclick function first, if present + local node_under = minetest.get_node(under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then + return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack + end + end - local wdir = minetest.dir_to_wallmounted(dir) + local dir = vector.subtract(under, above) - --local placer_pos = placer:get_pos() + -- Only build when it's legal + local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] + if not abovenodedef or abovenodedef.buildable_to == false then + return itemstack + end - local fdir = minetest.dir_to_facedir(dir) + local wdir = minetest.dir_to_wallmounted(dir) - local sign_info - local nodeitem = ItemStack(itemstack) - -- Ceiling - if wdir == 0 then - --how would you add sign to ceiling? - return itemstack - -- Floor - end + --local placer_pos = placer:get_pos() - if wdir == 1 then - -- Standing sign + local fdir = minetest.dir_to_facedir(dir) - -- Determine the sign rotation based on player's yaw - local yaw = pi * 2 - placer:get_look_horizontal() + local sign_info + local nodeitem = ItemStack(itemstack) + -- Ceiling + if wdir == 0 then + --how would you add sign to ceiling? + return itemstack + -- Floor + end - -- Select one of 16 possible rotations (0-15) - local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) + if wdir == 1 then + -- Standing sign - if rotation_level > 15 then - rotation_level = 0 - elseif rotation_level < 0 then - rotation_level = 15 - end + -- Determine the sign rotation based on player's yaw + local yaw = pi * 2 - placer:get_look_horizontal() - -- The actual rotation is a combination of predefined mesh and facedir (see node definition) - if rotation_level % 4 == 0 then - nodeitem:set_name("mcl_signs:standing_sign") - elseif rotation_level % 4 == 1 then - nodeitem:set_name("mcl_signs:standing_sign22_5") - elseif rotation_level % 4 == 2 then - nodeitem:set_name("mcl_signs:standing_sign45") - elseif rotation_level % 4 == 3 then - nodeitem:set_name("mcl_signs:standing_sign67_5") - end - fdir = math.floor(rotation_level / 4) + -- Select one of 16 possible rotations (0-15) + local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) - -- Place the node! - local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) - if not success then - return itemstack - end - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end - sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] - -- Side - else - -- Wall sign - local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) - if not success then - return itemstack - end - sign_info = mcl_signs.signtext_info_wall[fdir + 1] - end + if rotation_level > 15 then + rotation_level = 0 + elseif rotation_level < 0 then + rotation_level = 15 + end - -- Determine spawn position of entity - local place_pos - if minetest.registered_nodes[node_under.name].buildable_to then - place_pos = under - else - place_pos = above - end + -- The actual rotation is a combination of predefined mesh and facedir (see node definition) + if rotation_level % 4 == 0 then + nodeitem:set_name("mcl_signs:standing_sign") + elseif rotation_level % 4 == 1 then + nodeitem:set_name("mcl_signs:standing_sign22_5") + elseif rotation_level % 4 == 2 then + nodeitem:set_name("mcl_signs:standing_sign45") + elseif rotation_level % 4 == 3 then + nodeitem:set_name("mcl_signs:standing_sign67_5") + end + fdir = math.floor(rotation_level / 4) - local text_entity = minetest.add_entity({ - x = place_pos.x + sign_info.delta.x, - y = place_pos.y + sign_info.delta.y, - z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") - text_entity:set_yaw(sign_info.yaw) - text_entity:get_luaentity()._signnodename = nodeitem:get_name() - if DEBUG then - minetest.log("verbose", "[mcl_signs]Placed position:" .. dump(place_pos) .. "\nSign_info: " .. dump(sign_info)) - end + -- Place the node! + local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) + if not success then + return itemstack + end + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] + -- Side + else + -- Wall sign + local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) + if not success then + return itemstack + end + sign_info = mcl_signs.signtext_info_wall[fdir + 1] + end - minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) + -- Determine spawn position of entity + local place_pos + if minetest.registered_nodes[node_under.name].buildable_to then + place_pos = under + else + place_pos = above + end - mcl_signs:show_formspec(placer, place_pos) - return itemstack - end, - on_destruct = function(pos) - mcl_signs:destruct_sign(pos) - end, + local text_entity = minetest.add_entity({ + x = place_pos.x + sign_info.delta.x, + y = place_pos.y + sign_info.delta.y, + z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") + text_entity:set_yaw(sign_info.yaw) + text_entity:get_luaentity()._signnodename = nodeitem:get_name() + if DEBUG then + minetest.log("verbose", "[mcl_signs]Placed position:" .. dump(place_pos) .. "\nSign_info: " .. dump(sign_info)) + end - -- Not Useless Code. force updates the sign. - on_punch = function(pos, node, puncher) - mcl_signs:update_sign(pos) - if DISINTEGRATE then - mcl_signs:destruct_sign(pos) - end - end, - on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - local r = screwdriver.rotate.wallmounted(pos, node, mode) - node.param2 = r - minetest.swap_node(pos, node) - mcl_signs:update_sign(pos, nil, nil, true) - return true - else - return false - end - end, - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - if DEBUG then - minetest.log("verbose", "[mcl_signs] Wall_Sign Right Click event.") - end + minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) - -- make sure player is clicking - if not clicker or not clicker:is_player() then - return - end + mcl_signs:show_formspec(placer, place_pos) + return itemstack + end, + on_destruct = function(pos) + mcl_signs:destruct_sign(pos) + end, - local item = clicker:get_wielded_item() - local iname = item:get_name() + -- Not Useless Code. force updates the sign. + on_punch = function(pos, node, puncher) + mcl_signs:update_sign(pos) + local timer = minetest.get_node_timer(pos) + if timer:is_started() == false then + timer:start(40.0) + end + end, + on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + local r = screwdriver.rotate.wallmounted(pos, node, mode) + node.param2 = r + minetest.swap_node(pos, node) + mcl_signs:update_sign(pos, nil, nil, true) + return true + else + return false + end + end, + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + if DEBUG then + minetest.log("verbose", "[mcl_signs] Wall_Sign Right Click event.") + end - if node then - if DEBUG then - minetest.log("verbose", "[mcl_signs] Wall_Sign Right Click event on valid node.") - end + -- make sure player is clicking + if not clicker or not clicker:is_player() then + return + end - -- handle glow from glow_ink_sac *first* - if (iname == "mcl_mobitems:glow_ink_sac") then - clicker:set_wielded_item(item) - local success = mcl_signs:glow_sign(pos) - if success then - if DEBUG then - minetest.log("verbose", "[mcl_signs] Sign Glow Success.") - end - itemstack:take_item() - end - return - end + local timer = minetest.get_node_timer(pos) + if timer:is_started() == false then + timer:start(40.0) + end - -- "mcl_dye:black" is a special case: it makes the sign's lettering black AND removes glow. - if (iname == "mcl_dye:black") then - clicker:set_wielded_item(item) - local success = mcl_signs:glow_sign(pos, true) - mcl_signs:color_sign(pos, mcl_colors.BLACK) - if success then - if DEBUG then - minetest.log("verbose", "[mcl_signs] Sign Glow removal Success.") - end + local item = clicker:get_wielded_item() + local iname = item:get_name() - itemstack:take_item() - end - return - end + if node then + if DEBUG then + minetest.log("verbose", "[mcl_signs] Wall_Sign Right Click event on valid node.") + end - -- check the wielded item to make sure that it is a dye. - local txt_color = mcl_signs:get_color_for_sign(iname) - if txt_color ~= "false" then - clicker:set_wielded_item(item) - local success = mcl_signs:color_sign(pos, txt_color) - if success then - if DEBUG then - minetest.log("verbose", "[mcl_signs] Sign Color Success.") - end - itemstack:take_item() - end - end - end - end, + -- handle glow from glow_ink_sac *first* + if (iname == "mcl_mobitems:glow_ink_sac") then + clicker:set_wielded_item(item) + local success = mcl_signs:glow_sign(pos) + if success then + if DEBUG then + minetest.log("verbose", "[mcl_signs] Sign Glow Success.") + end + itemstack:take_item() + end + return + end - _mcl_hardness = 1, - _mcl_blast_resistance = 1, + -- "mcl_dye:black" is a special case: it makes the sign's lettering black AND removes glow. + if (iname == "mcl_dye:black") then + clicker:set_wielded_item(item) + local success = mcl_signs:glow_sign(pos, true) + mcl_signs:color_sign(pos, mcl_colors.BLACK) + if success then + if DEBUG then + minetest.log("verbose", "[mcl_signs] Sign Glow removal Success.") + end + + itemstack:take_item() + end + return + end + + -- check the wielded item to make sure that it is a dye. + local txt_color = mcl_signs:get_color_for_sign(iname) + if txt_color ~= "false" then + clicker:set_wielded_item(item) + local success = mcl_signs:color_sign(pos, txt_color) + if success then + if DEBUG then + minetest.log("verbose", "[mcl_signs] Sign Color Success.") + end + itemstack:take_item() + end + end + end + end, + + _mcl_hardness = 1, + _mcl_blast_resistance = 1, } -- standing sign base (definition) mcl_signs.standing_standard = { - paramtype = "light", - use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, - sunlight_propagates = true, - walkable = false, - is_ground_content = false, - paramtype2 = "facedir", - drawtype = "mesh", - mesh = "mcl_signs_sign.obj", - selection_box = { type = "fixed", fixed = { -0.2, -0.5, -0.2, 0.2, 0.5, 0.2 } }, - tiles = { "mcl_signs_sign.png" }, - groups = mcl_signs.sign_groups, - drop = "mcl_signs:wall_sign", - stack_max = 16, - sounds = node_sounds, + paramtype = "light", + use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, + sunlight_propagates = true, + walkable = false, + is_ground_content = false, + paramtype2 = "facedir", + drawtype = "mesh", + mesh = "mcl_signs_sign.obj", + selection_box = { type = "fixed", fixed = { -0.2, -0.5, -0.2, 0.2, 0.5, 0.2 } }, + tiles = { "mcl_signs_sign.png" }, + groups = mcl_signs.sign_groups, + drop = "mcl_signs:wall_sign", + stack_max = 16, + sounds = node_sounds, - on_destruct = function(pos) - mcl_signs:destruct_sign(pos) - end, + on_destruct = function(pos) + mcl_signs:destruct_sign(pos) + end, - -- Not Useless Code. this force updates the sign. - on_punch = function(pos, node, puncher) - mcl_signs:update_sign(pos) - if DISINTEGRATE then - mcl_signs:destruct_sign(pos) - end - end, - on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign22_5" - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end, + on_timer = function(pos) + -- fix for /ClearObjects + mcl_signs:update_sign(pos) + minetest.get_node_timer(pos):start(40.0) + end, - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + -- Not Useless Code. this force updates the sign. + on_punch = function(pos, node, puncher) + mcl_signs:update_sign(pos) + local timer = minetest.get_node_timer(pos) + if timer:is_started() == false then + timer:start(40.0) + end + end, + on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign22_5" + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end, - if DEBUG then - minetest.log("verbose", "[mcl_signs] Standing_Sign Right Click event.") - end + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - -- make sure player is clicking - if not clicker or not clicker:is_player() then - return - end + if DEBUG then + minetest.log("verbose", "[mcl_signs] Standing_Sign Right Click event.") + end - local item = clicker:get_wielded_item() - local iname = item:get_name() + -- make sure player is clicking + if not clicker or not clicker:is_player() then + return + end - if node then - -- handle glow from glow_ink_sac *first* - if DEBUG then - minetest.log("verbose", "[mcl_signs] Standing_Sign Right Click event on valid node.") - end + local timer = minetest.get_node_timer(pos) + if timer:is_started() == false then + timer:start(40.0) + end - if (iname == "mcl_mobitems:glow_ink_sac") then - clicker:set_wielded_item(item) - local success = mcl_signs:glow_sign(pos) - if success then - if DEBUG then - minetest.log("verbose", "[mcl_signs] Sign Glow Success.") - end - itemstack:take_item() - end - return - end + local item = clicker:get_wielded_item() + local iname = item:get_name() - -- check the wielded item to make sure that it is a dye. - local txt_color = mcl_signs:get_color_for_sign(iname) - if txt_color ~= "false" then - clicker:set_wielded_item(item) - local success = mcl_signs:color_sign(pos, txt_color) - if success then - if DEBUG then - minetest.log("verbose", "[mcl_signs] Sign Color Success.") - end - itemstack:take_item() - end - end - end - end, + if node then + -- handle glow from glow_ink_sac *first* + if DEBUG then + minetest.log("verbose", "[mcl_signs] Standing_Sign Right Click event on valid node.") + end - _mcl_hardness = 1, - _mcl_blast_resistance = 1, + if (iname == "mcl_mobitems:glow_ink_sac") then + clicker:set_wielded_item(item) + local success = mcl_signs:glow_sign(pos) + if success then + if DEBUG then + minetest.log("verbose", "[mcl_signs] Sign Glow Success.") + end + itemstack:take_item() + end + return + end + + -- check the wielded item to make sure that it is a dye. + local txt_color = mcl_signs:get_color_for_sign(iname) + if txt_color ~= "false" then + clicker:set_wielded_item(item) + local success = mcl_signs:color_sign(pos, txt_color) + if success then + if DEBUG then + minetest.log("verbose", "[mcl_signs] Sign Color Success.") + end + itemstack:take_item() + end + end + end + end, + + _mcl_hardness = 1, + _mcl_blast_resistance = 1, } -- HELPER FUNCTIONS' VARIABLES local sign_glow = 6 local Dyes_table = { - { "mcl_dye:aqua", mcl_colors_official.AQUA }, - { "mcl_dye:black", mcl_colors_official.BLACK }, - { "mcl_dye:blue", mcl_colors_official.BLUE }, - { "mcl_dye:brown", mcl_colors_official.brown }, - { "mcl_dye:cyan", mcl_signs.mcl_wool_colors.unicolor_cyan }, - { "mcl_dye:green", mcl_colors_official.GREEN }, - { "mcl_dye:dark_green", mcl_colors_official.DARK_GREEN }, - { "mcl_dye:grey", mcl_colors_official.GRAY }, - { "mcl_dye:dark_grey", mcl_colors_official.DARK_GRAY }, - { "mcl_dye:lightblue", mcl_signs.mcl_wool_colors.unicolor_light_blue }, - { "mcl_dye:lime", mcl_signs.unicolor_green_or_lime }, - { "mcl_dye:magenta", mcl_colors_official.LIGHT_PURPLE }, - { "mcl_dye:orange", mcl_signs.mcl_wool_colors.unicolor_orange }, - { "mcl_dye:pink", mcl_signs.mcl_wool_colors.unicolor_light_red_pink }, - { "mcl_dye:purple", mcl_colors_official.LIGHT_PURPLE }, - { "mcl_dye:red", mcl_signs.mcl_wool_colors.unicolor_red }, - { "mcl_dye:silver", mcl_signs.mcl_wool_colors.unicolor_grey }, - { "mcl_dye:violet", mcl_colors_official.DARK_PURPLE }, - { "mcl_dye:white", mcl_colors_official.WHITE }, - { "mcl_dye:yellow", mcl_colors_official.YELLOW }, + { "mcl_dye:aqua", mcl_colors_official.AQUA }, + { "mcl_dye:black", mcl_colors_official.BLACK }, + { "mcl_dye:blue", mcl_colors_official.BLUE }, + { "mcl_dye:brown", mcl_colors_official.brown }, + { "mcl_dye:cyan", mcl_signs.mcl_wool_colors.unicolor_cyan }, + { "mcl_dye:green", mcl_colors_official.GREEN }, + { "mcl_dye:dark_green", mcl_colors_official.DARK_GREEN }, + { "mcl_dye:grey", mcl_colors_official.GRAY }, + { "mcl_dye:dark_grey", mcl_colors_official.DARK_GRAY }, + { "mcl_dye:lightblue", mcl_signs.mcl_wool_colors.unicolor_light_blue }, + { "mcl_dye:lime", mcl_signs.unicolor_green_or_lime }, + { "mcl_dye:magenta", mcl_colors_official.LIGHT_PURPLE }, + { "mcl_dye:orange", mcl_signs.mcl_wool_colors.unicolor_orange }, + { "mcl_dye:pink", mcl_signs.mcl_wool_colors.unicolor_light_red_pink }, + { "mcl_dye:purple", mcl_colors_official.LIGHT_PURPLE }, + { "mcl_dye:red", mcl_signs.mcl_wool_colors.unicolor_red }, + { "mcl_dye:silver", mcl_signs.mcl_wool_colors.unicolor_grey }, + { "mcl_dye:violet", mcl_colors_official.DARK_PURPLE }, + { "mcl_dye:white", mcl_colors_official.WHITE }, + { "mcl_dye:yellow", mcl_colors_official.YELLOW }, } local function update_sign_registry(type, name) - if type == "wall" then - table.insert(mcl_signs.registered_signs.wall_signs, name) - end - if type == "standing" then - table.insert(mcl_signs.registered_signs.standing_signs, name) - end - if type == "hanging" then - table.insert(mcl_signs.registered_signs.hanging_signs, name) - end + if type == "wall" then + table.insert(mcl_signs.registered_signs.wall_signs, name) + end + if type == "standing" then + table.insert(mcl_signs.registered_signs.standing_signs, name) + end + if type == "hanging" then + table.insert(mcl_signs.registered_signs.hanging_signs, name) + end end function mcl_signs.make_lbm() - local registered_sign_nodenames = {} + local registered_sign_nodenames = {} - for i = 0, #mcl_signs.registered_signs.wall_signs do - table.insert(registered_sign_nodenames, mcl_signs.registered_signs.wall_signs[i]) - end + for i = 0, #mcl_signs.registered_signs.wall_signs do + table.insert(registered_sign_nodenames, mcl_signs.registered_signs.wall_signs[i]) + end - for i = 0, #mcl_signs.registered_signs.standing_signs do - table.insert(registered_sign_nodenames, mcl_signs.registered_signs.standing_signs[i]) - end + for i = 0, #mcl_signs.registered_signs.standing_signs do + table.insert(registered_sign_nodenames, mcl_signs.registered_signs.standing_signs[i]) + end - for i = 0, #mcl_signs.registered_signs.hanging_signs do - table.insert(registered_sign_nodenames, mcl_signs.registered_signs.hanging_signs[i]) - end + for i = 0, #mcl_signs.registered_signs.hanging_signs do + table.insert(registered_sign_nodenames, mcl_signs.registered_signs.hanging_signs[i]) + end - -- the above is not yet used. - minetest.register_lbm({ - name = "mcl_signs:respawn_entities", - label = "Respawn sign text entities", - run_at_every_load = true, - nodenames = registered_sign_nodenames , - action = function(pos, node) - mcl_signs:update_sign(pos) - end, - }) + -- the above is not yet used. + minetest.register_lbm({ + name = "mcl_signs:respawn_entities", + label = "Respawn sign text entities", + run_at_every_load = true, + nodenames = registered_sign_nodenames, + action = function(pos, node) + mcl_signs:update_sign(pos) + end, + }) end function mcl_signs.register_dye (modname, item_name, color_code) - if minetest.get_modpath(modname) then - table.insert(Dyes_table, { item_name, color_code }) - end + if minetest.get_modpath(modname) then + table.insert(Dyes_table, { item_name, color_code }) + end end --- Register a new sign, tint the textures, and gives it an unique node name. Creates both wall and standing signs. @@ -524,227 +555,237 @@ end --- ttsign: the tool tip of the sign that gets translated. Shown when the mouse hovers the inventory sign. --- For example: the basic, default oak (wood) sign is just "Sign"; and a spruce sign would be "Spruce Sign" function mcl_signs.register_sign (modname, color, _name, ttsign) - local mod_name_pass = false - if modname ~= "" and modname ~= "false" then - if minetest.get_modpath(modname) then - mod_name_pass = true - end - if mod_name_pass == false then - return - end - end - local new_sign = {} + local mod_name_pass = false + if modname ~= "" and modname ~= "false" then + if minetest.get_modpath(modname) then + mod_name_pass = true + end + if mod_name_pass == false then + return + end + end + local new_sign = {} - if color == nil or color == "" then - color = "#FFFFFF" - end + if color == nil or color == "" then + color = "#FFFFFF" + end - new_sign = table.copy(mcl_signs.wall_standard) - new_sign.description = S(ttsign) + new_sign = table.copy(mcl_signs.wall_standard) + new_sign.description = S(ttsign) - new_sign.wield_image = "(default_sign.png^[multiply:" .. color .. ")" - new_sign.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } - new_sign.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" + new_sign.wield_image = "(default_sign.png^[multiply:" .. color .. ")" + new_sign.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } + new_sign.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" - -- currently have to do this, because of how the base node placement works. - new_sign.on_place = function(itemstack, placer, pointed_thing) - local above = pointed_thing.above - local under = pointed_thing.under + -- currently have to do this, because of how the base node placement works. + new_sign.on_place = function(itemstack, placer, pointed_thing) + local above = pointed_thing.above + local under = pointed_thing.under - -- Use pointed node's on_rightclick function first, if present - local node_under = minetest.get_node(under) - if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then - return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack - end - end + -- Use pointed node's on_rightclick function first, if present + local node_under = minetest.get_node(under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then + return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack + end + end - local dir = vector.subtract(under, above) + local timer = minetest.get_node_timer(pos) + if timer:is_started() == false then + timer:start(40.0) + end - -- Only build when it's legal - local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] - if not abovenodedef or abovenodedef.buildable_to == false then - return itemstack - end + local dir = vector.subtract(under, above) - local wdir = minetest.dir_to_wallmounted(dir) - local fdir = minetest.dir_to_facedir(dir) + -- Only build when it's legal + local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] + if not abovenodedef or abovenodedef.buildable_to == false then + return itemstack + end - local sign_info - local nodeitem = ItemStack(itemstack) - -- Ceiling - if wdir == 0 then - --how would you add sign to ceiling? - return itemstack - -- Floor - elseif wdir == 1 then - -- Standing sign + local wdir = minetest.dir_to_wallmounted(dir) + local fdir = minetest.dir_to_facedir(dir) - -- Determine the sign rotation based on player's yaw - local yaw = pi * 2 - placer:get_look_horizontal() + local sign_info + local nodeitem = ItemStack(itemstack) - -- Select one of 16 possible rotations (0-15) - local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) + local yaw = 0 - if rotation_level > 15 then - rotation_level = 0 - elseif rotation_level < 0 then - rotation_level = 15 - end + -- Ceiling + if wdir == 0 then + --how would you add sign to ceiling? simple - hanging sign. + -- add code for placement underneath a node. - -- The actual rotation is a combination of predefined mesh and facedir (see node definition) - if rotation_level % 4 == 0 then - nodeitem:set_name("mcl_signs:standing_sign" .. _name) - elseif rotation_level % 4 == 1 then - nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) - elseif rotation_level % 4 == 2 then - nodeitem:set_name("mcl_signs:standing_sign45" .. _name) - elseif rotation_level % 4 == 3 then - nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) - end - fdir = math.floor(rotation_level / 4) + return itemstack + -- Floor + elseif wdir == 1 then + -- Standing sign - -- Place the node! - local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) - if not success then - return itemstack - end - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end - sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] - -- Side - else - -- Wall sign - local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) - if not success then - return itemstack - end - sign_info = mcl_signs.signtext_info_wall[fdir + 1] - end + -- Determine the sign rotation based on player's yaw + yaw = pi * 2 - placer:get_look_horizontal() - -- Determine spawn position of entity - local place_pos - if minetest.registered_nodes[node_under.name].buildable_to then - place_pos = under - else - place_pos = above - end + -- Select one of 16 possible rotations (0-15) + local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) - if DEBUG then - minetest.log("action", "[mcl_signs] Register_Sign::Placed position:" .. dump(place_pos) .. "\nSign_info: " .. dump(sign_info)) - end + if rotation_level > 15 then + rotation_level = 0 + elseif rotation_level < 0 then + rotation_level = 15 + end - local text_entity = minetest.add_entity({ - x = place_pos.x + sign_info.delta.x, - y = place_pos.y + sign_info.delta.y, - z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") - text_entity:set_yaw(sign_info.yaw) - text_entity:get_luaentity()._signnodename = nodeitem:get_name() + -- The actual rotation is a combination of predefined mesh and facedir (see node definition) + if rotation_level % 4 == 0 then + nodeitem:set_name("mcl_signs:standing_sign" .. _name) + elseif rotation_level % 4 == 1 then + nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) + elseif rotation_level % 4 == 2 then + nodeitem:set_name("mcl_signs:standing_sign45" .. _name) + elseif rotation_level % 4 == 3 then + nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) + end + fdir = math.floor(rotation_level / 4) - minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) + -- Place the node! + local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) + if not success then + return itemstack + end + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] + -- Side + else + -- Wall sign + local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) + if not success then + return itemstack + end + sign_info = mcl_signs.signtext_info_wall[fdir + 1] + end - mcl_signs:show_formspec(placer, place_pos) - return itemstack - end + -- Determine spawn position of entity + local place_pos + if minetest.registered_nodes[node_under.name].buildable_to then + place_pos = under + else + place_pos = above + end - minetest.register_node("mcl_signs:wall_sign" .. _name, new_sign) - update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) + if DEBUG then + minetest.log("action", "[mcl_signs] Register_Sign::Placed position:" .. dump(place_pos) .. "\nSign_info: " .. dump(sign_info)) + end - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Registered: mcl_signs:wall_sign" .. _name .. color .. "\n" .. dump(new_sign)) - minetest.log("action", "[mcl_signs] mcl_signs:wall_sign_standard\n" .. dump(mcl_signs.wall_standard)) - end + local text_entity = minetest.add_entity({ + x = place_pos.x + sign_info.delta.x, + y = place_pos.y + sign_info.delta.y, + z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") + text_entity:set_yaw(sign_info.yaw) + text_entity:get_luaentity()._signnodename = nodeitem:get_name() - -- standing sign base. - local new_sign_standing = {} - new_sign_standing = table.copy(mcl_signs.standing_standard) - new_sign_standing.drop = "mcl_signs:wall_sign" .. _name - new_sign_standing.wield_image = "(default_sign.png^[multiply:" .. color .. ")" - new_sign_standing.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } - new_sign_standing.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" + minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) - new_sign_standing.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign22_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end, + mcl_signs:show_formspec(placer, place_pos) + return itemstack + end - minetest.register_node("mcl_signs:standing_sign" .. _name, new_sign_standing) - update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Registered: mcl_signs:standing_sign" .. _name .. color .. "\n" .. dump(new_sign_standing)) - end + minetest.register_node(":mcl_signs:wall_sign" .. _name, new_sign) + update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) - -- 22.5° - local ssign22_5d = table.copy(new_sign_standing) - ssign22_5d.mesh = "mcl_signs_sign22.5.obj" - ssign22_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign45" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.register_node("mcl_signs:standing_sign22_5" .. _name, ssign22_5d) - update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Registered: mcl_signs:wall_sign" .. _name .. color .. "\n" .. dump(new_sign)) + minetest.log("action", "[mcl_signs] mcl_signs:wall_sign_standard\n" .. dump(mcl_signs.wall_standard)) + end - -- 45° - local ssign45d = table.copy(new_sign_standing) - ssign45d.mesh = "mcl_signs_sign45.obj" - ssign45d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign67_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.register_node("mcl_signs:standing_sign45" .. _name, ssign45d) - update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) + -- standing sign base. + local new_sign_standing = {} + new_sign_standing = table.copy(mcl_signs.standing_standard) + new_sign_standing.drop = "mcl_signs:wall_sign" .. _name + new_sign_standing.wield_image = "(default_sign.png^[multiply:" .. color .. ")" + new_sign_standing.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } + new_sign_standing.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" - -- 67.5° - local ssign67_5d = table.copy(new_sign_standing) - ssign67_5d.mesh = "mcl_signs_sign67.5.obj" - ssign67_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign" .. _name - node.param2 = (node.param2 + 1) % 4 - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.register_node("mcl_signs:standing_sign67_5" .. _name, ssign67_5d) - update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) + new_sign_standing.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign22_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end, - -- register Doc entry - if minetest.get_modpath("doc") then - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) - end + minetest.register_node(":mcl_signs:standing_sign" .. _name, new_sign_standing) + update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Registered: mcl_signs:standing_sign" .. _name .. color .. "\n" .. dump(new_sign_standing)) + end - --register standing sign's rotation_levels - 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}) + -- 22.5° + local ssign22_5d = table.copy(new_sign_standing) + ssign22_5d.mesh = "mcl_signs_sign22.5.obj" + ssign22_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign45" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.register_node(":mcl_signs:standing_sign22_5" .. _name, ssign22_5d) + update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) + + -- 45° + local ssign45d = table.copy(new_sign_standing) + ssign45d.mesh = "mcl_signs_sign45.obj" + ssign45d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign67_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.register_node(":mcl_signs:standing_sign45" .. _name, ssign45d) + update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) + + -- 67.5° + local ssign67_5d = table.copy(new_sign_standing) + ssign67_5d.mesh = "mcl_signs_sign67.5.obj" + ssign67_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign" .. _name + node.param2 = (node.param2 + 1) % 4 + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.register_node(":mcl_signs:standing_sign67_5" .. _name, ssign67_5d) + update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) + + -- register Doc entry + if minetest.get_modpath("doc") then + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) + end + + --register standing sign's rotation_levels + 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 }) end --- The same as register_sign, except caller defines the textures. Note, there is a greyscale version of the sign, @@ -769,205 +810,210 @@ end --- ttsign: the tool tip of the sign that gets translated. Shown when the mouse hovers the inventory sign. --- For example: the basic, default oak (wood) sign is just "Sign"; and a spruce sign would be "Spruce Sign" function mcl_signs.register_sign_custom (modname, _name, tiles, color, inventory_image, wield_image, ttsign) - local mod_name_pass = false - if modname ~= "" and modname ~= "false" then - if minetest.get_modpath(modname) then - mod_name_pass = true - end - if mod_name_pass == false then - return - end - end - local new_sign = {} + local mod_name_pass = false + if modname ~= "" and modname ~= "false" then + if minetest.get_modpath(modname) then + mod_name_pass = true + end + if mod_name_pass == false then + return + end + end + local new_sign = {} - new_sign = table.copy(mcl_signs.wall_standard) + new_sign = table.copy(mcl_signs.wall_standard) - new_sign.wield_image ="("..wield_image.."^[multiply:" .. color .. ")" - new_sign.tiles = { "("..tiles.."^[multiply:" .. color .. ")" } - new_sign.inventory_image = "("..inventory_image.."^[multiply:" .. color .. ")" - new_sign.description = S(ttsign) - -- currently have to do this, because of how the base node placement works. - new_sign.on_place = function(itemstack, placer, pointed_thing) - local above = pointed_thing.above - local under = pointed_thing.under + new_sign.wield_image = "(" .. wield_image .. "^[multiply:" .. color .. ")" + new_sign.tiles = { "(" .. tiles .. "^[multiply:" .. color .. ")" } + new_sign.inventory_image = "(" .. inventory_image .. "^[multiply:" .. color .. ")" + new_sign.description = S(ttsign) + -- currently have to do this, because of how the base node placement works. + new_sign.on_place = function(itemstack, placer, pointed_thing) + local above = pointed_thing.above + local under = pointed_thing.under - -- Use pointed node's on_rightclick function first, if present - local node_under = minetest.get_node(under) - if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then - return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack - end - end + -- Use pointed node's on_rightclick function first, if present + local node_under = minetest.get_node(under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then + return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack + end + end - local dir = vector.subtract(under, above) + local timer = minetest.get_node_timer(pos) + if timer:is_started() == false then + timer:start(40.0) + end - -- Only build when it's legal - local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] - if not abovenodedef or abovenodedef.buildable_to == false then - return itemstack - end + local dir = vector.subtract(under, above) - local wdir = minetest.dir_to_wallmounted(dir) - local fdir = minetest.dir_to_facedir(dir) + -- Only build when it's legal + local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] + if not abovenodedef or abovenodedef.buildable_to == false then + return itemstack + end - local sign_info - local nodeitem = ItemStack(itemstack) - -- Ceiling - if wdir == 0 then - --how would you add sign to ceiling? - return itemstack - -- Floor - elseif wdir == 1 then - -- Standing sign + local wdir = minetest.dir_to_wallmounted(dir) + local fdir = minetest.dir_to_facedir(dir) - -- Determine the sign rotation based on player's yaw - local yaw = pi * 2 - placer:get_look_horizontal() + local sign_info + local nodeitem = ItemStack(itemstack) + -- Ceiling + if wdir == 0 then + --how would you add sign to ceiling? + return itemstack + -- Floor + elseif wdir == 1 then + -- Standing sign - -- Select one of 16 possible rotations (0-15) - local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) + -- Determine the sign rotation based on player's yaw + local yaw = pi * 2 - placer:get_look_horizontal() - if rotation_level > 15 then - rotation_level = 0 - elseif rotation_level < 0 then - rotation_level = 15 - end + -- Select one of 16 possible rotations (0-15) + local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) - -- The actual rotation is a combination of predefined mesh and facedir (see node definition) - if rotation_level % 4 == 0 then - nodeitem:set_name("mcl_signs:standing_sign" .. _name) - elseif rotation_level % 4 == 1 then - nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) - elseif rotation_level % 4 == 2 then - nodeitem:set_name("mcl_signs:standing_sign45" .. _name) - elseif rotation_level % 4 == 3 then - nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) - end - fdir = math.floor(rotation_level / 4) + if rotation_level > 15 then + rotation_level = 0 + elseif rotation_level < 0 then + rotation_level = 15 + end - -- Place the node! - local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) - if not success then - return itemstack - end - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end - sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] - -- Side - else - -- Wall sign - local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) - if not success then - return itemstack - end - sign_info = mcl_signs.signtext_info_wall[fdir + 1] - end + -- The actual rotation is a combination of predefined mesh and facedir (see node definition) + if rotation_level % 4 == 0 then + nodeitem:set_name("mcl_signs:standing_sign" .. _name) + elseif rotation_level % 4 == 1 then + nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) + elseif rotation_level % 4 == 2 then + nodeitem:set_name("mcl_signs:standing_sign45" .. _name) + elseif rotation_level % 4 == 3 then + nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) + end + fdir = math.floor(rotation_level / 4) - -- Determine spawn position of entity - local place_pos - if minetest.registered_nodes[node_under.name].buildable_to then - place_pos = under - else - place_pos = above - end + -- Place the node! + local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) + if not success then + return itemstack + end + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] + -- Side + else + -- Wall sign + local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) + if not success then + return itemstack + end + sign_info = mcl_signs.signtext_info_wall[fdir + 1] + end - local text_entity = minetest.add_entity({ - x = place_pos.x + sign_info.delta.x, - y = place_pos.y + sign_info.delta.y, - z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") - text_entity:set_yaw(sign_info.yaw) - text_entity:get_luaentity()._signnodename = nodeitem:get_name() + -- Determine spawn position of entity + local place_pos + if minetest.registered_nodes[node_under.name].buildable_to then + place_pos = under + else + place_pos = above + end - minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) + local text_entity = minetest.add_entity({ + x = place_pos.x + sign_info.delta.x, + y = place_pos.y + sign_info.delta.y, + z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") + text_entity:set_yaw(sign_info.yaw) + text_entity:get_luaentity()._signnodename = nodeitem:get_name() - mcl_signs:show_formspec(placer, place_pos) - return itemstack - end - minetest.register_node("mcl_signs:wall_sign" .. _name, new_sign) - update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) + minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) - -- standing sign base. - local new_sign_standing = {} - new_sign_standing = table.copy(mcl_signs.standing_standard) - new_sign_standing.drop = "mcl_signs:wall_sign" .. _name - new_sign_standing.wield_image ="("..wield_image.."^[multiply:" .. color .. ")" - new_sign_standing.tiles = { "("..tiles.."^[multiply:" .. color .. ")" } - new_sign_standing.inventory_image = "("..inventory_image.."^[multiply:" .. color .. ")" - new_sign_standing.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign22_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end, - minetest.register_node("mcl_signs:standing_sign" .. _name, new_sign_standing) - update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) + mcl_signs:show_formspec(placer, place_pos) + return itemstack + end + minetest.register_node(":mcl_signs:wall_sign" .. _name, new_sign) + update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) - -- 22.5° - local ssign22_5d = table.copy(new_sign_standing) - ssign22_5d.mesh = "mcl_signs_sign22.5.obj" - ssign22_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign45" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.register_node("mcl_signs:standing_sign22_5" .. _name, ssign22_5d) - update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) + -- standing sign base. + local new_sign_standing = {} + new_sign_standing = table.copy(mcl_signs.standing_standard) + new_sign_standing.drop = "mcl_signs:wall_sign" .. _name + new_sign_standing.wield_image = "(" .. wield_image .. "^[multiply:" .. color .. ")" + new_sign_standing.tiles = { "(" .. tiles .. "^[multiply:" .. color .. ")" } + new_sign_standing.inventory_image = "(" .. inventory_image .. "^[multiply:" .. color .. ")" + new_sign_standing.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign22_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end, + minetest.register_node(":mcl_signs:standing_sign" .. _name, new_sign_standing) + update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) - -- 45° - local ssign45d = table.copy(new_sign_standing) - ssign45d.mesh = "mcl_signs_sign45.obj" - ssign45d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign67_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.register_node("mcl_signs:standing_sign45" .. _name, ssign45d) - update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) + -- 22.5° + local ssign22_5d = table.copy(new_sign_standing) + ssign22_5d.mesh = "mcl_signs_sign22.5.obj" + ssign22_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign45" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.register_node(":mcl_signs:standing_sign22_5" .. _name, ssign22_5d) + update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) - -- 67.5° - local ssign67_5d = table.copy(new_sign_standing) - ssign67_5d.mesh = "mcl_signs_sign67.5.obj" - ssign67_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign" .. _name - node.param2 = (node.param2 + 1) % 4 - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.register_node("mcl_signs:standing_sign67_5" .. _name, ssign67_5d) - update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) + -- 45° + local ssign45d = table.copy(new_sign_standing) + ssign45d.mesh = "mcl_signs_sign45.obj" + ssign45d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign67_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.register_node(":mcl_signs:standing_sign45" .. _name, ssign45d) + update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) - -- register Doc entry - if minetest.get_modpath("doc") then - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) - end + -- 67.5° + local ssign67_5d = table.copy(new_sign_standing) + ssign67_5d.mesh = "mcl_signs_sign67.5.obj" + ssign67_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign" .. _name + node.param2 = (node.param2 + 1) % 4 + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.register_node(":mcl_signs:standing_sign67_5" .. _name, ssign67_5d) + update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) - --register standing sign's rotation_levels - 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 Doc entry + if minetest.get_modpath("doc") then + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) + end + + --register standing sign's rotation_levels + 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 }) end @@ -982,225 +1028,230 @@ end --- ttsign: the tool tip of the sign that gets translated. Shown when the mouse hovers the inventory sign. --- For example: the basic, default oak (wood) sign is just "Sign"; and a spruce sign would be "Spruce Sign" function mcl_signs.reregister_sign (modname, color, _name, ttsign) - local mod_name_pass = false - if modname ~= "" and modname ~= "false" then - if minetest.get_modpath(modname) then - mod_name_pass = true - end - if mod_name_pass == false then - return - end - end - local new_sign = {} + local mod_name_pass = false + if modname ~= "" and modname ~= "false" then + if minetest.get_modpath(modname) then + mod_name_pass = true + end + if mod_name_pass == false then + return + end + end + local new_sign = {} - if color == nil or color == "" then - color = "#FFFFFF" - end + if color == nil or color == "" then + color = "#FFFFFF" + end - new_sign = table.copy(mcl_signs.wall_standard) - new_sign.description = S(ttsign) + new_sign = table.copy(mcl_signs.wall_standard) + new_sign.description = S(ttsign) - new_sign.wield_image = "(default_sign.png^[multiply:" .. color .. ")" - new_sign.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } - new_sign.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" + new_sign.wield_image = "(default_sign.png^[multiply:" .. color .. ")" + new_sign.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } + new_sign.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" - -- currently have to do this, because of how the base node placement works. - new_sign.on_place = function(itemstack, placer, pointed_thing) - local above = pointed_thing.above - local under = pointed_thing.under + -- currently have to do this, because of how the base node placement works. + new_sign.on_place = function(itemstack, placer, pointed_thing) + local above = pointed_thing.above + local under = pointed_thing.under - -- Use pointed node's on_rightclick function first, if present - local node_under = minetest.get_node(under) - if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then - return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack - end - end + -- Use pointed node's on_rightclick function first, if present + local node_under = minetest.get_node(under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then + return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack + end + end - local dir = vector.subtract(under, above) + local timer = minetest.get_node_timer(pos) + if timer:is_started() == false then + timer:start(40.0) + end - -- Only build when it's legal - local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] - if not abovenodedef or abovenodedef.buildable_to == false then - return itemstack - end + local dir = vector.subtract(under, above) - local wdir = minetest.dir_to_wallmounted(dir) - local fdir = minetest.dir_to_facedir(dir) + -- Only build when it's legal + local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] + if not abovenodedef or abovenodedef.buildable_to == false then + return itemstack + end - local sign_info - local nodeitem = ItemStack(itemstack) - -- Ceiling - if wdir == 0 then - --how would you add sign to ceiling? - return itemstack - -- Floor - elseif wdir == 1 then - -- Standing sign + local wdir = minetest.dir_to_wallmounted(dir) + local fdir = minetest.dir_to_facedir(dir) - -- Determine the sign rotation based on player's yaw - local yaw = pi * 2 - placer:get_look_horizontal() + local sign_info + local nodeitem = ItemStack(itemstack) + -- Ceiling + if wdir == 0 then + --how would you add sign to ceiling? + return itemstack + -- Floor + elseif wdir == 1 then + -- Standing sign - -- Select one of 16 possible rotations (0-15) - local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) + -- Determine the sign rotation based on player's yaw + local yaw = pi * 2 - placer:get_look_horizontal() - if rotation_level > 15 then - rotation_level = 0 - elseif rotation_level < 0 then - rotation_level = 15 - end + -- Select one of 16 possible rotations (0-15) + local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) - -- The actual rotation is a combination of predefined mesh and facedir (see node definition) - if rotation_level % 4 == 0 then - nodeitem:set_name("mcl_signs:standing_sign" .. _name) - elseif rotation_level % 4 == 1 then - nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) - elseif rotation_level % 4 == 2 then - nodeitem:set_name("mcl_signs:standing_sign45" .. _name) - elseif rotation_level % 4 == 3 then - nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) - end - fdir = math.floor(rotation_level / 4) + if rotation_level > 15 then + rotation_level = 0 + elseif rotation_level < 0 then + rotation_level = 15 + end - -- Place the node! - local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) - if not success then - return itemstack - end - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end - sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] - -- Side - else - -- Wall sign - local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) - if not success then - return itemstack - end - sign_info = mcl_signs.signtext_info_wall[fdir + 1] - end + -- The actual rotation is a combination of predefined mesh and facedir (see node definition) + if rotation_level % 4 == 0 then + nodeitem:set_name("mcl_signs:standing_sign" .. _name) + elseif rotation_level % 4 == 1 then + nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) + elseif rotation_level % 4 == 2 then + nodeitem:set_name("mcl_signs:standing_sign45" .. _name) + elseif rotation_level % 4 == 3 then + nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) + end + fdir = math.floor(rotation_level / 4) - -- Determine spawn position of entity - local place_pos - if minetest.registered_nodes[node_under.name].buildable_to then - place_pos = under - else - place_pos = above - end + -- Place the node! + local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) + if not success then + return itemstack + end + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] + -- Side + else + -- Wall sign + local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) + if not success then + return itemstack + end + sign_info = mcl_signs.signtext_info_wall[fdir + 1] + end - if DEBUG then - minetest.log("action", "[mcl_signs] Register_Sign::Placed position:" .. dump(place_pos) .. "\nSign_info: " .. dump(sign_info)) - end + -- Determine spawn position of entity + local place_pos + if minetest.registered_nodes[node_under.name].buildable_to then + place_pos = under + else + place_pos = above + end - local text_entity = minetest.add_entity({ - x = place_pos.x + sign_info.delta.x, - y = place_pos.y + sign_info.delta.y, - z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") - text_entity:set_yaw(sign_info.yaw) - text_entity:get_luaentity()._signnodename = nodeitem:get_name() + if DEBUG then + minetest.log("action", "[mcl_signs] Register_Sign::Placed position:" .. dump(place_pos) .. "\nSign_info: " .. dump(sign_info)) + end - minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) + local text_entity = minetest.add_entity({ + x = place_pos.x + sign_info.delta.x, + y = place_pos.y + sign_info.delta.y, + z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") + text_entity:set_yaw(sign_info.yaw) + text_entity:get_luaentity()._signnodename = nodeitem:get_name() - mcl_signs:show_formspec(placer, place_pos) - return itemstack - end + minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) - minetest.override_item("mcl_signs:wall_sign" .. _name, new_sign) - update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) + mcl_signs:show_formspec(placer, place_pos) + return itemstack + end - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Registered: mcl_signs:wall_sign" .. _name .. color .. "\n" .. dump(new_sign)) - minetest.log("action", "[mcl_signs] mcl_signs:wall_sign_standard\n" .. dump(mcl_signs.wall_standard)) - end + minetest.override_item("mcl_signs:wall_sign" .. _name, new_sign) + update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) - -- standing sign base. - local new_sign_standing = {} - new_sign_standing = table.copy(mcl_signs.standing_standard) - new_sign_standing.drop = "mcl_signs:wall_sign" .. _name - new_sign_standing.wield_image = "(default_sign.png^[multiply:" .. color .. ")" - new_sign_standing.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } - new_sign_standing.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" - new_sign_standing.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign22_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end, - minetest.override_item("mcl_signs:standing_sign" .. _name, new_sign_standing) - update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Registered: mcl_signs:standing_sign" .. _name .. color .. "\n" .. dump(new_sign_standing)) - end + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Registered: mcl_signs:wall_sign" .. _name .. color .. "\n" .. dump(new_sign)) + minetest.log("action", "[mcl_signs] mcl_signs:wall_sign_standard\n" .. dump(mcl_signs.wall_standard)) + end - -- 22.5° - local ssign22_5d = table.copy(new_sign_standing) - ssign22_5d.mesh = "mcl_signs_sign22.5.obj" - ssign22_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign45" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.override_item("mcl_signs:standing_sign22_5" .. _name, ssign22_5d) - update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) + -- standing sign base. + local new_sign_standing = {} + new_sign_standing = table.copy(mcl_signs.standing_standard) + new_sign_standing.drop = "mcl_signs:wall_sign" .. _name + new_sign_standing.wield_image = "(default_sign.png^[multiply:" .. color .. ")" + new_sign_standing.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } + new_sign_standing.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" + new_sign_standing.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign22_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end, + minetest.override_item("mcl_signs:standing_sign" .. _name, new_sign_standing) + update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Registered: mcl_signs:standing_sign" .. _name .. color .. "\n" .. dump(new_sign_standing)) + end - -- 45° - local ssign45d = table.copy(new_sign_standing) - ssign45d.mesh = "mcl_signs_sign45.obj" - ssign45d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign67_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.override_item("mcl_signs:standing_sign45" .. _name, ssign45d) - update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) + -- 22.5° + local ssign22_5d = table.copy(new_sign_standing) + ssign22_5d.mesh = "mcl_signs_sign22.5.obj" + ssign22_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign45" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.override_item("mcl_signs:standing_sign22_5" .. _name, ssign22_5d) + update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) - -- 67.5° - local ssign67_5d = table.copy(new_sign_standing) - ssign67_5d.mesh = "mcl_signs_sign67.5.obj" - ssign67_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign" .. _name - node.param2 = (node.param2 + 1) % 4 - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.override_item("mcl_signs:standing_sign67_5" .. _name, ssign67_5d) - update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) + -- 45° + local ssign45d = table.copy(new_sign_standing) + ssign45d.mesh = "mcl_signs_sign45.obj" + ssign45d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign67_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.override_item("mcl_signs:standing_sign45" .. _name, ssign45d) + update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) - -- register Doc entry - if minetest.get_modpath("doc") then - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) - end + -- 67.5° + local ssign67_5d = table.copy(new_sign_standing) + ssign67_5d.mesh = "mcl_signs_sign67.5.obj" + ssign67_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign" .. _name + node.param2 = (node.param2 + 1) % 4 + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.override_item("mcl_signs:standing_sign67_5" .. _name, ssign67_5d) + update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) - --register standing sign's rotation_levels - 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 Doc entry + if minetest.get_modpath("doc") then + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) + end + + --register standing sign's rotation_levels + 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 }) end --- The same as reregister_sign, except caller defines the textures. Note, there is a greyscale version of the sign, @@ -1225,205 +1276,210 @@ end --- ttsign: the tool tip of the sign that gets translated. Shown when the mouse hovers the inventory sign. --- For example: the basic, default oak (wood) sign is just "Sign"; and a spruce sign would be "Spruce Sign" function mcl_signs.reregister_sign_custom (modname, _name, tiles, color, inventory_image, wield_image, ttsign) - local mod_name_pass = false - if modname ~= "" and modname ~= "false" then - if minetest.get_modpath(modname) then - mod_name_pass = true - end - if mod_name_pass == false then - return - end - end - local new_sign = {} + local mod_name_pass = false + if modname ~= "" and modname ~= "false" then + if minetest.get_modpath(modname) then + mod_name_pass = true + end + if mod_name_pass == false then + return + end + end + local new_sign = {} - new_sign = table.copy(mcl_signs.wall_standard) + new_sign = table.copy(mcl_signs.wall_standard) - new_sign.wield_image ="("..wield_image.."^[multiply:" .. color .. ")" - new_sign.tiles = { "("..tiles.."^[multiply:" .. color .. ")" } - new_sign.inventory_image = "("..inventory_image.."^[multiply:" .. color .. ")" - new_sign.description = S(ttsign) - -- currently have to do this, because of how the base node placement works. - new_sign.on_place = function(itemstack, placer, pointed_thing) - local above = pointed_thing.above - local under = pointed_thing.under + new_sign.wield_image = "(" .. wield_image .. "^[multiply:" .. color .. ")" + new_sign.tiles = { "(" .. tiles .. "^[multiply:" .. color .. ")" } + new_sign.inventory_image = "(" .. inventory_image .. "^[multiply:" .. color .. ")" + new_sign.description = S(ttsign) + -- currently have to do this, because of how the base node placement works. + new_sign.on_place = function(itemstack, placer, pointed_thing) + local above = pointed_thing.above + local under = pointed_thing.under - -- Use pointed node's on_rightclick function first, if present - local node_under = minetest.get_node(under) - if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then - return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack - end - end + -- Use pointed node's on_rightclick function first, if present + local node_under = minetest.get_node(under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then + return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack + end + end - local dir = vector.subtract(under, above) + local timer = minetest.get_node_timer(pos) + if timer:is_started() == false then + timer:start(40.0) + end - -- Only build when it's legal - local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] - if not abovenodedef or abovenodedef.buildable_to == false then - return itemstack - end + local dir = vector.subtract(under, above) - local wdir = minetest.dir_to_wallmounted(dir) - local fdir = minetest.dir_to_facedir(dir) + -- Only build when it's legal + local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] + if not abovenodedef or abovenodedef.buildable_to == false then + return itemstack + end - local sign_info - local nodeitem = ItemStack(itemstack) - -- Ceiling - if wdir == 0 then - --how would you add sign to ceiling? - return itemstack - -- Floor - elseif wdir == 1 then - -- Standing sign + local wdir = minetest.dir_to_wallmounted(dir) + local fdir = minetest.dir_to_facedir(dir) - -- Determine the sign rotation based on player's yaw - local yaw = pi * 2 - placer:get_look_horizontal() + local sign_info + local nodeitem = ItemStack(itemstack) + -- Ceiling + if wdir == 0 then + --how would you add sign to ceiling? + return itemstack + -- Floor + elseif wdir == 1 then + -- Standing sign - -- Select one of 16 possible rotations (0-15) - local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) + -- Determine the sign rotation based on player's yaw + local yaw = pi * 2 - placer:get_look_horizontal() - if rotation_level > 15 then - rotation_level = 0 - elseif rotation_level < 0 then - rotation_level = 15 - end + -- Select one of 16 possible rotations (0-15) + local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) - -- The actual rotation is a combination of predefined mesh and facedir (see node definition) - if rotation_level % 4 == 0 then - nodeitem:set_name("mcl_signs:standing_sign" .. _name) - elseif rotation_level % 4 == 1 then - nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) - elseif rotation_level % 4 == 2 then - nodeitem:set_name("mcl_signs:standing_sign45" .. _name) - elseif rotation_level % 4 == 3 then - nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) - end - fdir = math.floor(rotation_level / 4) + if rotation_level > 15 then + rotation_level = 0 + elseif rotation_level < 0 then + rotation_level = 15 + end - -- Place the node! - local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) - if not success then - return itemstack - end - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end - sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] - -- Side - else - -- Wall sign - local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) - if not success then - return itemstack - end - sign_info = mcl_signs.signtext_info_wall[fdir + 1] - end + -- The actual rotation is a combination of predefined mesh and facedir (see node definition) + if rotation_level % 4 == 0 then + nodeitem:set_name("mcl_signs:standing_sign" .. _name) + elseif rotation_level % 4 == 1 then + nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) + elseif rotation_level % 4 == 2 then + nodeitem:set_name("mcl_signs:standing_sign45" .. _name) + elseif rotation_level % 4 == 3 then + nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) + end + fdir = math.floor(rotation_level / 4) - -- Determine spawn position of entity - local place_pos - if minetest.registered_nodes[node_under.name].buildable_to then - place_pos = under - else - place_pos = above - end + -- Place the node! + local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) + if not success then + return itemstack + end + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] + -- Side + else + -- Wall sign + local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) + if not success then + return itemstack + end + sign_info = mcl_signs.signtext_info_wall[fdir + 1] + end - local text_entity = minetest.add_entity({ - x = place_pos.x + sign_info.delta.x, - y = place_pos.y + sign_info.delta.y, - z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") - text_entity:set_yaw(sign_info.yaw) - text_entity:get_luaentity()._signnodename = nodeitem:get_name() + -- Determine spawn position of entity + local place_pos + if minetest.registered_nodes[node_under.name].buildable_to then + place_pos = under + else + place_pos = above + end - minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) + local text_entity = minetest.add_entity({ + x = place_pos.x + sign_info.delta.x, + y = place_pos.y + sign_info.delta.y, + z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") + text_entity:set_yaw(sign_info.yaw) + text_entity:get_luaentity()._signnodename = nodeitem:get_name() - mcl_signs:show_formspec(placer, place_pos) - return itemstack - end - minetest.override_item("mcl_signs:wall_sign" .. _name, new_sign) - update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) + minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) - -- standing sign base. - local new_sign_standing = {} - new_sign_standing = table.copy(mcl_signs.standing_standard) - new_sign_standing.drop = "mcl_signs:wall_sign" .. _name - new_sign_standing.wield_image ="("..wield_image.."^[multiply:" .. color .. ")" - new_sign_standing.tiles = { "("..tiles.."^[multiply:" .. color .. ")" } - new_sign_standing.inventory_image = "("..inventory_image.."^[multiply:" .. color .. ")" - new_sign_standing.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign22_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end, - minetest.override_item("mcl_signs:standing_sign" .. _name, new_sign_standing) - update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) + mcl_signs:show_formspec(placer, place_pos) + return itemstack + end + minetest.override_item("mcl_signs:wall_sign" .. _name, new_sign) + update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) - -- 22.5° - local ssign22_5d = table.copy(new_sign_standing) - ssign22_5d.mesh = "mcl_signs_sign22.5.obj" - ssign22_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign45" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.override_item("mcl_signs:standing_sign22_5" .. _name, ssign22_5d) - update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) + -- standing sign base. + local new_sign_standing = {} + new_sign_standing = table.copy(mcl_signs.standing_standard) + new_sign_standing.drop = "mcl_signs:wall_sign" .. _name + new_sign_standing.wield_image = "(" .. wield_image .. "^[multiply:" .. color .. ")" + new_sign_standing.tiles = { "(" .. tiles .. "^[multiply:" .. color .. ")" } + new_sign_standing.inventory_image = "(" .. inventory_image .. "^[multiply:" .. color .. ")" + new_sign_standing.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign22_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end, + minetest.override_item("mcl_signs:standing_sign" .. _name, new_sign_standing) + update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) - -- 45° - local ssign45d = table.copy(new_sign_standing) - ssign45d.mesh = "mcl_signs_sign45.obj" - ssign45d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign67_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.override_item("mcl_signs:standing_sign45" .. _name, ssign45d) - update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) + -- 22.5° + local ssign22_5d = table.copy(new_sign_standing) + ssign22_5d.mesh = "mcl_signs_sign22.5.obj" + ssign22_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign45" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.override_item("mcl_signs:standing_sign22_5" .. _name, ssign22_5d) + update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) - -- 67.5° - local ssign67_5d = table.copy(new_sign_standing) - ssign67_5d.mesh = "mcl_signs_sign67.5.obj" - ssign67_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign" .. _name - node.param2 = (node.param2 + 1) % 4 - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.override_item("mcl_signs:standing_sign67_5" .. _name, ssign67_5d) - update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) + -- 45° + local ssign45d = table.copy(new_sign_standing) + ssign45d.mesh = "mcl_signs_sign45.obj" + ssign45d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign67_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.override_item("mcl_signs:standing_sign45" .. _name, ssign45d) + update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) - -- register Doc entry - if minetest.get_modpath("doc") then - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) - end + -- 67.5° + local ssign67_5d = table.copy(new_sign_standing) + ssign67_5d.mesh = "mcl_signs_sign67.5.obj" + ssign67_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign" .. _name + node.param2 = (node.param2 + 1) % 4 + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.override_item("mcl_signs:standing_sign67_5" .. _name, ssign67_5d) + update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) - --register standing sign's rotation_levels - 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 Doc entry + if minetest.get_modpath("doc") then + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) + end + + --register standing sign's rotation_levels + 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 }) end @@ -1438,485 +1494,527 @@ end --- --- _name: the sign's name suffix, such as "_dark" or "_red", etc., appended to "wall_sign" or "standing_sign" function mcl_signs.register_sign_craft(modname, wood_item_string, _name) - local mod_name_pass = false - if modname ~= "" and modname ~= "false" then - if minetest.get_modpath(modname) then - mod_name_pass = true - end - if mod_name_pass == false then - return - end - end + local mod_name_pass = false + if modname ~= "" and modname ~= "false" then + if minetest.get_modpath(modname) then + mod_name_pass = true + end + if mod_name_pass == false then + return + end + end - minetest.register_craft({ - type = "fuel", - recipe = "mcl_signs:wall_sign" .. _name, - burntime = 10, - }) + minetest.register_craft({ + type = "fuel", + recipe = ":mcl_signs:wall_sign" .. _name, + burntime = 10, + }) - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Register Sign Crafts: \n" .. modname .. "\n" .. wood_item_string .. "\n" .. _name) - end + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Register Sign Crafts: \n" .. modname .. "\n" .. wood_item_string .. "\n" .. _name) + end - -- register crafts (actual recipe) - if minetest.get_modpath(modname) then + -- register crafts (actual recipe) + if minetest.get_modpath(modname) then - local itemstring = "mcl_signs:wall_sign" + local itemstring = ":mcl_signs:wall_sign" - minetest.register_craft({ - output = itemstring .. _name .. " 3", - recipe = { - { wood_item_string, wood_item_string, wood_item_string }, - { wood_item_string, wood_item_string, wood_item_string }, - { "", "mcl_core:stick", "" }, - }, - }) - end + minetest.register_craft({ + output = itemstring .. _name .. " 3", + recipe = { + { wood_item_string, wood_item_string, wood_item_string }, + { wood_item_string, wood_item_string, wood_item_string }, + { "", "mcl_core:stick", "" }, + }, + }) + end +end +function mcl_signs.register_hanging_sign_craft(modname, wood_item_string, _name) + local mod_name_pass = false + if modname ~= "" and modname ~= "false" then + if minetest.get_modpath(modname) then + mod_name_pass = true + end + if mod_name_pass == false then + return + end + end + + minetest.register_craft({ + type = "fuel", + recipe = ":mcl_signs:wall_sign" .. _name, + burntime = 10, + }) + + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Register Sign Crafts: \n" .. modname .. "\n" .. wood_item_string .. "\n" .. _name) + end + + -- register crafts (actual recipe) + if minetest.get_modpath(modname) then + + local itemstring = ":mcl_signs:hanging_sign" + local quantity = "6" + + local bamboo = string.find(wood_item_string, "bamboo") + if bamboo then + quantity = "2" + end + minetest.register_craft({ + output = itemstring .. _name .. " " .. quantity, + recipe = { + { "mcl_lanterns:chain", "", "mcl_lanterns:chain" }, + { wood_item_string, wood_item_string, wood_item_string }, + { wood_item_string, wood_item_string, wood_item_string }, + }, + }) + end end -- Helper functions local function string_to_array(str) - local string_table = {} - for i = 1, string.len(str) do - table.insert(string_table, string.sub(str, i, i)) - end - return string_table + local string_table = {} + for i = 1, string.len(str) do + table.insert(string_table, string.sub(str, i, i)) + end + return string_table end local function string_to_line_array(str) - local linechar_table = {} - local current = 1 - local linechar = 1 - linechar_table[1] = "" - for _, char in ipairs(string_to_array(str)) do - -- New line - if char == "\n" then - current = current + 1 - linechar_table[current] = "" - linechar = 1 - else - linechar_table[current] = linechar_table[current] .. char - linechar = linechar + 1 - end - end - return linechar_table + local linechar_table = {} + local current = 1 + local linechar = 1 + linechar_table[1] = "" + for _, char in ipairs(string_to_array(str)) do + -- New line + if char == "\n" then + current = current + 1 + linechar_table[current] = "" + linechar = 1 + else + linechar_table[current] = linechar_table[current] .. char + linechar = linechar + 1 + end + end + return linechar_table end local function get_rotation_level(facedir, nodename) - local nnames = mcl_signs.standing_rotation_levels -- functional copy... was easier this way. #LazyAF :P + local nnames = mcl_signs.standing_rotation_levels -- functional copy... was easier this way. #LazyAF :P - local rl - local offset = 0 - for x = 1, #nnames do - if nnames[x][1] == nodename then - offset = nnames[x][2] - break - end - end - rl = facedir * 4 + offset - if DEBUG then - minetest.log("action", "[mcl_signs] GetRotationLevel: NodeName: " .. nodename .. " RL value: " .. rl) - end - return rl + local rl + local offset = 0 + for x = 1, #nnames do + if nnames[x][1] == nodename then + offset = nnames[x][2] + break + end + end + rl = facedir * 4 + offset + if DEBUG then + minetest.log("action", "[mcl_signs] GetRotationLevel: NodeName: " .. nodename .. " RL value: " .. rl) + end + return rl end function mcl_signs:round(num, idp) - local mult = 10 ^ (idp or 0) - return math.floor(num * mult + 0.5) / mult + local mult = 10 ^ (idp or 0) + return math.floor(num * mult + 0.5) / mult end function mcl_signs:get_color_for_sign(item_name) - for d = 1, #Dyes_table do - if Dyes_table[d][1] == item_name then - return Dyes_table[d][2] - end - end - return "false" + for d = 1, #Dyes_table do + if Dyes_table[d][1] == item_name then + return Dyes_table[d][2] + end + end + return "false" end function mcl_signs:color_sign (pos, text_color) - local success = mcl_signs:update_sign(pos, nil, nil, true, text_color) + local success = mcl_signs:update_sign(pos, nil, nil, true, text_color) - -- debug step - local meta = minetest.get_meta(pos) - if not meta then - minetest.log("error", "[mcl_signs] Sign Color Fail - Metadata.") + -- debug step + local meta = minetest.get_meta(pos) + if not meta then + minetest.log("error", "[mcl_signs] Sign Color Fail - Metadata.") - return false - end - if DEBUG then - minetest.log("verbose", "[mcl_signs] Post-Sign Color: " .. meta:get_string("mcl_signs:text_color") .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) - end + return false + end + if DEBUG then + minetest.log("verbose", "[mcl_signs] Post-Sign Color: " .. meta:get_string("mcl_signs:text_color") .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) + end - return success + return success end function mcl_signs:glow_sign (pos, remove_glow) - local success = true - -- Get Meta Data for the sign. - local meta = minetest.get_meta(pos) + local success = true + -- Get Meta Data for the sign. + local meta = minetest.get_meta(pos) - if not meta then - return false - end - local text = meta:get_string("text") - if text == nil then - text = "" - end + if not meta then + return false + end + local text = meta:get_string("text") + if text == nil then + text = "" + end - -- we can't make the text glow if there isn't any text - if text == "" then - return false - end + -- we can't make the text glow if there isn't any text + if text == "" then + return false + end - if remove_glow == nil then - remove_glow = false - end + if remove_glow == nil then + remove_glow = false + end - -- set up text glow - local objects = minetest.get_objects_inside_radius(pos, 0.5) - local text_entity - for _, v in ipairs(objects) do - local ent = v:get_luaentity() - if ent and ent.name == "mcl_signs:text" then - text_entity = v - break - end - end - if remove_glow == true then - text_entity:set_properties({ - glow = nil, - }) - meta:set_string("mcl_signs:glowing_sign", "false") - else - text_entity:set_properties({ - glow = sign_glow, - }) - meta:set_string("mcl_signs:glowing_sign", "true") - end - if not text_entity then - return false - end - text_entity:get_luaentity()._glowing_sign = meta:get_string("mcl_signs:glowing_sign") + -- set up text glow + local objects = minetest.get_objects_inside_radius(pos, 0.5) + local text_entity + for _, v in ipairs(objects) do + local ent = v:get_luaentity() + if ent and ent.name == "mcl_signs:text" then + text_entity = v + break + end + end + if remove_glow == true then + text_entity:set_properties({ + glow = nil, + }) + meta:set_string("mcl_signs:glowing_sign", "false") + else + text_entity:set_properties({ + glow = sign_glow, + }) + meta:set_string("mcl_signs:glowing_sign", "true") + end + if not text_entity then + return false + end + text_entity:get_luaentity()._glowing_sign = meta:get_string("mcl_signs:glowing_sign") - -- debug step - if DEBUG then - minetest.log("verbose", "[mcl_signs] Post-Sign Glow: " .. meta:get_string("mcl_signs:text_color") .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) - end - return success + -- debug step + if DEBUG then + minetest.log("verbose", "[mcl_signs] Post-Sign Glow: " .. meta:get_string("mcl_signs:text_color") .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) + end + return success end function mcl_signs:create_lettering(text, signnodename, sign_color) - if sign_color == nil then - sign_color = mcl_colors.BLACK - end - local texture = mcl_signs:generate_texture(mcl_signs:create_lines(text), signnodename, sign_color) + if sign_color == nil then + sign_color = mcl_colors.BLACK + end + local texture = mcl_signs:generate_texture(mcl_signs:create_lines(text), signnodename, sign_color) - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Creating sign text; text:" .. text) - end + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Creating sign text; text:" .. text) + end - return texture + return texture end function mcl_signs:create_lines(text) - local line_num = 1 - local text_table = {} - for _, line in ipairs(string_to_line_array(text)) do - if line_num > NUMBER_OF_LINES then - break - end - table.insert(text_table, line) - line_num = line_num + 1 - end - return text_table + local line_num = 1 + local text_table = {} + for _, line in ipairs(string_to_line_array(text)) do + if line_num > NUMBER_OF_LINES then + break + end + table.insert(text_table, line) + line_num = line_num + 1 + end + return text_table end function mcl_signs:generate_line(s, ypos) - local i = 1 - local parsed = {} - local width = 0 - local chars = 0 - local printed_char_width = CHAR_WIDTH + 1 - while chars < LINE_LENGTH and i <= #s do - local file - -- Get and render character - if charmap[s:sub(i, i)] then - file = charmap[s:sub(i, i)] - i = i + 1 - elseif i < #s and charmap[s:sub(i, i + 1)] then - file = charmap[s:sub(i, i + 1)] - i = i + 2 - else - -- No character image found. - -- Use replacement character: - file = "_rc" - i = i + 1 - if DEBUG then - minetest.log("verbose", "[mcl_signs] Unknown symbol in '" .. s .. "' at " .. i) - end - end - if file then - width = width + printed_char_width - table.insert(parsed, file) - chars = chars + 1 - end - end - width = width - 1 + local i = 1 + local parsed = {} + local width = 0 + local chars = 0 + local printed_char_width = CHAR_WIDTH + 1 + while chars < LINE_LENGTH and i <= #s do + local file + -- Get and render character + if charmap[s:sub(i, i)] then + file = charmap[s:sub(i, i)] + i = i + 1 + elseif i < #s and charmap[s:sub(i, i + 1)] then + file = charmap[s:sub(i, i + 1)] + i = i + 2 + else + -- No character image found. + -- Use replacement character: + file = "_rc" + i = i + 1 + if DEBUG then + minetest.log("verbose", "[mcl_signs] Unknown symbol in '" .. s .. "' at " .. i) + end + end + if file then + width = width + printed_char_width + table.insert(parsed, file) + chars = chars + 1 + end + end + width = width - 1 - local texture = "" - local xpos = math.floor((SIGN_WIDTH - width) / 2) + local texture = "" + local xpos = math.floor((SIGN_WIDTH - width) / 2) - for j = 1, #parsed do - texture = texture .. ":" .. xpos .. "," .. ypos .. "=" .. parsed[j] .. ".png" - xpos = xpos + printed_char_width - end - return texture + for j = 1, #parsed do + texture = texture .. ":" .. xpos .. "," .. ypos .. "=" .. parsed[j] .. ".png" + xpos = xpos + printed_char_width + end + return texture end function mcl_signs:generate_texture(lines, signnodename, letter_color) - local texture = "[combine:" .. SIGN_WIDTH .. "x" .. SIGN_WIDTH - local ypos = 0 + local texture = "[combine:" .. SIGN_WIDTH .. "x" .. SIGN_WIDTH + local ypos = 0 - -- Handle all of the dynamically created signs. - for x = 1, #mcl_signs.registered_signs.wall_signs do - if signnodename == mcl_signs.registered_signs.wall_signs[x] then - ypos = 30 - break - end - end - for x = 1, #mcl_signs.registered_signs.standing_signs do - if signnodename == mcl_signs.registered_signs.standing_signs[x] then - ypos = 0 - break - end - end - -- for future inclusion, when the hanging sings are made. - --[[ - for x = 1, #mcl_signs.registered_signs.hanging_signs do - if signnodename == mcl_signs.registered_signs.hanging_signs[x] then - ypos = 30 - break - end - end - ]] + -- Handle all of the dynamically created signs. + for x = 1, #mcl_signs.registered_signs.wall_signs do + if signnodename == mcl_signs.registered_signs.wall_signs[x] then + ypos = 30 + break + end + end + for x = 1, #mcl_signs.registered_signs.standing_signs do + if signnodename == mcl_signs.registered_signs.standing_signs[x] then + ypos = 0 + break + end + end + -- for future inclusion, when the hanging sings are made. + --[[ + for x = 1, #mcl_signs.registered_signs.hanging_signs do + if signnodename == mcl_signs.registered_signs.hanging_signs[x] then + ypos = 30 + break + end + end + ]] - -- kept in for now, compatibility with existing hard coded signs. TODO: Remove after done with api. - if signnodename == "mcl_signs:wall_sign" or signnodename == "mcl_signs:wall_sign_dark" then - ypos = 30 - end + -- kept in for now, compatibility with existing hard coded signs. TODO: Remove after done with api. + if signnodename == "mcl_signs:wall_sign" or signnodename == "mcl_signs:wall_sign_dark" then + ypos = 30 + end - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Generate_Texture::Debug_Data:\nSignNodeName: " .. dump(signnodename) .. "\nYPOS: " .. ypos) - end + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Generate_Texture::Debug_Data:\nSignNodeName: " .. dump(signnodename) .. "\nYPOS: " .. ypos) + end - for i = 1, #lines do - texture = texture .. mcl_signs:generate_line(lines[i], ypos) - ypos = ypos + LINE_HEIGHT - end + for i = 1, #lines do + texture = texture .. mcl_signs:generate_line(lines[i], ypos) + ypos = ypos + LINE_HEIGHT + end - texture = "(" .. texture .. "^[multiply:" .. letter_color .. ")" - return texture + texture = "(" .. texture .. "^[multiply:" .. letter_color .. ")" + return texture end function mcl_signs:get_wall_signtext_info(param2, nodename) - local dir = minetest.wallmounted_to_dir(param2) - if dir.x > 0 then - return 2 - elseif dir.z > 0 then - return 1 - elseif dir.x < 0 then - return 4 - else - return 3 - end + local dir = minetest.wallmounted_to_dir(param2) + if dir.x > 0 then + return 2 + elseif dir.z > 0 then + return 1 + elseif dir.x < 0 then + return 4 + else + return 3 + end end function mcl_signs:destruct_sign(pos) - local objects = minetest.get_objects_inside_radius(pos, 0.5) - for _, v in ipairs(objects) do - local ent = v:get_luaentity() - if ent and ent.name == "mcl_signs:text" then - v:remove() - end - end - local players = minetest.get_connected_players() - for p = 1, #players do - if vector.distance(players[p]:get_pos(), pos) <= 30 then - minetest.close_formspec(players[p]:get_player_name(), "mcl_signs:set_text_" .. pos.x .. "_" .. pos.y .. "_" .. pos.z) - end - end + local objects = minetest.get_objects_inside_radius(pos, 0.5) + for _, v in ipairs(objects) do + local ent = v:get_luaentity() + if ent and ent.name == "mcl_signs:text" then + v:remove() + end + end + local players = minetest.get_connected_players() + for p = 1, #players do + if vector.distance(players[p]:get_pos(), pos) <= 30 then + minetest.close_formspec(players[p]:get_player_name(), "mcl_signs:set_text_" .. pos.x .. "_" .. pos.y .. "_" .. pos.z) + end + end end function mcl_signs:update_sign(pos, fields, sender, force_remove, text_color) - -- Get Meta Data for the sign. - local meta = minetest.get_meta(pos) + -- Get Meta Data for the sign. + local meta = minetest.get_meta(pos) - if not meta then - return false - end - local text = meta:get_string("text") - if fields and (text == "" and fields.text) then - meta:set_string("text", fields.text) - text = fields.text - end - if text == nil then - text = "" - end + if not meta then + return false + end + local text = meta:get_string("text") + if fields and (text == "" and fields.text) then + meta:set_string("text", fields.text) + text = fields.text + end + if text == nil then + text = "" + end - -- find text color. - local sign_color + -- find text color. + local sign_color - if meta:get_string("mcl_signs:text_color") == "" then - -- if no sign text color has been assigned, make it black. - sign_color = mcl_colors.BLACK - meta:set_string("mcl_signs:text_color", sign_color) - else - sign_color = meta:get_string("mcl_signs:text_color") - end + if meta:get_string("mcl_signs:text_color") == "" then + -- if no sign text color has been assigned, make it black. + sign_color = mcl_colors.BLACK + meta:set_string("mcl_signs:text_color", sign_color) + else + sign_color = meta:get_string("mcl_signs:text_color") + end - if text_color == nil or text == "" then - text_color = "false" - end + if text_color == nil or text == "" then + text_color = "false" + end - if text_color == "false" then - text_color = sign_color --if a new color hasn't been chosen, then keep the existing color. - end + if text_color == "false" then + text_color = sign_color --if a new color hasn't been chosen, then keep the existing color. + end - -- find the sign's glow value - local has_glow = false + -- find the sign's glow value + local has_glow = false - if meta:get_string("mcl_signs:glowing_sign") == "" or meta:get_string("mcl_signs:glowing_sign") == "false" then - has_glow = false - meta:set_string("mcl_signs:glowing_sign", "false") - else - has_glow = true - end + if meta:get_string("mcl_signs:glowing_sign") == "" or meta:get_string("mcl_signs:glowing_sign") == "false" then + has_glow = false + meta:set_string("mcl_signs:glowing_sign", "false") + else + has_glow = true + end - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Update_Signs: Pre-Sign Update: " .. sign_color .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) - end + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Update_Signs: Pre-Sign Update: " .. sign_color .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) + end - local sign_info - local npos = minetest.get_node(pos) - local npos_name = npos.name + local sign_info + local npos = minetest.get_node(pos) + local npos_name = npos.name - -- Handle all of the dynamically created signs. - for x = 1, #mcl_signs.registered_signs.wall_signs do - if npos_name == mcl_signs.registered_signs.wall_signs[x] then - sign_info = mcl_signs.signtext_info_wall[mcl_signs:get_wall_signtext_info(npos.param2)] - break - end - end - for x = 1, #mcl_signs.registered_signs.standing_signs do - if npos_name == mcl_signs.registered_signs.standing_signs[x] then - sign_info = mcl_signs.signtext_info_standing[get_rotation_level(npos.param2, npos_name) + 1] - break - end - end - -- for future inclusion, when the hanging sings are made. - --[[ - for x = 1, #mcl_signs.registered_signs.hanging_signs do - if nn == mcl_signs.registered_signs.hanging_signs[x] then - sign_info = mcl_signs.signtext_info_wall[mcl_signs:get_wall_signtext_info(n.param2)] - break - end - end - ]] + -- Handle all of the dynamically created signs. + for x = 1, #mcl_signs.registered_signs.wall_signs do + if npos_name == mcl_signs.registered_signs.wall_signs[x] then + sign_info = mcl_signs.signtext_info_wall[mcl_signs:get_wall_signtext_info(npos.param2)] + break + end + end + for x = 1, #mcl_signs.registered_signs.standing_signs do + if npos_name == mcl_signs.registered_signs.standing_signs[x] then + sign_info = mcl_signs.signtext_info_standing[get_rotation_level(npos.param2, npos_name) + 1] + break + end + end + -- for future inclusion, when the hanging sings are made. + --[[ + for x = 1, #mcl_signs.registered_signs.hanging_signs do + if nn == mcl_signs.registered_signs.hanging_signs[x] then + sign_info = mcl_signs.signtext_info_wall[mcl_signs:get_wall_signtext_info(n.param2)] + break + end + end + ]] - -- the following if..elseif..end block is here for compatibility with the old code. TODO: remove this block after the new api is complete. - if npos_name == "mcl_signs:standing_sign_dark" or npos_name == "mcl_signs:standing_sign22_5_dark" or npos_name == "mcl_signs:standing_sign45_dark" or npos_name == "mcl_signs:standing_sign67_5_dark" then - sign_info = mcl_signs.signtext_info_standing[get_rotation_level(npos.param2, npos_name) + 1] - elseif npos_name == "mcl_signs:wall_sign_dark" then - sign_info = mcl_signs.signtext_info_wall[mcl_signs:get_wall_signtext_info(npos.param2)] - end - if sign_info == nil then - minetest.log("error", "[mcl_signs] Update_Signs: Missing sign_info!") - return false - end + -- the following if..elseif..end block is here for compatibility with the old code. TODO: remove this block after the new api is complete. + if npos_name == "mcl_signs:standing_sign_dark" or npos_name == "mcl_signs:standing_sign22_5_dark" or npos_name == "mcl_signs:standing_sign45_dark" or npos_name == "mcl_signs:standing_sign67_5_dark" then + sign_info = mcl_signs.signtext_info_standing[get_rotation_level(npos.param2, npos_name) + 1] + elseif npos_name == "mcl_signs:wall_sign_dark" then + sign_info = mcl_signs.signtext_info_wall[mcl_signs:get_wall_signtext_info(npos.param2)] + end + if sign_info == nil then + minetest.log("error", "[mcl_signs] Update_Signs: Missing sign_info!") + return false + end - local objects = minetest.get_objects_inside_radius(pos, 0.5) - local text_entity - for _, v in ipairs(objects) do - local ent = v:get_luaentity() - if ent and ent.name == "mcl_signs:text" then - if force_remove then - v:remove() - else - text_entity = v - break - end - end - end + local objects = minetest.get_objects_inside_radius(pos, 0.5) + local text_entity + for _, v in ipairs(objects) do + local ent = v:get_luaentity() + if ent and ent.name == "mcl_signs:text" then + if force_remove then + v:remove() + else + text_entity = v + break + end + end + end - if not text_entity then - if DEBUG then - minetest.log("action", "[mcl_signs] Update_Sign: Text_Entity - does not exist, creating it now.") - end - text_entity = minetest.add_entity({ - x = pos.x + sign_info.delta.x, - y = pos.y + sign_info.delta.y, - z = pos.z + sign_info.delta.z }, "mcl_signs:text") + if not text_entity then + if DEBUG then + minetest.log("action", "[mcl_signs] Update_Sign: Text_Entity - does not exist, creating it now.") + end + text_entity = minetest.add_entity({ + x = pos.x + sign_info.delta.x, + y = pos.y + sign_info.delta.y, + z = pos.z + sign_info.delta.z }, "mcl_signs:text") - if DEBUG then - minetest.log("action", "[mcl_signs] Update_Sign: Placed position:" .. dump(pos) .. "\nSign_info: " .. dump(sign_info)) - end - end - text_entity:get_luaentity()._signnodename = npos_name + if DEBUG then + minetest.log("action", "[mcl_signs] Update_Sign: Placed position:" .. dump(pos) .. "\nSign_info: " .. dump(sign_info)) + end + end + text_entity:get_luaentity()._signnodename = npos_name - -- set up special case: Dark Oak Sign. Dark Oak signs are soooo dark, they start off with white lettering. - if npos_name == "mcl_signs:wall_sign_darkwood" or - npos_name == "mcl_signs:standing_sign67_5_darkwood" or - npos_name == "mcl_signs:standing_sign45_darkwood" or - npos_name == "mcl_signs:standing_sign22_5_darkwood" or - npos_name == "mcl_signs:standing_sign_darkwood" - then - if text_color == "#000000" then - text_color = "#ffffff" - end - end + -- set up special case: Dark Oak Sign. Dark Oak signs are soooo dark, they start off with white lettering. + if npos_name == "mcl_signs:wall_sign_darkwood" or + npos_name == "mcl_signs:standing_sign67_5_darkwood" or + npos_name == "mcl_signs:standing_sign45_darkwood" or + npos_name == "mcl_signs:standing_sign22_5_darkwood" or + npos_name == "mcl_signs:standing_sign_darkwood" + then + if text_color == "#000000" then + text_color = "#ffffff" + end + end - -- Set the actual properties for the sign + -- Set the actual properties for the sign - text_entity:set_properties({ - textures = { mcl_signs:create_lettering(text, npos_name, text_color) }, - }) + text_entity:set_properties({ + textures = { mcl_signs:create_lettering(text, npos_name, text_color) }, + }) - if has_glow then - text_entity:set_properties({ - glow = sign_glow, - }) - end + if has_glow then + text_entity:set_properties({ + glow = sign_glow, + }) + end - text_entity:set_yaw(sign_info.yaw) - if DEBUG then - minetest.log("verbose", "[mcl_signs] Update_Sign: After texture recreation.") - minetest.log("action","[mcl_signs] Update_Sign: " .. npos_name .. "\nPlaced position:" .. dump(pos) .. "\nSign_info: " .. dump(sign_info)) - end + text_entity:set_yaw(sign_info.yaw) + if DEBUG then + minetest.log("verbose", "[mcl_signs] Update_Sign: After texture recreation.") + minetest.log("action", "[mcl_signs] Update_Sign: " .. npos_name .. "\nPlaced position:" .. dump(pos) .. "\nSign_info: " .. dump(sign_info)) + end - -- save sign metadata. - meta:set_string("mcl_signs:text_color", text_color) - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Update_Sign: Post-Sign Update: " .. meta:get_string("mcl_signs:text_color") .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) - end + -- save sign metadata. + meta:set_string("mcl_signs:text_color", text_color) + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Update_Sign: Post-Sign Update: " .. meta:get_string("mcl_signs:text_color") .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) + end - return true + return true end function mcl_signs:show_formspec(player, pos) - minetest.show_formspec( - player:get_player_name(), - "mcl_signs:set_text_" .. pos.x .. "_" .. pos.y .. "_" .. pos.z, - "size[6,3]textarea[0.25,0.25;6,1.5;text;" .. F(S("Enter sign text:")) .. ";]label[0,1.5;" .. F(S("Maximum line length: 15")) .. "\n" .. F(S("Maximum lines: 4")) .. "]button_exit[0,2.5;6,1;submit;" .. F(S("Done")) .. "]" - ) + minetest.show_formspec( + player:get_player_name(), + "mcl_signs:set_text_" .. pos.x .. "_" .. pos.y .. "_" .. pos.z, + "size[6,3]textarea[0.25,0.25;6,1.5;text;" .. F(S("Enter sign text:")) .. ";]label[0,1.5;" .. F(S("Maximum line length: 15")) .. "\n" .. F(S("Maximum lines: 4")) .. "]button_exit[0,2.5;6,1;submit;" .. F(S("Done")) .. "]" + ) end From 4a1e37d9c678ae98aef2a60fd4c63a0e51e2464e Mon Sep 17 00:00:00 2001 From: Michieal Date: Tue, 8 Nov 2022 00:35:09 +0000 Subject: [PATCH 14/47] fix typo that somehow propagated. --- mods/ITEMS/mcl_signs/README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_signs/README.txt b/mods/ITEMS/mcl_signs/README.txt index 5ef65481ce..e4fbead8ad 100644 --- a/mods/ITEMS/mcl_signs/README.txt +++ b/mods/ITEMS/mcl_signs/README.txt @@ -2,7 +2,7 @@ --- # Mineclone2-Signs --- -A reworking of MineClone 2's mcl_signs to be colorable and made to glow. Rquires Minetest and Mineclone2. +A reworking of MineClone 2's mcl_signs to be colorable and made to glow. Requires Minetest and Mineclone2. --- Created by Michieal (FaerRaven) @ DateTime: 10/14/22 4:05 PM From 67296c7a37ec7e6cce49fea035a4bc282ea8cc5a Mon Sep 17 00:00:00 2001 From: Michieal Date: Tue, 8 Nov 2022 00:36:25 +0000 Subject: [PATCH 15/47] Update Signs API to only use timer functions when there is text to display. --- mods/ITEMS/mcl_signs/signs_api.lua | 97 ++++++++++++------------------ 1 file changed, 40 insertions(+), 57 deletions(-) diff --git a/mods/ITEMS/mcl_signs/signs_api.lua b/mods/ITEMS/mcl_signs/signs_api.lua index cb37669383..666b510209 100644 --- a/mods/ITEMS/mcl_signs/signs_api.lua +++ b/mods/ITEMS/mcl_signs/signs_api.lua @@ -28,6 +28,7 @@ local NUMBER_OF_LINES = 4 local LINE_HEIGHT = 14 local CHAR_WIDTH = 5 +local TIMER_INTERVAL = 40.0 -- ----------------------- -- CACHE LOCAL COPIES local table = table @@ -166,18 +167,14 @@ mcl_signs.wall_standard = { on_timer = function(pos) -- fix for /ClearObjects mcl_signs:update_sign(pos) - minetest.get_node_timer(pos):start(40.0) + -- note: update_sign decides to keep the timer running based on if there is text. + -- This prevents every sign from having a timer, when not needed. end, on_place = function(itemstack, placer, pointed_thing) local above = pointed_thing.above local under = pointed_thing.under - local timer = minetest.get_node_timer(pos) - if timer:is_started() == false then - timer:start(40.0) - end - -- Use pointed node's on_rightclick function first, if present local node_under = minetest.get_node(under) if placer and not placer:get_player_control().sneak then @@ -285,10 +282,6 @@ mcl_signs.wall_standard = { -- Not Useless Code. force updates the sign. on_punch = function(pos, node, puncher) mcl_signs:update_sign(pos) - local timer = minetest.get_node_timer(pos) - if timer:is_started() == false then - timer:start(40.0) - end end, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_FACE then @@ -311,11 +304,6 @@ mcl_signs.wall_standard = { return end - local timer = minetest.get_node_timer(pos) - if timer:is_started() == false then - timer:start(40.0) - end - local item = clicker:get_wielded_item() local iname = item:get_name() @@ -400,10 +388,6 @@ mcl_signs.standing_standard = { -- Not Useless Code. this force updates the sign. on_punch = function(pos, node, puncher) mcl_signs:update_sign(pos) - local timer = minetest.get_node_timer(pos) - if timer:is_started() == false then - timer:start(40.0) - end end, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_FACE then @@ -427,11 +411,6 @@ mcl_signs.standing_standard = { return end - local timer = minetest.get_node_timer(pos) - if timer:is_started() == false then - timer:start(40.0) - end - local item = clicker:get_wielded_item() local iname = item:get_name() @@ -590,11 +569,6 @@ function mcl_signs.register_sign (modname, color, _name, ttsign) end end - local timer = minetest.get_node_timer(pos) - if timer:is_started() == false then - timer:start(40.0) - end - local dir = vector.subtract(under, above) -- Only build when it's legal @@ -840,11 +814,6 @@ function mcl_signs.register_sign_custom (modname, _name, tiles, color, inventory end end - local timer = minetest.get_node_timer(pos) - if timer:is_started() == false then - timer:start(40.0) - end - local dir = vector.subtract(under, above) -- Only build when it's legal @@ -1063,11 +1032,6 @@ function mcl_signs.reregister_sign (modname, color, _name, ttsign) end end - local timer = minetest.get_node_timer(pos) - if timer:is_started() == false then - timer:start(40.0) - end - local dir = vector.subtract(under, above) -- Only build when it's legal @@ -1306,11 +1270,6 @@ function mcl_signs.reregister_sign_custom (modname, _name, tiles, color, invento end end - local timer = minetest.get_node_timer(pos) - if timer:is_started() == false then - timer:start(40.0) - end - local dir = vector.subtract(under, above) -- Only build when it's legal @@ -1860,7 +1819,7 @@ function mcl_signs:update_sign(pos, fields, sender, force_remove, text_color) if not meta then return false end - local text = meta:get_string("text") + local text = meta:get_string("text", "") if fields and (text == "" and fields.text) then meta:set_string("text", fields.text) text = fields.text @@ -1941,19 +1900,8 @@ function mcl_signs:update_sign(pos, fields, sender, force_remove, text_color) return false end - local objects = minetest.get_objects_inside_radius(pos, 0.5) local text_entity - for _, v in ipairs(objects) do - local ent = v:get_luaentity() - if ent and ent.name == "mcl_signs:text" then - if force_remove then - v:remove() - else - text_entity = v - break - end - end - end + text_entity = mcl_signs:get_text_entity(pos,force_remove) if not text_entity then if DEBUG then @@ -2002,6 +1950,24 @@ function mcl_signs:update_sign(pos, fields, sender, force_remove, text_color) -- save sign metadata. meta:set_string("mcl_signs:text_color", text_color) + + -- Moved timer stuff to here, to make sure that it's called and only has one set of code. + local timer = minetest.get_node_timer(pos) + if text_entity and text ~= "" then + -- Do timer related stuff - but only if there is text to display. + -- Also, prevent excessive use with punching. (see node def.) + if timer:is_started() == false then + timer:start(TIMER_INTERVAL) + else + timer:stop() + timer:start(TIMER_INTERVAL) + end + else + if timer:is_started() == true then + timer:stop() + end + end + -- debug step if DEBUG then minetest.log("action", "[mcl_signs] Update_Sign: Post-Sign Update: " .. meta:get_string("mcl_signs:text_color") .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) @@ -2018,3 +1984,20 @@ function mcl_signs:show_formspec(player, pos) "size[6,3]textarea[0.25,0.25;6,1.5;text;" .. F(S("Enter sign text:")) .. ";]label[0,1.5;" .. F(S("Maximum line length: 15")) .. "\n" .. F(S("Maximum lines: 4")) .. "]button_exit[0,2.5;6,1;submit;" .. F(S("Done")) .. "]" ) end + +function mcl_signs:get_text_entity (pos, force_remove) + local objects = minetest.get_objects_inside_radius(pos, 0.5) + local text_entity = false -- just to have a check for failure. + for _, v in ipairs(objects) do + local ent = v:get_luaentity() + if ent and ent.name == "mcl_signs:text" then + if force_remove ~= nil and force_remove == true then + v:remove() + else + text_entity = v + break + end + end + end + return text_entity +end \ No newline at end of file From 577f9f7785c22e30f0f32a35bcfaac0ff4119682 Mon Sep 17 00:00:00 2001 From: Michieal Date: Tue, 8 Nov 2022 00:56:11 +0000 Subject: [PATCH 16/47] Change Frames to only use the timer if it's displaying an object. --- mods/ITEMS/mcl_itemframes/item_frames_API.lua | 43 +++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/mods/ITEMS/mcl_itemframes/item_frames_API.lua b/mods/ITEMS/mcl_itemframes/item_frames_API.lua index 36e49bf7fc..2b6735a9b2 100644 --- a/mods/ITEMS/mcl_itemframes/item_frames_API.lua +++ b/mods/ITEMS/mcl_itemframes/item_frames_API.lua @@ -34,6 +34,8 @@ local glow_amount = 6 -- LIGHT_MAX is 15, but the items aren't supposed to be a local frame_item_base = {} local map_item_base = {} +local TIMER_INTERVAL = 40.0 + -- Time to Fleckenstein! (it just sounds cool lol) --- self: the object to roll. @@ -247,6 +249,7 @@ mcl_itemframes.update_item_entity = function(pos, node, param2) local map_id_entity = {} local map_id_lua = {} + local timer = minetest.get_node_timer(pos) if map_id == "" then -- handle regular items placed into custom frame. if mcl_itemframes.DEBUG then @@ -268,13 +271,32 @@ mcl_itemframes.update_item_entity = function(pos, node, param2) if itemname == "" or itemname == nil then map_id_lua._texture = "blank.png" map_id_lua._scale = 1 + + -- set up glow, as this is the default/initial clause on placement. if has_glow then map_id_lua.glow = glow_amount end + + -- if there's nothing to display, then kill the timer. + if timer:is_started() == true then + timer:stop() + end else map_id_lua._texture = itemname local def = minetest.registered_items[itemname] map_id_lua._scale = def and def.wield_scale and def.wield_scale.x or 1 + + -- fix for /ClearObjects + if minetest.get_item_group(itemname, "clock") == 0 then + -- Do timer related stuff - but only if there is something to display... and it's not a clock. + if timer:is_started() == false then + timer:start(TIMER_INTERVAL) + else + timer:stop() + timer:start(TIMER_INTERVAL) + end + end + end if mcl_itemframes.DEBUG then minetest.log("action", "[mcl_itemframes] Update_Generic_Item: item's name: " .. itemname) @@ -297,6 +319,15 @@ mcl_itemframes.update_item_entity = function(pos, node, param2) else minetest.log("error", "[mcl_itemframes] Update_Generic_Item: Failed to set Map Item in " .. found_name_to_use .. "'s frame.") end + + -- give maps a refresh timer. + if timer:is_started() == false then + timer:start(TIMER_INTERVAL) + else + timer:stop() + timer:start(TIMER_INTERVAL) + end + end -- finally, set the rotation (roll) of the displayed object. @@ -609,10 +640,8 @@ function mcl_itemframes.create_base_definitions() end minetest.get_node_timer(pos):start(1.0) else - -- fix for /ClearObjects node = minetest.get_node(pos) mcl_itemframes.update_item_entity(pos, node, node.param2) - minetest.get_node_timer(pos):start(40.0) end end, @@ -665,8 +694,6 @@ function mcl_itemframes.create_base_definitions() end if minetest.get_item_group(itemname, "clock") > 0 then minetest.get_node_timer(pos):start(1.0) - else - minetest.get_node_timer(pos):start(40.0) end inv:set_stack("main", 1, put_itemstack) @@ -792,14 +819,6 @@ function mcl_itemframes.create_base_definitions() mcl_itemframes.glow_frame_base.wield_image = "mcl_itemframes_glow_item_frame.png" mcl_itemframes.glow_frame_base.mesh = "mcl_itemframes_glow_item_frame.obj" - --[[ - minetest.register_node("mcl_itemframes:glow_item_frame", mcl_itemframes.glow_frame_base) - - mcl_itemframes.update_frame_registry("false", "mcl_itemframes:item_frame", false) - mcl_itemframes.update_frame_registry("false", "mcl_itemframes:glow_item_frame", true) - create_register_lbm("mcl_itemframes:item_frame") - create_register_lbm("mcl_itemframes:glow_item_frame") - --]] end -- for compatibility: From e2e86ae9a899b0885f2ddafd745f519aa40fd8e7 Mon Sep 17 00:00:00 2001 From: Michieal Date: Sun, 13 Nov 2022 06:02:53 +0000 Subject: [PATCH 17/47] Final commit Add in the ability to place frames on surfaces. Has minor visual bugs. Should be modified to disallow placing on top of items to prevent visual bugging. Signed-off-by: Michieal --- mods/ITEMS/mcl_itemframes/item_frames_API.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_itemframes/item_frames_API.lua b/mods/ITEMS/mcl_itemframes/item_frames_API.lua index 2b6735a9b2..eaa9a2a28e 100644 --- a/mods/ITEMS/mcl_itemframes/item_frames_API.lua +++ b/mods/ITEMS/mcl_itemframes/item_frames_API.lua @@ -621,7 +621,7 @@ function mcl_itemframes.create_base_definitions() paramtype = "light", paramtype2 = "facedir", sunlight_propagates = true, - groups = { dig_immediate = 3, deco_block = 1, dig_by_piston = 1, container = 7, attached_node_facedir = 1 }, + groups = { dig_immediate = 3, deco_block = 1, dig_by_piston = 1, container = 7 }, --, attached_node_facedir = 1 }, -- allows for more placement options. sounds = mcl_sounds.node_sound_defaults(), node_placement_prediction = "", From 2577a70a657eb3aa4778feac0582b8100b716a0a Mon Sep 17 00:00:00 2001 From: Michieal Date: Mon, 14 Nov 2022 02:05:31 +0000 Subject: [PATCH 18/47] Made displayed entities immortal Added in extended placement. Registered the Achievement "Glow and Behold!" --- mods/ITEMS/mcl_itemframes/item_frames_API.lua | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_itemframes/item_frames_API.lua b/mods/ITEMS/mcl_itemframes/item_frames_API.lua index eaa9a2a28e..e9bc48bdf0 100644 --- a/mods/ITEMS/mcl_itemframes/item_frames_API.lua +++ b/mods/ITEMS/mcl_itemframes/item_frames_API.lua @@ -395,7 +395,7 @@ function mcl_itemframes.create_base_item_entity() textures = { "blank.png" }, _texture = "blank.png", _scale = 1, - + groups = { immortal =1,}, on_activate = function(self, staticdata) if staticdata and staticdata ~= "" then local data = staticdata:split(";") @@ -592,6 +592,23 @@ function mcl_itemframes.custom_register_lbm() end +local function register_frame_achievements() + + awards.register_achievement("mcl_itemframes:glowframe", { + title = S("Glow and Behold!"), + description = S("Craft a glow item frame."), + icon = "mcl_itemframes_glow_item_frame.png", + trigger = { + type = "craft", + item = "mcl_itemframes:glow_item_frame", + target = 1 + }, + type = "Advancement", + group = "Overworld", + }) + +end + function mcl_itemframes.create_base_definitions() if mcl_itemframes.DEBUG then minetest.log("action", "[mcl_itemframes] create_base_definitions.") @@ -621,7 +638,7 @@ function mcl_itemframes.create_base_definitions() paramtype = "light", paramtype2 = "facedir", sunlight_propagates = true, - groups = { dig_immediate = 3, deco_block = 1, dig_by_piston = 1, container = 7 }, --, attached_node_facedir = 1 }, -- allows for more placement options. + groups = { dig_immediate = 3, deco_block = 1, dig_by_piston = 1, container = 7,}, -- attached_node_facedir = 1 }, -- allows for more placement options. sounds = mcl_sounds.node_sound_defaults(), node_placement_prediction = "", @@ -650,6 +667,14 @@ function mcl_itemframes.create_base_definitions() return itemstack end + local dir = vector.subtract(pointed_thing.under, pointed_thing.above) + local wdir = minetest.dir_to_wallmounted(dir) + + -- remove bottom and top of objects. + if wdir == 0 or wdir == 1 then + return itemstack + end + -- Use pointed node's on_rightclick function first, if present local node = minetest.get_node(pointed_thing.under) if placer and not placer:get_player_control().sneak then @@ -818,6 +843,10 @@ function mcl_itemframes.create_base_definitions() mcl_itemframes.glow_frame_base.inventory_image = "mcl_itemframes_glow_item_frame_item.png" mcl_itemframes.glow_frame_base.wield_image = "mcl_itemframes_glow_item_frame.png" mcl_itemframes.glow_frame_base.mesh = "mcl_itemframes_glow_item_frame.obj" + mcl_itemframes.glow_frame_base.glow = 1 --make the glow frames have some glow at night, but not enough to be a light source. + + -- set up the achievement for glow frames. + register_frame_achievements() end @@ -858,3 +887,4 @@ function mcl_itemframes.backwards_compatibility () minetest.register_entity("mcl_itemframes:glow_map", map_item_base) end + From bee40c55ec9a9c86a922cdd1460952bedc373ca6 Mon Sep 17 00:00:00 2001 From: Michieal Date: Mon, 14 Nov 2022 02:27:16 +0000 Subject: [PATCH 19/47] Fix KillAura bug destroying the Displayed Item. --- mods/ITEMS/mcl_itemframes/item_frames_API.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_itemframes/item_frames_API.lua b/mods/ITEMS/mcl_itemframes/item_frames_API.lua index e9bc48bdf0..231482800a 100644 --- a/mods/ITEMS/mcl_itemframes/item_frames_API.lua +++ b/mods/ITEMS/mcl_itemframes/item_frames_API.lua @@ -395,7 +395,7 @@ function mcl_itemframes.create_base_item_entity() textures = { "blank.png" }, _texture = "blank.png", _scale = 1, - groups = { immortal =1,}, + groups = { immortal = 1, }, on_activate = function(self, staticdata) if staticdata and staticdata ~= "" then local data = staticdata:split(";") @@ -426,7 +426,7 @@ function mcl_itemframes.create_base_item_entity() end return "" end, - + on_punch = function() return true end, _update_texture = function(self) if self._texture then self.object:set_properties({ @@ -638,7 +638,7 @@ function mcl_itemframes.create_base_definitions() paramtype = "light", paramtype2 = "facedir", sunlight_propagates = true, - groups = { dig_immediate = 3, deco_block = 1, dig_by_piston = 1, container = 7,}, -- attached_node_facedir = 1 }, -- allows for more placement options. + groups = { dig_immediate = 3, deco_block = 1, dig_by_piston = 1, container = 7, }, -- attached_node_facedir = 1 }, -- allows for more placement options. sounds = mcl_sounds.node_sound_defaults(), node_placement_prediction = "", @@ -887,4 +887,3 @@ function mcl_itemframes.backwards_compatibility () minetest.register_entity("mcl_itemframes:glow_map", map_item_base) end - From 439ac600fdf894e07792f40a21e613778cfcf0d8 Mon Sep 17 00:00:00 2001 From: Michieal Date: Wed, 16 Nov 2022 20:05:01 +0000 Subject: [PATCH 20/47] This has the achievement in there. --- mods/ITEMS/mcl_itemframes/item_frames_API.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_itemframes/item_frames_API.lua b/mods/ITEMS/mcl_itemframes/item_frames_API.lua index 231482800a..5200d4f837 100644 --- a/mods/ITEMS/mcl_itemframes/item_frames_API.lua +++ b/mods/ITEMS/mcl_itemframes/item_frames_API.lua @@ -426,7 +426,7 @@ function mcl_itemframes.create_base_item_entity() end return "" end, - on_punch = function() return true end, + on_punch = function() return true end, -- to prevent KillAura from destroying the entities. _update_texture = function(self) if self._texture then self.object:set_properties({ From 9dc27e535b1695fb9f6fd12eb9ee1e5e89c86da6 Mon Sep 17 00:00:00 2001 From: Michieal Date: Wed, 16 Nov 2022 20:06:26 +0000 Subject: [PATCH 21/47] revert 020a9510cbd7adf7419c166af5c2baba7c96cf45 revert "This has the achievement in there." The only difference is the placement of a single comment, not worth a full on commit. --- mods/ITEMS/mcl_itemframes/item_frames_API.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_itemframes/item_frames_API.lua b/mods/ITEMS/mcl_itemframes/item_frames_API.lua index 5200d4f837..231482800a 100644 --- a/mods/ITEMS/mcl_itemframes/item_frames_API.lua +++ b/mods/ITEMS/mcl_itemframes/item_frames_API.lua @@ -426,7 +426,7 @@ function mcl_itemframes.create_base_item_entity() end return "" end, - on_punch = function() return true end, -- to prevent KillAura from destroying the entities. + on_punch = function() return true end, _update_texture = function(self) if self._texture then self.object:set_properties({ From daf5bf90a44cea62ee30cf7dbf117f747826faf1 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Fri, 4 Nov 2022 20:59:46 -0600 Subject: [PATCH 22/47] Add Honey, Honeycomb, and respective blocks --- mods/ITEMS/mcl_honey/init.lua | 83 ++++++++++++++++++ .../textures/mcl_honey_block_bottom.png | Bin 0 -> 839 bytes .../textures/mcl_honey_block_side.png | Bin 0 -> 830 bytes .../textures/mcl_honey_block_top.png | Bin 0 -> 830 bytes .../textures/mcl_honey_honey_bottle.png | Bin 0 -> 1998 bytes .../textures/mcl_honey_honeycomb.png | Bin 0 -> 1996 bytes .../textures/mcl_honey_honeycomb_block.png | Bin 0 -> 2114 bytes mods/ITEMS/mcl_mobitems/init.lua | 10 +-- 8 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 mods/ITEMS/mcl_honey/init.lua create mode 100644 mods/ITEMS/mcl_honey/textures/mcl_honey_block_bottom.png create mode 100644 mods/ITEMS/mcl_honey/textures/mcl_honey_block_side.png create mode 100644 mods/ITEMS/mcl_honey/textures/mcl_honey_block_top.png create mode 100644 mods/ITEMS/mcl_honey/textures/mcl_honey_honey_bottle.png create mode 100644 mods/ITEMS/mcl_honey/textures/mcl_honey_honeycomb.png create mode 100644 mods/ITEMS/mcl_honey/textures/mcl_honey_honeycomb_block.png diff --git a/mods/ITEMS/mcl_honey/init.lua b/mods/ITEMS/mcl_honey/init.lua new file mode 100644 index 0000000000..7ced3b65d7 --- /dev/null +++ b/mods/ITEMS/mcl_honey/init.lua @@ -0,0 +1,83 @@ +--------------- +---- Honey ---- +--------------- + +-- Variables +local S = minetest.get_translator(minetest.get_current_modname()) + +-- Honeycomb +minetest.register_craftitem("mcl_honey:honeycomb", { + description = S("Honeycomb"), + _doc_items_longdesc = S("Used to craft beehives and protect copper blocks from further oxidation."), + _doc_items_usagehelp = S("Use on copper blocks to prevent further oxidation."), + inventory_image = "mcl_honey_honeycomb.png", + groups = { craftitem = 1 }, +}) + +minetest.register_node("mcl_honey:honeycomb_block", { + description = S("Honeycomb Block"), + _doc_items_longdesc = S("Honeycomb Block. Used as a decoration."), + tiles = { + "mcl_honey_honeycomb_block.png" + }, + groups = { handy = 1, deco_block = 1 }, + _mcl_blast_resistance = 0.6, + _mcl_hardness = 0.6, +}) + +-- Honey +minetest.register_craftitem("mcl_honey:honey_bottle", { + description = S("Honey Bottle"), + _doc_items_longdesc = S("Honey Bottle is used to craft honey blocks and to restore hunger points."), + _doc_items_usagehelp = S("Drinking will restore 6 hunger points. Can also be used to craft honey blocks."), + inventory_image = "mcl_honey_honey_bottle.png", + groups = { craftitem = 1, food = 3, eatable = 6, can_eat_when_full=1 }, + on_place = minetest.item_eat(6, "mcl_potions:glass_bottle"), + on_secondary_use = minetest.item_eat(6, "mcl_potions:glass_bottle"), + _mcl_saturation = 1.2, + stack_max = 16, +}) + +minetest.register_node("mcl_honey:honey_block", { + description = S("Honey Block"), + _doc_items_longdesc = S("Honey Block. Used as a decoration and in redstone. Is sticky on some sides."), + tiles = { + "mcl_honey_block_top.png", "mcl_honey_block_bottom.png", + "mcl_honey_block_side.png", "mcl_honey_block_side.png", + "mcl_honey_block_side.png", "mcl_honey_block_side.png", + }, + groups = { handy = 1, deco_block = 1 }, + _mcl_blast_resistance = 0, + _mcl_hardness = 0, +}) + +-- Crafting +minetest.register_craft({ + output = "mcl_honey:honeycomb_block", + recipe = { + { "mcl_honey:honeycomb", "mcl_honey:honeycomb" }, + { "mcl_honey:honeycomb", "mcl_honey:honeycomb" }, + }, +}) + +minetest.register_craft({ + output = "mcl_honey:honey_block", + recipe = { + { "mcl_honey:honey_bottle", "mcl_honey:honey_bottle" }, + { "mcl_honey:honey_bottle", "mcl_honey:honey_bottle" }, + }, +}) + +minetest.register_craft({ + output = "mcl_honey:honey_bottle 4", + recipe = { + { "mcl_potions:glass_bottle", "mcl_potions:glass_bottle", "mcl_honey:honey_block" }, + { "mcl_potions:glass_bottle", "mcl_potions:glass_bottle", "" }, + }, +}) + +minetest.register_craft({ + type = "shapeless", + output = "mcl_core:sugar 3", + recipe = { "mcl_honey:honey_bottle" }, +}) diff --git a/mods/ITEMS/mcl_honey/textures/mcl_honey_block_bottom.png b/mods/ITEMS/mcl_honey/textures/mcl_honey_block_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..9de96528442e5aa14376c55d3600418fe6ce3e42 GIT binary patch literal 839 zcmV-N1GxN&P)EX>4Tx04R}tkv&MmKpe$iQ>7vmQ7eczWT;LSL`58>ibb$c+6t{Ym|Xe=O&XFE z7e~Rh;NZt%)xpJCR|i)?5c~jfadlF3krMxx6k5c1aNLh~_a1le0HI!Hs@X9CsG4OY zV^J}aT@?eb2%-;z5YR6%Q;(+>)9@T$_we!cF2b|C&;2=il$^-`pGZ8%bi*RvAfDN@ zbk6(4Ay$+W;&bA0gDyz?$aUG}H_ioz1)do)(#d(^5V2TjW4Vo4(NKw}iNlJjQNECI zS>e3JSuIyt^Pc>L!JM{|;yTR{#IS@o5)dJyiW17O5TR8g#YB?!qaOZY$DbgVOs*0b zITlcX3d!+<|H1EW&HU7)n-q)!oiDciF$x5Bfkw@?zmILZaRT_Cfh(=$uhfCrPtt2G zEqny@ZUYzBElu77E_Z;TCtWfmNAlAY@_FF>jJ_!g4BP_UYi@7NeVjf3Y3geE1~@nb z#tM|Z?(y!f_TK(I)9mjDHuZ9kU_3~v0004gNklo_n6>?(KcQ z2Opfo{*a>w{iO%``Bm8-fJNQ_5V*qpaoryA&H0)U-qy`qGGOvV)eb!jY1k<}MXb!luNPBq*4jGbxuF@Kg-oN6CrRUH^a zTCvC*dy_PX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5LnOh7+%;PSU+iJzt)$1VwI0US28ptD8wxgZnxz zb}%K!6NK)!RY^vX8#arb#o|;m9&IUdWA(d)4f)eDw&=@}%zEIOtCEcUYzk1BSl1{2 zK_!_bj#KS<6KMtJOd#9nE|X}KLU&|&a#^OJzRvY^t>g9FAM_ZlA~g`^;s5{u07*qo IM6N<$f{EXMHvj+t literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_honey/textures/mcl_honey_block_top.png b/mods/ITEMS/mcl_honey/textures/mcl_honey_block_top.png new file mode 100644 index 0000000000000000000000000000000000000000..c2f330440817859c5f52277de140c4f8bcb477b1 GIT binary patch literal 830 zcmV-E1Ht@>P)EX>4Tx04R}tkv&MmKpe$iQ>7vmQ7eczWT;LSL`58>ibb$c+6t{Ym|Xe=O&XFE z7e~Rh;NZt%)xpJCR|i)?5c~jfadlF3krMxx6k5c1aNLh~_a1le0HI!Hs@X9CsG4OY zV^J}aT@?eb2%-;z5YR6%Q;(+>)9@T$_we!cF2b|C&;2=il$^-`pGZ8%bi*RvAfDN@ zbk6(4Ay$+W;&bA0gDyz?$aUG}H_ioz1)do)(#d(^5V2TjW4Vo4(NKw}iNlJjQNECI zS>e3JSuIyt^Pc>L!JM{|;yTR{#IS@o5)dJyiW17O5TR8g#YB?!qaOZY$DbgVOs*0b zITlcX3d!+<|H1EW&HU7)n-q)!oiDciF$x5Bfkw@?zmILZaRT_Cfh(=$uhfCrPtt2G zEqny@ZUYzBElu77E_Z;TCtWfmNAlAY@_FF>jJ_!g4BP_UYi@7NeVjf3Y3geE1~@nb z#tM|Z?(y!f_TK(I)9mjDHuZ9kU_3~v0004XNkl3-r5QV=x++Zcgv2ZAX z0|{K}7}BIkrI6o|pO+>O1Z`qtBMK=MM7Tx~mP4$>D@>uYw|iu&<;~37d2e@u?~m|@ zS{zT+xz((&RpiN-__7x(|p` zO`K|=>Inf3ru32$LNXq00Vr}~rxaNY(NyHdCgN1HpG`TKlC`S(^*3CNwHGL!=d( z#g6R#4S;gL^2oZqHml*p`T{os|IH1n;lyjIlXP!W&zI*bL6IAhmsiUD>Sj{a;J%KF z9Zbpb1flzFRgzKUhRtGUu{hO?M_Y>ASp6dNxT$U-QuXBA}>v%o)2mPk4D2_DGga7~l07*qo IM6N<$g0cF8VgLXD literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_honey/textures/mcl_honey_honey_bottle.png b/mods/ITEMS/mcl_honey/textures/mcl_honey_honey_bottle.png new file mode 100644 index 0000000000000000000000000000000000000000..16956f56e62f4fcee9d6f8f0e0cfe96c6a30eee1 GIT binary patch literal 1998 zcmV;<2Qm1GP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+TB-KmLw+({O1%t0@_%P!}^|Y;Nv?;sHJPVJUu=B zu`^#5q!J_%AqmQjzy6%=4_r(doLWpFhv0E(*31Q+jwj}#0S6lFeH4xtmo`_$Q@FRZCKV$d;;Jx>PpTBt~4>-1>+p@w7 zPDf7mBA2@v{@@Yu-7-IWq{T=7d_CbeXHRpEy}GjEC~G*2x-I4EVPJ(Sxuyl&5s#rC zuRG&TzW4^#I+j|UuXxGCKzx!?r$Up))i!EyQF(Ag%iMtYk|l|pxq%E4T{lgRPO@}K zV5NaMftc^U&}BC-doY$@xf4b*K^Zvyc)M4@ckd61=3HS;}Cj zYg499n_9iOFgF1+9(w(~pb8mTbK=)U9nBQyN+W|6K-p0F1YD2##h`nYDEGa*n3Ydhna9~9jp8n?6P0+(*2`rCrylLP?Ugjb4{q{i zcNmJ`2wS7W!OPENGH}eixmxwtGuORy_1V*D<-F^ZL7?%ZG0ws_4%{$CnWemA6-Tko zH>T|PID=o)XFjX=lpgoh$bI4OD1y%kCEZJR<)lStT~M`CyJxF9>)P~g6(^@w_vEZ2 z3vKTz4l#2rz>&=|GV1?t=D+(qzmFoD8An$9KPuZs0Qg}8op7XmcGtb}S1KJ4tP76i zw@i4O2<~4&+Ls+ivs**7w3f~QLb!|%(JlFSxORYB7>;)0p+|Ld*^}^y>Tm8xDE_mY zU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T9p>;GJh$QV-S*hk`B3Q4Cp|6;d(gGR>tm ztj24OeoiB>W}PklV()&x+RuHCV{ASyOJt{|L;1HXde@gyOsJ7PgT7o;%E!2Y94#X^pSPG zBU;{uen5=p!vBtHudG+iZrT)3*s^)Z;`?|q*_9VBEaZ+#2%)BF5c_R1zd@rH7Cmw- z?omzCF5L`&Yxiw9rW)D}cwgRId!I;`u7Upz>0-xL^O}OP!hYlnTkm-7skZ6USNczA zmwwz_H~;ihTg5IMN)2Z*1K|;E165Fc8ZB z7=|B%LM9OrLJ`z@kVDjX6r<_0^+8KbAkO@2Nc z-}}Aqch-5kr~#@%0^r91zaP!F=PHtQ#1yywUgxzR2RPvhRf-nst$Z|J0|PsrXm1U3TDgX8hU}#UIs96RSHxos0xYg#{rSK~THPS3hH&lgeW9mv?CbTh*jbxWUJMyggk!O;Jr^`q>UM(5u z@yMJ)*X3IywR@l)Hf>_IKQy(0-?fR8CU!56ky=4EU&t sUCG)0!13gaa^os@bJu%d8mTHI|FQPq*iWDKg#Z8m07*qoM6N<$g0n94761SM literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_mobitems/init.lua b/mods/ITEMS/mcl_mobitems/init.lua index 256be90254..e1b39660f1 100644 --- a/mods/ITEMS/mcl_mobitems/init.lua +++ b/mods/ITEMS/mcl_mobitems/init.lua @@ -402,11 +402,11 @@ minetest.register_alias("mobs_mc:gold_horse_armor", "mcl_mobitems:gold_horse_arm minetest.register_alias("mobs_mc:diamond_horse_armor", "mcl_mobitems:diamond_horse_armor") minetest.register_craftitem("mcl_mobitems:glow_ink_sac", { - description = S("Glow Ink Sac"), - _doc_items_longdesc = S("Use it to craft the Glow Item Frame."), - _doc_items_usagehelp = S("Use the Glow Ink Sac and the normal Item Frame to craft the Glow Item Frame."), - inventory_image = "extra_mobs_glow_ink_sac.png", - groups = { craftitem = 1 }, + description = S("Glow Ink Sac"), + _doc_items_longdesc = S("Use it to craft the Glow Item Frame."), + _doc_items_usagehelp = S("Use the Glow Ink Sac and the normal Item Frame to craft the Glow Item Frame."), + inventory_image = "extra_mobs_glow_ink_sac.png", + groups = { craftitem = 1 }, }) From 4bb824cd388d0703346d50adf178775a971a218b Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Sat, 5 Nov 2022 09:28:17 -0600 Subject: [PATCH 23/47] Add mcl_honey mod.conf file along with translation templates --- mods/ITEMS/mcl_honey/locale/template.txt | 10 ++++++++++ mods/ITEMS/mcl_honey/mod.conf | 3 +++ 2 files changed, 13 insertions(+) create mode 100644 mods/ITEMS/mcl_honey/locale/template.txt create mode 100644 mods/ITEMS/mcl_honey/mod.conf diff --git a/mods/ITEMS/mcl_honey/locale/template.txt b/mods/ITEMS/mcl_honey/locale/template.txt new file mode 100644 index 0000000000..a9814d6175 --- /dev/null +++ b/mods/ITEMS/mcl_honey/locale/template.txt @@ -0,0 +1,10 @@ +Honeycomb= +Used to craft beehives and protect copper blocks from further oxidation.= +Use on copper blocks to prevent further oxidation.= +Honeycomb Block= +Honeycomb Block. Used as a decoration.= +Honey Bottle= +Honey Bottle is used to craft honey blocks and to restore hunger points.= +Drinking will restore 6 hunger points. Can also be used to craft honey blocks.= +Honey Block= +Honey Block. Used as a decoration and in redstone. Is sticky on some sides.= \ No newline at end of file diff --git a/mods/ITEMS/mcl_honey/mod.conf b/mods/ITEMS/mcl_honey/mod.conf new file mode 100644 index 0000000000..6ef9d7e458 --- /dev/null +++ b/mods/ITEMS/mcl_honey/mod.conf @@ -0,0 +1,3 @@ +name = mcl_honey +author = PrairieWind +description = MineClone 2 mod that adds honey and honeycomb and the respective block versions. \ No newline at end of file From db0b44326b6b0a0756ed93654b2ae2bc64a24fe5 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Sat, 5 Nov 2022 09:28:38 -0600 Subject: [PATCH 24/47] Add crafting recipe item replacements --- mods/ITEMS/mcl_honey/init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mods/ITEMS/mcl_honey/init.lua b/mods/ITEMS/mcl_honey/init.lua index 7ced3b65d7..576a5459f4 100644 --- a/mods/ITEMS/mcl_honey/init.lua +++ b/mods/ITEMS/mcl_honey/init.lua @@ -66,6 +66,12 @@ minetest.register_craft({ { "mcl_honey:honey_bottle", "mcl_honey:honey_bottle" }, { "mcl_honey:honey_bottle", "mcl_honey:honey_bottle" }, }, + replacements = { + { "mcl_honey:honey_bottle", "mcl_potions:glass_bottle" }, + { "mcl_honey:honey_bottle", "mcl_potions:glass_bottle" }, + { "mcl_honey:honey_bottle", "mcl_potions:glass_bottle" }, + { "mcl_honey:honey_bottle", "mcl_potions:glass_bottle" }, + }, }) minetest.register_craft({ @@ -80,4 +86,7 @@ minetest.register_craft({ type = "shapeless", output = "mcl_core:sugar 3", recipe = { "mcl_honey:honey_bottle" }, + replacements = { + { "mcl_honey:honey_bottle", "mcl_potions:glass_bottle" }, + }, }) From 89b02c126aff1dde1c1d6f592809bc8f5e1c9c08 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Sat, 5 Nov 2022 10:38:21 -0600 Subject: [PATCH 25/47] Add basic beehives and bee nests Still need to add functionality --- mods/ITEMS/mcl_beehives/init.lua | 47 ++++++++++++++++++ mods/ITEMS/mcl_beehives/locale/template.txt | 4 ++ mods/ITEMS/mcl_beehives/mod.conf | 3 ++ .../textures/mcl_beehives_bee_nest_bottom.png | Bin 0 -> 2051 bytes .../textures/mcl_beehives_bee_nest_front.png | Bin 0 -> 6152 bytes .../mcl_beehives_bee_nest_front_honey.png | Bin 0 -> 6254 bytes .../textures/mcl_beehives_bee_nest_side.png | Bin 0 -> 6252 bytes .../textures/mcl_beehives_bee_nest_top.png | Bin 0 -> 6155 bytes .../textures/mcl_beehives_beehive_end.png | Bin 0 -> 2008 bytes .../textures/mcl_beehives_beehive_front.png | Bin 0 -> 2131 bytes .../mcl_beehives_beehive_front_honey.png | Bin 0 -> 2370 bytes .../textures/mcl_beehives_beehive_side.png | Bin 0 -> 2085 bytes 12 files changed, 54 insertions(+) create mode 100644 mods/ITEMS/mcl_beehives/init.lua create mode 100644 mods/ITEMS/mcl_beehives/locale/template.txt create mode 100644 mods/ITEMS/mcl_beehives/mod.conf create mode 100644 mods/ITEMS/mcl_beehives/textures/mcl_beehives_bee_nest_bottom.png create mode 100644 mods/ITEMS/mcl_beehives/textures/mcl_beehives_bee_nest_front.png create mode 100644 mods/ITEMS/mcl_beehives/textures/mcl_beehives_bee_nest_front_honey.png create mode 100644 mods/ITEMS/mcl_beehives/textures/mcl_beehives_bee_nest_side.png create mode 100644 mods/ITEMS/mcl_beehives/textures/mcl_beehives_bee_nest_top.png create mode 100644 mods/ITEMS/mcl_beehives/textures/mcl_beehives_beehive_end.png create mode 100644 mods/ITEMS/mcl_beehives/textures/mcl_beehives_beehive_front.png create mode 100644 mods/ITEMS/mcl_beehives/textures/mcl_beehives_beehive_front_honey.png create mode 100644 mods/ITEMS/mcl_beehives/textures/mcl_beehives_beehive_side.png diff --git a/mods/ITEMS/mcl_beehives/init.lua b/mods/ITEMS/mcl_beehives/init.lua new file mode 100644 index 0000000000..a9a1656fa7 --- /dev/null +++ b/mods/ITEMS/mcl_beehives/init.lua @@ -0,0 +1,47 @@ +------------------ +---- Beehives ---- +------------------ + +-- Variables +local S = minetest.get_translator(minetest.get_current_modname()) + +-- Beehive +minetest.register_node("mcl_beehives:beehive", { + description = S("Beehive"), + _doc_items_longdesc = S("Artificial bee nest."), + tiles = { + "mcl_beehives_beehive_end.png", "mcl_beehives_beehive_end.png", + "mcl_beehives_beehive_side.png", "mcl_beehives_beehive_side.png", + "mcl_beehives_beehive_side.png", "mcl_beehives_beehive_front.png", + }, + paramtype2 = "facedir", + groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 5, material_wood = 1 }, + _mcl_blast_resistance = 0.6, + _mcl_hardness = 0.6, +}) + +-- Bee Nest +minetest.register_node("mcl_beehives:bee_nest", { + description = S("Bee Nest"), + _doc_items_longdesc = S("A naturally generating block that houses bees and a tasty treat...if you can get it."), + tiles = { + "mcl_beehives_bee_nest_top.png", "mcl_beehives_bee_nest_bottom.png", + "mcl_beehives_bee_nest_side.png", "mcl_beehives_bee_nest_side.png", + "mcl_beehives_bee_nest_side.png", "mcl_beehives_bee_nest_front.png", + }, + paramtype2 = "facedir", + groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 30 }, + _mcl_blast_resistance = 0.3, + _mcl_hardness = 0.3, +}) + +-- Crafting +minetest.register_craft({ + output = "mcl_beehives:beehive", + recipe = { + { "group:wood", "group:wood", "group:wood" }, + { "mcl_honey:honeycomb", "mcl_honey:honeycomb", "mcl_honey:honeycomb" }, + { "group:wood", "group:wood", "group:wood" }, + }, +}) + diff --git a/mods/ITEMS/mcl_beehives/locale/template.txt b/mods/ITEMS/mcl_beehives/locale/template.txt new file mode 100644 index 0000000000..135786c7cf --- /dev/null +++ b/mods/ITEMS/mcl_beehives/locale/template.txt @@ -0,0 +1,4 @@ +Beehive= +Artificial bee nest.= +Bee Nest= +A naturally generating block that houses bees and a tasty treat...if you can get it.= \ No newline at end of file diff --git a/mods/ITEMS/mcl_beehives/mod.conf b/mods/ITEMS/mcl_beehives/mod.conf new file mode 100644 index 0000000000..905c86d5bb --- /dev/null +++ b/mods/ITEMS/mcl_beehives/mod.conf @@ -0,0 +1,3 @@ +name = mcl_beehives +author = PrairieWind +description = Adds beehives and bee nests to MineClone 2. \ No newline at end of file diff --git a/mods/ITEMS/mcl_beehives/textures/mcl_beehives_bee_nest_bottom.png b/mods/ITEMS/mcl_beehives/textures/mcl_beehives_bee_nest_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..f3ad4a418efc7e8a4bfe8ce5bf9eada9d230cbaa GIT binary patch literal 2051 zcmV+e2>kbnP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1aEaqKt@{6`cU0tw#X@T__nZ1~$eByltv``NXU zEm9B&g55ZV>c4*){ez2HYSPAe8>|($bkKn#CSJ^Ij#B9HTrc97yvXVNzz`{nYQEaK z^dscvTHy4Or&l?-yzKa8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0)>U+pqXZPDw@P3v(W&Hg+mho4hWKPcq%|8DG&HFyF|!=WPlj74TN(5 zK4-YNl;@0`JDh)}U*ly#pdz_&1RNTVM-$Av2zVNiLL*aAL#K_j#40-Mr`=jAdJuy_ z8>xq-qDRr_ibV93ibOmvDE?ZfPkHlSa3k!8bM)`bN5Y1z?S!ImxQc@yH<{qO?!N&X zVsPQIK!HT~z0gNOhGZFW5y3GJ&A}HOd|zTeUzo#Lq9~+)@Mk#t{y`5g^-m{1r0-9; ze#-Sj3j7fGXLkLR>xUHhA@I-a`oGDg{pFDx6u{s6Wbgy^=1Zm^{4lP;bY5hS7*zab zlpRTiXS764%i$+@%uK~gMSjR844xbf(HRb-AL>jsm}SwWuD=WZk4pgE-qy?f+MykI z*BE!bO*XYUb(45oo#MQvCRSlT()dRrQC4B_JEK_>e-^xCPg8(v%IkXYP-+N z$T(QZ46jhro^S+seSRJ1<2nuJ$R=;Z^&YKto7bGTd-LYQ*raQ`1znVD{Uw{40;CKK z(cTb>&gn7V(^3gxD51_yRoyhtTGbT$8RZxG0BT}|%IM?yDJ5664sU&7d(HTC)@VrpK6> zQdgykuRzF&xK|$!H55H`a-MF{IuOKb($i{wV_pqR(k*?~9Jjpf0b}v)s>jTih?5CB3u1|_Y89!4$z|v4Ry4-h z&pT@IEWTGqn!T}kO#QqV*WUcxLzw)_H;NL(SvhY-r;ol{^rvcOL+$hZYc9mW@+0UD LuJ(Bg1ET*8&%jl= literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_beehives/textures/mcl_beehives_bee_nest_front_honey.png b/mods/ITEMS/mcl_beehives/textures/mcl_beehives_bee_nest_front_honey.png new file mode 100644 index 0000000000000000000000000000000000000000..d88dd655501b8f47a3395060b9dd8f2fb7c83d2b GIT binary patch literal 6254 zcmeHLdpy+X8XrV1m2xeVX%wr>eTJFI{g#PA2+^kB%L`JD4#d}hr1yx-^hJn#2?p7))fAAG%6 z&ek;2L?95e=^n0r@ZY)em%1AKZu)uxKp<3?#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bee_nest_side.png b/mods/ITEMS/mcl_beehives/textures/mcl_beehives_bee_nest_side.png new file mode 100644 index 0000000000000000000000000000000000000000..9c0de93d7fd8206022e4a72805e786a09f5208a3 GIT binary patch literal 6252 zcmeHLcUV(b8xL59P%R3MGBgc>Gs(>!5QfYkVargl+$1+4W|BbyPLK+U48?&6s3?L9 z>q69`2#N#6Es6??D2f)UC_)AOZUQ2H^|PPP)BYzsN$xr4_x|4ZyzAWOED!MW8fIc? zfY`;9oQC$Jh}59^dgEL?FJ)i4O@^27zj%OfKaKL=aLLCxeiXM!-WLH1&JJ zBKAL=WY*JSq4;j+trZWE>r#%mj$b@7lN(WErBcqmq(ABqKQVu1?`vuB`}}_h*f{-G#d+S2e4^?zt(k zudx%ogve_Iw(t4YNhRsuUox0wvn^s>XJF;Nq{7;LqP1sxb}kZb;H*CamE>&_yS!Q9 zW?eOB*pF!rR{2A-U(B=z6J&hzqfObfr`a#4${A`Yuba5=tWRFxZT>5ya{{|(%~a## z8=t;;5$e}=ynEikF0>CLWHW&^}D@h^v=2-dOq8Ag!nKoJMLa& ze1HegIkjn|K_|~;uJWd7iSMck&AqchTinxH#}c4z(MRw|@bUK{M|}~2&36NBqmoiB zjm%j%{bu}qQs&Ei)3mafq?!rFbBuF*WuAE^I~(6szkX7D$S)3sp1(J9jCv$0Eq%@j zH`65ncQnnOOAkNmd0J+PeB!y$z`(xTcTDQmwX^fQcnI<4CqQkv=a${WFQZPydK)@a ztnTDm$6ZaJnQh6?Uog^os8x+A64_FQoKae>Sz>#aQ)PeoGIS<*CBf8%`jCYnUYQUD z#r&G!eA0xvCO76LttC>{R4}7K^DOU;Q`e%d!l=Yym@c!#q_L~V?rS@|f!x z=5@FsY|+q^Q|i{3Rn@{F%nb%|`{v`C|(0I%wTVE{(fs==G#hE#9Obj z7t3;6FZT{>4oPm)J2F*5DPH@o^jv*$LO|oP@*VY2Z%NP0XEYVg5@=N3i!0wIFC%)| zKl`JuaZYkzo&nZ#{N3!z-apXw;jf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(F%*-z4IEiHTm^lk$e*DX!n11@)fp(kB3BuDbo6!LlC z{fxdT3k=)>-D_@d&3&9c0BP!K`35*R1jY)Kz3%buuJ+#kJ=5&(2R8L`kKW6o?peU{i4&o*bBDlHxTl^>PT^-%K zhKepN9i+qzO-t{CYatHTyXLHQ$Oi{`+@b-}>;BZ)ZT4xthGj-fFzMpM$<{z!tAh5B+~2?m#^%mo0JP6+9QP<0pp1cFx* zOH$fk+uy2au-xGEAOryPhBLIA!A5~e--Mhdgc<;Jk}&|-HVnCZ;)o*@t9Clc7=hs0 z;Nfg%O=u<*z9TeaG%OGtz2VHhp5}9x`5P}eS+2B!B!!E^*mT<= zFKW7l+oQ-4nHEe?qzdO44FGueSC>|~>6ezI92^J^NeY4B_yK2ak@}E}sM`Pl002ov JPDHLkV1mgT^2-1K literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_beehives/textures/mcl_beehives_beehive_front_honey.png b/mods/ITEMS/mcl_beehives/textures/mcl_beehives_beehive_front_honey.png new file mode 100644 index 0000000000000000000000000000000000000000..e47a7c776e6fc2ecaf5aa37ba6bdeef5a52de31b GIT binary patch literal 2370 zcmV-I3BC4-P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1b>lJh7G{Ld-&2uL6V$H6?R_6B?WZ60*sU7*t7E@H`fP-$f0%X zHMFgtA(zJh^;>?t%8iz7CvHP@8J?FLGmn1VPHsbvmz?&yNqayJPs`aqF5B!jet-80 zFsi_wW5dmnv-8PoCI>HEa(PJRQ+Y@t`lB6^^p2mg&luhSym~kM?CF_%z_ARS%L+G~ zww&Z9ch@xh;t}yRGe3I-J8GY=C;WP^vG=xCmwhmRE9^y`OPM_=9)Q!$VF9<|C+O?E z6YglUEnux;sfV!#UJ@}7@8qdcrcQ0Pg$i8s+!$~(b741S5%4E26M8>x>Z}I*R4~G> zfH?;-U%t?sH;wr)S;WkhpveSdgVC4U+y(#jelgVh2y-GEFRb7fkNAQcgSqj976_rf zF_nognbp|)HHdX!P$t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HStPBw!_2*a(7!rJZOHtSl9@O|a1>APAOPiiIQ`K}9%CwXAp9+h}&Y zy}(+GH{6~JLLLn4d-MMP{rlb<=i!aZg%l3^F`XB<-6$grJbvmudod^7O2BkZH_Di) z0!=1P$L6G4%5~!%O}wMouekvCE_MM3js&=kA$##G(U0iA{)2a+A$az&Z5bcmDd@*Z zDQ4`D{aRk!{(G+tLAzB4U~_Ai{(8d7#sXpRuUsh{;&jBzPseDtAns_>#I?=<0AC4K zHWqC1z?+3YZtz9_j%J0WIE^U3BOe3!{-6Zi`yolF+?>3Za;E3bIMdz&46~R&f8AUD2UTh zsgkb*Pu`m@-oH7-X(@d5n{Jc=&|go8(^)(zjDj#YT)8COC}Z{2JlB^J!eHLUUw=PN z7{Irl##uUlu1Ii8jnsKz*SDc+m5=Dnmz1M&#!TVTNo7IfNdWZH+>TA>g*{^oU=)mj oo)ne8lIgtUds2|;98U`V0PhI5muZ2hTL1t607*qoM6N<$f(X@mTL1t6 literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_beehives/textures/mcl_beehives_beehive_side.png b/mods/ITEMS/mcl_beehives/textures/mcl_beehives_beehive_side.png new file mode 100644 index 0000000000000000000000000000000000000000..820acb4916c59d02bf1037482fb4f6a7e9025944 GIT binary patch literal 2085 zcmV+=2-^3FP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1bvvg0-k{O2ih1QH;)9EWRFZjj@rxoENMH}hU5 zQrUoD5(K*eP*&}qzq|Si7isU56(3x5PUEuCMoLhEUe}UF+xfj8^r5`i)%gR##E`rm zUEAXm>~c-;cH8r-UHP*8gzf0?ydCmbnV{4i}Ef!NJ~lXww?Xyh2k(tUOzpb ztp^xY;EzdBW5arW(^`oU1xHT9GQT|yOSoC$JAO*vF?;}cY7hK$*>=9*SdNZuxd%?$ zZsaq56Qz4ZhR&7gB_h^d->*A(lg`UU7IWnmPo7ze!cePMy%=A&13-ke1;H2w1KJrDZ;DQe!#E>FIMjI0qUGy=;7*oQc z$tL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`2sbb2=L;5Y1wcnd)fp7AQQ%g@ zMv-Pq0AiyUPjVCx3{zc7KfGJ4MM9`_?nvj3U7-N1(L0fI=SzY8_TG*H>ld7zbQ=ep zFRFB!kd9m_AkH>n@sB;$=u$wkeSZ67(6?I&vJ=((dqxB>9L)geCAu~oRxiNo zM>DL^rNHg^!3I&#HSHQvARJ|lu6eNGM}t4%jLMy7&_8Vav#j|xyiV6CJUo5WzTtdP zoj={OG2X|QjAIj(9$cL!HIjHR&3r`&OE>_no6CzL%yrw!{>?vk9&0o|U1O4n%r Date: Sat, 5 Nov 2022 13:18:38 -0600 Subject: [PATCH 26/47] Add basic functionality to beehives Uses a temporary ABM to progress through honey levels --- mods/ITEMS/mcl_beehives/init.lua | 88 +++++++++++++++++++++++++++++++- mods/ITEMS/mcl_honey/init.lua | 1 + 2 files changed, 88 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_beehives/init.lua b/mods/ITEMS/mcl_beehives/init.lua index a9a1656fa7..d2b0ee6431 100644 --- a/mods/ITEMS/mcl_beehives/init.lua +++ b/mods/ITEMS/mcl_beehives/init.lua @@ -5,6 +5,34 @@ -- Variables local S = minetest.get_translator(minetest.get_current_modname()) +-- Function to allow harvesting honey and honeycomb from the beehive and bee nest. +local honey_harvest = function(pos, node, player, itemstack, pointed_thing) + local inv = player:get_inventory() + local beehive = "mcl_beehives:beehive" + + if node.name == "mcl_beehives:beehive_5" then + beehive = "mcl_beehives:beehive" + elseif node.name == "mcl_beehives:bee_nest_5" then + beehive = "mcl_beehives:bee_nest" + end + + if player:get_wielded_item():get_name() == "mcl_potions:glass_bottle" then + local honey = "mcl_honey:honey_bottle" + if inv:room_for_item("main", honey) then + node.name = beehive + minetest.set_node(pos, node) + inv:add_item("main", "mcl_honey:honey_bottle") + if not minetest.is_creative_enabled(player:get_player_name()) then + itemstack:take_item() + end + end + elseif player:get_wielded_item():get_name() == "mcl_tools:shears" then + minetest.add_item(pos, "mcl_honey:honeycomb 3") + node.name = beehive + minetest.set_node(pos, node) + end +end + -- Beehive minetest.register_node("mcl_beehives:beehive", { description = S("Beehive"), @@ -15,11 +43,43 @@ minetest.register_node("mcl_beehives:beehive", { "mcl_beehives_beehive_side.png", "mcl_beehives_beehive_front.png", }, paramtype2 = "facedir", - groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 5, material_wood = 1 }, + groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 5, material_wood = 1, beehive = 1 }, _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, }) +for l = 1, 4 do + minetest.register_node("mcl_beehives:beehive_" .. l, { + description = S("Beehive"), + _doc_items_longdesc = S("Artificial bee nest."), + tiles = { + "mcl_beehives_beehive_end.png", "mcl_beehives_beehive_end.png", + "mcl_beehives_beehive_side.png", "mcl_beehives_beehive_side.png", + "mcl_beehives_beehive_side.png", "mcl_beehives_beehive_front.png", + }, + paramtype2 = "facedir", + groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 5, material_wood = 1, not_in_creative_inventory = 1, beehive = 1 }, + _mcl_blast_resistance = 0.6, + _mcl_hardness = 0.6, + drops = "mcl_beehives:beehive", + }) +end + +minetest.register_node("mcl_beehives:beehive_5", { + description = S("Beehive"), + _doc_items_longdesc = S("Artificial bee nest."), + tiles = { + "mcl_beehives_beehive_end.png", "mcl_beehives_beehive_end.png", + "mcl_beehives_beehive_side.png", "mcl_beehives_beehive_side.png", + "mcl_beehives_beehive_side.png", "mcl_beehives_beehive_front_honey.png", + }, + paramtype2 = "facedir", + groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 5, material_wood = 1, not_in_creative_inventory = 1, beehive = 1 }, + _mcl_blast_resistance = 0.6, + _mcl_hardness = 0.6, + on_rightclick = honey_harvest, +}) + -- Bee Nest minetest.register_node("mcl_beehives:bee_nest", { description = S("Bee Nest"), @@ -45,3 +105,29 @@ minetest.register_craft({ }, }) +-- Temporary ABM to update honey levels +minetest.register_abm({ + label = "Update Beehive Honey Levels", + nodenames = "group:beehive", + interval = 500, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local beehive = "mcl_beehives:beehive" + if node.name == beehive then + node.name = beehive.."_1" + minetest.set_node(pos, node) + elseif node.name == beehive.."_1" then + node.name = beehive.."_2" + minetest.set_node(pos, node) + elseif node.name == beehive.."_2" then + node.name = beehive.."_3" + minetest.set_node(pos, node) + elseif node.name == beehive.."_3" then + node.name = beehive.."_4" + minetest.set_node(pos, node) + elseif node.name == beehive.."_4" then + node.name = beehive.."_5" + minetest.set_node(pos, node) + end + end, +}) diff --git a/mods/ITEMS/mcl_honey/init.lua b/mods/ITEMS/mcl_honey/init.lua index 576a5459f4..0300eb7b94 100644 --- a/mods/ITEMS/mcl_honey/init.lua +++ b/mods/ITEMS/mcl_honey/init.lua @@ -47,6 +47,7 @@ minetest.register_node("mcl_honey:honey_block", { "mcl_honey_block_side.png", "mcl_honey_block_side.png", }, groups = { handy = 1, deco_block = 1 }, + paramtype2 = "facedir", _mcl_blast_resistance = 0, _mcl_hardness = 0, }) From a79692a68bfd0fa62fb16b657b5efc6114d825e0 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Sat, 5 Nov 2022 16:21:01 -0600 Subject: [PATCH 27/47] Add harvesting functionality to bee nests Still has temporary abm updating --- mods/ITEMS/mcl_beehives/init.lua | 62 +++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_beehives/init.lua b/mods/ITEMS/mcl_beehives/init.lua index d2b0ee6431..e852727f87 100644 --- a/mods/ITEMS/mcl_beehives/init.lua +++ b/mods/ITEMS/mcl_beehives/init.lua @@ -77,6 +77,7 @@ minetest.register_node("mcl_beehives:beehive_5", { groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 5, material_wood = 1, not_in_creative_inventory = 1, beehive = 1 }, _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, + drops = "mcl_beehives:beehive", on_rightclick = honey_harvest, }) @@ -90,11 +91,44 @@ minetest.register_node("mcl_beehives:bee_nest", { "mcl_beehives_bee_nest_side.png", "mcl_beehives_bee_nest_front.png", }, paramtype2 = "facedir", - groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 30 }, + groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 30, bee_nest = 1 }, _mcl_blast_resistance = 0.3, _mcl_hardness = 0.3, }) +for i = 1, 4 do + minetest.register_node("mcl_beehives:bee_nest_"..i, { + description = S("Bee Nest"), + _doc_items_longdesc = S("A naturally generating block that houses bees and a tasty treat...if you can get it."), + tiles = { + "mcl_beehives_bee_nest_top.png", "mcl_beehives_bee_nest_bottom.png", + "mcl_beehives_bee_nest_side.png", "mcl_beehives_bee_nest_side.png", + "mcl_beehives_bee_nest_side.png", "mcl_beehives_bee_nest_front.png", + }, + paramtype2 = "facedir", + groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 30, not_in_creative_inventory = 1, bee_nest = 1 }, + _mcl_blast_resistance = 0.3, + _mcl_hardness = 0.3, + drops = "mcl_beehives:bee_nest", + }) +end + +minetest.register_node("mcl_beehives:bee_nest_5", { + description = S("Bee Nest"), + _doc_items_longdesc = S("A naturally generating block that houses bees and a tasty treat...if you can get it."), + tiles = { + "mcl_beehives_bee_nest_top.png", "mcl_beehives_bee_nest_bottom.png", + "mcl_beehives_bee_nest_side.png", "mcl_beehives_bee_nest_side.png", + "mcl_beehives_bee_nest_side.png", "mcl_beehives_bee_nest_front_honey.png", + }, + paramtype2 = "facedir", + groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 30, not_in_creative_inventory = 1, bee_nest = 1 }, + _mcl_blast_resistance = 0.3, + _mcl_hardness = 0.3, + drops = "mcl_beehives:bee_nest", + on_rightclick = honey_harvest, +}) + -- Crafting minetest.register_craft({ output = "mcl_beehives:beehive", @@ -131,3 +165,29 @@ minetest.register_abm({ end end, }) + +minetest.register_abm({ + label = "Update Bee Nest Honey Levels", + nodenames = "group:bee_nest", + interval = 500, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local beehive = "mcl_beehives:bee_nest" + if node.name == beehive then + node.name = beehive.."_1" + minetest.set_node(pos, node) + elseif node.name == beehive.."_1" then + node.name = beehive.."_2" + minetest.set_node(pos, node) + elseif node.name == beehive.."_2" then + node.name = beehive.."_3" + minetest.set_node(pos, node) + elseif node.name == beehive.."_3" then + node.name = beehive.."_4" + minetest.set_node(pos, node) + elseif node.name == beehive.."_4" then + node.name = beehive.."_5" + minetest.set_node(pos, node) + end + end, +}) From 8a3c1eaa6e6ae785552e174b9eae7f903d8a0e77 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Fri, 11 Nov 2022 14:27:23 -0700 Subject: [PATCH 28/47] Add harvest and digging damage, and campfire usage Damage is temporary until bees are implemented --- mods/ITEMS/mcl_beehives/init.lua | 72 ++++++++++++++++++++++++-------- mods/ITEMS/mcl_beehives/mod.conf | 3 +- 2 files changed, 56 insertions(+), 19 deletions(-) diff --git a/mods/ITEMS/mcl_beehives/init.lua b/mods/ITEMS/mcl_beehives/init.lua index e852727f87..41582d363b 100644 --- a/mods/ITEMS/mcl_beehives/init.lua +++ b/mods/ITEMS/mcl_beehives/init.lua @@ -8,7 +8,10 @@ local S = minetest.get_translator(minetest.get_current_modname()) -- Function to allow harvesting honey and honeycomb from the beehive and bee nest. local honey_harvest = function(pos, node, player, itemstack, pointed_thing) local inv = player:get_inventory() + local shears = player:get_wielded_item():get_name() == "mcl_tools:shears" + local bottle = player:get_wielded_item():get_name() == "mcl_potions:glass_bottle" local beehive = "mcl_beehives:beehive" + local is_creative = minetest.is_creative_enabled(player:get_player_name()) if node.name == "mcl_beehives:beehive_5" then beehive = "mcl_beehives:beehive" @@ -16,20 +19,45 @@ local honey_harvest = function(pos, node, player, itemstack, pointed_thing) beehive = "mcl_beehives:bee_nest" end - if player:get_wielded_item():get_name() == "mcl_potions:glass_bottle" then + local campfire_area = vector.offset(pos, 0, -5, 0) + local campfire = minetest.find_nodes_in_area(pos, campfire_area, "group:lit_campfire") + + if bottle then local honey = "mcl_honey:honey_bottle" if inv:room_for_item("main", honey) then node.name = beehive minetest.set_node(pos, node) inv:add_item("main", "mcl_honey:honey_bottle") - if not minetest.is_creative_enabled(player:get_player_name()) then + if not is_creative then itemstack:take_item() end + if not campfire[1] then mcl_util.deal_damage(player, 10) end end - elseif player:get_wielded_item():get_name() == "mcl_tools:shears" then + elseif shears then minetest.add_item(pos, "mcl_honey:honeycomb 3") node.name = beehive minetest.set_node(pos, node) + if not campfire[1] then mcl_util.deal_damage(player, 10) end + end +end + +-- Dig Function for Beehives +local dig_hive = function(pos, node, oldmetadata, digger) + local wield_item = digger:get_wielded_item() + local beehive = string.find(node.name, "mcl_beehives:beehive") + local beenest = string.find(node.name, "mcl_beehives:bee_nest") + local silk_touch = mcl_enchanting.has_enchantment(wield_item, "silk_touch") + local is_creative = minetest.is_creative_enabled(digger:get_player_name()) + + if beehive then + minetest.add_item(pos, "mcl_beehives:beehive") + if not silk_touch and not is_creative then mcl_util.deal_damage(digger, 10) end + elseif beenest then + if silk_touch or is_creative then + minetest.add_item(pos, "mcl_beehives:bee_nest") + else + mcl_util.deal_damage(digger, 10) + end end end @@ -46,22 +74,25 @@ minetest.register_node("mcl_beehives:beehive", { groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 5, material_wood = 1, beehive = 1 }, _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, + drop = "", + after_dig_node = dig_hive, }) for l = 1, 4 do minetest.register_node("mcl_beehives:beehive_" .. l, { - description = S("Beehive"), - _doc_items_longdesc = S("Artificial bee nest."), - tiles = { - "mcl_beehives_beehive_end.png", "mcl_beehives_beehive_end.png", - "mcl_beehives_beehive_side.png", "mcl_beehives_beehive_side.png", - "mcl_beehives_beehive_side.png", "mcl_beehives_beehive_front.png", - }, - paramtype2 = "facedir", - groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 5, material_wood = 1, not_in_creative_inventory = 1, beehive = 1 }, - _mcl_blast_resistance = 0.6, - _mcl_hardness = 0.6, - drops = "mcl_beehives:beehive", + description = S("Beehive"), + _doc_items_longdesc = S("Artificial bee nest."), + tiles = { + "mcl_beehives_beehive_end.png", "mcl_beehives_beehive_end.png", + "mcl_beehives_beehive_side.png", "mcl_beehives_beehive_side.png", + "mcl_beehives_beehive_side.png", "mcl_beehives_beehive_front.png", + }, + paramtype2 = "facedir", + groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 5, material_wood = 1, not_in_creative_inventory = 1, beehive = 1 }, + _mcl_blast_resistance = 0.6, + _mcl_hardness = 0.6, + drop = "", + after_dig_node = dig_hive, }) end @@ -77,8 +108,9 @@ minetest.register_node("mcl_beehives:beehive_5", { groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 5, material_wood = 1, not_in_creative_inventory = 1, beehive = 1 }, _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, - drops = "mcl_beehives:beehive", on_rightclick = honey_harvest, + drop = "", + after_dig_node = dig_hive, }) -- Bee Nest @@ -94,6 +126,8 @@ minetest.register_node("mcl_beehives:bee_nest", { groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 30, bee_nest = 1 }, _mcl_blast_resistance = 0.3, _mcl_hardness = 0.3, + drop = "", + after_dig_node = dig_hive, }) for i = 1, 4 do @@ -109,7 +143,8 @@ for i = 1, 4 do groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 30, not_in_creative_inventory = 1, bee_nest = 1 }, _mcl_blast_resistance = 0.3, _mcl_hardness = 0.3, - drops = "mcl_beehives:bee_nest", + drop = "", + after_dig_node = dig_hive, }) end @@ -125,8 +160,9 @@ minetest.register_node("mcl_beehives:bee_nest_5", { groups = { axey = 1, deco_block = 1, flammable = 0, fire_flammability = 30, not_in_creative_inventory = 1, bee_nest = 1 }, _mcl_blast_resistance = 0.3, _mcl_hardness = 0.3, - drops = "mcl_beehives:bee_nest", on_rightclick = honey_harvest, + drop = "", + after_dig_node = dig_hive, }) -- Crafting diff --git a/mods/ITEMS/mcl_beehives/mod.conf b/mods/ITEMS/mcl_beehives/mod.conf index 905c86d5bb..0a7855bec1 100644 --- a/mods/ITEMS/mcl_beehives/mod.conf +++ b/mods/ITEMS/mcl_beehives/mod.conf @@ -1,3 +1,4 @@ name = mcl_beehives author = PrairieWind -description = Adds beehives and bee nests to MineClone 2. \ No newline at end of file +description = Adds beehives and bee nests to MineClone 2. +depends = mcl_util, mcl_enchanting From 0aaaa051648c774f458634fdbaf152f759d101ba Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Fri, 11 Nov 2022 14:52:09 -0700 Subject: [PATCH 29/47] Bee Our Guest Advancement --- mods/HUD/mcl_achievements/init.lua | 9 +++++++++ mods/HUD/mcl_achievements/locale/template.txt | 2 ++ mods/ITEMS/mcl_beehives/init.lua | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mods/HUD/mcl_achievements/init.lua b/mods/HUD/mcl_achievements/init.lua index f76662fce3..5d0b14511c 100644 --- a/mods/HUD/mcl_achievements/init.lua +++ b/mods/HUD/mcl_achievements/init.lua @@ -389,6 +389,15 @@ awards.register_achievement("mcl:theEndAgain", { group = "End", }) +-- Triggered in mcl_beehives +awards.register_achievement("mcl:bee_our_guest", { + title = S("Bee Our Guest"), + description = S("Use a campfire to collect a bottle of honey from a beehive without aggrivating the bees inside."), + icon = "mcl_honey_honey_bottle.png", + type = "Advancement", + group = "Husbandry", +}) + -- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.) if non_pc_achievements then diff --git a/mods/HUD/mcl_achievements/locale/template.txt b/mods/HUD/mcl_achievements/locale/template.txt index cd3726b05d..8db3bb1cb9 100644 --- a/mods/HUD/mcl_achievements/locale/template.txt +++ b/mods/HUD/mcl_achievements/locale/template.txt @@ -87,3 +87,5 @@ Sky's The Limit= Find the elytra and prepare to fly above and beyond!= Free the End= Kill the ender dragon. Good Luck!= +Bee Our Guest= +Use a campfire to collect a bottle of honey from a beehive without aggrivating the bees inside.= diff --git a/mods/ITEMS/mcl_beehives/init.lua b/mods/ITEMS/mcl_beehives/init.lua index 41582d363b..c117b519ae 100644 --- a/mods/ITEMS/mcl_beehives/init.lua +++ b/mods/ITEMS/mcl_beehives/init.lua @@ -31,7 +31,7 @@ local honey_harvest = function(pos, node, player, itemstack, pointed_thing) if not is_creative then itemstack:take_item() end - if not campfire[1] then mcl_util.deal_damage(player, 10) end + if not campfire[1] then mcl_util.deal_damage(player, 10) else awards.unlock(player:get_player_name(), "mcl:bee_our_guest") end end elseif shears then minetest.add_item(pos, "mcl_honey:honeycomb 3") From bbb908239b4734f038f1f2dac18d25e1f81867d3 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Fri, 11 Nov 2022 15:09:17 -0700 Subject: [PATCH 30/47] Total Beelocation Advancement --- mods/HUD/mcl_achievements/init.lua | 8 ++++++++ mods/HUD/mcl_achievements/locale/template.txt | 2 ++ mods/ITEMS/mcl_beehives/init.lua | 1 + 3 files changed, 11 insertions(+) diff --git a/mods/HUD/mcl_achievements/init.lua b/mods/HUD/mcl_achievements/init.lua index 5d0b14511c..5d139e6dc6 100644 --- a/mods/HUD/mcl_achievements/init.lua +++ b/mods/HUD/mcl_achievements/init.lua @@ -398,6 +398,14 @@ awards.register_achievement("mcl:bee_our_guest", { group = "Husbandry", }) +awards.register_achievement("mcl:total_beelocation", { + title = S("Total Beelocation"), + description = S("Move a bee nest, with 3 bees inside, using a silk touch enchanted tool."), + icon = "mcl_beehives_bee_nest_front_honey.png", + type = "Advancement", + group = "Husbandry", +}) + -- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.) if non_pc_achievements then diff --git a/mods/HUD/mcl_achievements/locale/template.txt b/mods/HUD/mcl_achievements/locale/template.txt index 8db3bb1cb9..4334438e50 100644 --- a/mods/HUD/mcl_achievements/locale/template.txt +++ b/mods/HUD/mcl_achievements/locale/template.txt @@ -89,3 +89,5 @@ Free the End= Kill the ender dragon. Good Luck!= Bee Our Guest= Use a campfire to collect a bottle of honey from a beehive without aggrivating the bees inside.= +Total Beelocation= +Move a bee nest, with 3 bees inside, using a silk touch enchanted tool.= diff --git a/mods/ITEMS/mcl_beehives/init.lua b/mods/ITEMS/mcl_beehives/init.lua index c117b519ae..a7a1a76232 100644 --- a/mods/ITEMS/mcl_beehives/init.lua +++ b/mods/ITEMS/mcl_beehives/init.lua @@ -55,6 +55,7 @@ local dig_hive = function(pos, node, oldmetadata, digger) elseif beenest then if silk_touch or is_creative then minetest.add_item(pos, "mcl_beehives:bee_nest") + awards.unlock(digger:get_player_name(), "mcl:total_beelocation") else mcl_util.deal_damage(digger, 10) end From 16f878d3dc901f4144d1fea504bf6eba47f43503 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Fri, 11 Nov 2022 19:02:01 -0700 Subject: [PATCH 31/47] Make Honey Blocks Sticky Uses slime block stickiness code. --- mods/ITEMS/mcl_honey/init.lua | 35 +++++++++++++++++++++++++++++++++++ mods/ITEMS/mcl_honey/mod.conf | 3 ++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_honey/init.lua b/mods/ITEMS/mcl_honey/init.lua index 0300eb7b94..972112ea39 100644 --- a/mods/ITEMS/mcl_honey/init.lua +++ b/mods/ITEMS/mcl_honey/init.lua @@ -4,6 +4,7 @@ -- Variables local S = minetest.get_translator(minetest.get_current_modname()) +local alldirs = {{x=0,y=0,z=1}, {x=1,y=0,z=0}, {x=0,y=0,z=-1}, {x=-1,y=0,z=0}, {x=0,y=-1,z=0}, {x=0,y=1,z=0}} -- Honeycomb minetest.register_craftitem("mcl_honey:honeycomb", { @@ -50,6 +51,40 @@ minetest.register_node("mcl_honey:honey_block", { paramtype2 = "facedir", _mcl_blast_resistance = 0, _mcl_hardness = 0, + mvps_sticky = function(pos, node, piston_pos) + local connected = {} + for n, v in ipairs(alldirs) do + local neighbor_pos = vector.add(pos, v) + local neighbor_node = minetest.get_node(neighbor_pos) + if neighbor_node then + if neighbor_node.name == "ignore" then + minetest.get_voxel_manip():read_from_map(neighbor_pos, neighbor_pos) + neighbor_node = minetest.get_node(neighbor_pos) + end + local name = neighbor_node.name + if name ~= "air" and name ~= "ignore" and not mesecon.mvps_unsticky[name] then + local piston, piston_side, piston_up, piston_down = false, false, false, false + if name == "mesecons_pistons:piston_sticky_off" or name == "mesecons_pistons:piston_normal_off" then + piston, piston_side = true, true + elseif name == "mesecons_pistons:piston_up_sticky_off" or name == "mesecons_pistons:piston_up_normal_off" then + piston, piston_up = true, true + elseif name == "mesecons_pistons:piston_down_sticky_off" or name == "mesecons_pistons:piston_down_normal_off" then + piston, piston_down = true, true + end + if not( (piston_side and (n-1==neighbor_node.param2)) or (piston_up and (n==5)) or (piston_down and (n==6)) ) then + if piston and piston_pos then + if piston_pos.x == neighbor_pos.x and piston_pos.y == neighbor_pos.y and piston_pos.z == neighbor_pos.z then + -- Loopback to the same piston! Preventing unwanted behavior: + return {}, true + end + end + table.insert(connected, neighbor_pos) + end + end + end + end + return connected, false + end, }) -- Crafting diff --git a/mods/ITEMS/mcl_honey/mod.conf b/mods/ITEMS/mcl_honey/mod.conf index 6ef9d7e458..4368112911 100644 --- a/mods/ITEMS/mcl_honey/mod.conf +++ b/mods/ITEMS/mcl_honey/mod.conf @@ -1,3 +1,4 @@ name = mcl_honey author = PrairieWind -description = MineClone 2 mod that adds honey and honeycomb and the respective block versions. \ No newline at end of file +description = MineClone 2 mod that adds honey and honeycomb and the respective block versions. +depends = mesecons_mvps From fb651a49224909452ae4fce22b19a8dc3b26a0b2 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Tue, 15 Nov 2022 10:38:29 -0700 Subject: [PATCH 32/47] Wax On and Wax Off Advancements --- mods/HUD/mcl_achievements/init.lua | 17 +++++++++++++++++ mods/HUD/mcl_achievements/locale/template.txt | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/mods/HUD/mcl_achievements/init.lua b/mods/HUD/mcl_achievements/init.lua index 5d139e6dc6..952fc17897 100644 --- a/mods/HUD/mcl_achievements/init.lua +++ b/mods/HUD/mcl_achievements/init.lua @@ -406,6 +406,23 @@ awards.register_achievement("mcl:total_beelocation", { group = "Husbandry", }) +-- Triggered in mcl_copper +awards.register_achievement("mcl:wax_on", { + title = S("Wax On"), + description = S("Apply honeycomb to a copper block to protect it from the elements."), + icon = "mcl_honey_honeycomb.png", + type = "Advancement", + group = "Husbandry", +}) + +awards.register_achievement("mcl:wax_off", { + title = S("Wax Off"), + description = S("Scrape wax off of a copper block."), + icon = "default_tool_stoneaxe.png", + type = "Advancement", + group = "Husbandry", +}) + -- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.) if non_pc_achievements then diff --git a/mods/HUD/mcl_achievements/locale/template.txt b/mods/HUD/mcl_achievements/locale/template.txt index 4334438e50..3420a39dcf 100644 --- a/mods/HUD/mcl_achievements/locale/template.txt +++ b/mods/HUD/mcl_achievements/locale/template.txt @@ -91,3 +91,7 @@ Bee Our Guest= Use a campfire to collect a bottle of honey from a beehive without aggrivating the bees inside.= Total Beelocation= Move a bee nest, with 3 bees inside, using a silk touch enchanted tool.= +Wax On= +Apply honeycomb to a copper block to protect it from the elements.= +Wax Off= +Scrape wax off of a copper block.= From c767c617f870ac0fb941429e9fb7c1913c1b2af8 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Tue, 15 Nov 2022 14:02:05 -0700 Subject: [PATCH 33/47] Add waxing copper blocks --- mods/ITEMS/mcl_copper/crafting.lua | 20 ++- mods/ITEMS/mcl_copper/functions.lua | 28 ++++ mods/ITEMS/mcl_copper/init.lua | 2 +- mods/ITEMS/mcl_copper/locale/template.txt | 20 +++ mods/ITEMS/mcl_copper/nodes.lua | 196 ++++++++++++++++++++-- 5 files changed, 246 insertions(+), 20 deletions(-) diff --git a/mods/ITEMS/mcl_copper/crafting.lua b/mods/ITEMS/mcl_copper/crafting.lua index 7b1e183c79..ce280fcdf8 100644 --- a/mods/ITEMS/mcl_copper/crafting.lua +++ b/mods/ITEMS/mcl_copper/crafting.lua @@ -47,6 +47,17 @@ minetest.register_craft({ }, }) +local waxable_blocks = { "block", "block_cut", "block_exposed", "block_exposed_cut", "block_weathered", "block_weathered_cut", "block_oxidized", "block_oxidized_cut" } + +for _, w in ipairs(waxable_blocks) do + minetest.register_craft({ + output = "mcl_copper:waxed_"..w, + recipe = { + { "mcl_copper:"..w, "mcl_honey:honeycomb" }, + }, + }) +end + minetest.register_craft({ output = "mcl_copper:copper_ingot 4", recipe = { @@ -73,4 +84,11 @@ minetest.register_craft({ output = "mcl_copper:copper_ingot", recipe = "mcl_copper:stone_with_copper", cooktime = 10, -}) \ No newline at end of file +}) + +minetest.register_craft({ + type = "cooking", + output = "mcl_copper:block", + recipe = "mcl_copper:block_raw", + cooktime = 90, +}) diff --git a/mods/ITEMS/mcl_copper/functions.lua b/mods/ITEMS/mcl_copper/functions.lua index b6e0cb7e26..81dfdb69d8 100644 --- a/mods/ITEMS/mcl_copper/functions.lua +++ b/mods/ITEMS/mcl_copper/functions.lua @@ -12,6 +12,34 @@ local function register_oxidation_abm(abm_name, node_name, oxidized_variant) }) end +function waxing_copper_block(pos, node, player, itemstack, convert_to) + if itemstack:get_name() == "mcl_honey:honeycomb" then + node.name = convert_to + minetest.set_node(pos, node) + awards.unlock(player:get_player_name(), "mcl:wax_on") + if not minetest.is_creative_enabled(player:get_player_name()) then + itemstack:take_item() + end + else + return true + end +end + +function scraping_copper_block(pos, node, player, itemstack, convert_to) + if itemstack:get_name():find("axe") then + node.name = convert_to + minetest.set_node(pos, node) + awards.unlock(player:get_player_name(), "mcl:wax_off") + if not minetest.is_creative_enabled(player:get_player_name()) then + local tool = itemstack:get_name() + local wear = mcl_autogroup.get_wear(tool, "axey") + itemstack:add_wear(wear) + end + else + return true + end +end + --[[ local stairs = { {"stair", "exposed", "_inner", "cut_inner"}, diff --git a/mods/ITEMS/mcl_copper/init.lua b/mods/ITEMS/mcl_copper/init.lua index ea15e58274..a99d03f2cc 100644 --- a/mods/ITEMS/mcl_copper/init.lua +++ b/mods/ITEMS/mcl_copper/init.lua @@ -1,6 +1,6 @@ local path = minetest.get_modpath("mcl_copper") +dofile(path .. "/functions.lua") dofile(path .. "/nodes.lua") dofile(path .. "/items.lua") dofile(path .. "/crafting.lua") -dofile(path .. "/functions.lua") \ No newline at end of file diff --git a/mods/ITEMS/mcl_copper/locale/template.txt b/mods/ITEMS/mcl_copper/locale/template.txt index 050c099ee2..7022780ff0 100644 --- a/mods/ITEMS/mcl_copper/locale/template.txt +++ b/mods/ITEMS/mcl_copper/locale/template.txt @@ -2,36 +2,56 @@ A block of copper is mostly a decorative block.= A block used for compact raw copper storage.= Block of Copper= +Waxed Block of Copper= Block of Raw Copper= Copper Ingot= Copper Ore= Cut copper is a decorative block.= Cut Copper= +Waxed Cut Copper= Double Slab of Cut Copper= Double Slab of Exposed Cut Copper= Double Slab of Oxidized Cut Copper= Double Slab of Weathered Cut Copper= +Waxed Double Slab of Cut Copper= +Waxed Double Slab of Exposed Cut Copper= +Waxed Double Slab of Oxidized Cut Copper= +Waxed Double Slab of Weathered Cut Copper= Exposed copper is a decorative block.= Exposed Copper= +Waxed Exposed Copper= Exposed cut copper is a decorative block.= Exposed Cut Copper= +Waxed Exposed Cut Copper= Molten Raw Copper. It is used to craft blocks.= Oxidized copper is a decorative block.= Oxidized Copper= +Waxed Oxidized Copper= Oxidized cut copper is a decorative block.= Oxidized Cut Copper= +Waxed Oxidized Cut Copper= Raw Copper. Mine a Copper Ore to get it.= Raw Copper= Slab of Cut Copper= Slab of Exposed Cut Copper= Slab of Oxidized Cut Copper= Slab of Weathered Cut Copper= +Waxed Slab of Cut Copper= +Waxed Slab of Exposed Cut Copper= +Waxed Slab of Oxidized Cut Copper= +Waxed Slab of Weathered Cut Copper= Some copper contained in stone, it is pretty common and can be found below sea level.= Stairs of Cut Copper= Stairs of Exposed Cut Copper= Stairs of Oxidized Cut Copper= Stairs of Weathered Cut Copper= +Waxed Stairs of Cut Copper= +Waxed Stairs of Exposed Cut Copper= +Waxed Stairs of Oxidized Cut Copper= +Waxed Stairs of Weathered Cut Copper= Weathered copper is a decorative block.= Weathered Copper= +Waxed Weathered Copper= Weathered cut copper is a decorative block.= Weathered Cut Copper= +Waxed Weathered Cut Copper= diff --git a/mods/ITEMS/mcl_copper/nodes.lua b/mods/ITEMS/mcl_copper/nodes.lua index 22c1bf807b..75c2973da2 100644 --- a/mods/ITEMS/mcl_copper/nodes.lua +++ b/mods/ITEMS/mcl_copper/nodes.lua @@ -35,6 +35,19 @@ minetest.register_node("mcl_copper:block", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 3, + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block") end, +}) + +minetest.register_node("mcl_copper:waxed_block", { + description = S("Waxed Block of Copper"), + _doc_items_longdesc = S("A block of copper is mostly a decorative block."), + tiles = {"mcl_copper_block.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 3, + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block") end, }) minetest.register_node("mcl_copper:block_exposed", { @@ -47,18 +60,19 @@ minetest.register_node("mcl_copper:block_exposed", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_anti_oxidation_varient = "mcl_copper:block", + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block_exposed") end, }) -minetest.register_node("mcl_copper:block_oxidized", { - description = S("Oxidized Copper"), - _doc_items_longdesc = S("Oxidized copper is a decorative block."), - tiles = {"mcl_copper_oxidized.png"}, +minetest.register_node("mcl_copper:waxed_block_exposed", { + description = S("Waxed Exposed Copper"), + _doc_items_longdesc = S("Exposed copper is a decorative block."), + tiles = {"mcl_copper_exposed.png"}, is_ground_content = false, groups = {pickaxey = 2, building_block = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, - _mcl_anti_oxidation_varient = "mcl_copper:block_weathered", + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block") end, }) minetest.register_node("mcl_copper:block_weathered", { @@ -71,6 +85,44 @@ minetest.register_node("mcl_copper:block_weathered", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_anti_oxidation_varient = "mcl_copper:block_exposed", + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block_weathered") end, +}) + +minetest.register_node("mcl_copper:waxed_block_weathered", { + description = S("Waxed Weathered Copper"), + _doc_items_longdesc = S("Weathered copper is a decorative block."), + tiles = {"mcl_copper_weathered.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block_exposed") end, +}) + +minetest.register_node("mcl_copper:block_oxidized", { + description = S("Oxidized Copper"), + _doc_items_longdesc = S("Oxidized copper is a decorative block."), + tiles = {"mcl_copper_oxidized.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + _mcl_anti_oxidation_varient = "mcl_copper:block_weathered", + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block_oxidized") end, +}) + +minetest.register_node("mcl_copper:waxed_block_oxidized", { + description = S("Waxed Oxidized Copper"), + _doc_items_longdesc = S("Oxidized copper is a decorative block."), + tiles = {"mcl_copper_oxidized.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block_weather") end, }) minetest.register_node("mcl_copper:block_cut", { @@ -82,6 +134,19 @@ minetest.register_node("mcl_copper:block_cut", { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block_cut") end, +}) + +minetest.register_node("mcl_copper:waxed_block_cut", { + description = S("Waxed Cut Copper"), + _doc_items_longdesc = S("Cut copper is a decorative block."), + tiles = {"mcl_copper_block_cut.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block_cut") end, }) minetest.register_node("mcl_copper:block_exposed_cut", { @@ -94,18 +159,19 @@ minetest.register_node("mcl_copper:block_exposed_cut", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_anti_oxidation_varient = "mcl_copper:block_cut", + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block_exposed_cut") end, }) -minetest.register_node("mcl_copper:block_oxidized_cut", { - description = S("Oxidized Cut Copper"), - _doc_items_longdesc = S("Oxidized cut copper is a decorative block."), - tiles = {"mcl_copper_oxidized_cut.png"}, +minetest.register_node("mcl_copper:waxed_block_exposed_cut", { + description = S("Waxed Exposed Cut Copper"), + _doc_items_longdesc = S("Exposed cut copper is a decorative block."), + tiles = {"mcl_copper_exposed_cut.png"}, is_ground_content = false, groups = {pickaxey = 2, building_block = 1}, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, - _mcl_anti_oxidation_varient = "mcl_copper:block_weathered_cut", + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block_cut") end, }) minetest.register_node("mcl_copper:block_weathered_cut", { @@ -118,6 +184,44 @@ minetest.register_node("mcl_copper:block_weathered_cut", { _mcl_blast_resistance = 6, _mcl_hardness = 5, _mcl_anti_oxidation_varient = "mcl_copper:block_exposed_cut", + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block_weathered_cut") end, +}) + +minetest.register_node("mcl_copper:waxed_block_weathered_cut", { + description = S("Waxed Weathered Cut Copper"), + _doc_items_longdesc = S("Weathered cut copper is a decorative block."), + tiles = {"mcl_copper_weathered_cut.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block_exposed_cut") end, +}) + +minetest.register_node("mcl_copper:block_oxidized_cut", { + description = S("Oxidized Cut Copper"), + _doc_items_longdesc = S("Oxidized cut copper is a decorative block."), + tiles = {"mcl_copper_oxidized_cut.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + _mcl_anti_oxidation_varient = "mcl_copper:block_weathered_cut", + on_rightclick = function(pos, node, player, itemstack) waxing_copper_block(pos, node, player, itemstack, "mcl_copper:waxed_block_oxidized_cut") end, +}) + +minetest.register_node("mcl_copper:waxed_block_oxidized_cut", { + description = S("Waxed Oxidized Cut Copper"), + _doc_items_longdesc = S("Oxidized cut copper is a decorative block."), + tiles = {"mcl_copper_oxidized_cut.png"}, + is_ground_content = false, + groups = {pickaxey = 2, building_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + on_rightclick = function(pos, node, player, itemstack) scraping_copper_block(pos, node, player, itemstack, "mcl_copper:block_weathered_cut") end, }) mcl_stairs.register_slab("copper_cut", "mcl_copper:block_cut", @@ -127,6 +231,13 @@ mcl_stairs.register_slab("copper_cut", "mcl_copper:block_cut", nil, nil, nil, S("Double Slab of Cut Copper")) +mcl_stairs.register_slab("waxed_copper_cut", "mcl_copper:waxed_block_cut", + {pickaxey = 2}, + {"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"}, + S("Waxed Slab of Cut Copper"), + nil, nil, nil, + S("Waxed Double Slab of Cut Copper")) + mcl_stairs.register_slab("copper_exposed_cut", "mcl_copper:block_exposed_cut", {pickaxey = 2}, {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"}, @@ -134,12 +245,12 @@ mcl_stairs.register_slab("copper_exposed_cut", "mcl_copper:block_exposed_cut", nil, nil, nil, S("Double Slab of Exposed Cut Copper")) -mcl_stairs.register_slab("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", +mcl_stairs.register_slab("waxed_copper_exposed_cut", "mcl_copper:waxed_block_exposed_cut", {pickaxey = 2}, - {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, - S("Slab of Oxidized Cut Copper"), + {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"}, + S("Waxed Slab of Exposed Cut Copper"), nil, nil, nil, - S("Double Slab of Oxidized Cut Copper")) + S("Waxed Double Slab of Exposed Cut Copper")) mcl_stairs.register_slab("copper_weathered_cut", "mcl_copper:block_weathered_cut", {pickaxey = 2}, @@ -148,6 +259,27 @@ mcl_stairs.register_slab("copper_weathered_cut", "mcl_copper:block_weathered_cut nil, nil, nil, S("Double Slab of Weathered Cut Copper")) +mcl_stairs.register_slab("waxed_copper_weathered_cut", "mcl_copper:waxed_block_weathered_cut", + {pickaxey = 2}, + {"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"}, + S("Waxed Slab of Weathered Cut Copper"), + nil, nil, nil, + S("Waxed Double Slab of Weathered Cut Copper")) + +mcl_stairs.register_slab("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", + {pickaxey = 2}, + {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, + S("Slab of Oxidized Cut Copper"), + nil, nil, nil, + S("Double Slab of Oxidized Cut Copper")) + +mcl_stairs.register_slab("waxed_copper_oxidized_cut", "mcl_copper:waxed_block_oxidized_cut", + {pickaxey = 2}, + {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, + S("Waxed Slab of Oxidized Cut Copper"), + nil, nil, nil, + S("Waxed Double Slab of Oxidized Cut Copper")) + mcl_stairs.register_stair("copper_cut", "mcl_copper:block_cut", {pickaxey = 2}, {"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"}, @@ -155,6 +287,13 @@ mcl_stairs.register_stair("copper_cut", "mcl_copper:block_cut", nil, 6, nil, "woodlike") +mcl_stairs.register_stair("waxed_copper_cut", "mcl_copper:waxed_block_cut", + {pickaxey = 2}, + {"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"}, + S("Waxed Stairs of Cut Copper"), + nil, 6, nil, + "woodlike") + mcl_stairs.register_stair("copper_exposed_cut", "mcl_copper:block_exposed_cut", {pickaxey = 2}, {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"}, @@ -162,10 +301,10 @@ mcl_stairs.register_stair("copper_exposed_cut", "mcl_copper:block_exposed_cut", nil, 6, nil, "woodlike") -mcl_stairs.register_stair("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", +mcl_stairs.register_stair("waxed_copper_exposed_cut", "mcl_copper:waxed_block_exposed_cut", {pickaxey = 2}, - {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, - S("Stairs of Oxidized Cut Copper"), + {"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"}, + S("Waxed Stairs of Exposed Cut Copper"), nil, 6, nil, "woodlike") @@ -174,4 +313,25 @@ mcl_stairs.register_stair("copper_weathered_cut", "mcl_copper:block_weathered_cu {"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"}, S("Stairs of Weathered Cut Copper"), nil, 6, nil, - "woodlike") \ No newline at end of file + "woodlike") + +mcl_stairs.register_stair("waxed_copper_weathered_cut", "mcl_copper:waxed_block_weathered_cut", + {pickaxey = 2}, + {"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"}, + S("Waxed Stairs of Weathered Cut Copper"), + nil, 6, nil, + "woodlike") + +mcl_stairs.register_stair("copper_oxidized_cut", "mcl_copper:block_oxidized_cut", + {pickaxey = 2}, + {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, + S("Stairs of Oxidized Cut Copper"), + nil, 6, nil, + "woodlike") + +mcl_stairs.register_stair("waxed_copper_oxidized_cut", "mcl_copper:waxed_block_oxidized_cut", + {pickaxey = 2}, + {"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"}, + S("Waxed Stairs of Oxidized Cut Copper"), + nil, 6, nil, + "woodlike") From b17dcf26da8fa59663c8314105116f5f21e8fe6c Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Tue, 15 Nov 2022 14:32:53 -0700 Subject: [PATCH 34/47] Make beehives transparent and not launch entities, thanks MysticTempest! --- mods/ITEMS/REDSTONE/mesecons_mvps/init.lua | 2 +- mods/ITEMS/mcl_honey/init.lua | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua b/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua index a27904e483..b2ff0916ed 100644 --- a/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua @@ -364,7 +364,7 @@ function mesecon.mvps_move_objects(pos, dir, nodestack) for _, r in ipairs(mesecon.rules.alldirs) do local adjpos = vector.add(np, r) local adjnode = minetest.get_node(adjpos) - if minetest.registered_nodes[adjnode.name] and minetest.registered_nodes[adjnode.name].mvps_sticky then + if minetest.registered_nodes[adjnode.name] and minetest.registered_nodes[adjnode.name].mvps_sticky and adjnode.name == "mcl_core:slimeblock" then local np = vector.add(obj:get_pos(), dir) -- Reset acceleration of all objects before launching. diff --git a/mods/ITEMS/mcl_honey/init.lua b/mods/ITEMS/mcl_honey/init.lua index 972112ea39..e736320aad 100644 --- a/mods/ITEMS/mcl_honey/init.lua +++ b/mods/ITEMS/mcl_honey/init.lua @@ -42,13 +42,21 @@ minetest.register_craftitem("mcl_honey:honey_bottle", { minetest.register_node("mcl_honey:honey_block", { description = S("Honey Block"), _doc_items_longdesc = S("Honey Block. Used as a decoration and in redstone. Is sticky on some sides."), - tiles = { - "mcl_honey_block_top.png", "mcl_honey_block_bottom.png", - "mcl_honey_block_side.png", "mcl_honey_block_side.png", - "mcl_honey_block_side.png", "mcl_honey_block_side.png", + tiles = {"mcl_honey_block_side.png"}, + use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "blend" or true, + groups = { handy = 1, deco_block = 1, fall_damage_add_percent = -80 }, + paramtype = "light", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.4, -0.4, -0.4, 0.4, 0.4, 0.4}, + {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + } + }, + selection_box = { + type = "regular", }, - groups = { handy = 1, deco_block = 1 }, - paramtype2 = "facedir", _mcl_blast_resistance = 0, _mcl_hardness = 0, mvps_sticky = function(pos, node, piston_pos) From 89a342a34f449c6c425d3507a9265a8e6930c539 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Tue, 15 Nov 2022 20:19:50 -0700 Subject: [PATCH 35/47] Add Bee Nest Tree Schematics and generation --- .../schematics/mcl_core_birch_bee_nest.mts | Bin 0 -> 175 bytes .../mcl_core_oak_classic_bee_nest.mts | Bin 0 -> 180 bytes .../schematics/mcl_mangrove_bee_nest.mts | Bin 0 -> 682 bytes mods/MAPGEN/mcl_biomes/init.lua | 86 +++++++++++++++++- 4 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 mods/ITEMS/mcl_core/schematics/mcl_core_birch_bee_nest.mts create mode 100644 mods/ITEMS/mcl_core/schematics/mcl_core_oak_classic_bee_nest.mts create mode 100644 mods/ITEMS/mcl_mangrove/schematics/mcl_mangrove_bee_nest.mts diff --git a/mods/ITEMS/mcl_core/schematics/mcl_core_birch_bee_nest.mts b/mods/ITEMS/mcl_core/schematics/mcl_core_birch_bee_nest.mts new file mode 100644 index 0000000000000000000000000000000000000000..fff8fddc4a40a5ba8bc678ec7c738d321b5302c4 GIT binary patch literal 175 zcmeYb3HD`RVPIw8U|_9>0wA9`F|&w4BsV!HJ~_WA)ha2oC^;i1HL)zUm_ZyQnv|NF zkqP8k0U7amsl_GnrVK);%1eq;Q!D0N?K{ZDpupiAUbkbv+|&rRw#sbgn-4A7T0+}$ zPp!z4y=JgiJ5b@P|0T6szlvu6t#$1*f4bdZ^Bitt4neioGKXVl`SaatII++FD#LqY GIX(c%tV2Zr literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_core/schematics/mcl_core_oak_classic_bee_nest.mts b/mods/ITEMS/mcl_core/schematics/mcl_core_oak_classic_bee_nest.mts new file mode 100644 index 0000000000000000000000000000000000000000..1f793f47c825b119361eee42b3188f63034f8d8e GIT binary patch literal 180 zcmeYb3HD`RVPIw8U|_9>0wA9`F|&w)KQ}oiJ~_WA)hZ`7u`IQiffp`NQk0s?AP(Xt zrKVtd^*KIwF5dYXXXVNEE$;b>`MHU{zhfC>D|)ALluSyKZ@X6-n&I)y=FSv_ S=`X%7-&ePPjh`d4G#3EBB}@GP literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_mangrove/schematics/mcl_mangrove_bee_nest.mts b/mods/ITEMS/mcl_mangrove/schematics/mcl_mangrove_bee_nest.mts new file mode 100644 index 0000000000000000000000000000000000000000..630117463135d0c2f07b779988d94c14ceff3ee5 GIT binary patch literal 682 zcmeYb3HD`RVc=xoW8kVs0Ss&m%!!#r47|C?Iq}K)MX6S0nR%%U(jabbVqSVtep#v& zj1gaypI=gpLoz2du`IQiK?=LhlA_d9262#FQfg{OCQzjnkP)AkT3ixuS~2Hp#OG}#n--ju_*0q2nbK#eN$4pPu-F;aqZgTdV?J;f9gLcvGS@c>3_4fwdT^j z@bh;o8sEg~y^OMKT&wwN-M!p-2^SI~%52viU#Dg2p@7Uz*=C-*=LS=l8kbs0xeSvhQ?X9WGGen`AY~ z;@ry3y;fb}+b=u`6jAx9(-(32VRd7g2G7bIVYS5*6jTIN{1t8He$gq~5SbUb#Jyj^xOQIBPq`1W$K7_=a^y&?aw=0&JJ+ANHGC77G*i0cvma+V?b77~ zV}G4{%ckPM$1o*+>eZdDi}JY(7yaOO&{O}rX1khd-*y|0OO(hkN?ak6wgq=Ef_tv_-t7gqs cUA;lEK+NS_)LhAn&vRsh?`@11z1Fb`0H1t2;s5{u literal 0 HcmV?d00001 diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index d468ae4f41..2869a53158 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -3160,7 +3160,48 @@ local function register_decorations() flags = "place_center_x, place_center_z", rotation = "random", }) - + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"group:grass_block_no_snow", "mcl_core:dirt"}, + sidelen = 16, + --[[noise_params = { + offset = 0.01, + scale = 0.00001, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.33 + },]]-- + fill_ratio = 0.0002, + biomes = {"FlowerForest"}, + y_min = 1, + y_max = mcl_vars.mg_overworld_max, + schematic = mod_mcl_core.."/schematics/mcl_core_oak_classic_bee_nest.mts", + flags = "place_center_x, place_center_z", + rotation = "random", + spawn_by = "group:flower", + }) + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"group:grass_block_no_snow", "mcl_core:dirt"}, + sidelen = 16, + --[[noise_params = { + offset = 0.01, + scale = 0.00001, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.33 + },]]-- + fill_ratio = 0.00002, + biomes = {"Forest"}, + y_min = 1, + y_max = mcl_vars.mg_overworld_max, + schematic = mod_mcl_core.."/schematics/mcl_core_oak_classic_bee_nest.mts", + flags = "place_center_x, place_center_z", + rotation = "random", + spawn_by = "group:flower", + }) -- Rare balloon oak minetest.register_decoration({ @@ -3269,7 +3310,27 @@ local function register_decorations() flags = "place_center_x, place_center_z, force_placement", rotation = "random", }) - + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"mcl_mud:mud"}, + sidelen = 80, + --[[noise_params = { + offset = 0.01, + scale = 0.00001, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.33 + },]]-- + fill_ratio = 0.0005, + biomes = {"MangroveSwamp"}, + y_min = 1, + y_max = mcl_vars.mg_overworld_max, + schematic = mod_mcl_mangrove.."/schematics/mcl_mangrove_bee_nest.mts", + flags = "place_center_x, place_center_z, force_placement", + rotation = "random", + spawn_by = "group:flower", + }) minetest.register_decoration({ deco_type = "simple", place_on = {"mcl_mud:mud"}, @@ -3630,6 +3691,27 @@ local function register_decorations() schematic = mod_mcl_core.."/schematics/mcl_core_birch.mts", flags = "place_center_x, place_center_z", }) + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"group:grass_block_no_snow", "mcl_core:dirt"}, + sidelen = 16, + --[[noise_params = { + offset = 0.01, + scale = 0.00001, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.33 + },]]-- + fill_ratio = 0.00002, + biomes = {"Forest", "BirchForest", "BirchForestM"}, + y_min = 1, + y_max = mcl_vars.mg_overworld_max, + schematic = mod_mcl_core.."/schematics/mcl_core_birch_bee_nest.mts", + flags = "place_center_x, place_center_z", + rotation = "random", + spawn_by = "group:flower", + }) -- Dark Oak minetest.register_decoration({ From d764c3eac326c6d40f67cecfd00fdea2c674799e Mon Sep 17 00:00:00 2001 From: Johannes Fritz Date: Tue, 15 Nov 2022 13:27:07 -0600 Subject: [PATCH 36/47] Make Steve hair unlike MC --- mods/PLAYER/mcl_skins/media_credits.txt | 2 +- .../mcl_skins/textures/mcl_skins_hair_10.png | Bin 328 -> 356 bytes .../textures/mcl_skins_hair_10_mask.png | Bin 170 -> 143 bytes 3 files changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/PLAYER/mcl_skins/media_credits.txt b/mods/PLAYER/mcl_skins/media_credits.txt index b810583566..cda321d60d 100644 --- a/mods/PLAYER/mcl_skins/media_credits.txt +++ b/mods/PLAYER/mcl_skins/media_credits.txt @@ -20,6 +20,7 @@ mcl_skins_top_6.png mcl_skins_bottom_3.png mcl_skins_eye_7.png mcl_skins_mouth_7.png +mcl_skins_hair_10.png Original work by MrRar License: CC BY-SA 4.0 @@ -99,7 +100,6 @@ Source: http://minetest.fensta.bplaced.net/#id=1258 mcl_skins_bottom_4.png mcl_skins_top_9.png mcl_skins_top_10.png -mcl_skins_hair_10.png mcl_skins_hair_11.png Name: Pixel Perfection Legacy 1.19 Author: Nova_Wostra. Adapted for mcl_skins by MrRar. diff --git a/mods/PLAYER/mcl_skins/textures/mcl_skins_hair_10.png b/mods/PLAYER/mcl_skins/textures/mcl_skins_hair_10.png index 72a50f722f0b9428f561c119132492ad9d46f5c4..962d1aa700cf3d8c75c0965982b3ad63a05a91b8 100644 GIT binary patch delta 329 zcmV-P0k;0g0^|aaB!4SOL_t(&-tCu73c@fHghOxO+oE^d4C%7Li@hkdX?L$tgfu7u6Q2I07}(709XL91m^Fx0z!h}%pgVp zu#n*(0JsqVWTZef907nq3;`ff1UwYOp&~#O!)X)%-1Zz9_kRF#dbLw^)Y_6b>6Y`c zMTAHPU)EL|8n8g^lJ}v(>m`D!p}D-wg$mn*m(1-MwLpi?5JXhOC+WfaNZ;l0n_U2? zr@c`mc=Z0dpKpBA7qdMi8XY{Klvp@OfD`BmhrQ6naX5 z6-IBL9G(E>FhWf*GDSic0G4mUrJ|Rq_zm@6qG_hqnNR5eh0Yn3N~Kb%R4SE9rBbO> bsuSxD?6@zE*xB4X00000NkvXXu0mjfX}Fgy delta 301 zcmV+|0n+~D0>}c8B!3S{L_t(&-tCq_3dA4`MH89T9H6)?o@4HRjM8-v(B=Hu7zmEm zIxw_K9*ELLF`E2HR3`v%09+h<`9?&6I>*%v0PJx%0a%lN>+lCaM8wQ<#_@>;z_l2w zgBZg3<^vcZ%k1`Q!og)#q$WYsn)@+50uz_aAh->pu(xozpj?g`X#^s1evB=Qcju8 Sy?xFE#Pf9Zb6Mw<&;$VTP%otb delta 142 zcmeBYT*Wv+rM}S9#W5t~-rMU3c@HS?IA4?~{Xg|E(^RJ}m#H7_Pvw?y?$&vBaL1Yr ziPM!Cm=u7hVRq(2>-r=7lIe$G{S3Uh20|+$SQY#B$*Dv;D2?lXJ* Date: Wed, 16 Nov 2022 02:41:17 +0100 Subject: [PATCH 37/47] Add missing EndBarrens biome definition --- mods/MAPGEN/mcl_biomes/init.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index 2869a53158..e393716511 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -1760,6 +1760,21 @@ local function register_dimension_biomes() _mcl_biome_type = "medium", _mcl_palette_index = 0, }) + minetest.register_biome({ + name = "EndBarrens", + node_stone = "air", + node_filler = "air", + node_water = "air", + node_river_water = "air", + node_cave_liquid = "air", + y_min = mcl_vars.mg_end_min, + y_max = mcl_vars.mg_end_max + 80, + heat_point = 1000, + humidity_point = 1000, + vertical_blend = 16, + _mcl_biome_type = "medium", + _mcl_palette_index = 0, + }) minetest.register_biome({ name = "EndMidlands", node_stone = "air", From c5ec3c770c4e24c119907c23ee28fcfc21724bda Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 16 Nov 2022 02:58:15 +0100 Subject: [PATCH 38/47] Sweet berries: Add rightclick harvesting --- mods/ITEMS/mcl_farming/sweet_berry.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mods/ITEMS/mcl_farming/sweet_berry.lua b/mods/ITEMS/mcl_farming/sweet_berry.lua index f87220d90c..2d1bbb9927 100644 --- a/mods/ITEMS/mcl_farming/sweet_berry.lua +++ b/mods/ITEMS/mcl_farming/sweet_berry.lua @@ -35,6 +35,20 @@ for i=0, 3 do sounds = mcl_sounds.node_sound_leaves_defaults(), _mcl_blast_resistance = 0, _mcl_hardness = 0, + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + local stage + if node.name:find("_2") then + stage = 2 + elseif node.name:find("_3") then + stage = 3 + end + if stage then + for i=1,math.random(stage) do + minetest.add_item(pos,"mcl_farming:sweet_berry") + end + minetest.swap_node(pos,{name = "mcl_farming:sweet_berry_bush_" .. stage - 1 }) + end + end, }) minetest.register_alias("mcl_sweet_berry:sweet_berry_bush_" .. i, node_name) end From 328a377940b38bc3791c3afd5fe784ed07a4889c Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 16 Nov 2022 17:24:05 +0100 Subject: [PATCH 39/47] export apply_bone_meal function in mcl_dye this is essentially just a hack to not put any more sweetberry code in mcl_dye because the architecture makes it necessary for mcl_dye to depend on mcl_farming, not the other way around - hence all the plant bonemealing is done in mcl_dye... --- mods/ITEMS/mcl_dye/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index 73884856ae..8296519cae 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -379,6 +379,8 @@ local function apply_bone_meal(pointed_thing,user) return false end +mcl_dye.apply_bone_meal = apply_bone_meal + minetest.register_craftitem("mcl_dye:white", { inventory_image = "mcl_dye_white.png", description = S("Bone Meal"), From 142f3d6d5a5e4ee93245c4de051eab3d052d02c5 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 16 Nov 2022 17:25:38 +0100 Subject: [PATCH 40/47] Handle bonemealing in the sweetberry on_rightclick --- mods/ITEMS/mcl_farming/sweet_berry.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mods/ITEMS/mcl_farming/sweet_berry.lua b/mods/ITEMS/mcl_farming/sweet_berry.lua index 2d1bbb9927..69ac552e5a 100644 --- a/mods/ITEMS/mcl_farming/sweet_berry.lua +++ b/mods/ITEMS/mcl_farming/sweet_berry.lua @@ -36,6 +36,10 @@ for i=0, 3 do _mcl_blast_resistance = 0, _mcl_hardness = 0, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + if mcl_dye and clicker:get_wielded_item():get_name() == "mcl_dye:white" then + mcl_dye.apply_bone_meal({under=pos},clicker) + return + end local stage if node.name:find("_2") then stage = 2 From a6db44b71fd17607811467e9c9e10f0bbe443e82 Mon Sep 17 00:00:00 2001 From: Johannes Fritz Date: Thu, 17 Nov 2022 12:57:43 -0600 Subject: [PATCH 41/47] Base mcl_skins templates off old PP skins --- mods/PLAYER/mcl_skins/edit_skin.lua | 24 ++++---- mods/PLAYER/mcl_skins/list.json | 52 +++++++++--------- .../mcl_skins/textures/mcl_skins_hair_1.png | Bin 484 -> 361 bytes 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/mods/PLAYER/mcl_skins/edit_skin.lua b/mods/PLAYER/mcl_skins/edit_skin.lua index 72947d3826..3ced41d6da 100644 --- a/mods/PLAYER/mcl_skins/edit_skin.lua +++ b/mods/PLAYER/mcl_skins/edit_skin.lua @@ -25,21 +25,21 @@ mcl_skins = { -- Base color is separate to keep the number of junk nodes registered in check base_color = {0xffeeb592, 0xffb47a57, 0xff8d471d}, color = { - 0xff613915, -- 1 Dark brown Steve hair, Alex bottom + 0xff613915, -- 1 Dark brown 0xff97491b, -- 2 Medium brown 0xffb17050, -- 3 Light brown 0xffe2bc7b, -- 4 Beige 0xff706662, -- 5 Gray 0xff151515, -- 6 Black 0xffc21c1c, -- 7 Red - 0xff178c32, -- 8 Green Alex top + 0xff178c32, -- 8 Green 0xffae2ad3, -- 9 Plum 0xffebe8e4, -- 10 White 0xffe3dd26, -- 11 Yellow - 0xff449acc, -- 12 Light blue Steve top - 0xff124d87, -- 13 Dark blue Steve bottom + 0xff449acc, -- 12 Light blue + 0xff124d87, -- 13 Dark blue 0xfffc0eb3, -- 14 Pink - 0xffd0672a, -- 15 Orange Alex hair + 0xffd0672a, -- 15 Orange }, footwear = {}, mouth = {}, @@ -574,16 +574,16 @@ local function init() for _, item in pairs(json) do mcl_skins.register_item(item) end - mcl_skins.steve.base_color = mcl_skins.base_color[1] - mcl_skins.steve.hair_color = mcl_skins.color[1] - mcl_skins.steve.top_color = mcl_skins.color[12] - mcl_skins.steve.bottom_color = mcl_skins.color[13] + mcl_skins.steve.base_color = mcl_skins.base_color[2] + mcl_skins.steve.hair_color = 0xff5d473b + mcl_skins.steve.top_color = 0xff993535 + mcl_skins.steve.bottom_color = 0xff644939 mcl_skins.steve.slim_arms = false mcl_skins.alex.base_color = mcl_skins.base_color[1] - mcl_skins.alex.hair_color = mcl_skins.color[15] - mcl_skins.alex.top_color = mcl_skins.color[8] - mcl_skins.alex.bottom_color = mcl_skins.color[1] + mcl_skins.alex.hair_color = 0xff715d57 + mcl_skins.alex.top_color = 0xff346840 + mcl_skins.alex.bottom_color = 0xff383532 mcl_skins.alex.slim_arms = true end diff --git a/mods/PLAYER/mcl_skins/list.json b/mods/PLAYER/mcl_skins/list.json index 163111a4ce..01bb622e53 100644 --- a/mods/PLAYER/mcl_skins/list.json +++ b/mods/PLAYER/mcl_skins/list.json @@ -18,11 +18,13 @@ }, { "type": "eye", - "texture": "mcl_skins_eye_1.png" + "texture": "mcl_skins_eye_1.png", + "alex": true }, { "type": "eye", - "texture": "mcl_skins_eye_2.png" + "texture": "mcl_skins_eye_2.png", + "steve": true }, { "type": "eye", @@ -34,9 +36,7 @@ }, { "type": "eye", - "texture": "mcl_skins_eye_5.png", - "steve": true, - "alex": true + "texture": "mcl_skins_eye_5.png" }, { "type": "eye", @@ -73,21 +73,23 @@ }, { "type": "mouth", - "texture": "mcl_skins_mouth_7.png", - "alex": true + "texture": "mcl_skins_mouth_7.png" }, { - "type": "mouth" + "type": "mouth", + "alex": true }, { "type": "hair", "texture": "mcl_skins_hair_1.png", - "mask": "mcl_skins_hair_1_mask.png" + "mask": "mcl_skins_hair_1_mask.png", + "alex": true }, { "type": "hair", "texture": "mcl_skins_hair_2.png", - "mask": "mcl_skins_hair_2_mask.png" + "mask": "mcl_skins_hair_2_mask.png", + "steve": true }, { "type": "hair", @@ -127,14 +129,12 @@ { "type": "hair", "texture": "mcl_skins_hair_10.png", - "mask": "mcl_skins_hair_10_mask.png", - "steve": true + "mask": "mcl_skins_hair_10_mask.png" }, { "type": "hair", "texture": "mcl_skins_hair_11.png", - "mask": "mcl_skins_hair_11_mask.png", - "alex": true + "mask": "mcl_skins_hair_11_mask.png" }, { "type": "hair" @@ -145,7 +145,8 @@ }, { "type": "headwear", - "texture": "mcl_skins_headwear_2.png" + "texture": "mcl_skins_headwear_2.png", + "alex": true }, { "type": "headwear", @@ -173,13 +174,14 @@ }, { "type": "headwear", - "steve": true, - "alex": true + "steve": true }, { "type": "bottom", "texture": "mcl_skins_bottom_1.png", - "mask": "mcl_skins_bottom_1_mask.png" + "mask": "mcl_skins_bottom_1_mask.png", + "steve": true, + "alex": true }, { "type": "bottom", @@ -194,14 +196,14 @@ { "type": "bottom", "texture": "mcl_skins_bottom_4.png", - "mask": "mcl_skins_bottom_4_mask.png", - "steve": true, - "alex": true + "mask": "mcl_skins_bottom_4_mask.png" }, { "type": "top", "texture": "mcl_skins_top_1.png", - "mask": "mcl_skins_top_1_mask.png" + "mask": "mcl_skins_top_1_mask.png", + "steve": true, + "alex": true }, { "type": "top", @@ -241,14 +243,12 @@ { "type": "top", "texture": "mcl_skins_top_9.png", - "mask": "mcl_skins_top_9_mask.png", - "alex": true + "mask": "mcl_skins_top_9_mask.png" }, { "type": "top", "texture": "mcl_skins_top_10.png", - "mask": "mcl_skins_top_10_mask.png", - "steve": true + "mask": "mcl_skins_top_10_mask.png" }, { "type": "base", diff --git a/mods/PLAYER/mcl_skins/textures/mcl_skins_hair_1.png b/mods/PLAYER/mcl_skins/textures/mcl_skins_hair_1.png index df2397d329b19ec48a5de1ad2d90d15c11e957ac..789468518faec83f0c1460ddb0c07d96d33b2923 100644 GIT binary patch delta 334 zcmV-U0kQt%1L*>gB!4hTL_t(&-tAb+4Z|P|#gnjzH|YZ1r-zK|UK$BG{!z#Q97_m6 z0+Ao~dnTp$hNToFB4~SUUU+Y9YaFVqhb#b8A_A#D9X*>g-UR^OS|H4}TLg#zIO(%K z0GtD|0RRg5wc`{3Sn{_n0G@;GSYUXJ)C5i~@mDI|nd87dgntIZbH^%^L@jOH^x=mj z$Zx$(=eaYE%weEbu%1T`2&BDd>pb+bys*aF>rzvU9?)HtUL61++SlF)kiI>W1GEr3 zjO9l#eMVA1EvaV#0EWI}Gy?b3wG5V1oA*1Aw_e>v*Z>V0^|dbB!8<(L_t(&-tAdyZi6rkj#01C9~goAOJ)} zBY=r}RJ+#FLP92&Wyuu$XDJ#H(G|c~O2ucb2(a+oTgpowzenu#HF}8zsq&ej8O|p> z4;<62L+s7T(ta<2VcuW7$gWibyye{-%qd=6lqI8}&`A^DKc`QPZgemTnqMI^uKeAC z;g}5nneso@s(%4L56~(;5j_@O>|yl`1$JA-T$w@mP1m(a=b)FXa6@U7EF+!qdPehQm53 zprwJu-(3nU6|Ekp$G@xr$M}wD_4soSe}oi(gv0r~$3xF#gF862GC=IT_%)9JMd^5m zkV-}HrtojB!#_$cjl8c#)&~GbMDC=MPU?of0X@*PBDYLw+5i9m07*qoM6N<$g0TMD ArvLx| From e658e29179d5d35ab99981914ee13fa30d9be7e1 Mon Sep 17 00:00:00 2001 From: anarquimico Date: Thu, 17 Nov 2022 20:16:58 -0300 Subject: [PATCH 42/47] Make kelp cookable by smoker. --- mods/ITEMS/mcl_ocean/kelp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_ocean/kelp.lua b/mods/ITEMS/mcl_ocean/kelp.lua index 5cddabd300..5957bafb22 100644 --- a/mods/ITEMS/mcl_ocean/kelp.lua +++ b/mods/ITEMS/mcl_ocean/kelp.lua @@ -741,7 +741,7 @@ minetest.register_craftitem("mcl_ocean:kelp", { inventory_image = "mcl_ocean_kelp_item.png", wield_image = "mcl_ocean_kelp_item.png", on_place = kelp.kelp_on_place, - groups = {deco_block = 1, compostability = 30}, + groups = {deco_block = 1, compostability = 30, smoker_cookable = 1}, }) if mod_doc then From 1877f7261e33cedeecba8928e9fbcd1bd194c3d3 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Thu, 17 Nov 2022 12:15:20 -0700 Subject: [PATCH 43/47] Make Raw Copper (Block) smeltable in the blast furnace --- mods/ITEMS/mcl_copper/items.lua | 2 +- mods/ITEMS/mcl_copper/nodes.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_copper/items.lua b/mods/ITEMS/mcl_copper/items.lua index 450ec8cb38..694e693dc4 100644 --- a/mods/ITEMS/mcl_copper/items.lua +++ b/mods/ITEMS/mcl_copper/items.lua @@ -11,5 +11,5 @@ minetest.register_craftitem("mcl_copper:raw_copper", { description = S("Raw Copper"), _doc_items_longdesc = S("Raw Copper. Mine a Copper Ore to get it."), inventory_image = "mcl_copper_raw.png", - groups = { craftitem = 1 }, + groups = { craftitem = 1, blast_furnace_smeltable = 1 }, }) \ No newline at end of file diff --git a/mods/ITEMS/mcl_copper/nodes.lua b/mods/ITEMS/mcl_copper/nodes.lua index 75c2973da2..c83dd9e10d 100644 --- a/mods/ITEMS/mcl_copper/nodes.lua +++ b/mods/ITEMS/mcl_copper/nodes.lua @@ -20,7 +20,7 @@ minetest.register_node("mcl_copper:block_raw", { _doc_items_longdesc = S("A block used for compact raw copper storage."), tiles = {"mcl_copper_block_raw.png"}, is_ground_content = false, - groups = {pickaxey = 2, building_block = 1}, + groups = {pickaxey = 2, building_block = 1, blast_furnace_smeltable = 1 }, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 6, _mcl_hardness = 5, From a7e643818f34269a6ef52f281907e34c2a3fb0b6 Mon Sep 17 00:00:00 2001 From: Michieal Date: Thu, 17 Nov 2022 23:27:21 +0000 Subject: [PATCH 44/47] Fix the crafting recipes for the signs. --- signs_api.lua | 2003 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2003 insertions(+) create mode 100644 signs_api.lua diff --git a/signs_api.lua b/signs_api.lua new file mode 100644 index 0000000000..1f7369ba3c --- /dev/null +++ b/signs_api.lua @@ -0,0 +1,2003 @@ +--- +--- Generated by EmmyLua. +--- Created by Michieal (FaerRaven). +--- DateTime: 10/14/22 4:05 PM +--- + +--local logging = minetest.settings:get_bool("mcl_logging_mcl_signs",true) + +local DEBUG = minetest.settings:get_bool("mcl_logging_mcl_signs", false) -- special debug setting. + +if DEBUG then + minetest.log("action", "[mcl_signs] Signs API Loading") +end + +-- LOCALIZATION +local S = minetest.get_translator("mcl_signs") +-- Signs form +local F = minetest.formspec_escape + +-- PATHs +local modpath = minetest.get_modpath("mcl_signs") + +-- CONSTANTS +local SIGN_WIDTH = 115 + +local LINE_LENGTH = 15 +local NUMBER_OF_LINES = 4 + +local LINE_HEIGHT = 14 +local CHAR_WIDTH = 5 +local TIMER_INTERVAL = 40.0 +-- ----------------------- +-- CACHE LOCAL COPIES +local table = table +local string = string + +-- CACHE NODE_SOUNDS +local node_sounds +if minetest.get_modpath("mcl_sounds") then + node_sounds = mcl_sounds.node_sound_wood_defaults() +end + +-- SET UP THE CHARACTER MAPPING +-- Load the characters map (characters.txt) +--[[ File format of characters.txt: +It's an UTF-8 encoded text file that contains metadata for all supported characters. It contains a sequence of info + blocks, one for each character. Each info block is made out of 3 lines: +Line 1: The literal UTF-8 encoded character +Line 2: Name of the texture file for this character minus the “.png” suffix; found in the “textures/” sub-directory +Line 3: Currently ignored. Previously this was for the character width in pixels + +After line 3, another info block may follow. This repeats until the end of the file. + +All character files must be 5 or 6 pixels wide (5 pixels are preferred) +]] + +local chars_file = io.open(modpath .. "/characters.txt", "r") +-- FIXME: Support more characters (many characters are missing). Currently ASCII and Latin-1 Supplement are supported. +local charmap = {} +if not chars_file then + minetest.log("error", "[mcl_signs] : character map file not found") +else + while true do + local char = chars_file:read("*l") + if char == nil then + break + end + local img = chars_file:read("*l") + chars_file:read("*l") + charmap[char] = img + end +end + +local pi = 3.1415926 -- enough accuracy, to build an engine for a car. + +local math = math + +-- locally cached copy of the official colors; this way, it updates as mcl_colors updates. +local mcl_colors_official = mcl_colors +if DEBUG then + minetest.log("verbose", "[mcl_signs]Official MCL_Colors:\n" .. dump(mcl_colors_official)) +end + +-- INITIALIZE THE GLOBAL API FOR SIGNS. +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 } +--- colors used for wools. +mcl_signs.mcl_wool_colors = { + unicolor_white = "#FFFFFF", + unicolor_dark_orange = "#502A00", + unicolor_grey = "#5B5B5B", + unicolor_darkgrey = "#303030", + unicolor_blue = "#0000CC", + unicolor_dark_green = "#005000", + unicolor_green_or_lime = "#50CC00", + unicolor_violet_purple = "#5000CC", + unicolor_light_red_pink = "#FF5050", + unicolor_yellow = "#CCCC00", + unicolor_orange = "#CC5000", + unicolor_red = "#CC0000", + unicolor_cyan = "#00CCCC", + unicolor_red_violet_magenta = "#CC0050", + unicolor_black = "#000000", + unicolor_light_blue = "#5050FF", +} +mcl_signs.signtext_info_wall = {} +mcl_signs.signtext_info_standing = {} -- built in build_signs_info(). +-- the rotational levels for all of the standing signs. +mcl_signs.standing_rotation_levels = {} + +-- data structure block for dynamically registered signs. +mcl_signs.registered_signs = {} +mcl_signs.registered_signs.wall_signs = {} +mcl_signs.registered_signs.standing_signs = {} +mcl_signs.registered_signs.hanging_signs = {} -- unused. prepping for future use. +-- DEFINE SIGN BASE TYPES +mcl_signs.wall_standard = {} -- initialize +mcl_signs.standing_standard = {} -- initialize + +function mcl_signs.build_signs_info() + local n = 23 / 56 - 1 / 128 -- some required magic number from the original code. + local m = -1 / 16 + 1 / 64 -- " " " " " " " " + + mcl_signs.signtext_info_wall = { + { delta = { x = 0, y = 0, z = n }, yaw = 0 }, + { delta = { x = n, y = 0, z = 0 }, yaw = pi / -2 }, + { delta = { x = 0, y = 0, z = -n }, yaw = pi }, + { delta = { x = -n, y = 0, z = 0 }, yaw = pi / 2 }, + } + + -- PLACE YAW VALUES INTO THE TABLE. + for rot = 0, 15 do + local yaw = pi * 2 - (((pi * 2) / 16) * rot) + local delta = vector.multiply(minetest.yaw_to_dir(yaw), m) + -- Offset because sign is a bit above node boundaries + delta.y = delta.y + 2 / 28 + table.insert(mcl_signs.signtext_info_standing, { delta = delta, yaw = yaw }) + end + +end + +-- wall signs' & hanging signs' base (definition) +mcl_signs.wall_standard = { + description = S("Sign"), + _tt_help = S("Can be written"), + _doc_items_longdesc = S("Signs can be written and come in two variants: Wall sign and sign on a sign post. Signs can be placed on the top and the sides of other blocks, but not below them."), + _doc_items_usagehelp = S("After placing the sign, you can write something on it. You have 4 lines of text with up to 15 characters for each line; anything beyond these limits is lost. Not all characters are supported. The text can not be changed once it has been written; you have to break and place the sign again. Can be colored and made to glow."), + inventory_image = "default_sign.png", + walkable = false, + is_ground_content = false, + wield_image = "default_sign.png", + node_placement_prediction = "", + paramtype = "light", + sunlight_propagates = true, + paramtype2 = "wallmounted", + drawtype = "mesh", + mesh = "mcl_signs_signonwallmount.obj", + selection_box = { type = "wallmounted", wall_side = { -0.5, -7 / 28, -0.5, -23 / 56, 7 / 28, 0.5 } }, + tiles = { "mcl_signs_sign.png" }, + use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, + groups = mcl_signs.sign_groups, + stack_max = 16, + sounds = node_sounds, + + on_timer = function(pos) + -- fix for /ClearObjects + mcl_signs:update_sign(pos) + -- note: update_sign decides to keep the timer running based on if there is text. + -- This prevents every sign from having a timer, when not needed. + end, + + on_place = function(itemstack, placer, pointed_thing) + local above = pointed_thing.above + local under = pointed_thing.under + + -- Use pointed node's on_rightclick function first, if present + local node_under = minetest.get_node(under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then + return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack + end + end + + local dir = vector.subtract(under, above) + + -- Only build when it's legal + local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] + if not abovenodedef or abovenodedef.buildable_to == false then + return itemstack + end + + local wdir = minetest.dir_to_wallmounted(dir) + + --local placer_pos = placer:get_pos() + + local fdir = minetest.dir_to_facedir(dir) + + local sign_info + local nodeitem = ItemStack(itemstack) + -- Ceiling + if wdir == 0 then + --how would you add sign to ceiling? + return itemstack + -- Floor + end + + if wdir == 1 then + -- Standing sign + + -- Determine the sign rotation based on player's yaw + local yaw = pi * 2 - placer:get_look_horizontal() + + -- Select one of 16 possible rotations (0-15) + local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) + + if rotation_level > 15 then + rotation_level = 0 + elseif rotation_level < 0 then + rotation_level = 15 + end + + -- The actual rotation is a combination of predefined mesh and facedir (see node definition) + if rotation_level % 4 == 0 then + nodeitem:set_name("mcl_signs:standing_sign") + elseif rotation_level % 4 == 1 then + nodeitem:set_name("mcl_signs:standing_sign22_5") + elseif rotation_level % 4 == 2 then + nodeitem:set_name("mcl_signs:standing_sign45") + elseif rotation_level % 4 == 3 then + nodeitem:set_name("mcl_signs:standing_sign67_5") + end + fdir = math.floor(rotation_level / 4) + + -- Place the node! + local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) + if not success then + return itemstack + end + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] + -- Side + else + -- Wall sign + local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) + if not success then + return itemstack + end + sign_info = mcl_signs.signtext_info_wall[fdir + 1] + end + + -- Determine spawn position of entity + local place_pos + if minetest.registered_nodes[node_under.name].buildable_to then + place_pos = under + else + place_pos = above + end + + local text_entity = minetest.add_entity({ + x = place_pos.x + sign_info.delta.x, + y = place_pos.y + sign_info.delta.y, + z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") + text_entity:set_yaw(sign_info.yaw) + text_entity:get_luaentity()._signnodename = nodeitem:get_name() + if DEBUG then + minetest.log("verbose", "[mcl_signs]Placed position:" .. dump(place_pos) .. "\nSign_info: " .. dump(sign_info)) + end + + minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) + + mcl_signs:show_formspec(placer, place_pos) + return itemstack + end, + on_destruct = function(pos) + mcl_signs:destruct_sign(pos) + end, + + -- Not Useless Code. force updates the sign. + on_punch = function(pos, node, puncher) + mcl_signs:update_sign(pos) + end, + on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + local r = screwdriver.rotate.wallmounted(pos, node, mode) + node.param2 = r + minetest.swap_node(pos, node) + mcl_signs:update_sign(pos, nil, nil, true) + return true + else + return false + end + end, + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + if DEBUG then + minetest.log("verbose", "[mcl_signs] Wall_Sign Right Click event.") + end + + -- make sure player is clicking + if not clicker or not clicker:is_player() then + return + end + + local item = clicker:get_wielded_item() + local iname = item:get_name() + + if node then + if DEBUG then + minetest.log("verbose", "[mcl_signs] Wall_Sign Right Click event on valid node.") + end + + -- handle glow from glow_ink_sac *first* + if (iname == "mcl_mobitems:glow_ink_sac") then + clicker:set_wielded_item(item) + local success = mcl_signs:glow_sign(pos) + if success then + if DEBUG then + minetest.log("verbose", "[mcl_signs] Sign Glow Success.") + end + itemstack:take_item() + end + return + end + + -- "mcl_dye:black" is a special case: it makes the sign's lettering black AND removes glow. + if (iname == "mcl_dye:black") then + clicker:set_wielded_item(item) + local success = mcl_signs:glow_sign(pos, true) + mcl_signs:color_sign(pos, mcl_colors.BLACK) + if success then + if DEBUG then + minetest.log("verbose", "[mcl_signs] Sign Glow removal Success.") + end + + itemstack:take_item() + end + return + end + + -- check the wielded item to make sure that it is a dye. + local txt_color = mcl_signs:get_color_for_sign(iname) + if txt_color ~= "false" then + clicker:set_wielded_item(item) + local success = mcl_signs:color_sign(pos, txt_color) + if success then + if DEBUG then + minetest.log("verbose", "[mcl_signs] Sign Color Success.") + end + itemstack:take_item() + end + end + end + end, + + _mcl_hardness = 1, + _mcl_blast_resistance = 1, +} +-- standing sign base (definition) +mcl_signs.standing_standard = { + paramtype = "light", + use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, + sunlight_propagates = true, + walkable = false, + is_ground_content = false, + paramtype2 = "facedir", + drawtype = "mesh", + mesh = "mcl_signs_sign.obj", + selection_box = { type = "fixed", fixed = { -0.2, -0.5, -0.2, 0.2, 0.5, 0.2 } }, + tiles = { "mcl_signs_sign.png" }, + groups = mcl_signs.sign_groups, + drop = "mcl_signs:wall_sign", + stack_max = 16, + sounds = node_sounds, + + on_destruct = function(pos) + mcl_signs:destruct_sign(pos) + end, + + on_timer = function(pos) + -- fix for /ClearObjects + mcl_signs:update_sign(pos) + minetest.get_node_timer(pos):start(40.0) + end, + + -- Not Useless Code. this force updates the sign. + on_punch = function(pos, node, puncher) + mcl_signs:update_sign(pos) + end, + on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign22_5" + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end, + + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + + if DEBUG then + minetest.log("verbose", "[mcl_signs] Standing_Sign Right Click event.") + end + + -- make sure player is clicking + if not clicker or not clicker:is_player() then + return + end + + local item = clicker:get_wielded_item() + local iname = item:get_name() + + if node then + -- handle glow from glow_ink_sac *first* + if DEBUG then + minetest.log("verbose", "[mcl_signs] Standing_Sign Right Click event on valid node.") + end + + if (iname == "mcl_mobitems:glow_ink_sac") then + clicker:set_wielded_item(item) + local success = mcl_signs:glow_sign(pos) + if success then + if DEBUG then + minetest.log("verbose", "[mcl_signs] Sign Glow Success.") + end + itemstack:take_item() + end + return + end + + -- check the wielded item to make sure that it is a dye. + local txt_color = mcl_signs:get_color_for_sign(iname) + if txt_color ~= "false" then + clicker:set_wielded_item(item) + local success = mcl_signs:color_sign(pos, txt_color) + if success then + if DEBUG then + minetest.log("verbose", "[mcl_signs] Sign Color Success.") + end + itemstack:take_item() + end + end + end + end, + + _mcl_hardness = 1, + _mcl_blast_resistance = 1, +} + +-- HELPER FUNCTIONS' VARIABLES +local sign_glow = 6 +local Dyes_table = { + { "mcl_dye:aqua", mcl_colors_official.AQUA }, + { "mcl_dye:black", mcl_colors_official.BLACK }, + { "mcl_dye:blue", mcl_colors_official.BLUE }, + { "mcl_dye:brown", mcl_colors_official.brown }, + { "mcl_dye:cyan", mcl_signs.mcl_wool_colors.unicolor_cyan }, + { "mcl_dye:green", mcl_colors_official.GREEN }, + { "mcl_dye:dark_green", mcl_colors_official.DARK_GREEN }, + { "mcl_dye:grey", mcl_colors_official.GRAY }, + { "mcl_dye:dark_grey", mcl_colors_official.DARK_GRAY }, + { "mcl_dye:lightblue", mcl_signs.mcl_wool_colors.unicolor_light_blue }, + { "mcl_dye:lime", mcl_signs.unicolor_green_or_lime }, + { "mcl_dye:magenta", mcl_colors_official.LIGHT_PURPLE }, + { "mcl_dye:orange", mcl_signs.mcl_wool_colors.unicolor_orange }, + { "mcl_dye:pink", mcl_signs.mcl_wool_colors.unicolor_light_red_pink }, + { "mcl_dye:purple", mcl_colors_official.LIGHT_PURPLE }, + { "mcl_dye:red", mcl_signs.mcl_wool_colors.unicolor_red }, + { "mcl_dye:silver", mcl_signs.mcl_wool_colors.unicolor_grey }, + { "mcl_dye:violet", mcl_colors_official.DARK_PURPLE }, + { "mcl_dye:white", mcl_colors_official.WHITE }, + { "mcl_dye:yellow", mcl_colors_official.YELLOW }, +} + +local function update_sign_registry(type, name) + if type == "wall" then + table.insert(mcl_signs.registered_signs.wall_signs, name) + end + if type == "standing" then + table.insert(mcl_signs.registered_signs.standing_signs, name) + end + if type == "hanging" then + table.insert(mcl_signs.registered_signs.hanging_signs, name) + end +end + +function mcl_signs.make_lbm() + + local registered_sign_nodenames = {} + + for i = 0, #mcl_signs.registered_signs.wall_signs do + table.insert(registered_sign_nodenames, mcl_signs.registered_signs.wall_signs[i]) + end + + for i = 0, #mcl_signs.registered_signs.standing_signs do + table.insert(registered_sign_nodenames, mcl_signs.registered_signs.standing_signs[i]) + end + + for i = 0, #mcl_signs.registered_signs.hanging_signs do + table.insert(registered_sign_nodenames, mcl_signs.registered_signs.hanging_signs[i]) + end + + -- the above is not yet used. + minetest.register_lbm({ + name = "mcl_signs:respawn_entities", + label = "Respawn sign text entities", + run_at_every_load = true, + nodenames = registered_sign_nodenames, + action = function(pos, node) + mcl_signs:update_sign(pos) + end, + }) + +end + +function mcl_signs.register_dye (modname, item_name, color_code) + if minetest.get_modpath(modname) then + table.insert(Dyes_table, { item_name, color_code }) + end +end + +--- Register a new sign, tint the textures, and gives it an unique node name. Creates both wall and standing signs. +--- modname: optional (pass "" or "false" to ignore), for use with other mods to +--- allow the creation of a sign from the mod's wood (if installed). +--- +--- color: the color code to color the base sign textures. must be a valid html color code. +--- +--- _name: the sign's name suffix, such as "_dark" or "_red", etc., appended to "wall_sign" or "standing_sign" +--- +--- ttsign: the tool tip of the sign that gets translated. Shown when the mouse hovers the inventory sign. +--- For example: the basic, default oak (wood) sign is just "Sign"; and a spruce sign would be "Spruce Sign" +function mcl_signs.register_sign (modname, color, _name, ttsign) + local mod_name_pass = false + if modname ~= "" and modname ~= "false" then + if minetest.get_modpath(modname) then + mod_name_pass = true + end + if mod_name_pass == false then + return + end + end + local new_sign = {} + + if color == nil or color == "" then + color = "#FFFFFF" + end + + new_sign = table.copy(mcl_signs.wall_standard) + new_sign.description = S(ttsign) + + new_sign.wield_image = "(default_sign.png^[multiply:" .. color .. ")" + new_sign.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } + new_sign.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" + + -- currently have to do this, because of how the base node placement works. + new_sign.on_place = function(itemstack, placer, pointed_thing) + local above = pointed_thing.above + local under = pointed_thing.under + + -- Use pointed node's on_rightclick function first, if present + local node_under = minetest.get_node(under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then + return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack + end + end + + local dir = vector.subtract(under, above) + + -- Only build when it's legal + local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] + if not abovenodedef or abovenodedef.buildable_to == false then + return itemstack + end + + local wdir = minetest.dir_to_wallmounted(dir) + local fdir = minetest.dir_to_facedir(dir) + + local sign_info + local nodeitem = ItemStack(itemstack) + + local yaw = 0 + + -- Ceiling + if wdir == 0 then + --how would you add sign to ceiling? simple - hanging sign. + -- add code for placement underneath a node. + + return itemstack + -- Floor + elseif wdir == 1 then + -- Standing sign + + -- Determine the sign rotation based on player's yaw + yaw = pi * 2 - placer:get_look_horizontal() + + -- Select one of 16 possible rotations (0-15) + local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) + + if rotation_level > 15 then + rotation_level = 0 + elseif rotation_level < 0 then + rotation_level = 15 + end + + -- The actual rotation is a combination of predefined mesh and facedir (see node definition) + if rotation_level % 4 == 0 then + nodeitem:set_name("mcl_signs:standing_sign" .. _name) + elseif rotation_level % 4 == 1 then + nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) + elseif rotation_level % 4 == 2 then + nodeitem:set_name("mcl_signs:standing_sign45" .. _name) + elseif rotation_level % 4 == 3 then + nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) + end + fdir = math.floor(rotation_level / 4) + + -- Place the node! + local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) + if not success then + return itemstack + end + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] + -- Side + else + -- Wall sign + local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) + if not success then + return itemstack + end + sign_info = mcl_signs.signtext_info_wall[fdir + 1] + end + + -- Determine spawn position of entity + local place_pos + if minetest.registered_nodes[node_under.name].buildable_to then + place_pos = under + else + place_pos = above + end + + if DEBUG then + minetest.log("action", "[mcl_signs] Register_Sign::Placed position:" .. dump(place_pos) .. "\nSign_info: " .. dump(sign_info)) + end + + local text_entity = minetest.add_entity({ + x = place_pos.x + sign_info.delta.x, + y = place_pos.y + sign_info.delta.y, + z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") + text_entity:set_yaw(sign_info.yaw) + text_entity:get_luaentity()._signnodename = nodeitem:get_name() + + minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) + + mcl_signs:show_formspec(placer, place_pos) + return itemstack + end + + minetest.register_node(":mcl_signs:wall_sign" .. _name, new_sign) + update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) + + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Registered: mcl_signs:wall_sign" .. _name .. color .. "\n" .. dump(new_sign)) + minetest.log("action", "[mcl_signs] mcl_signs:wall_sign_standard\n" .. dump(mcl_signs.wall_standard)) + end + + -- standing sign base. + local new_sign_standing = {} + new_sign_standing = table.copy(mcl_signs.standing_standard) + new_sign_standing.drop = "mcl_signs:wall_sign" .. _name + new_sign_standing.wield_image = "(default_sign.png^[multiply:" .. color .. ")" + new_sign_standing.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } + new_sign_standing.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" + + new_sign_standing.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign22_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end, + + minetest.register_node(":mcl_signs:standing_sign" .. _name, new_sign_standing) + update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Registered: mcl_signs:standing_sign" .. _name .. color .. "\n" .. dump(new_sign_standing)) + end + + -- 22.5° + local ssign22_5d = table.copy(new_sign_standing) + ssign22_5d.mesh = "mcl_signs_sign22.5.obj" + ssign22_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign45" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.register_node(":mcl_signs:standing_sign22_5" .. _name, ssign22_5d) + update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) + + -- 45° + local ssign45d = table.copy(new_sign_standing) + ssign45d.mesh = "mcl_signs_sign45.obj" + ssign45d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign67_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.register_node(":mcl_signs:standing_sign45" .. _name, ssign45d) + update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) + + -- 67.5° + local ssign67_5d = table.copy(new_sign_standing) + ssign67_5d.mesh = "mcl_signs_sign67.5.obj" + ssign67_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign" .. _name + node.param2 = (node.param2 + 1) % 4 + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.register_node(":mcl_signs:standing_sign67_5" .. _name, ssign67_5d) + update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) + + -- register Doc entry + if minetest.get_modpath("doc") then + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) + end + + --register standing sign's rotation_levels + 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 }) +end + +--- The same as register_sign, except caller defines the textures. Note, there is a greyscale version of the sign, +--- called "default_sign_greyscale.png" and "mcl_signs_sign_greyscale.png" for optional use in the textures directory. +--- +--- modname: optional (pass "" or "false" to ignore), for use with other mods to +--- allow the creation of a sign from the mod's wood (if installed). +--- +--- _name: the sign's name suffix, such as "_dark" or "_red", etc., appended to "wall_sign" or "standing_sign" +--- +--- tiles: the texture file to use for the sign. +--- +--- color: color the texture file to use with this color. Use white (#FFFFFF) to negate the color, +--- and just use the texture as is +--- +--- inventory_image: the texture file to use for the sign's display in inventory. +--- +--- wield_image: the texture file to use for the sign's weilded (in hand) object. +--- +--- inventory_image: the image used for in-inventory and in hand. +--- +--- ttsign: the tool tip of the sign that gets translated. Shown when the mouse hovers the inventory sign. +--- For example: the basic, default oak (wood) sign is just "Sign"; and a spruce sign would be "Spruce Sign" +function mcl_signs.register_sign_custom (modname, _name, tiles, color, inventory_image, wield_image, ttsign) + local mod_name_pass = false + if modname ~= "" and modname ~= "false" then + if minetest.get_modpath(modname) then + mod_name_pass = true + end + if mod_name_pass == false then + return + end + end + local new_sign = {} + + new_sign = table.copy(mcl_signs.wall_standard) + + new_sign.wield_image = "(" .. wield_image .. "^[multiply:" .. color .. ")" + new_sign.tiles = { "(" .. tiles .. "^[multiply:" .. color .. ")" } + new_sign.inventory_image = "(" .. inventory_image .. "^[multiply:" .. color .. ")" + new_sign.description = S(ttsign) + -- currently have to do this, because of how the base node placement works. + new_sign.on_place = function(itemstack, placer, pointed_thing) + local above = pointed_thing.above + local under = pointed_thing.under + + -- Use pointed node's on_rightclick function first, if present + local node_under = minetest.get_node(under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then + return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack + end + end + + local dir = vector.subtract(under, above) + + -- Only build when it's legal + local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] + if not abovenodedef or abovenodedef.buildable_to == false then + return itemstack + end + + local wdir = minetest.dir_to_wallmounted(dir) + local fdir = minetest.dir_to_facedir(dir) + + local sign_info + local nodeitem = ItemStack(itemstack) + -- Ceiling + if wdir == 0 then + --how would you add sign to ceiling? + return itemstack + -- Floor + elseif wdir == 1 then + -- Standing sign + + -- Determine the sign rotation based on player's yaw + local yaw = pi * 2 - placer:get_look_horizontal() + + -- Select one of 16 possible rotations (0-15) + local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) + + if rotation_level > 15 then + rotation_level = 0 + elseif rotation_level < 0 then + rotation_level = 15 + end + + -- The actual rotation is a combination of predefined mesh and facedir (see node definition) + if rotation_level % 4 == 0 then + nodeitem:set_name("mcl_signs:standing_sign" .. _name) + elseif rotation_level % 4 == 1 then + nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) + elseif rotation_level % 4 == 2 then + nodeitem:set_name("mcl_signs:standing_sign45" .. _name) + elseif rotation_level % 4 == 3 then + nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) + end + fdir = math.floor(rotation_level / 4) + + -- Place the node! + local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) + if not success then + return itemstack + end + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] + -- Side + else + -- Wall sign + local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) + if not success then + return itemstack + end + sign_info = mcl_signs.signtext_info_wall[fdir + 1] + end + + -- Determine spawn position of entity + local place_pos + if minetest.registered_nodes[node_under.name].buildable_to then + place_pos = under + else + place_pos = above + end + + local text_entity = minetest.add_entity({ + x = place_pos.x + sign_info.delta.x, + y = place_pos.y + sign_info.delta.y, + z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") + text_entity:set_yaw(sign_info.yaw) + text_entity:get_luaentity()._signnodename = nodeitem:get_name() + + minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) + + mcl_signs:show_formspec(placer, place_pos) + return itemstack + end + minetest.register_node(":mcl_signs:wall_sign" .. _name, new_sign) + update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) + + -- standing sign base. + local new_sign_standing = {} + new_sign_standing = table.copy(mcl_signs.standing_standard) + new_sign_standing.drop = "mcl_signs:wall_sign" .. _name + new_sign_standing.wield_image = "(" .. wield_image .. "^[multiply:" .. color .. ")" + new_sign_standing.tiles = { "(" .. tiles .. "^[multiply:" .. color .. ")" } + new_sign_standing.inventory_image = "(" .. inventory_image .. "^[multiply:" .. color .. ")" + new_sign_standing.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign22_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end, + minetest.register_node(":mcl_signs:standing_sign" .. _name, new_sign_standing) + update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) + + -- 22.5° + local ssign22_5d = table.copy(new_sign_standing) + ssign22_5d.mesh = "mcl_signs_sign22.5.obj" + ssign22_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign45" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.register_node(":mcl_signs:standing_sign22_5" .. _name, ssign22_5d) + update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) + + -- 45° + local ssign45d = table.copy(new_sign_standing) + ssign45d.mesh = "mcl_signs_sign45.obj" + ssign45d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign67_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.register_node(":mcl_signs:standing_sign45" .. _name, ssign45d) + update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) + + -- 67.5° + local ssign67_5d = table.copy(new_sign_standing) + ssign67_5d.mesh = "mcl_signs_sign67.5.obj" + ssign67_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign" .. _name + node.param2 = (node.param2 + 1) % 4 + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.register_node(":mcl_signs:standing_sign67_5" .. _name, ssign67_5d) + update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) + + -- register Doc entry + if minetest.get_modpath("doc") then + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) + end + + --register standing sign's rotation_levels + 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 }) + +end + +--- Override an existing sign, tint the textures, and gives it an unique node name. Creates both wall and standing signs. +--- modname: optional (pass "" or "false" to ignore), for use with other mods to +--- allow the creation of a sign from the mod's wood (if installed). +--- +--- color: the color code to color the base sign textures. must be a valid html color code. +--- +--- _name: the sign's name suffix, such as "_dark" or "_red", etc., appended to "wall_sign" or "standing_sign" +--- +--- ttsign: the tool tip of the sign that gets translated. Shown when the mouse hovers the inventory sign. +--- For example: the basic, default oak (wood) sign is just "Sign"; and a spruce sign would be "Spruce Sign" +function mcl_signs.reregister_sign (modname, color, _name, ttsign) + local mod_name_pass = false + if modname ~= "" and modname ~= "false" then + if minetest.get_modpath(modname) then + mod_name_pass = true + end + if mod_name_pass == false then + return + end + end + local new_sign = {} + + if color == nil or color == "" then + color = "#FFFFFF" + end + + new_sign = table.copy(mcl_signs.wall_standard) + new_sign.description = S(ttsign) + + new_sign.wield_image = "(default_sign.png^[multiply:" .. color .. ")" + new_sign.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } + new_sign.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" + + -- currently have to do this, because of how the base node placement works. + new_sign.on_place = function(itemstack, placer, pointed_thing) + local above = pointed_thing.above + local under = pointed_thing.under + + -- Use pointed node's on_rightclick function first, if present + local node_under = minetest.get_node(under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then + return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack + end + end + + local dir = vector.subtract(under, above) + + -- Only build when it's legal + local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] + if not abovenodedef or abovenodedef.buildable_to == false then + return itemstack + end + + local wdir = minetest.dir_to_wallmounted(dir) + local fdir = minetest.dir_to_facedir(dir) + + local sign_info + local nodeitem = ItemStack(itemstack) + -- Ceiling + if wdir == 0 then + --how would you add sign to ceiling? + return itemstack + -- Floor + elseif wdir == 1 then + -- Standing sign + + -- Determine the sign rotation based on player's yaw + local yaw = pi * 2 - placer:get_look_horizontal() + + -- Select one of 16 possible rotations (0-15) + local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) + + if rotation_level > 15 then + rotation_level = 0 + elseif rotation_level < 0 then + rotation_level = 15 + end + + -- The actual rotation is a combination of predefined mesh and facedir (see node definition) + if rotation_level % 4 == 0 then + nodeitem:set_name("mcl_signs:standing_sign" .. _name) + elseif rotation_level % 4 == 1 then + nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) + elseif rotation_level % 4 == 2 then + nodeitem:set_name("mcl_signs:standing_sign45" .. _name) + elseif rotation_level % 4 == 3 then + nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) + end + fdir = math.floor(rotation_level / 4) + + -- Place the node! + local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) + if not success then + return itemstack + end + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] + -- Side + else + -- Wall sign + local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) + if not success then + return itemstack + end + sign_info = mcl_signs.signtext_info_wall[fdir + 1] + end + + -- Determine spawn position of entity + local place_pos + if minetest.registered_nodes[node_under.name].buildable_to then + place_pos = under + else + place_pos = above + end + + if DEBUG then + minetest.log("action", "[mcl_signs] Register_Sign::Placed position:" .. dump(place_pos) .. "\nSign_info: " .. dump(sign_info)) + end + + local text_entity = minetest.add_entity({ + x = place_pos.x + sign_info.delta.x, + y = place_pos.y + sign_info.delta.y, + z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") + text_entity:set_yaw(sign_info.yaw) + text_entity:get_luaentity()._signnodename = nodeitem:get_name() + + minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) + + mcl_signs:show_formspec(placer, place_pos) + return itemstack + end + + minetest.override_item("mcl_signs:wall_sign" .. _name, new_sign) + update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) + + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Registered: mcl_signs:wall_sign" .. _name .. color .. "\n" .. dump(new_sign)) + minetest.log("action", "[mcl_signs] mcl_signs:wall_sign_standard\n" .. dump(mcl_signs.wall_standard)) + end + + -- standing sign base. + local new_sign_standing = {} + new_sign_standing = table.copy(mcl_signs.standing_standard) + new_sign_standing.drop = "mcl_signs:wall_sign" .. _name + new_sign_standing.wield_image = "(default_sign.png^[multiply:" .. color .. ")" + new_sign_standing.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } + new_sign_standing.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" + new_sign_standing.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign22_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end, + minetest.override_item("mcl_signs:standing_sign" .. _name, new_sign_standing) + update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Registered: mcl_signs:standing_sign" .. _name .. color .. "\n" .. dump(new_sign_standing)) + end + + -- 22.5° + local ssign22_5d = table.copy(new_sign_standing) + ssign22_5d.mesh = "mcl_signs_sign22.5.obj" + ssign22_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign45" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.override_item("mcl_signs:standing_sign22_5" .. _name, ssign22_5d) + update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) + + -- 45° + local ssign45d = table.copy(new_sign_standing) + ssign45d.mesh = "mcl_signs_sign45.obj" + ssign45d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign67_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.override_item("mcl_signs:standing_sign45" .. _name, ssign45d) + update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) + + -- 67.5° + local ssign67_5d = table.copy(new_sign_standing) + ssign67_5d.mesh = "mcl_signs_sign67.5.obj" + ssign67_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign" .. _name + node.param2 = (node.param2 + 1) % 4 + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.override_item("mcl_signs:standing_sign67_5" .. _name, ssign67_5d) + update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) + + -- register Doc entry + if minetest.get_modpath("doc") then + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) + end + + --register standing sign's rotation_levels + 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 }) +end + +--- The same as reregister_sign, except caller defines the textures. Note, there is a greyscale version of the sign, +--- called "default_sign_greyscale.png" and "mcl_signs_sign_greyscale.png" for optional use in the textures directory. +--- +--- modname: optional (pass "" or "false" to ignore), for use with other mods to +--- allow the creation of a sign from the mod's wood (if installed). +--- +--- _name: the sign's name suffix, such as "_dark" or "_red", etc., appended to "wall_sign" or "standing_sign" +--- +--- tiles: the texture file to use for the sign. +--- +--- color: color the texture file to use with this color. Use white (#FFFFFF) to negate the color, +--- and just use the texture as is +--- +--- inventory_image: the texture file to use for the sign's display in inventory. +--- +--- wield_image: the texture file to use for the sign's weilded (in hand) object. +--- +--- inventory_image: the image used for in-inventory and in hand. +--- +--- ttsign: the tool tip of the sign that gets translated. Shown when the mouse hovers the inventory sign. +--- For example: the basic, default oak (wood) sign is just "Sign"; and a spruce sign would be "Spruce Sign" +function mcl_signs.reregister_sign_custom (modname, _name, tiles, color, inventory_image, wield_image, ttsign) + local mod_name_pass = false + if modname ~= "" and modname ~= "false" then + if minetest.get_modpath(modname) then + mod_name_pass = true + end + if mod_name_pass == false then + return + end + end + local new_sign = {} + + new_sign = table.copy(mcl_signs.wall_standard) + + new_sign.wield_image = "(" .. wield_image .. "^[multiply:" .. color .. ")" + new_sign.tiles = { "(" .. tiles .. "^[multiply:" .. color .. ")" } + new_sign.inventory_image = "(" .. inventory_image .. "^[multiply:" .. color .. ")" + new_sign.description = S(ttsign) + -- currently have to do this, because of how the base node placement works. + new_sign.on_place = function(itemstack, placer, pointed_thing) + local above = pointed_thing.above + local under = pointed_thing.under + + -- Use pointed node's on_rightclick function first, if present + local node_under = minetest.get_node(under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then + return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack + end + end + + local dir = vector.subtract(under, above) + + -- Only build when it's legal + local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] + if not abovenodedef or abovenodedef.buildable_to == false then + return itemstack + end + + local wdir = minetest.dir_to_wallmounted(dir) + local fdir = minetest.dir_to_facedir(dir) + + local sign_info + local nodeitem = ItemStack(itemstack) + -- Ceiling + if wdir == 0 then + --how would you add sign to ceiling? + return itemstack + -- Floor + elseif wdir == 1 then + -- Standing sign + + -- Determine the sign rotation based on player's yaw + local yaw = pi * 2 - placer:get_look_horizontal() + + -- Select one of 16 possible rotations (0-15) + local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) + + if rotation_level > 15 then + rotation_level = 0 + elseif rotation_level < 0 then + rotation_level = 15 + end + + -- The actual rotation is a combination of predefined mesh and facedir (see node definition) + if rotation_level % 4 == 0 then + nodeitem:set_name("mcl_signs:standing_sign" .. _name) + elseif rotation_level % 4 == 1 then + nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) + elseif rotation_level % 4 == 2 then + nodeitem:set_name("mcl_signs:standing_sign45" .. _name) + elseif rotation_level % 4 == 3 then + nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) + end + fdir = math.floor(rotation_level / 4) + + -- Place the node! + local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) + if not success then + return itemstack + end + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] + -- Side + else + -- Wall sign + local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) + if not success then + return itemstack + end + sign_info = mcl_signs.signtext_info_wall[fdir + 1] + end + + -- Determine spawn position of entity + local place_pos + if minetest.registered_nodes[node_under.name].buildable_to then + place_pos = under + else + place_pos = above + end + + local text_entity = minetest.add_entity({ + x = place_pos.x + sign_info.delta.x, + y = place_pos.y + sign_info.delta.y, + z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") + text_entity:set_yaw(sign_info.yaw) + text_entity:get_luaentity()._signnodename = nodeitem:get_name() + + minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) + + mcl_signs:show_formspec(placer, place_pos) + return itemstack + end + minetest.override_item("mcl_signs:wall_sign" .. _name, new_sign) + update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) + + -- standing sign base. + local new_sign_standing = {} + new_sign_standing = table.copy(mcl_signs.standing_standard) + new_sign_standing.drop = "mcl_signs:wall_sign" .. _name + new_sign_standing.wield_image = "(" .. wield_image .. "^[multiply:" .. color .. ")" + new_sign_standing.tiles = { "(" .. tiles .. "^[multiply:" .. color .. ")" } + new_sign_standing.inventory_image = "(" .. inventory_image .. "^[multiply:" .. color .. ")" + new_sign_standing.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign22_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end, + minetest.override_item("mcl_signs:standing_sign" .. _name, new_sign_standing) + update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) + + -- 22.5° + local ssign22_5d = table.copy(new_sign_standing) + ssign22_5d.mesh = "mcl_signs_sign22.5.obj" + ssign22_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign45" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.override_item("mcl_signs:standing_sign22_5" .. _name, ssign22_5d) + update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) + + -- 45° + local ssign45d = table.copy(new_sign_standing) + ssign45d.mesh = "mcl_signs_sign45.obj" + ssign45d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign67_5" .. _name + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.override_item("mcl_signs:standing_sign45" .. _name, ssign45d) + update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) + + -- 67.5° + local ssign67_5d = table.copy(new_sign_standing) + ssign67_5d.mesh = "mcl_signs_sign67.5.obj" + ssign67_5d.on_rotate = function(pos, node, user, mode) + if mode == screwdriver.ROTATE_FACE then + node.name = "mcl_signs:standing_sign" .. _name + node.param2 = (node.param2 + 1) % 4 + minetest.swap_node(pos, node) + elseif mode == screwdriver.ROTATE_AXIS then + return false + end + mcl_signs:update_sign(pos, nil, nil, true) + return true + end + minetest.override_item("mcl_signs:standing_sign67_5" .. _name, ssign67_5d) + update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) + + -- register Doc entry + if minetest.get_modpath("doc") then + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) + doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) + end + + --register standing sign's rotation_levels + 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 }) + +end + +--- Usage: Call this with the mod's name, the wood's item string (for the planks), and with the sign's suffix. +--- Registers the crafting recipe for that sign. for every registered sign, call this function to register the +--- standard recipe for the sign. Otherwise, you have to do your own register craft call. +--- +--- modname: optional (pass "" or "false" to ignore), for use with other mods to +--- allow the creation of a sign from the mod's wood (if installed). Example: "mcl_core". +--- +--- wood_item_string: example: "mcl_core:wood" or "mcl_core:sprucewood" +--- +--- _name: the sign's name suffix, such as "_dark" or "_red", etc., appended to "wall_sign" or "standing_sign" +function mcl_signs.register_sign_craft(modname, wood_item_string, _name) + local mod_name_pass = false + if modname ~= "" and modname ~= "false" then + if minetest.get_modpath(modname) then + mod_name_pass = true + end + if mod_name_pass == false then + return + end + end + + minetest.register_craft({ + type = "fuel", + recipe = "mcl_signs:wall_sign" .. _name, + burntime = 10, + }) + + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Register Sign Crafts: \n" .. modname .. "\n" .. wood_item_string .. "\n" .. _name) + end + + -- register crafts (actual recipe) + if minetest.get_modpath(modname) then + + local itemstring = "mcl_signs:wall_sign" + + minetest.register_craft({ + output = itemstring .. _name .. " 3", + recipe = { + { wood_item_string, wood_item_string, wood_item_string }, + { wood_item_string, wood_item_string, wood_item_string }, + { "", "mcl_core:stick", "" }, + }, + }) + end +end + +function mcl_signs.register_hanging_sign_craft(modname, wood_item_string, _name) + local mod_name_pass = false + if modname ~= "" and modname ~= "false" then + if minetest.get_modpath(modname) then + mod_name_pass = true + end + if mod_name_pass == false then + return + end + end + + minetest.register_craft({ + type = "fuel", + recipe = ":mcl_signs:wall_sign" .. _name, + burntime = 10, + }) + + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Register Sign Crafts: \n" .. modname .. "\n" .. wood_item_string .. "\n" .. _name) + end + + -- register crafts (actual recipe) + if minetest.get_modpath(modname) then + + local itemstring = ":mcl_signs:hanging_sign" + local quantity = "6" + + local bamboo = string.find(wood_item_string, "bamboo") + if bamboo then + quantity = "2" + end + minetest.register_craft({ + output = itemstring .. _name .. " " .. quantity, + recipe = { + { "mcl_lanterns:chain", "", "mcl_lanterns:chain" }, + { wood_item_string, wood_item_string, wood_item_string }, + { wood_item_string, wood_item_string, wood_item_string }, + }, + }) + end +end + +-- Helper functions +local function string_to_array(str) + local string_table = {} + for i = 1, string.len(str) do + table.insert(string_table, string.sub(str, i, i)) + end + return string_table +end + +local function string_to_line_array(str) + local linechar_table = {} + local current = 1 + local linechar = 1 + linechar_table[1] = "" + for _, char in ipairs(string_to_array(str)) do + -- New line + if char == "\n" then + current = current + 1 + linechar_table[current] = "" + linechar = 1 + else + linechar_table[current] = linechar_table[current] .. char + linechar = linechar + 1 + end + end + return linechar_table +end + +local function get_rotation_level(facedir, nodename) + local nnames = mcl_signs.standing_rotation_levels -- functional copy... was easier this way. #LazyAF :P + + local rl + local offset = 0 + for x = 1, #nnames do + if nnames[x][1] == nodename then + offset = nnames[x][2] + break + end + end + rl = facedir * 4 + offset + if DEBUG then + minetest.log("action", "[mcl_signs] GetRotationLevel: NodeName: " .. nodename .. " RL value: " .. rl) + end + return rl +end + +function mcl_signs:round(num, idp) + local mult = 10 ^ (idp or 0) + return math.floor(num * mult + 0.5) / mult +end + +function mcl_signs:get_color_for_sign(item_name) + + for d = 1, #Dyes_table do + if Dyes_table[d][1] == item_name then + return Dyes_table[d][2] + end + end + return "false" +end + +function mcl_signs:color_sign (pos, text_color) + + local success = mcl_signs:update_sign(pos, nil, nil, true, text_color) + + -- debug step + local meta = minetest.get_meta(pos) + if not meta then + minetest.log("error", "[mcl_signs] Sign Color Fail - Metadata.") + + return false + end + if DEBUG then + minetest.log("verbose", "[mcl_signs] Post-Sign Color: " .. meta:get_string("mcl_signs:text_color") .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) + end + + return success + +end + +function mcl_signs:glow_sign (pos, remove_glow) + local success = true + -- Get Meta Data for the sign. + local meta = minetest.get_meta(pos) + + if not meta then + return false + end + local text = meta:get_string("text") + if text == nil then + text = "" + end + + -- we can't make the text glow if there isn't any text + if text == "" then + return false + end + + if remove_glow == nil then + remove_glow = false + end + + -- set up text glow + local objects = minetest.get_objects_inside_radius(pos, 0.5) + local text_entity + for _, v in ipairs(objects) do + local ent = v:get_luaentity() + if ent and ent.name == "mcl_signs:text" then + text_entity = v + break + end + end + if remove_glow == true then + text_entity:set_properties({ + glow = nil, + }) + meta:set_string("mcl_signs:glowing_sign", "false") + else + text_entity:set_properties({ + glow = sign_glow, + }) + meta:set_string("mcl_signs:glowing_sign", "true") + end + if not text_entity then + return false + end + text_entity:get_luaentity()._glowing_sign = meta:get_string("mcl_signs:glowing_sign") + + -- debug step + if DEBUG then + minetest.log("verbose", "[mcl_signs] Post-Sign Glow: " .. meta:get_string("mcl_signs:text_color") .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) + end + return success +end + +function mcl_signs:create_lettering(text, signnodename, sign_color) + if sign_color == nil then + sign_color = mcl_colors.BLACK + end + local texture = mcl_signs:generate_texture(mcl_signs:create_lines(text), signnodename, sign_color) + + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Creating sign text; text:" .. text) + end + + return texture +end + +function mcl_signs:create_lines(text) + local line_num = 1 + local text_table = {} + for _, line in ipairs(string_to_line_array(text)) do + if line_num > NUMBER_OF_LINES then + break + end + table.insert(text_table, line) + line_num = line_num + 1 + end + return text_table +end + +function mcl_signs:generate_line(s, ypos) + local i = 1 + local parsed = {} + local width = 0 + local chars = 0 + local printed_char_width = CHAR_WIDTH + 1 + while chars < LINE_LENGTH and i <= #s do + local file + -- Get and render character + if charmap[s:sub(i, i)] then + file = charmap[s:sub(i, i)] + i = i + 1 + elseif i < #s and charmap[s:sub(i, i + 1)] then + file = charmap[s:sub(i, i + 1)] + i = i + 2 + else + -- No character image found. + -- Use replacement character: + file = "_rc" + i = i + 1 + if DEBUG then + minetest.log("verbose", "[mcl_signs] Unknown symbol in '" .. s .. "' at " .. i) + end + end + if file then + width = width + printed_char_width + table.insert(parsed, file) + chars = chars + 1 + end + end + width = width - 1 + + local texture = "" + local xpos = math.floor((SIGN_WIDTH - width) / 2) + + for j = 1, #parsed do + texture = texture .. ":" .. xpos .. "," .. ypos .. "=" .. parsed[j] .. ".png" + xpos = xpos + printed_char_width + end + return texture +end + +function mcl_signs:generate_texture(lines, signnodename, letter_color) + local texture = "[combine:" .. SIGN_WIDTH .. "x" .. SIGN_WIDTH + local ypos = 0 + + -- Handle all of the dynamically created signs. + for x = 1, #mcl_signs.registered_signs.wall_signs do + if signnodename == mcl_signs.registered_signs.wall_signs[x] then + ypos = 30 + break + end + end + for x = 1, #mcl_signs.registered_signs.standing_signs do + if signnodename == mcl_signs.registered_signs.standing_signs[x] then + ypos = 0 + break + end + end + -- for future inclusion, when the hanging sings are made. + --[[ + for x = 1, #mcl_signs.registered_signs.hanging_signs do + if signnodename == mcl_signs.registered_signs.hanging_signs[x] then + ypos = 30 + break + end + end + ]] + + -- kept in for now, compatibility with existing hard coded signs. TODO: Remove after done with api. + if signnodename == "mcl_signs:wall_sign" or signnodename == "mcl_signs:wall_sign_dark" then + ypos = 30 + end + + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Generate_Texture::Debug_Data:\nSignNodeName: " .. dump(signnodename) .. "\nYPOS: " .. ypos) + end + + for i = 1, #lines do + texture = texture .. mcl_signs:generate_line(lines[i], ypos) + ypos = ypos + LINE_HEIGHT + end + + texture = "(" .. texture .. "^[multiply:" .. letter_color .. ")" + return texture +end + +function mcl_signs:get_wall_signtext_info(param2, nodename) + local dir = minetest.wallmounted_to_dir(param2) + if dir.x > 0 then + return 2 + elseif dir.z > 0 then + return 1 + elseif dir.x < 0 then + return 4 + else + return 3 + end +end + +function mcl_signs:destruct_sign(pos) + local objects = minetest.get_objects_inside_radius(pos, 0.5) + for _, v in ipairs(objects) do + local ent = v:get_luaentity() + if ent and ent.name == "mcl_signs:text" then + v:remove() + end + end + local players = minetest.get_connected_players() + for p = 1, #players do + if vector.distance(players[p]:get_pos(), pos) <= 30 then + minetest.close_formspec(players[p]:get_player_name(), "mcl_signs:set_text_" .. pos.x .. "_" .. pos.y .. "_" .. pos.z) + end + end +end + +function mcl_signs:update_sign(pos, fields, sender, force_remove, text_color) + -- Get Meta Data for the sign. + local meta = minetest.get_meta(pos) + + if not meta then + return false + end + local text = meta:get_string("text", "") + if fields and (text == "" and fields.text) then + meta:set_string("text", fields.text) + text = fields.text + end + if text == nil then + text = "" + end + + -- find text color. + local sign_color + + if meta:get_string("mcl_signs:text_color") == "" then + -- if no sign text color has been assigned, make it black. + sign_color = mcl_colors.BLACK + meta:set_string("mcl_signs:text_color", sign_color) + else + sign_color = meta:get_string("mcl_signs:text_color") + end + + if text_color == nil or text == "" then + text_color = "false" + end + + if text_color == "false" then + text_color = sign_color --if a new color hasn't been chosen, then keep the existing color. + end + + -- find the sign's glow value + local has_glow = false + + if meta:get_string("mcl_signs:glowing_sign") == "" or meta:get_string("mcl_signs:glowing_sign") == "false" then + has_glow = false + meta:set_string("mcl_signs:glowing_sign", "false") + else + has_glow = true + end + + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Update_Signs: Pre-Sign Update: " .. sign_color .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) + end + + local sign_info + local npos = minetest.get_node(pos) + local npos_name = npos.name + + -- Handle all of the dynamically created signs. + for x = 1, #mcl_signs.registered_signs.wall_signs do + if npos_name == mcl_signs.registered_signs.wall_signs[x] then + sign_info = mcl_signs.signtext_info_wall[mcl_signs:get_wall_signtext_info(npos.param2)] + break + end + end + for x = 1, #mcl_signs.registered_signs.standing_signs do + if npos_name == mcl_signs.registered_signs.standing_signs[x] then + sign_info = mcl_signs.signtext_info_standing[get_rotation_level(npos.param2, npos_name) + 1] + break + end + end + -- for future inclusion, when the hanging sings are made. + --[[ + for x = 1, #mcl_signs.registered_signs.hanging_signs do + if nn == mcl_signs.registered_signs.hanging_signs[x] then + sign_info = mcl_signs.signtext_info_wall[mcl_signs:get_wall_signtext_info(n.param2)] + break + end + end + ]] + + -- the following if..elseif..end block is here for compatibility with the old code. TODO: remove this block after the new api is complete. + if npos_name == "mcl_signs:standing_sign_dark" or npos_name == "mcl_signs:standing_sign22_5_dark" or npos_name == "mcl_signs:standing_sign45_dark" or npos_name == "mcl_signs:standing_sign67_5_dark" then + sign_info = mcl_signs.signtext_info_standing[get_rotation_level(npos.param2, npos_name) + 1] + elseif npos_name == "mcl_signs:wall_sign_dark" then + sign_info = mcl_signs.signtext_info_wall[mcl_signs:get_wall_signtext_info(npos.param2)] + end + if sign_info == nil then + minetest.log("error", "[mcl_signs] Update_Signs: Missing sign_info!") + return false + end + + local text_entity + text_entity = mcl_signs:get_text_entity(pos,force_remove) + + if not text_entity then + if DEBUG then + minetest.log("action", "[mcl_signs] Update_Sign: Text_Entity - does not exist, creating it now.") + end + text_entity = minetest.add_entity({ + x = pos.x + sign_info.delta.x, + y = pos.y + sign_info.delta.y, + z = pos.z + sign_info.delta.z }, "mcl_signs:text") + + if DEBUG then + minetest.log("action", "[mcl_signs] Update_Sign: Placed position:" .. dump(pos) .. "\nSign_info: " .. dump(sign_info)) + end + end + text_entity:get_luaentity()._signnodename = npos_name + + -- set up special case: Dark Oak Sign. Dark Oak signs are soooo dark, they start off with white lettering. + if npos_name == "mcl_signs:wall_sign_darkwood" or + npos_name == "mcl_signs:standing_sign67_5_darkwood" or + npos_name == "mcl_signs:standing_sign45_darkwood" or + npos_name == "mcl_signs:standing_sign22_5_darkwood" or + npos_name == "mcl_signs:standing_sign_darkwood" + then + if text_color == "#000000" then + text_color = "#ffffff" + end + end + + -- Set the actual properties for the sign + + text_entity:set_properties({ + textures = { mcl_signs:create_lettering(text, npos_name, text_color) }, + }) + + if has_glow then + text_entity:set_properties({ + glow = sign_glow, + }) + end + + text_entity:set_yaw(sign_info.yaw) + if DEBUG then + minetest.log("verbose", "[mcl_signs] Update_Sign: After texture recreation.") + minetest.log("action", "[mcl_signs] Update_Sign: " .. npos_name .. "\nPlaced position:" .. dump(pos) .. "\nSign_info: " .. dump(sign_info)) + end + + -- save sign metadata. + meta:set_string("mcl_signs:text_color", text_color) + + -- Moved timer stuff to here, to make sure that it's called and only has one set of code. + local timer = minetest.get_node_timer(pos) + if text_entity and text ~= "" then + -- Do timer related stuff - but only if there is text to display. + -- Also, prevent excessive use with punching. (see node def.) + if timer:is_started() == false then + timer:start(TIMER_INTERVAL) + else + timer:stop() + timer:start(TIMER_INTERVAL) + end + else + if timer:is_started() == true then + timer:stop() + end + end + + -- debug step + if DEBUG then + minetest.log("action", "[mcl_signs] Update_Sign: Post-Sign Update: " .. meta:get_string("mcl_signs:text_color") .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) + end + + return true + +end + +function mcl_signs:show_formspec(player, pos) + minetest.show_formspec( + player:get_player_name(), + "mcl_signs:set_text_" .. pos.x .. "_" .. pos.y .. "_" .. pos.z, + "size[6,3]textarea[0.25,0.25;6,1.5;text;" .. F(S("Enter sign text:")) .. ";]label[0,1.5;" .. F(S("Maximum line length: 15")) .. "\n" .. F(S("Maximum lines: 4")) .. "]button_exit[0,2.5;6,1;submit;" .. F(S("Done")) .. "]" + ) +end + +function mcl_signs:get_text_entity (pos, force_remove) + local objects = minetest.get_objects_inside_radius(pos, 0.5) + local text_entity = false -- just to have a check for failure. + for _, v in ipairs(objects) do + local ent = v:get_luaentity() + if ent and ent.name == "mcl_signs:text" then + if force_remove ~= nil and force_remove == true then + v:remove() + else + text_entity = v + break + end + end + end + return text_entity +end \ No newline at end of file From 467700591bfdafdaacad287189b990f8033d8495 Mon Sep 17 00:00:00 2001 From: Michieal Date: Thu, 17 Nov 2022 23:33:31 +0000 Subject: [PATCH 45/47] revert 62fb34a029a78e74a4b768a30827961329719551 revert Fix the crafting recipes for the signs. --- signs_api.lua | 2003 ------------------------------------------------- 1 file changed, 2003 deletions(-) delete mode 100644 signs_api.lua diff --git a/signs_api.lua b/signs_api.lua deleted file mode 100644 index 1f7369ba3c..0000000000 --- a/signs_api.lua +++ /dev/null @@ -1,2003 +0,0 @@ ---- ---- Generated by EmmyLua. ---- Created by Michieal (FaerRaven). ---- DateTime: 10/14/22 4:05 PM ---- - ---local logging = minetest.settings:get_bool("mcl_logging_mcl_signs",true) - -local DEBUG = minetest.settings:get_bool("mcl_logging_mcl_signs", false) -- special debug setting. - -if DEBUG then - minetest.log("action", "[mcl_signs] Signs API Loading") -end - --- LOCALIZATION -local S = minetest.get_translator("mcl_signs") --- Signs form -local F = minetest.formspec_escape - --- PATHs -local modpath = minetest.get_modpath("mcl_signs") - --- CONSTANTS -local SIGN_WIDTH = 115 - -local LINE_LENGTH = 15 -local NUMBER_OF_LINES = 4 - -local LINE_HEIGHT = 14 -local CHAR_WIDTH = 5 -local TIMER_INTERVAL = 40.0 --- ----------------------- --- CACHE LOCAL COPIES -local table = table -local string = string - --- CACHE NODE_SOUNDS -local node_sounds -if minetest.get_modpath("mcl_sounds") then - node_sounds = mcl_sounds.node_sound_wood_defaults() -end - --- SET UP THE CHARACTER MAPPING --- Load the characters map (characters.txt) ---[[ File format of characters.txt: -It's an UTF-8 encoded text file that contains metadata for all supported characters. It contains a sequence of info - blocks, one for each character. Each info block is made out of 3 lines: -Line 1: The literal UTF-8 encoded character -Line 2: Name of the texture file for this character minus the “.png” suffix; found in the “textures/” sub-directory -Line 3: Currently ignored. Previously this was for the character width in pixels - -After line 3, another info block may follow. This repeats until the end of the file. - -All character files must be 5 or 6 pixels wide (5 pixels are preferred) -]] - -local chars_file = io.open(modpath .. "/characters.txt", "r") --- FIXME: Support more characters (many characters are missing). Currently ASCII and Latin-1 Supplement are supported. -local charmap = {} -if not chars_file then - minetest.log("error", "[mcl_signs] : character map file not found") -else - while true do - local char = chars_file:read("*l") - if char == nil then - break - end - local img = chars_file:read("*l") - chars_file:read("*l") - charmap[char] = img - end -end - -local pi = 3.1415926 -- enough accuracy, to build an engine for a car. - -local math = math - --- locally cached copy of the official colors; this way, it updates as mcl_colors updates. -local mcl_colors_official = mcl_colors -if DEBUG then - minetest.log("verbose", "[mcl_signs]Official MCL_Colors:\n" .. dump(mcl_colors_official)) -end - --- INITIALIZE THE GLOBAL API FOR SIGNS. -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 } ---- colors used for wools. -mcl_signs.mcl_wool_colors = { - unicolor_white = "#FFFFFF", - unicolor_dark_orange = "#502A00", - unicolor_grey = "#5B5B5B", - unicolor_darkgrey = "#303030", - unicolor_blue = "#0000CC", - unicolor_dark_green = "#005000", - unicolor_green_or_lime = "#50CC00", - unicolor_violet_purple = "#5000CC", - unicolor_light_red_pink = "#FF5050", - unicolor_yellow = "#CCCC00", - unicolor_orange = "#CC5000", - unicolor_red = "#CC0000", - unicolor_cyan = "#00CCCC", - unicolor_red_violet_magenta = "#CC0050", - unicolor_black = "#000000", - unicolor_light_blue = "#5050FF", -} -mcl_signs.signtext_info_wall = {} -mcl_signs.signtext_info_standing = {} -- built in build_signs_info(). --- the rotational levels for all of the standing signs. -mcl_signs.standing_rotation_levels = {} - --- data structure block for dynamically registered signs. -mcl_signs.registered_signs = {} -mcl_signs.registered_signs.wall_signs = {} -mcl_signs.registered_signs.standing_signs = {} -mcl_signs.registered_signs.hanging_signs = {} -- unused. prepping for future use. --- DEFINE SIGN BASE TYPES -mcl_signs.wall_standard = {} -- initialize -mcl_signs.standing_standard = {} -- initialize - -function mcl_signs.build_signs_info() - local n = 23 / 56 - 1 / 128 -- some required magic number from the original code. - local m = -1 / 16 + 1 / 64 -- " " " " " " " " - - mcl_signs.signtext_info_wall = { - { delta = { x = 0, y = 0, z = n }, yaw = 0 }, - { delta = { x = n, y = 0, z = 0 }, yaw = pi / -2 }, - { delta = { x = 0, y = 0, z = -n }, yaw = pi }, - { delta = { x = -n, y = 0, z = 0 }, yaw = pi / 2 }, - } - - -- PLACE YAW VALUES INTO THE TABLE. - for rot = 0, 15 do - local yaw = pi * 2 - (((pi * 2) / 16) * rot) - local delta = vector.multiply(minetest.yaw_to_dir(yaw), m) - -- Offset because sign is a bit above node boundaries - delta.y = delta.y + 2 / 28 - table.insert(mcl_signs.signtext_info_standing, { delta = delta, yaw = yaw }) - end - -end - --- wall signs' & hanging signs' base (definition) -mcl_signs.wall_standard = { - description = S("Sign"), - _tt_help = S("Can be written"), - _doc_items_longdesc = S("Signs can be written and come in two variants: Wall sign and sign on a sign post. Signs can be placed on the top and the sides of other blocks, but not below them."), - _doc_items_usagehelp = S("After placing the sign, you can write something on it. You have 4 lines of text with up to 15 characters for each line; anything beyond these limits is lost. Not all characters are supported. The text can not be changed once it has been written; you have to break and place the sign again. Can be colored and made to glow."), - inventory_image = "default_sign.png", - walkable = false, - is_ground_content = false, - wield_image = "default_sign.png", - node_placement_prediction = "", - paramtype = "light", - sunlight_propagates = true, - paramtype2 = "wallmounted", - drawtype = "mesh", - mesh = "mcl_signs_signonwallmount.obj", - selection_box = { type = "wallmounted", wall_side = { -0.5, -7 / 28, -0.5, -23 / 56, 7 / 28, 0.5 } }, - tiles = { "mcl_signs_sign.png" }, - use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, - groups = mcl_signs.sign_groups, - stack_max = 16, - sounds = node_sounds, - - on_timer = function(pos) - -- fix for /ClearObjects - mcl_signs:update_sign(pos) - -- note: update_sign decides to keep the timer running based on if there is text. - -- This prevents every sign from having a timer, when not needed. - end, - - on_place = function(itemstack, placer, pointed_thing) - local above = pointed_thing.above - local under = pointed_thing.under - - -- Use pointed node's on_rightclick function first, if present - local node_under = minetest.get_node(under) - if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then - return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack - end - end - - local dir = vector.subtract(under, above) - - -- Only build when it's legal - local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] - if not abovenodedef or abovenodedef.buildable_to == false then - return itemstack - end - - local wdir = minetest.dir_to_wallmounted(dir) - - --local placer_pos = placer:get_pos() - - local fdir = minetest.dir_to_facedir(dir) - - local sign_info - local nodeitem = ItemStack(itemstack) - -- Ceiling - if wdir == 0 then - --how would you add sign to ceiling? - return itemstack - -- Floor - end - - if wdir == 1 then - -- Standing sign - - -- Determine the sign rotation based on player's yaw - local yaw = pi * 2 - placer:get_look_horizontal() - - -- Select one of 16 possible rotations (0-15) - local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) - - if rotation_level > 15 then - rotation_level = 0 - elseif rotation_level < 0 then - rotation_level = 15 - end - - -- The actual rotation is a combination of predefined mesh and facedir (see node definition) - if rotation_level % 4 == 0 then - nodeitem:set_name("mcl_signs:standing_sign") - elseif rotation_level % 4 == 1 then - nodeitem:set_name("mcl_signs:standing_sign22_5") - elseif rotation_level % 4 == 2 then - nodeitem:set_name("mcl_signs:standing_sign45") - elseif rotation_level % 4 == 3 then - nodeitem:set_name("mcl_signs:standing_sign67_5") - end - fdir = math.floor(rotation_level / 4) - - -- Place the node! - local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) - if not success then - return itemstack - end - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end - sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] - -- Side - else - -- Wall sign - local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) - if not success then - return itemstack - end - sign_info = mcl_signs.signtext_info_wall[fdir + 1] - end - - -- Determine spawn position of entity - local place_pos - if minetest.registered_nodes[node_under.name].buildable_to then - place_pos = under - else - place_pos = above - end - - local text_entity = minetest.add_entity({ - x = place_pos.x + sign_info.delta.x, - y = place_pos.y + sign_info.delta.y, - z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") - text_entity:set_yaw(sign_info.yaw) - text_entity:get_luaentity()._signnodename = nodeitem:get_name() - if DEBUG then - minetest.log("verbose", "[mcl_signs]Placed position:" .. dump(place_pos) .. "\nSign_info: " .. dump(sign_info)) - end - - minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) - - mcl_signs:show_formspec(placer, place_pos) - return itemstack - end, - on_destruct = function(pos) - mcl_signs:destruct_sign(pos) - end, - - -- Not Useless Code. force updates the sign. - on_punch = function(pos, node, puncher) - mcl_signs:update_sign(pos) - end, - on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - local r = screwdriver.rotate.wallmounted(pos, node, mode) - node.param2 = r - minetest.swap_node(pos, node) - mcl_signs:update_sign(pos, nil, nil, true) - return true - else - return false - end - end, - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - if DEBUG then - minetest.log("verbose", "[mcl_signs] Wall_Sign Right Click event.") - end - - -- make sure player is clicking - if not clicker or not clicker:is_player() then - return - end - - local item = clicker:get_wielded_item() - local iname = item:get_name() - - if node then - if DEBUG then - minetest.log("verbose", "[mcl_signs] Wall_Sign Right Click event on valid node.") - end - - -- handle glow from glow_ink_sac *first* - if (iname == "mcl_mobitems:glow_ink_sac") then - clicker:set_wielded_item(item) - local success = mcl_signs:glow_sign(pos) - if success then - if DEBUG then - minetest.log("verbose", "[mcl_signs] Sign Glow Success.") - end - itemstack:take_item() - end - return - end - - -- "mcl_dye:black" is a special case: it makes the sign's lettering black AND removes glow. - if (iname == "mcl_dye:black") then - clicker:set_wielded_item(item) - local success = mcl_signs:glow_sign(pos, true) - mcl_signs:color_sign(pos, mcl_colors.BLACK) - if success then - if DEBUG then - minetest.log("verbose", "[mcl_signs] Sign Glow removal Success.") - end - - itemstack:take_item() - end - return - end - - -- check the wielded item to make sure that it is a dye. - local txt_color = mcl_signs:get_color_for_sign(iname) - if txt_color ~= "false" then - clicker:set_wielded_item(item) - local success = mcl_signs:color_sign(pos, txt_color) - if success then - if DEBUG then - minetest.log("verbose", "[mcl_signs] Sign Color Success.") - end - itemstack:take_item() - end - end - end - end, - - _mcl_hardness = 1, - _mcl_blast_resistance = 1, -} --- standing sign base (definition) -mcl_signs.standing_standard = { - paramtype = "light", - use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, - sunlight_propagates = true, - walkable = false, - is_ground_content = false, - paramtype2 = "facedir", - drawtype = "mesh", - mesh = "mcl_signs_sign.obj", - selection_box = { type = "fixed", fixed = { -0.2, -0.5, -0.2, 0.2, 0.5, 0.2 } }, - tiles = { "mcl_signs_sign.png" }, - groups = mcl_signs.sign_groups, - drop = "mcl_signs:wall_sign", - stack_max = 16, - sounds = node_sounds, - - on_destruct = function(pos) - mcl_signs:destruct_sign(pos) - end, - - on_timer = function(pos) - -- fix for /ClearObjects - mcl_signs:update_sign(pos) - minetest.get_node_timer(pos):start(40.0) - end, - - -- Not Useless Code. this force updates the sign. - on_punch = function(pos, node, puncher) - mcl_signs:update_sign(pos) - end, - on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign22_5" - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end, - - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - - if DEBUG then - minetest.log("verbose", "[mcl_signs] Standing_Sign Right Click event.") - end - - -- make sure player is clicking - if not clicker or not clicker:is_player() then - return - end - - local item = clicker:get_wielded_item() - local iname = item:get_name() - - if node then - -- handle glow from glow_ink_sac *first* - if DEBUG then - minetest.log("verbose", "[mcl_signs] Standing_Sign Right Click event on valid node.") - end - - if (iname == "mcl_mobitems:glow_ink_sac") then - clicker:set_wielded_item(item) - local success = mcl_signs:glow_sign(pos) - if success then - if DEBUG then - minetest.log("verbose", "[mcl_signs] Sign Glow Success.") - end - itemstack:take_item() - end - return - end - - -- check the wielded item to make sure that it is a dye. - local txt_color = mcl_signs:get_color_for_sign(iname) - if txt_color ~= "false" then - clicker:set_wielded_item(item) - local success = mcl_signs:color_sign(pos, txt_color) - if success then - if DEBUG then - minetest.log("verbose", "[mcl_signs] Sign Color Success.") - end - itemstack:take_item() - end - end - end - end, - - _mcl_hardness = 1, - _mcl_blast_resistance = 1, -} - --- HELPER FUNCTIONS' VARIABLES -local sign_glow = 6 -local Dyes_table = { - { "mcl_dye:aqua", mcl_colors_official.AQUA }, - { "mcl_dye:black", mcl_colors_official.BLACK }, - { "mcl_dye:blue", mcl_colors_official.BLUE }, - { "mcl_dye:brown", mcl_colors_official.brown }, - { "mcl_dye:cyan", mcl_signs.mcl_wool_colors.unicolor_cyan }, - { "mcl_dye:green", mcl_colors_official.GREEN }, - { "mcl_dye:dark_green", mcl_colors_official.DARK_GREEN }, - { "mcl_dye:grey", mcl_colors_official.GRAY }, - { "mcl_dye:dark_grey", mcl_colors_official.DARK_GRAY }, - { "mcl_dye:lightblue", mcl_signs.mcl_wool_colors.unicolor_light_blue }, - { "mcl_dye:lime", mcl_signs.unicolor_green_or_lime }, - { "mcl_dye:magenta", mcl_colors_official.LIGHT_PURPLE }, - { "mcl_dye:orange", mcl_signs.mcl_wool_colors.unicolor_orange }, - { "mcl_dye:pink", mcl_signs.mcl_wool_colors.unicolor_light_red_pink }, - { "mcl_dye:purple", mcl_colors_official.LIGHT_PURPLE }, - { "mcl_dye:red", mcl_signs.mcl_wool_colors.unicolor_red }, - { "mcl_dye:silver", mcl_signs.mcl_wool_colors.unicolor_grey }, - { "mcl_dye:violet", mcl_colors_official.DARK_PURPLE }, - { "mcl_dye:white", mcl_colors_official.WHITE }, - { "mcl_dye:yellow", mcl_colors_official.YELLOW }, -} - -local function update_sign_registry(type, name) - if type == "wall" then - table.insert(mcl_signs.registered_signs.wall_signs, name) - end - if type == "standing" then - table.insert(mcl_signs.registered_signs.standing_signs, name) - end - if type == "hanging" then - table.insert(mcl_signs.registered_signs.hanging_signs, name) - end -end - -function mcl_signs.make_lbm() - - local registered_sign_nodenames = {} - - for i = 0, #mcl_signs.registered_signs.wall_signs do - table.insert(registered_sign_nodenames, mcl_signs.registered_signs.wall_signs[i]) - end - - for i = 0, #mcl_signs.registered_signs.standing_signs do - table.insert(registered_sign_nodenames, mcl_signs.registered_signs.standing_signs[i]) - end - - for i = 0, #mcl_signs.registered_signs.hanging_signs do - table.insert(registered_sign_nodenames, mcl_signs.registered_signs.hanging_signs[i]) - end - - -- the above is not yet used. - minetest.register_lbm({ - name = "mcl_signs:respawn_entities", - label = "Respawn sign text entities", - run_at_every_load = true, - nodenames = registered_sign_nodenames, - action = function(pos, node) - mcl_signs:update_sign(pos) - end, - }) - -end - -function mcl_signs.register_dye (modname, item_name, color_code) - if minetest.get_modpath(modname) then - table.insert(Dyes_table, { item_name, color_code }) - end -end - ---- Register a new sign, tint the textures, and gives it an unique node name. Creates both wall and standing signs. ---- modname: optional (pass "" or "false" to ignore), for use with other mods to ---- allow the creation of a sign from the mod's wood (if installed). ---- ---- color: the color code to color the base sign textures. must be a valid html color code. ---- ---- _name: the sign's name suffix, such as "_dark" or "_red", etc., appended to "wall_sign" or "standing_sign" ---- ---- ttsign: the tool tip of the sign that gets translated. Shown when the mouse hovers the inventory sign. ---- For example: the basic, default oak (wood) sign is just "Sign"; and a spruce sign would be "Spruce Sign" -function mcl_signs.register_sign (modname, color, _name, ttsign) - local mod_name_pass = false - if modname ~= "" and modname ~= "false" then - if minetest.get_modpath(modname) then - mod_name_pass = true - end - if mod_name_pass == false then - return - end - end - local new_sign = {} - - if color == nil or color == "" then - color = "#FFFFFF" - end - - new_sign = table.copy(mcl_signs.wall_standard) - new_sign.description = S(ttsign) - - new_sign.wield_image = "(default_sign.png^[multiply:" .. color .. ")" - new_sign.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } - new_sign.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" - - -- currently have to do this, because of how the base node placement works. - new_sign.on_place = function(itemstack, placer, pointed_thing) - local above = pointed_thing.above - local under = pointed_thing.under - - -- Use pointed node's on_rightclick function first, if present - local node_under = minetest.get_node(under) - if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then - return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack - end - end - - local dir = vector.subtract(under, above) - - -- Only build when it's legal - local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] - if not abovenodedef or abovenodedef.buildable_to == false then - return itemstack - end - - local wdir = minetest.dir_to_wallmounted(dir) - local fdir = minetest.dir_to_facedir(dir) - - local sign_info - local nodeitem = ItemStack(itemstack) - - local yaw = 0 - - -- Ceiling - if wdir == 0 then - --how would you add sign to ceiling? simple - hanging sign. - -- add code for placement underneath a node. - - return itemstack - -- Floor - elseif wdir == 1 then - -- Standing sign - - -- Determine the sign rotation based on player's yaw - yaw = pi * 2 - placer:get_look_horizontal() - - -- Select one of 16 possible rotations (0-15) - local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) - - if rotation_level > 15 then - rotation_level = 0 - elseif rotation_level < 0 then - rotation_level = 15 - end - - -- The actual rotation is a combination of predefined mesh and facedir (see node definition) - if rotation_level % 4 == 0 then - nodeitem:set_name("mcl_signs:standing_sign" .. _name) - elseif rotation_level % 4 == 1 then - nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) - elseif rotation_level % 4 == 2 then - nodeitem:set_name("mcl_signs:standing_sign45" .. _name) - elseif rotation_level % 4 == 3 then - nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) - end - fdir = math.floor(rotation_level / 4) - - -- Place the node! - local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) - if not success then - return itemstack - end - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end - sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] - -- Side - else - -- Wall sign - local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) - if not success then - return itemstack - end - sign_info = mcl_signs.signtext_info_wall[fdir + 1] - end - - -- Determine spawn position of entity - local place_pos - if minetest.registered_nodes[node_under.name].buildable_to then - place_pos = under - else - place_pos = above - end - - if DEBUG then - minetest.log("action", "[mcl_signs] Register_Sign::Placed position:" .. dump(place_pos) .. "\nSign_info: " .. dump(sign_info)) - end - - local text_entity = minetest.add_entity({ - x = place_pos.x + sign_info.delta.x, - y = place_pos.y + sign_info.delta.y, - z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") - text_entity:set_yaw(sign_info.yaw) - text_entity:get_luaentity()._signnodename = nodeitem:get_name() - - minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) - - mcl_signs:show_formspec(placer, place_pos) - return itemstack - end - - minetest.register_node(":mcl_signs:wall_sign" .. _name, new_sign) - update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) - - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Registered: mcl_signs:wall_sign" .. _name .. color .. "\n" .. dump(new_sign)) - minetest.log("action", "[mcl_signs] mcl_signs:wall_sign_standard\n" .. dump(mcl_signs.wall_standard)) - end - - -- standing sign base. - local new_sign_standing = {} - new_sign_standing = table.copy(mcl_signs.standing_standard) - new_sign_standing.drop = "mcl_signs:wall_sign" .. _name - new_sign_standing.wield_image = "(default_sign.png^[multiply:" .. color .. ")" - new_sign_standing.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } - new_sign_standing.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" - - new_sign_standing.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign22_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end, - - minetest.register_node(":mcl_signs:standing_sign" .. _name, new_sign_standing) - update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Registered: mcl_signs:standing_sign" .. _name .. color .. "\n" .. dump(new_sign_standing)) - end - - -- 22.5° - local ssign22_5d = table.copy(new_sign_standing) - ssign22_5d.mesh = "mcl_signs_sign22.5.obj" - ssign22_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign45" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.register_node(":mcl_signs:standing_sign22_5" .. _name, ssign22_5d) - update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) - - -- 45° - local ssign45d = table.copy(new_sign_standing) - ssign45d.mesh = "mcl_signs_sign45.obj" - ssign45d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign67_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.register_node(":mcl_signs:standing_sign45" .. _name, ssign45d) - update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) - - -- 67.5° - local ssign67_5d = table.copy(new_sign_standing) - ssign67_5d.mesh = "mcl_signs_sign67.5.obj" - ssign67_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign" .. _name - node.param2 = (node.param2 + 1) % 4 - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.register_node(":mcl_signs:standing_sign67_5" .. _name, ssign67_5d) - update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) - - -- register Doc entry - if minetest.get_modpath("doc") then - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) - end - - --register standing sign's rotation_levels - 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 }) -end - ---- The same as register_sign, except caller defines the textures. Note, there is a greyscale version of the sign, ---- called "default_sign_greyscale.png" and "mcl_signs_sign_greyscale.png" for optional use in the textures directory. ---- ---- modname: optional (pass "" or "false" to ignore), for use with other mods to ---- allow the creation of a sign from the mod's wood (if installed). ---- ---- _name: the sign's name suffix, such as "_dark" or "_red", etc., appended to "wall_sign" or "standing_sign" ---- ---- tiles: the texture file to use for the sign. ---- ---- color: color the texture file to use with this color. Use white (#FFFFFF) to negate the color, ---- and just use the texture as is ---- ---- inventory_image: the texture file to use for the sign's display in inventory. ---- ---- wield_image: the texture file to use for the sign's weilded (in hand) object. ---- ---- inventory_image: the image used for in-inventory and in hand. ---- ---- ttsign: the tool tip of the sign that gets translated. Shown when the mouse hovers the inventory sign. ---- For example: the basic, default oak (wood) sign is just "Sign"; and a spruce sign would be "Spruce Sign" -function mcl_signs.register_sign_custom (modname, _name, tiles, color, inventory_image, wield_image, ttsign) - local mod_name_pass = false - if modname ~= "" and modname ~= "false" then - if minetest.get_modpath(modname) then - mod_name_pass = true - end - if mod_name_pass == false then - return - end - end - local new_sign = {} - - new_sign = table.copy(mcl_signs.wall_standard) - - new_sign.wield_image = "(" .. wield_image .. "^[multiply:" .. color .. ")" - new_sign.tiles = { "(" .. tiles .. "^[multiply:" .. color .. ")" } - new_sign.inventory_image = "(" .. inventory_image .. "^[multiply:" .. color .. ")" - new_sign.description = S(ttsign) - -- currently have to do this, because of how the base node placement works. - new_sign.on_place = function(itemstack, placer, pointed_thing) - local above = pointed_thing.above - local under = pointed_thing.under - - -- Use pointed node's on_rightclick function first, if present - local node_under = minetest.get_node(under) - if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then - return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack - end - end - - local dir = vector.subtract(under, above) - - -- Only build when it's legal - local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] - if not abovenodedef or abovenodedef.buildable_to == false then - return itemstack - end - - local wdir = minetest.dir_to_wallmounted(dir) - local fdir = minetest.dir_to_facedir(dir) - - local sign_info - local nodeitem = ItemStack(itemstack) - -- Ceiling - if wdir == 0 then - --how would you add sign to ceiling? - return itemstack - -- Floor - elseif wdir == 1 then - -- Standing sign - - -- Determine the sign rotation based on player's yaw - local yaw = pi * 2 - placer:get_look_horizontal() - - -- Select one of 16 possible rotations (0-15) - local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) - - if rotation_level > 15 then - rotation_level = 0 - elseif rotation_level < 0 then - rotation_level = 15 - end - - -- The actual rotation is a combination of predefined mesh and facedir (see node definition) - if rotation_level % 4 == 0 then - nodeitem:set_name("mcl_signs:standing_sign" .. _name) - elseif rotation_level % 4 == 1 then - nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) - elseif rotation_level % 4 == 2 then - nodeitem:set_name("mcl_signs:standing_sign45" .. _name) - elseif rotation_level % 4 == 3 then - nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) - end - fdir = math.floor(rotation_level / 4) - - -- Place the node! - local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) - if not success then - return itemstack - end - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end - sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] - -- Side - else - -- Wall sign - local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) - if not success then - return itemstack - end - sign_info = mcl_signs.signtext_info_wall[fdir + 1] - end - - -- Determine spawn position of entity - local place_pos - if minetest.registered_nodes[node_under.name].buildable_to then - place_pos = under - else - place_pos = above - end - - local text_entity = minetest.add_entity({ - x = place_pos.x + sign_info.delta.x, - y = place_pos.y + sign_info.delta.y, - z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") - text_entity:set_yaw(sign_info.yaw) - text_entity:get_luaentity()._signnodename = nodeitem:get_name() - - minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) - - mcl_signs:show_formspec(placer, place_pos) - return itemstack - end - minetest.register_node(":mcl_signs:wall_sign" .. _name, new_sign) - update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) - - -- standing sign base. - local new_sign_standing = {} - new_sign_standing = table.copy(mcl_signs.standing_standard) - new_sign_standing.drop = "mcl_signs:wall_sign" .. _name - new_sign_standing.wield_image = "(" .. wield_image .. "^[multiply:" .. color .. ")" - new_sign_standing.tiles = { "(" .. tiles .. "^[multiply:" .. color .. ")" } - new_sign_standing.inventory_image = "(" .. inventory_image .. "^[multiply:" .. color .. ")" - new_sign_standing.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign22_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end, - minetest.register_node(":mcl_signs:standing_sign" .. _name, new_sign_standing) - update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) - - -- 22.5° - local ssign22_5d = table.copy(new_sign_standing) - ssign22_5d.mesh = "mcl_signs_sign22.5.obj" - ssign22_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign45" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.register_node(":mcl_signs:standing_sign22_5" .. _name, ssign22_5d) - update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) - - -- 45° - local ssign45d = table.copy(new_sign_standing) - ssign45d.mesh = "mcl_signs_sign45.obj" - ssign45d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign67_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.register_node(":mcl_signs:standing_sign45" .. _name, ssign45d) - update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) - - -- 67.5° - local ssign67_5d = table.copy(new_sign_standing) - ssign67_5d.mesh = "mcl_signs_sign67.5.obj" - ssign67_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign" .. _name - node.param2 = (node.param2 + 1) % 4 - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.register_node(":mcl_signs:standing_sign67_5" .. _name, ssign67_5d) - update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) - - -- register Doc entry - if minetest.get_modpath("doc") then - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) - end - - --register standing sign's rotation_levels - 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 }) - -end - ---- Override an existing sign, tint the textures, and gives it an unique node name. Creates both wall and standing signs. ---- modname: optional (pass "" or "false" to ignore), for use with other mods to ---- allow the creation of a sign from the mod's wood (if installed). ---- ---- color: the color code to color the base sign textures. must be a valid html color code. ---- ---- _name: the sign's name suffix, such as "_dark" or "_red", etc., appended to "wall_sign" or "standing_sign" ---- ---- ttsign: the tool tip of the sign that gets translated. Shown when the mouse hovers the inventory sign. ---- For example: the basic, default oak (wood) sign is just "Sign"; and a spruce sign would be "Spruce Sign" -function mcl_signs.reregister_sign (modname, color, _name, ttsign) - local mod_name_pass = false - if modname ~= "" and modname ~= "false" then - if minetest.get_modpath(modname) then - mod_name_pass = true - end - if mod_name_pass == false then - return - end - end - local new_sign = {} - - if color == nil or color == "" then - color = "#FFFFFF" - end - - new_sign = table.copy(mcl_signs.wall_standard) - new_sign.description = S(ttsign) - - new_sign.wield_image = "(default_sign.png^[multiply:" .. color .. ")" - new_sign.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } - new_sign.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" - - -- currently have to do this, because of how the base node placement works. - new_sign.on_place = function(itemstack, placer, pointed_thing) - local above = pointed_thing.above - local under = pointed_thing.under - - -- Use pointed node's on_rightclick function first, if present - local node_under = minetest.get_node(under) - if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then - return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack - end - end - - local dir = vector.subtract(under, above) - - -- Only build when it's legal - local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] - if not abovenodedef or abovenodedef.buildable_to == false then - return itemstack - end - - local wdir = minetest.dir_to_wallmounted(dir) - local fdir = minetest.dir_to_facedir(dir) - - local sign_info - local nodeitem = ItemStack(itemstack) - -- Ceiling - if wdir == 0 then - --how would you add sign to ceiling? - return itemstack - -- Floor - elseif wdir == 1 then - -- Standing sign - - -- Determine the sign rotation based on player's yaw - local yaw = pi * 2 - placer:get_look_horizontal() - - -- Select one of 16 possible rotations (0-15) - local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) - - if rotation_level > 15 then - rotation_level = 0 - elseif rotation_level < 0 then - rotation_level = 15 - end - - -- The actual rotation is a combination of predefined mesh and facedir (see node definition) - if rotation_level % 4 == 0 then - nodeitem:set_name("mcl_signs:standing_sign" .. _name) - elseif rotation_level % 4 == 1 then - nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) - elseif rotation_level % 4 == 2 then - nodeitem:set_name("mcl_signs:standing_sign45" .. _name) - elseif rotation_level % 4 == 3 then - nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) - end - fdir = math.floor(rotation_level / 4) - - -- Place the node! - local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) - if not success then - return itemstack - end - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end - sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] - -- Side - else - -- Wall sign - local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) - if not success then - return itemstack - end - sign_info = mcl_signs.signtext_info_wall[fdir + 1] - end - - -- Determine spawn position of entity - local place_pos - if minetest.registered_nodes[node_under.name].buildable_to then - place_pos = under - else - place_pos = above - end - - if DEBUG then - minetest.log("action", "[mcl_signs] Register_Sign::Placed position:" .. dump(place_pos) .. "\nSign_info: " .. dump(sign_info)) - end - - local text_entity = minetest.add_entity({ - x = place_pos.x + sign_info.delta.x, - y = place_pos.y + sign_info.delta.y, - z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") - text_entity:set_yaw(sign_info.yaw) - text_entity:get_luaentity()._signnodename = nodeitem:get_name() - - minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) - - mcl_signs:show_formspec(placer, place_pos) - return itemstack - end - - minetest.override_item("mcl_signs:wall_sign" .. _name, new_sign) - update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) - - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Registered: mcl_signs:wall_sign" .. _name .. color .. "\n" .. dump(new_sign)) - minetest.log("action", "[mcl_signs] mcl_signs:wall_sign_standard\n" .. dump(mcl_signs.wall_standard)) - end - - -- standing sign base. - local new_sign_standing = {} - new_sign_standing = table.copy(mcl_signs.standing_standard) - new_sign_standing.drop = "mcl_signs:wall_sign" .. _name - new_sign_standing.wield_image = "(default_sign.png^[multiply:" .. color .. ")" - new_sign_standing.tiles = { "(mcl_signs_sign.png^[multiply:" .. color .. ")" } - new_sign_standing.inventory_image = "(default_sign.png^[multiply:" .. color .. ")" - new_sign_standing.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign22_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end, - minetest.override_item("mcl_signs:standing_sign" .. _name, new_sign_standing) - update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Registered: mcl_signs:standing_sign" .. _name .. color .. "\n" .. dump(new_sign_standing)) - end - - -- 22.5° - local ssign22_5d = table.copy(new_sign_standing) - ssign22_5d.mesh = "mcl_signs_sign22.5.obj" - ssign22_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign45" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.override_item("mcl_signs:standing_sign22_5" .. _name, ssign22_5d) - update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) - - -- 45° - local ssign45d = table.copy(new_sign_standing) - ssign45d.mesh = "mcl_signs_sign45.obj" - ssign45d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign67_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.override_item("mcl_signs:standing_sign45" .. _name, ssign45d) - update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) - - -- 67.5° - local ssign67_5d = table.copy(new_sign_standing) - ssign67_5d.mesh = "mcl_signs_sign67.5.obj" - ssign67_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign" .. _name - node.param2 = (node.param2 + 1) % 4 - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.override_item("mcl_signs:standing_sign67_5" .. _name, ssign67_5d) - update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) - - -- register Doc entry - if minetest.get_modpath("doc") then - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) - end - - --register standing sign's rotation_levels - 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 }) -end - ---- The same as reregister_sign, except caller defines the textures. Note, there is a greyscale version of the sign, ---- called "default_sign_greyscale.png" and "mcl_signs_sign_greyscale.png" for optional use in the textures directory. ---- ---- modname: optional (pass "" or "false" to ignore), for use with other mods to ---- allow the creation of a sign from the mod's wood (if installed). ---- ---- _name: the sign's name suffix, such as "_dark" or "_red", etc., appended to "wall_sign" or "standing_sign" ---- ---- tiles: the texture file to use for the sign. ---- ---- color: color the texture file to use with this color. Use white (#FFFFFF) to negate the color, ---- and just use the texture as is ---- ---- inventory_image: the texture file to use for the sign's display in inventory. ---- ---- wield_image: the texture file to use for the sign's weilded (in hand) object. ---- ---- inventory_image: the image used for in-inventory and in hand. ---- ---- ttsign: the tool tip of the sign that gets translated. Shown when the mouse hovers the inventory sign. ---- For example: the basic, default oak (wood) sign is just "Sign"; and a spruce sign would be "Spruce Sign" -function mcl_signs.reregister_sign_custom (modname, _name, tiles, color, inventory_image, wield_image, ttsign) - local mod_name_pass = false - if modname ~= "" and modname ~= "false" then - if minetest.get_modpath(modname) then - mod_name_pass = true - end - if mod_name_pass == false then - return - end - end - local new_sign = {} - - new_sign = table.copy(mcl_signs.wall_standard) - - new_sign.wield_image = "(" .. wield_image .. "^[multiply:" .. color .. ")" - new_sign.tiles = { "(" .. tiles .. "^[multiply:" .. color .. ")" } - new_sign.inventory_image = "(" .. inventory_image .. "^[multiply:" .. color .. ")" - new_sign.description = S(ttsign) - -- currently have to do this, because of how the base node placement works. - new_sign.on_place = function(itemstack, placer, pointed_thing) - local above = pointed_thing.above - local under = pointed_thing.under - - -- Use pointed node's on_rightclick function first, if present - local node_under = minetest.get_node(under) - if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then - return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack - end - end - - local dir = vector.subtract(under, above) - - -- Only build when it's legal - local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name] - if not abovenodedef or abovenodedef.buildable_to == false then - return itemstack - end - - local wdir = minetest.dir_to_wallmounted(dir) - local fdir = minetest.dir_to_facedir(dir) - - local sign_info - local nodeitem = ItemStack(itemstack) - -- Ceiling - if wdir == 0 then - --how would you add sign to ceiling? - return itemstack - -- Floor - elseif wdir == 1 then - -- Standing sign - - -- Determine the sign rotation based on player's yaw - local yaw = pi * 2 - placer:get_look_horizontal() - - -- Select one of 16 possible rotations (0-15) - local rotation_level = mcl_signs:round((yaw / (pi * 2)) * 16) - - if rotation_level > 15 then - rotation_level = 0 - elseif rotation_level < 0 then - rotation_level = 15 - end - - -- The actual rotation is a combination of predefined mesh and facedir (see node definition) - if rotation_level % 4 == 0 then - nodeitem:set_name("mcl_signs:standing_sign" .. _name) - elseif rotation_level % 4 == 1 then - nodeitem:set_name("mcl_signs:standing_sign22_5" .. _name) - elseif rotation_level % 4 == 2 then - nodeitem:set_name("mcl_signs:standing_sign45" .. _name) - elseif rotation_level % 4 == 3 then - nodeitem:set_name("mcl_signs:standing_sign67_5" .. _name) - end - fdir = math.floor(rotation_level / 4) - - -- Place the node! - local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir) - if not success then - return itemstack - end - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end - sign_info = mcl_signs.signtext_info_standing[rotation_level + 1] - -- Side - else - -- Wall sign - local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir) - if not success then - return itemstack - end - sign_info = mcl_signs.signtext_info_wall[fdir + 1] - end - - -- Determine spawn position of entity - local place_pos - if minetest.registered_nodes[node_under.name].buildable_to then - place_pos = under - else - place_pos = above - end - - local text_entity = minetest.add_entity({ - x = place_pos.x + sign_info.delta.x, - y = place_pos.y + sign_info.delta.y, - z = place_pos.z + sign_info.delta.z }, "mcl_signs:text") - text_entity:set_yaw(sign_info.yaw) - text_entity:get_luaentity()._signnodename = nodeitem:get_name() - - minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) - - mcl_signs:show_formspec(placer, place_pos) - return itemstack - end - minetest.override_item("mcl_signs:wall_sign" .. _name, new_sign) - update_sign_registry("wall", "mcl_signs:wall_sign" .. _name) - - -- standing sign base. - local new_sign_standing = {} - new_sign_standing = table.copy(mcl_signs.standing_standard) - new_sign_standing.drop = "mcl_signs:wall_sign" .. _name - new_sign_standing.wield_image = "(" .. wield_image .. "^[multiply:" .. color .. ")" - new_sign_standing.tiles = { "(" .. tiles .. "^[multiply:" .. color .. ")" } - new_sign_standing.inventory_image = "(" .. inventory_image .. "^[multiply:" .. color .. ")" - new_sign_standing.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign22_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end, - minetest.override_item("mcl_signs:standing_sign" .. _name, new_sign_standing) - update_sign_registry("standing", "mcl_signs:standing_sign" .. _name) - - -- 22.5° - local ssign22_5d = table.copy(new_sign_standing) - ssign22_5d.mesh = "mcl_signs_sign22.5.obj" - ssign22_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign45" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.override_item("mcl_signs:standing_sign22_5" .. _name, ssign22_5d) - update_sign_registry("standing", "mcl_signs:standing_sign22_5" .. _name) - - -- 45° - local ssign45d = table.copy(new_sign_standing) - ssign45d.mesh = "mcl_signs_sign45.obj" - ssign45d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign67_5" .. _name - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.override_item("mcl_signs:standing_sign45" .. _name, ssign45d) - update_sign_registry("standing", "mcl_signs:standing_sign45" .. _name) - - -- 67.5° - local ssign67_5d = table.copy(new_sign_standing) - ssign67_5d.mesh = "mcl_signs_sign67.5.obj" - ssign67_5d.on_rotate = function(pos, node, user, mode) - if mode == screwdriver.ROTATE_FACE then - node.name = "mcl_signs:standing_sign" .. _name - node.param2 = (node.param2 + 1) % 4 - minetest.swap_node(pos, node) - elseif mode == screwdriver.ROTATE_AXIS then - return false - end - mcl_signs:update_sign(pos, nil, nil, true) - return true - end - minetest.override_item("mcl_signs:standing_sign67_5" .. _name, ssign67_5d) - update_sign_registry("standing", "mcl_signs:standing_sign67_5" .. _name) - - -- register Doc entry - if minetest.get_modpath("doc") then - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:wall_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45" .. _name) - doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5" .. _name) - end - - --register standing sign's rotation_levels - 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 }) - -end - ---- Usage: Call this with the mod's name, the wood's item string (for the planks), and with the sign's suffix. ---- Registers the crafting recipe for that sign. for every registered sign, call this function to register the ---- standard recipe for the sign. Otherwise, you have to do your own register craft call. ---- ---- modname: optional (pass "" or "false" to ignore), for use with other mods to ---- allow the creation of a sign from the mod's wood (if installed). Example: "mcl_core". ---- ---- wood_item_string: example: "mcl_core:wood" or "mcl_core:sprucewood" ---- ---- _name: the sign's name suffix, such as "_dark" or "_red", etc., appended to "wall_sign" or "standing_sign" -function mcl_signs.register_sign_craft(modname, wood_item_string, _name) - local mod_name_pass = false - if modname ~= "" and modname ~= "false" then - if minetest.get_modpath(modname) then - mod_name_pass = true - end - if mod_name_pass == false then - return - end - end - - minetest.register_craft({ - type = "fuel", - recipe = "mcl_signs:wall_sign" .. _name, - burntime = 10, - }) - - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Register Sign Crafts: \n" .. modname .. "\n" .. wood_item_string .. "\n" .. _name) - end - - -- register crafts (actual recipe) - if minetest.get_modpath(modname) then - - local itemstring = "mcl_signs:wall_sign" - - minetest.register_craft({ - output = itemstring .. _name .. " 3", - recipe = { - { wood_item_string, wood_item_string, wood_item_string }, - { wood_item_string, wood_item_string, wood_item_string }, - { "", "mcl_core:stick", "" }, - }, - }) - end -end - -function mcl_signs.register_hanging_sign_craft(modname, wood_item_string, _name) - local mod_name_pass = false - if modname ~= "" and modname ~= "false" then - if minetest.get_modpath(modname) then - mod_name_pass = true - end - if mod_name_pass == false then - return - end - end - - minetest.register_craft({ - type = "fuel", - recipe = ":mcl_signs:wall_sign" .. _name, - burntime = 10, - }) - - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Register Sign Crafts: \n" .. modname .. "\n" .. wood_item_string .. "\n" .. _name) - end - - -- register crafts (actual recipe) - if minetest.get_modpath(modname) then - - local itemstring = ":mcl_signs:hanging_sign" - local quantity = "6" - - local bamboo = string.find(wood_item_string, "bamboo") - if bamboo then - quantity = "2" - end - minetest.register_craft({ - output = itemstring .. _name .. " " .. quantity, - recipe = { - { "mcl_lanterns:chain", "", "mcl_lanterns:chain" }, - { wood_item_string, wood_item_string, wood_item_string }, - { wood_item_string, wood_item_string, wood_item_string }, - }, - }) - end -end - --- Helper functions -local function string_to_array(str) - local string_table = {} - for i = 1, string.len(str) do - table.insert(string_table, string.sub(str, i, i)) - end - return string_table -end - -local function string_to_line_array(str) - local linechar_table = {} - local current = 1 - local linechar = 1 - linechar_table[1] = "" - for _, char in ipairs(string_to_array(str)) do - -- New line - if char == "\n" then - current = current + 1 - linechar_table[current] = "" - linechar = 1 - else - linechar_table[current] = linechar_table[current] .. char - linechar = linechar + 1 - end - end - return linechar_table -end - -local function get_rotation_level(facedir, nodename) - local nnames = mcl_signs.standing_rotation_levels -- functional copy... was easier this way. #LazyAF :P - - local rl - local offset = 0 - for x = 1, #nnames do - if nnames[x][1] == nodename then - offset = nnames[x][2] - break - end - end - rl = facedir * 4 + offset - if DEBUG then - minetest.log("action", "[mcl_signs] GetRotationLevel: NodeName: " .. nodename .. " RL value: " .. rl) - end - return rl -end - -function mcl_signs:round(num, idp) - local mult = 10 ^ (idp or 0) - return math.floor(num * mult + 0.5) / mult -end - -function mcl_signs:get_color_for_sign(item_name) - - for d = 1, #Dyes_table do - if Dyes_table[d][1] == item_name then - return Dyes_table[d][2] - end - end - return "false" -end - -function mcl_signs:color_sign (pos, text_color) - - local success = mcl_signs:update_sign(pos, nil, nil, true, text_color) - - -- debug step - local meta = minetest.get_meta(pos) - if not meta then - minetest.log("error", "[mcl_signs] Sign Color Fail - Metadata.") - - return false - end - if DEBUG then - minetest.log("verbose", "[mcl_signs] Post-Sign Color: " .. meta:get_string("mcl_signs:text_color") .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) - end - - return success - -end - -function mcl_signs:glow_sign (pos, remove_glow) - local success = true - -- Get Meta Data for the sign. - local meta = minetest.get_meta(pos) - - if not meta then - return false - end - local text = meta:get_string("text") - if text == nil then - text = "" - end - - -- we can't make the text glow if there isn't any text - if text == "" then - return false - end - - if remove_glow == nil then - remove_glow = false - end - - -- set up text glow - local objects = minetest.get_objects_inside_radius(pos, 0.5) - local text_entity - for _, v in ipairs(objects) do - local ent = v:get_luaentity() - if ent and ent.name == "mcl_signs:text" then - text_entity = v - break - end - end - if remove_glow == true then - text_entity:set_properties({ - glow = nil, - }) - meta:set_string("mcl_signs:glowing_sign", "false") - else - text_entity:set_properties({ - glow = sign_glow, - }) - meta:set_string("mcl_signs:glowing_sign", "true") - end - if not text_entity then - return false - end - text_entity:get_luaentity()._glowing_sign = meta:get_string("mcl_signs:glowing_sign") - - -- debug step - if DEBUG then - minetest.log("verbose", "[mcl_signs] Post-Sign Glow: " .. meta:get_string("mcl_signs:text_color") .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) - end - return success -end - -function mcl_signs:create_lettering(text, signnodename, sign_color) - if sign_color == nil then - sign_color = mcl_colors.BLACK - end - local texture = mcl_signs:generate_texture(mcl_signs:create_lines(text), signnodename, sign_color) - - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Creating sign text; text:" .. text) - end - - return texture -end - -function mcl_signs:create_lines(text) - local line_num = 1 - local text_table = {} - for _, line in ipairs(string_to_line_array(text)) do - if line_num > NUMBER_OF_LINES then - break - end - table.insert(text_table, line) - line_num = line_num + 1 - end - return text_table -end - -function mcl_signs:generate_line(s, ypos) - local i = 1 - local parsed = {} - local width = 0 - local chars = 0 - local printed_char_width = CHAR_WIDTH + 1 - while chars < LINE_LENGTH and i <= #s do - local file - -- Get and render character - if charmap[s:sub(i, i)] then - file = charmap[s:sub(i, i)] - i = i + 1 - elseif i < #s and charmap[s:sub(i, i + 1)] then - file = charmap[s:sub(i, i + 1)] - i = i + 2 - else - -- No character image found. - -- Use replacement character: - file = "_rc" - i = i + 1 - if DEBUG then - minetest.log("verbose", "[mcl_signs] Unknown symbol in '" .. s .. "' at " .. i) - end - end - if file then - width = width + printed_char_width - table.insert(parsed, file) - chars = chars + 1 - end - end - width = width - 1 - - local texture = "" - local xpos = math.floor((SIGN_WIDTH - width) / 2) - - for j = 1, #parsed do - texture = texture .. ":" .. xpos .. "," .. ypos .. "=" .. parsed[j] .. ".png" - xpos = xpos + printed_char_width - end - return texture -end - -function mcl_signs:generate_texture(lines, signnodename, letter_color) - local texture = "[combine:" .. SIGN_WIDTH .. "x" .. SIGN_WIDTH - local ypos = 0 - - -- Handle all of the dynamically created signs. - for x = 1, #mcl_signs.registered_signs.wall_signs do - if signnodename == mcl_signs.registered_signs.wall_signs[x] then - ypos = 30 - break - end - end - for x = 1, #mcl_signs.registered_signs.standing_signs do - if signnodename == mcl_signs.registered_signs.standing_signs[x] then - ypos = 0 - break - end - end - -- for future inclusion, when the hanging sings are made. - --[[ - for x = 1, #mcl_signs.registered_signs.hanging_signs do - if signnodename == mcl_signs.registered_signs.hanging_signs[x] then - ypos = 30 - break - end - end - ]] - - -- kept in for now, compatibility with existing hard coded signs. TODO: Remove after done with api. - if signnodename == "mcl_signs:wall_sign" or signnodename == "mcl_signs:wall_sign_dark" then - ypos = 30 - end - - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Generate_Texture::Debug_Data:\nSignNodeName: " .. dump(signnodename) .. "\nYPOS: " .. ypos) - end - - for i = 1, #lines do - texture = texture .. mcl_signs:generate_line(lines[i], ypos) - ypos = ypos + LINE_HEIGHT - end - - texture = "(" .. texture .. "^[multiply:" .. letter_color .. ")" - return texture -end - -function mcl_signs:get_wall_signtext_info(param2, nodename) - local dir = minetest.wallmounted_to_dir(param2) - if dir.x > 0 then - return 2 - elseif dir.z > 0 then - return 1 - elseif dir.x < 0 then - return 4 - else - return 3 - end -end - -function mcl_signs:destruct_sign(pos) - local objects = minetest.get_objects_inside_radius(pos, 0.5) - for _, v in ipairs(objects) do - local ent = v:get_luaentity() - if ent and ent.name == "mcl_signs:text" then - v:remove() - end - end - local players = minetest.get_connected_players() - for p = 1, #players do - if vector.distance(players[p]:get_pos(), pos) <= 30 then - minetest.close_formspec(players[p]:get_player_name(), "mcl_signs:set_text_" .. pos.x .. "_" .. pos.y .. "_" .. pos.z) - end - end -end - -function mcl_signs:update_sign(pos, fields, sender, force_remove, text_color) - -- Get Meta Data for the sign. - local meta = minetest.get_meta(pos) - - if not meta then - return false - end - local text = meta:get_string("text", "") - if fields and (text == "" and fields.text) then - meta:set_string("text", fields.text) - text = fields.text - end - if text == nil then - text = "" - end - - -- find text color. - local sign_color - - if meta:get_string("mcl_signs:text_color") == "" then - -- if no sign text color has been assigned, make it black. - sign_color = mcl_colors.BLACK - meta:set_string("mcl_signs:text_color", sign_color) - else - sign_color = meta:get_string("mcl_signs:text_color") - end - - if text_color == nil or text == "" then - text_color = "false" - end - - if text_color == "false" then - text_color = sign_color --if a new color hasn't been chosen, then keep the existing color. - end - - -- find the sign's glow value - local has_glow = false - - if meta:get_string("mcl_signs:glowing_sign") == "" or meta:get_string("mcl_signs:glowing_sign") == "false" then - has_glow = false - meta:set_string("mcl_signs:glowing_sign", "false") - else - has_glow = true - end - - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Update_Signs: Pre-Sign Update: " .. sign_color .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) - end - - local sign_info - local npos = minetest.get_node(pos) - local npos_name = npos.name - - -- Handle all of the dynamically created signs. - for x = 1, #mcl_signs.registered_signs.wall_signs do - if npos_name == mcl_signs.registered_signs.wall_signs[x] then - sign_info = mcl_signs.signtext_info_wall[mcl_signs:get_wall_signtext_info(npos.param2)] - break - end - end - for x = 1, #mcl_signs.registered_signs.standing_signs do - if npos_name == mcl_signs.registered_signs.standing_signs[x] then - sign_info = mcl_signs.signtext_info_standing[get_rotation_level(npos.param2, npos_name) + 1] - break - end - end - -- for future inclusion, when the hanging sings are made. - --[[ - for x = 1, #mcl_signs.registered_signs.hanging_signs do - if nn == mcl_signs.registered_signs.hanging_signs[x] then - sign_info = mcl_signs.signtext_info_wall[mcl_signs:get_wall_signtext_info(n.param2)] - break - end - end - ]] - - -- the following if..elseif..end block is here for compatibility with the old code. TODO: remove this block after the new api is complete. - if npos_name == "mcl_signs:standing_sign_dark" or npos_name == "mcl_signs:standing_sign22_5_dark" or npos_name == "mcl_signs:standing_sign45_dark" or npos_name == "mcl_signs:standing_sign67_5_dark" then - sign_info = mcl_signs.signtext_info_standing[get_rotation_level(npos.param2, npos_name) + 1] - elseif npos_name == "mcl_signs:wall_sign_dark" then - sign_info = mcl_signs.signtext_info_wall[mcl_signs:get_wall_signtext_info(npos.param2)] - end - if sign_info == nil then - minetest.log("error", "[mcl_signs] Update_Signs: Missing sign_info!") - return false - end - - local text_entity - text_entity = mcl_signs:get_text_entity(pos,force_remove) - - if not text_entity then - if DEBUG then - minetest.log("action", "[mcl_signs] Update_Sign: Text_Entity - does not exist, creating it now.") - end - text_entity = minetest.add_entity({ - x = pos.x + sign_info.delta.x, - y = pos.y + sign_info.delta.y, - z = pos.z + sign_info.delta.z }, "mcl_signs:text") - - if DEBUG then - minetest.log("action", "[mcl_signs] Update_Sign: Placed position:" .. dump(pos) .. "\nSign_info: " .. dump(sign_info)) - end - end - text_entity:get_luaentity()._signnodename = npos_name - - -- set up special case: Dark Oak Sign. Dark Oak signs are soooo dark, they start off with white lettering. - if npos_name == "mcl_signs:wall_sign_darkwood" or - npos_name == "mcl_signs:standing_sign67_5_darkwood" or - npos_name == "mcl_signs:standing_sign45_darkwood" or - npos_name == "mcl_signs:standing_sign22_5_darkwood" or - npos_name == "mcl_signs:standing_sign_darkwood" - then - if text_color == "#000000" then - text_color = "#ffffff" - end - end - - -- Set the actual properties for the sign - - text_entity:set_properties({ - textures = { mcl_signs:create_lettering(text, npos_name, text_color) }, - }) - - if has_glow then - text_entity:set_properties({ - glow = sign_glow, - }) - end - - text_entity:set_yaw(sign_info.yaw) - if DEBUG then - minetest.log("verbose", "[mcl_signs] Update_Sign: After texture recreation.") - minetest.log("action", "[mcl_signs] Update_Sign: " .. npos_name .. "\nPlaced position:" .. dump(pos) .. "\nSign_info: " .. dump(sign_info)) - end - - -- save sign metadata. - meta:set_string("mcl_signs:text_color", text_color) - - -- Moved timer stuff to here, to make sure that it's called and only has one set of code. - local timer = minetest.get_node_timer(pos) - if text_entity and text ~= "" then - -- Do timer related stuff - but only if there is text to display. - -- Also, prevent excessive use with punching. (see node def.) - if timer:is_started() == false then - timer:start(TIMER_INTERVAL) - else - timer:stop() - timer:start(TIMER_INTERVAL) - end - else - if timer:is_started() == true then - timer:stop() - end - end - - -- debug step - if DEBUG then - minetest.log("action", "[mcl_signs] Update_Sign: Post-Sign Update: " .. meta:get_string("mcl_signs:text_color") .. " " .. meta:get_string("mcl_signs:glowing_sign") .. ".\n" .. dump(pos)) - end - - return true - -end - -function mcl_signs:show_formspec(player, pos) - minetest.show_formspec( - player:get_player_name(), - "mcl_signs:set_text_" .. pos.x .. "_" .. pos.y .. "_" .. pos.z, - "size[6,3]textarea[0.25,0.25;6,1.5;text;" .. F(S("Enter sign text:")) .. ";]label[0,1.5;" .. F(S("Maximum line length: 15")) .. "\n" .. F(S("Maximum lines: 4")) .. "]button_exit[0,2.5;6,1;submit;" .. F(S("Done")) .. "]" - ) -end - -function mcl_signs:get_text_entity (pos, force_remove) - local objects = minetest.get_objects_inside_radius(pos, 0.5) - local text_entity = false -- just to have a check for failure. - for _, v in ipairs(objects) do - local ent = v:get_luaentity() - if ent and ent.name == "mcl_signs:text" then - if force_remove ~= nil and force_remove == true then - v:remove() - else - text_entity = v - break - end - end - end - return text_entity -end \ No newline at end of file From 197e807684786ba282e2904bb4da3a73a241c0ec Mon Sep 17 00:00:00 2001 From: Michieal Date: Thu, 17 Nov 2022 23:34:41 +0000 Subject: [PATCH 46/47] Fix the crafting recipes for the signs. Placed in the proper place. Ugh. --- mods/ITEMS/mcl_signs/signs_api.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_signs/signs_api.lua b/mods/ITEMS/mcl_signs/signs_api.lua index 666b510209..1f7369ba3c 100644 --- a/mods/ITEMS/mcl_signs/signs_api.lua +++ b/mods/ITEMS/mcl_signs/signs_api.lua @@ -1465,7 +1465,7 @@ function mcl_signs.register_sign_craft(modname, wood_item_string, _name) minetest.register_craft({ type = "fuel", - recipe = ":mcl_signs:wall_sign" .. _name, + recipe = "mcl_signs:wall_sign" .. _name, burntime = 10, }) @@ -1477,7 +1477,7 @@ function mcl_signs.register_sign_craft(modname, wood_item_string, _name) -- register crafts (actual recipe) if minetest.get_modpath(modname) then - local itemstring = ":mcl_signs:wall_sign" + local itemstring = "mcl_signs:wall_sign" minetest.register_craft({ output = itemstring .. _name .. " 3", From 7d63b07e099aac1ca56b0e586b442e94fd1469fb Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 18 Nov 2022 00:45:16 +0100 Subject: [PATCH 47/47] Fix mangrove sign registrations --- mods/ITEMS/mcl_signs/init.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index 403b53ef84..e724def68c 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -125,9 +125,11 @@ mcl_signs.register_sign_craft("mcl_core", "mcl_core:junglewood", "_junglewood") mcl_signs.register_sign("mcl_core", "#ea7479", "_acaciawood", "Acacia Sign") mcl_signs.register_sign_craft("mcl_core", "mcl_core:acaciawood", "_acaciawood") --- mangrove_wood Sign "#c7545c" -mcl_signs.register_sign("mcl_core", "#b8693d", "_mangrove_wood", "Mangrove Sign") -mcl_signs.register_sign_craft("mcl_core", "mcl_core:mangrove_wood", "_mangrove_wood") +if minetest.get_modpath("mcl_mangrove") then + -- mangrove_wood Sign "#c7545c" + mcl_signs.register_sign("mcl_mangrove", "#b8693d", "_mangrove_wood", "Mangrove Sign") + mcl_signs.register_sign_craft("mcl_mangrove", "mcl_mangrove:mangrove_wood", "_mangrove_wood") +end -- add in the nether wood signs if minetest.get_modpath("mcl_crimson") then