Compare commits

..

No commits in common. "0f20e18e532f4af86742836215ee382211bf6a4f" and "0170619866ae7b9ccd9f4b8580f23c4a76f3a043" have entirely different histories.

14 changed files with 506 additions and 1281 deletions

View File

@ -36,8 +36,6 @@ mcl_vars.MAP_BLOCKSIZE = math.max(1, minetest.MAP_BLOCKSIZE or 16)
mcl_vars.mapgen_limit = math.max(1, tonumber(minetest.get_mapgen_setting("mapgen_limit")) or 31000)
mcl_vars.MAX_MAP_GENERATION_LIMIT = math.max(1, minetest.MAX_MAP_GENERATION_LIMIT or 31000)
-- Central chunk is offset from 0,0,0 coordinates by 32 nodes (2 blocks)
-- See more in https://git.minetest.land/MineClone2/MineClone2/wiki/World-structure%3A-positions%2C-boundaries%2C-blocks%2C-chunks%2C-dimensions%2C-barriers-and-the-void
local central_chunk_offset = -math.floor(mcl_vars.chunksize / 2)
mcl_vars.central_chunk_offset_in_nodes = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE

View File

@ -113,55 +113,6 @@ local function disable_physics(object, luaentity, ignore_check, reset_movement)
end
end
local function try_object_pickup(player, inv, object, checkpos)
if not inv then return end
local le = object:get_luaentity()
-- Check magnet timer
if not (le._magnet_timer >= 0) then return end
if not (le._magnet_timer < item_drop_settings.magnet_time) then return end
-- Don't try to collect again
if le._removed then return end
-- Ignore if itemstring is not set yet
if le.itemstring == "" then return end
-- Add what we can to the inventory
local itemstack = ItemStack(le.itemstring)
local leftovers = inv:add_item("main", itemstack )
check_pickup_achievements(object, player)
if leftovers:is_empty() then
-- Destroy entity
-- This just prevents this section to be run again because object:remove() doesn't remove the item immediately.
le.target = checkpos
le._removed = true
-- Stop the object
object:set_velocity(vector.zero())
object:set_acceleration(vector.zero())
object:move_to(checkpos)
-- Update sound pool
local name = player:get_player_name()
pool[name] = ( pool[name] or 0 ) + 1
-- Make sure the object gets removed
minetest.after(0.25, function()
--safety check
if object and object:get_luaentity() then
object:remove()
end
end)
else
-- Update entity itemstring
le.itemstring = leftovers:to_string()
end
end
minetest.register_globalstep(function(_)
tick = not tick
@ -196,7 +147,40 @@ minetest.register_globalstep(function(_)
object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and object:get_luaentity()._magnet_timer
and (object:get_luaentity()._insta_collect or (object:get_luaentity().age > item_drop_settings.age)) then
try_object_pickup( player, inv, object, checkpos )
if object:get_luaentity()._magnet_timer >= 0 and
object:get_luaentity()._magnet_timer < item_drop_settings.magnet_time and inv and
inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
-- Collection
if not object:get_luaentity()._removed then
-- Ignore if itemstring is not set yet
if object:get_luaentity().itemstring ~= "" then
inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
check_pickup_achievements(object, player)
-- Destroy entity
-- This just prevents this section to be run again because object:remove() doesn't remove the item immediately.
object:get_luaentity().target = checkpos
object:get_luaentity()._removed = true
object:set_velocity(vector.zero())
object:set_acceleration(vector.zero())
object:move_to(checkpos)
pool[name] = pool[name] + 1
minetest.after(0.25, function()
--safety check
if object and object:get_luaentity() then
object:remove()
end
end)
end
end
end
elseif not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "mcl_experience:orb" then
local entity = object:get_luaentity()
entity.collector = player:get_player_name()

View File

@ -322,7 +322,7 @@ function mob_class:toggle_sit(clicker,p)
particle = "mobs_mc_wolf_icon_roam.png"
self.order = "roam"
self.state = "stand"
self.walk_chance = 50
self.walk_chance = default_walk_chance
self.jump = true
self:set_animation("stand")
-- TODO: Add sitting model

View File

@ -13,7 +13,7 @@ local get_node = minetest.get_node
local get_item_group = minetest.get_item_group
local get_node_light = minetest.get_node_light
local find_nodes_in_area_under_air = minetest.find_nodes_in_area_under_air
local mt_get_biome_name = minetest.get_biome_name
local get_biome_name = minetest.get_biome_name
local get_objects_inside_radius = minetest.get_objects_inside_radius
local get_connected_players = minetest.get_connected_players
@ -664,29 +664,7 @@ local function has_room(self,pos)
return true
end
mcl_mobs.custom_biomecheck = nil
function mcl_mobs.register_custom_biomecheck(custom_biomecheck)
mcl_mobs.custom_biomecheck = custom_biomecheck
end
local function get_biome_name(pos)
if mcl_mobs.custom_biomecheck then
return mcl_mobs.custom_biomecheck (pos)
else
local gotten_biome = minetest.get_biome_data(pos)
if not gotten_biome then
return
end
gotten_biome = mt_get_biome_name(gotten_biome.biome)
--minetest.log ("biome: " .. dump(gotten_biome))
return gotten_biome
end
end
local function spawn_check(pos, spawn_def)
if not spawn_def or not pos then return end
@ -696,10 +674,11 @@ local function spawn_check(pos, spawn_def)
local mob_def = minetest.registered_entities[spawn_def.name]
local mob_type = mob_def.type
local gotten_node = get_node(pos).name
if not gotten_node then return end
local gotten_biome = minetest.get_biome_data(pos)
local biome_name = get_biome_name(pos)
if not biome_name then return end
if not gotten_node or not gotten_biome then return end
gotten_biome = get_biome_name(gotten_biome.biome) --makes it easier to work with
local is_ground = minetest.get_item_group(gotten_node,"solid") ~= 0
if not is_ground then
@ -717,9 +696,8 @@ local function spawn_check(pos, spawn_def)
if pos.y >= spawn_def.min_height
and pos.y <= spawn_def.max_height
and spawn_def.dimension == dimension
and biome_check(spawn_def.biomes, biome_name) then
and biome_check(spawn_def.biomes, gotten_biome) then
mcl_log("Spawn level 1 check - Passed")
if (is_ground or spawn_def.type_of_spawning ~= "ground")
and (spawn_def.type_of_spawning ~= "ground" or not is_leaf)
and (not is_farm_animal(spawn_def.name) or is_grass)
@ -729,7 +707,6 @@ local function spawn_check(pos, spawn_def)
and (spawn_def.check_position and spawn_def.check_position(pos) or spawn_def.check_position == nil)
and ( not spawn_protected or not minetest.is_protected(pos, "") ) then
mcl_log("Spawn level 2 check - Passed")
local gotten_light = get_node_light(pos)
if modern_lighting then

View File

@ -16,13 +16,6 @@ local trading_items = {
{ itemstring = "mcl_throwing:ender_pearl", amount_min = 2, amount_max = 6 },
{ itemstring = "mcl_potions:fire_resistance", amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_potions:fire_resistance_splash", amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_enchanting:book_enchanted", amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_armor:boots_iron_enchanted", amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_blackstone:blackstone", amount_min = 8, amount_max = 16 },
{ itemstring = "mcl_bows:arrow", amount_min = 6, amount_max = 12 },
{ itemstring = "mcl_core:crying_obsidian", amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_fire:fire_charge", amount_min = 1, amount_max = 1 },
--{ itemstring = "FIXME:spectral_arrow", amount_min = 6, amount_max = 12 },
}
local S = minetest.get_translator("mobs_mc")
@ -149,18 +142,14 @@ local piglin = {
local c_pos = self.object:get_pos()
if c_pos then
self.what_traded = trading_items[math.random(#trading_items)]
local stack = ItemStack(self.what_traded.itemstring)
stack:set_count(math.random(self.what_traded.amount_min, self.what_traded.amount_max))
if mcl_enchanting.is_enchanted(self.what_traded.itemstring) then
local enchantment = "soul_speed"
mcl_enchanting.enchant(stack, enchantment, mcl_enchanting.random(nil, 1, mcl_enchanting.enchantments[enchantment].max_level))
for x = 1, math.random(self.what_traded.amount_min, self.what_traded.amount_max) do
local p = c_pos
local nn=minetest.find_nodes_in_area_under_air(vector.offset(c_pos,-1,-1,-1),vector.offset(c_pos,1,1,1),{"group:solid"})
if nn and #nn > 0 then
p = vector.offset(nn[math.random(#nn)],0,1,0)
end
minetest.add_item(p, self.what_traded.itemstring)
end
local p = c_pos
local nn=minetest.find_nodes_in_area_under_air(vector.offset(c_pos,-1,-1,-1),vector.offset(c_pos,1,1,1),{"group:solid"})
if nn and #nn > 0 then
p = vector.offset(nn[math.random(#nn)],0,1,0)
end
minetest.add_item(p, stack)
end
end)
end

View File

@ -30,8 +30,6 @@ local strider = {
} },
visual_size = {x=3, y=3},
sounds = {
eat = "mobs_mc_animal_eat_generic",
distance = 16,
},
jump = true,
makes_footstep_sound = true,
@ -53,7 +51,6 @@ local strider = {
walk_start = 1,
walk_end = 20,
},
follow = { "mcl_crimson:warped_fungus" },
lava_damage = 0,
fire_damage = 0,
light_damage = 0,
@ -70,13 +67,8 @@ local strider = {
do_custom = function(self, dtime)
if minetest.find_node_near(self.object:get_pos(), 2, {"mcl_core:lava_source","mcl_core:lava_flowing","mcl_nether:nether_lava_source","mcl_nether:nether_lava_flowing"}) then
if self.driver then
self.walk_velocity = 4
self.run_velocity = 8
else
self.walk_velocity = 2
self.run_velocity = 4
end
self.walk_velocity = 2
self.run_velocity = 4
self.base_texture[1] = "extra_mobs_strider.png"
self.shaking = false
else
@ -130,7 +122,7 @@ local strider = {
local wielditem = clicker:get_wielded_item()
if wielditem:get_name() == "mcl_crimson:warped_fungus" then
if wielditem:get_name() ~= "mcl_crimson:warped_fungus" then
if self:feed_tame(clicker, 1, true, true) then return end
end
@ -214,7 +206,7 @@ textures = { {
} }
baby_strider.walk_velocity = 1.2
baby_strider.run_velocity = 2.4
baby_strider.child = true
baby_strider.child = 1
mcl_mobs.register_mob("mobs_mc:baby_strider", baby_strider)

View File

@ -177,6 +177,7 @@ minetest.register_entity("mcl_experience:orb", {
delete_timer = 0,
radius = 4,
on_activate = function(self, staticdata, dtime_s)
self.object:set_velocity(vector.new(
math.random(-2,2)*math.random(),
@ -186,14 +187,10 @@ minetest.register_entity("mcl_experience:orb", {
self.object:set_armor_groups({immortal = 1})
self.object:set_velocity({x = 0, y = 2, z = 0})
self.object:set_acceleration(gravity)
-- Assign 0 xp in case the entity was persisted even though it should not have been (static_save = false)
-- This was a minetest bug for a while: https://github.com/minetest/minetest/issues/14420
local xp = tonumber(staticdata) or 0
local xp = tonumber(staticdata)
self._xp = xp
size = xp_to_size(xp)
self.object:set_properties({
size = xp_to_size(xp)
self.object:set_properties({
visual_size = {x = size, y = size},
glow = 14,
})

View File

@ -2,8 +2,6 @@
local planks = "mcl_cherry_blossom:cherrywood"
local logs = "mcl_cherry_blossom:cherrytree"
local stripped_logs = "mcl_cherry_blossom:stripped_cherrytree"
local wood = "mcl_cherry_blossom:cherrytree_bark"
local stripped_wood = "mcl_cherry_blossom:stripped_cherrytree_bark"
minetest.register_craft({
output = "mcl_cherry_blossom:cherrytree_bark 3",
@ -28,27 +26,6 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = "mcl_cherry_blossom:cherrywood 4",
recipe = {
{ wood },
}
})
minetest.register_craft({
output = "mcl_cherry_blossom:cherrywood 4",
recipe = {
{ stripped_logs },
}
})
minetest.register_craft({
output = "mcl_cherry_blossom:cherrywood 4",
recipe = {
{ stripped_wood },
}
})
minetest.register_craft({
output = "mcl_cherry_blossom:cherry_door 3",
recipe = {

View File

@ -5,8 +5,8 @@ local modpath = minetest.get_modpath(modname)
-- by debiankaios
-- adapted for mcl2 by cora
local wood_slab_groups = {handy = 1, axey = 1, material_wood = 1, wood_slab = 1}
local wood_stair_groups = {handy = 1, axey = 1, material_wood = 1, wood_stairs = 1}
local wood_slab_groups = {handy = 1, axey = 1, flammable = 3, material_wood = 1, fire_encouragement = 5, fire_flammability = 20, wood_slab = 1}
local wood_stair_groups = {handy = 1, axey = 1, flammable = 3, material_wood = 1, fire_encouragement = 5, fire_flammability = 20, wood_stairs = 1}
local function generate_warped_tree(pos)
minetest.place_schematic(pos,modpath.."/schematics/warped_fungus_1.mts","random",nil,false,"place_center_x,place_center_z")
@ -463,7 +463,7 @@ minetest.register_craft({
minetest.register_node("mcl_crimson:warped_hyphae_wood", {
description = S("Warped Hyphae Wood"),
tiles = {"mcl_crimson_warped_hyphae_wood.png"},
groups = {handy = 5,axey = 1, wood=1,building_block = 1, material_wood = 1},
groups = {handy = 5,axey = 1, flammable = 3, wood=1,building_block = 1, material_wood = 1, fire_encouragement = 5, fire_flammability = 20},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_hardness = 2,
})
@ -478,27 +478,6 @@ minetest.register_craft({
},
})
minetest.register_craft({
output = "mcl_crimson:warped_hyphae_wood 4",
recipe = {
{"mcl_crimson:warped_hyphae_bark"},
},
})
minetest.register_craft({
output = "mcl_crimson:warped_hyphae_wood 4",
recipe = {
{"mcl_crimson:stripped_warped_hyphae"},
},
})
minetest.register_craft({
output = "mcl_crimson:warped_hyphae_wood 4",
recipe = {
{"mcl_crimson:stripped_warped_hyphae_bark"},
},
})
minetest.register_craft({
output = "mcl_crimson:warped_nylium 2",
recipe = {
@ -691,27 +670,6 @@ minetest.register_craft({
},
})
minetest.register_craft({
output = "mcl_crimson:crimson_hyphae_wood 4",
recipe = {
{"mcl_crimson:crimson_hyphae_bark"},
},
})
minetest.register_craft({
output = "mcl_crimson:crimson_hyphae_wood 4",
recipe = {
{"mcl_crimson:stripped_crimson_hyphae"},
},
})
minetest.register_craft({
output = "mcl_crimson:crimson_hyphae_wood 4",
recipe = {
{"mcl_crimson:stripped_crimson_hyphae_bark"},
},
})
minetest.register_craft({
output = "mcl_crimson:crimson_nylium 2",
recipe = {
@ -757,7 +715,7 @@ mcl_doors:register_door("mcl_crimson:crimson_door", {
_doc_items_longdesc = S("Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal."),
_doc_items_usagehelp = S("To open or close a wooden door, rightclick it or supply its lower half with a redstone signal."),
inventory_image = "mcl_crimson_crimson_door.png",
groups = {handy=1,axey=1, material_wood=1},
groups = {handy=1,axey=1, material_wood=1, flammable=-1},
_mcl_hardness = 3,
_mcl_blast_resistance = 3,
tiles_bottom = "mcl_crimson_crimson_door_bottom.png",
@ -772,7 +730,7 @@ mcl_doors:register_trapdoor("mcl_crimson:crimson_trapdoor", {
tile_front = "mcl_crimson_crimson_trapdoor.png",
tile_side = "mcl_crimson_crimson_trapdoor_side.png",
wield_image = "mcl_crimson_crimson_trapdoor.png",
groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1},
groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1, flammable=-1},
_mcl_hardness = 3,
_mcl_blast_resistance = 3,
sounds = mcl_sounds.node_sound_wood_defaults(),
@ -783,7 +741,7 @@ mcl_fences.register_fence_and_fence_gate(
S("Crimson Fence"),
S("Crimson Fence Gate"),
"mcl_crimson_crimson_fence.png",
{handy=1,axey=1,fence_wood=1},
{handy=1,axey=1, flammable=2,fence_wood=1, fire_encouragement=5, fire_flammability=20},
minetest.registered_nodes["mcl_crimson:crimson_hyphae"]._mcl_hardness,
minetest.registered_nodes["mcl_crimson:crimson_hyphae"]._mcl_blast_resistance,
{"group:fence_wood"},
@ -795,7 +753,7 @@ mcl_doors:register_door("mcl_crimson:warped_door", {
_doc_items_longdesc = S("Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal."),
_doc_items_usagehelp = S("To open or close a wooden door, rightclick it or supply its lower half with a redstone signal."),
inventory_image = "mcl_crimson_warped_door.png",
groups = {handy=1,axey=1, material_wood=1},
groups = {handy=1,axey=1, material_wood=1, flammable=-1},
_mcl_hardness = 3,
_mcl_blast_resistance = 3,
tiles_bottom = "mcl_crimson_warped_door_bottom.png",
@ -810,7 +768,7 @@ mcl_doors:register_trapdoor("mcl_crimson:warped_trapdoor", {
tile_front = "mcl_crimson_warped_trapdoor.png",
tile_side = "mcl_crimson_warped_trapdoor_side.png",
wield_image = "mcl_crimson_warped_trapdoor.png",
groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1},
groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1, flammable=-1},
_mcl_hardness = 3,
_mcl_blast_resistance = 3,
sounds = mcl_sounds.node_sound_wood_defaults(),
@ -821,7 +779,7 @@ mcl_fences.register_fence_and_fence_gate(
S("Warped Fence"),
S("Warped Fence Gate"),
"mcl_crimson_warped_fence.png",
{handy=1,axey=1,fence_wood=1},
{handy=1,axey=1, flammable=2,fence_wood=1, fire_encouragement=5, fire_flammability=20},
minetest.registered_nodes["mcl_crimson:warped_hyphae"]._mcl_hardness,
minetest.registered_nodes["mcl_crimson:warped_hyphae"]._mcl_blast_resistance,
{"group:fence_wood"},

View File

@ -182,10 +182,6 @@ local function apply_bone_meal(pointed_thing, user)
local n = minetest.get_node(pos)
if n.name == "" then return false end
if mcl_util.check_area_protection(pos, pointed_thing.above, user) then
return false
end
for _, func in pairs(mcl_dye.bone_meal_callbacks) do
if func(pointed_thing, user) then
return true

View File

@ -399,27 +399,6 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = "mcl_mangrove:mangrove_wood 4",
recipe = {
{"mcl_mangrove:mangrove_tree_bark"},
}
})
minetest.register_craft({
output = "mcl_mangrove:mangrove_wood 4",
recipe = {
{"mcl_mangrove:mangrove_stripped"},
}
})
minetest.register_craft({
output = "mcl_mangrove:mangrove_wood 4",
recipe = {
{"mcl_mangrove:mangrove_stripped_bark"},
}
})
minetest.register_craft({
type = "fuel",
recipe = "group:fence_wood",

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,10 @@
--- 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
@ -112,6 +115,9 @@ 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.
@ -135,110 +141,37 @@ function mcl_signs.build_signs_info()
end
-- DEFINE SIGN BASE TYPES
local common_definition = {
_mcl_hardness = 1,
_mcl_blast_resistance = 1,
stack_max = 16,
sounds = node_sounds,
groups = mcl_signs.sign_groups,
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
drawtype = "mesh",
paramtype = "light",
tiles = { "mcl_signs_sign.png" },
sunlight_propagates = true,
-- 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 = "mcl_signs_default_sign.png",
walkable = false,
is_ground_content = false,
wield_image = "mcl_signs_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_rightclick = function (pos, node, clicker, itemstack, pointed_thing)
if DEBUG then
minetest.log("verbose", "[mcl_signs] 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()
local protected = mcl_util.check_position_protection(pos, clicker)
if node and not protected then
if DEBUG then
minetest.log("verbose", "[mcl_signs] 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
-- 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)
-- "mcl_dye:black" is a special case: it makes the sign's lettering black AND removes glow.
if (iname == "mcl_dye:black") then
success = mcl_signs:glow_sign(pos, true)
if success and DEBUG then
minetest.log("verbose", "[mcl_signs] Sign Glow removal Success.")
end
end
if success then
if DEBUG then
minetest.log("verbose", "[mcl_signs] Sign Color Success.")
end
itemstack:take_item()
end
return
end
-- No modifier item in hand, open the sign for edition
local old_text = minetest.get_meta(pos):get_string("text")
mcl_signs:show_formspec(clicker, pos, old_text)
end
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)
end,
}
-- wall signs' & hanging signs' base (definition)
mcl_signs.wall_standard = table.copy(common_definition)
mcl_signs.wall_standard.description = S("Sign")
mcl_signs.wall_standard._tt_help = S("Can be written")
mcl_signs.wall_standard._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.")
mcl_signs.wall_standard._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.")
mcl_signs.wall_standard.inventory_image = "mcl_signs_default_sign.png"
mcl_signs.wall_standard.wield_image = "mcl_signs_default_sign.png"
mcl_signs.wall_standard.node_placement_prediction = ""
mcl_signs.wall_standard.paramtype2 = "wallmounted"
mcl_signs.wall_standard.mesh = "mcl_signs_signonwallmount.obj"
mcl_signs.wall_standard.selection_box = { type = "wallmounted", wall_side = { -0.5, -7 / 28, -0.5, -23 / 56, 7 / 28, 0.5 } }
mcl_signs.wall_standard.on_timer = function(pos)
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
mcl_signs.wall_standard.on_place = function(itemstack, placer, pointed_thing)
end,
on_place = function(itemstack, placer, pointed_thing)
local above = pointed_thing.above
local under = pointed_thing.under
@ -259,6 +192,9 @@ mcl_signs.wall_standard.on_place = function(itemstack, placer, pointed_thing)
end
local wdir = minetest.dir_to_wallmounted(dir)
--local placer_pos = placer:get_pos()
local fdir = minetest.dir_to_facedir(dir)
local sign_info
@ -336,10 +272,18 @@ mcl_signs.wall_standard.on_place = function(itemstack, placer, pointed_thing)
minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true)
mcl_signs:show_formspec(placer, place_pos, "")
mcl_signs:show_formspec(placer, place_pos)
return itemstack
end
mcl_signs.wall_standard.on_rotate = function(pos, node, user, mode)
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
@ -349,21 +293,105 @@ mcl_signs.wall_standard.on_rotate = function(pos, node, user, mode)
else
return false
end
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()
local protected = mcl_util.check_position_protection(pos, clicker)
if node and not protected 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 = table.copy(common_definition)
mcl_signs.standing_standard.paramtype2 = "facedir"
mcl_signs.standing_standard.mesh = "mcl_signs_sign.obj"
mcl_signs.standing_standard.selection_box = { type = "fixed", fixed = { -0.2, -0.5, -0.2, 0.2, 0.5, 0.2 } }
mcl_signs.standing_standard.drop = "mcl_signs:wall_sign"
mcl_signs.standing_standard.on_timer = function(pos)
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
mcl_signs.standing_standard.on_rotate = function(pos, node, user, mode)
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)
@ -372,7 +400,60 @@ mcl_signs.standing_standard.on_rotate = function(pos, node, user, mode)
end
mcl_signs:update_sign(pos, nil, nil, true)
return true
end
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()
local protected = mcl_util.check_position_protection(pos, clicker)
if node and not protected 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
@ -582,7 +663,7 @@ function mcl_signs.register_sign (modname, color, _name, ttsign)
minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true)
mcl_signs:show_formspec(placer, place_pos, "")
mcl_signs:show_formspec(placer, place_pos)
return itemstack
end
@ -835,7 +916,7 @@ function mcl_signs.register_sign_custom (modname, _name, tiles, color, inventory
minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true)
mcl_signs:show_formspec(placer, place_pos, "")
mcl_signs:show_formspec(placer, place_pos)
return itemstack
end
minetest.register_node(":mcl_signs:wall_sign" .. _name, new_sign)
@ -1071,7 +1152,7 @@ function mcl_signs.reregister_sign (modname, color, _name, ttsign)
minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true)
mcl_signs:show_formspec(placer, place_pos, "")
mcl_signs:show_formspec(placer, place_pos)
return itemstack
end
@ -1320,7 +1401,7 @@ function mcl_signs.reregister_sign_custom (modname, _name, tiles, color, invento
minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true)
mcl_signs:show_formspec(placer, place_pos, "")
mcl_signs:show_formspec(placer, place_pos)
return itemstack
end
minetest.override_item("mcl_signs:wall_sign" .. _name, new_sign)
@ -1802,7 +1883,7 @@ function mcl_signs:update_sign(pos, fields, sender, force_remove, text_color)
return false
end
local text = meta:get_string("text", "")
if fields and fields.text then
if fields and (text == "" and fields.text) then
meta:set_string("text", fields.text)
text = fields.text
end
@ -1959,13 +2040,11 @@ function mcl_signs:update_sign(pos, fields, sender, force_remove, text_color)
end
function mcl_signs:show_formspec(player, pos, old_text)
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:")) .. ";".. F(old_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")) .. "]"
"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

View File

@ -338,17 +338,17 @@ Source path,Source file,Target file,xs,ys,xl,yl,xt,yt,Blacklisted?
/assets/minecraft/textures/block,mycelium_top.png,mcl_core_mycelium_top.png,,,,,,,
/assets/minecraft/textures/block,red_sand.png,mcl_core_red_sand.png,,,,,,,
/assets/minecraft/textures/block,red_sandstone_bottom.png,mcl_core_red_sandstone_bottom.png,,,,,,,
/assets/minecraft/textures/block,cut_red_sandstone.png,mcl_core_red_sandstone_smooth.png,,,,,,,
/assets/minecraft/textures/block,cut_red_sandstone.png,mcl_core_red_sandstone_carved.png,,,,,,,
/assets/minecraft/textures/block,red_sandstone.png,mcl_core_red_sandstone_normal.png,,,,,,,
/assets/minecraft/textures/block,chiseled_red_sandstone.png,mcl_core_red_sandstone_carved.png,,,,,,,
/assets/minecraft/textures/block,chiseled_red_sandstone.png,mcl_core_red_sandstone_smooth.png,,,,,,,
/assets/minecraft/textures/block,red_sandstone_top.png,mcl_core_red_sandstone_top.png,,,,,,,
/assets/minecraft/textures/block,redstone_ore.png,mcl_core_redstone_ore.png,,,,,,,
/assets/minecraft/textures/item,sugar_cane.png,mcl_core_reeds.png,,,,,,,
/assets/minecraft/textures/block,sandstone_bottom.png,mcl_core_sandstone_bottom.png,,,,,,,
/assets/minecraft/textures/block,cut_sandstone.png,mcl_core_sandstone_carved.png,,,,,,,
/assets/minecraft/textures/block,chiseled_sandstone.png,mcl_core_sandstone_normal.png,,,,,,,
/assets/minecraft/textures/block,cut_sandstone.png,mcl_core_sandstone_smooth.png,,,,,,,
/assets/minecraft/textures/block,chiseled_sandstone.png,mcl_core_sandstone_carved.png,,,,,,,
/assets/minecraft/textures/block,sandstone.png,mcl_core_sandstone_normal.png,,,,,,,
/assets/minecraft/textures/block,sandstone_top.png,mcl_core_sandstone_top.png,,,,,,,
/assets/minecraft/textures/block,sandstone.png,mcl_core_sandstone_top.png,,,,,,,
/assets/minecraft/textures/block,slime_block.png,mcl_core_slime.png,,,,,,,
/assets/minecraft/textures/block,smooth_stone.png,mcl_core_stonebrick_carved.png,,,,,,,
/assets/minecraft/textures/block,cracked_stone_bricks.png,mcl_core_stonebrick_cracked.png,,,,,,,

1 Source path Source file Target file xs ys xl yl xt yt Blacklisted?
338 /assets/minecraft/textures/block mycelium_top.png mcl_core_mycelium_top.png
339 /assets/minecraft/textures/block red_sand.png mcl_core_red_sand.png
340 /assets/minecraft/textures/block red_sandstone_bottom.png mcl_core_red_sandstone_bottom.png
341 /assets/minecraft/textures/block cut_red_sandstone.png mcl_core_red_sandstone_smooth.png mcl_core_red_sandstone_carved.png
342 /assets/minecraft/textures/block red_sandstone.png mcl_core_red_sandstone_normal.png
343 /assets/minecraft/textures/block chiseled_red_sandstone.png mcl_core_red_sandstone_carved.png mcl_core_red_sandstone_smooth.png
344 /assets/minecraft/textures/block red_sandstone_top.png mcl_core_red_sandstone_top.png
345 /assets/minecraft/textures/block redstone_ore.png mcl_core_redstone_ore.png
346 /assets/minecraft/textures/item sugar_cane.png mcl_core_reeds.png
347 /assets/minecraft/textures/block sandstone_bottom.png mcl_core_sandstone_bottom.png
348 /assets/minecraft/textures/block cut_sandstone.png mcl_core_sandstone_carved.png
349 /assets/minecraft/textures/block chiseled_sandstone.png mcl_core_sandstone_normal.png
350 /assets/minecraft/textures/block cut_sandstone.png mcl_core_sandstone_smooth.png
351 /assets/minecraft/textures/block chiseled_sandstone.png sandstone.png mcl_core_sandstone_carved.png mcl_core_sandstone_top.png
/assets/minecraft/textures/block sandstone.png mcl_core_sandstone_normal.png
/assets/minecraft/textures/block sandstone_top.png mcl_core_sandstone_top.png
352 /assets/minecraft/textures/block slime_block.png mcl_core_slime.png
353 /assets/minecraft/textures/block smooth_stone.png mcl_core_stonebrick_carved.png
354 /assets/minecraft/textures/block cracked_stone_bricks.png mcl_core_stonebrick_cracked.png