From 221ee0fcf1da898fffbfaeda1fddb1c22491a3da Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Sun, 7 Aug 2022 00:13:03 +0800 Subject: [PATCH 01/34] [5.6] mark places with unsafe set_hp entity handling There might be other places i might be missing, but these are the obvious ones. leftover entity handling i did not mark: * everything that involves a apply()-like algorithm (e.g. callbacks) over the same list of objects. * in mcl_damage, it's not known whether mcl_damage.from_mt() would involve entity handling or just player handling. --- mods/CORE/mcl_explosions/init.lua | 3 ++- mods/ENTITIES/mcl_boats/init.lua | 1 + mods/ENTITIES/mcl_mobs/api.lua | 1 + mods/ENVIRONMENT/lightning/init.lua | 3 +++ mods/ITEMS/mcl_armor/damage.lua | 1 + mods/ITEMS/mcl_bows/arrow.lua | 1 + mods/ITEMS/mcl_bows/rocket.lua | 1 + 7 files changed, 10 insertions(+), 1 deletion(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 0132d1669..92453a9d5 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -337,12 +337,13 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc if not obj:is_player() then return end - + -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_util.deal_damage(obj, damage, {type = "explosion", direct = direct, source = source}) obj:add_velocity(vector.multiply(punch_dir, impact * 20)) end) else + -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_util.deal_damage(obj, damage, {type = "explosion", direct = direct, source = source}) if obj:is_player() or ent.tnt_knockback then diff --git a/mods/ENTITIES/mcl_boats/init.lua b/mods/ENTITIES/mcl_boats/init.lua index 087cd7eae..cd8002b22 100644 --- a/mods/ENTITIES/mcl_boats/init.lua +++ b/mods/ENTITIES/mcl_boats/init.lua @@ -201,6 +201,7 @@ function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, d end function boat.on_step(self, dtime, moveresult) + -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_burning.tick(self.object, dtime, self) self._v = get_v(self.object:get_velocity()) * get_sign(self._v) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 8945c6e20..d183d55c7 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3617,6 +3617,7 @@ local mob_step = function(self, dtime) check_item_pickup(self) check_aggro(self,dtime) if not self.fire_resistant then + -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_burning.tick(self.object, dtime, self) end diff --git a/mods/ENVIRONMENT/lightning/init.lua b/mods/ENVIRONMENT/lightning/init.lua index 14d8f5176..48eefce4e 100644 --- a/mods/ENVIRONMENT/lightning/init.lua +++ b/mods/ENVIRONMENT/lightning/init.lua @@ -120,6 +120,8 @@ function lightning.strike(pos) if not pos then return false end + -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS + -- mcl_util.deal_damage inside one of on_strike_functions local objects = get_objects_inside_radius(pos2, 3.5) if lightning.on_strike_functions then for _, func in pairs(lightning.on_strike_functions) do @@ -174,6 +176,7 @@ lightning.register_on_strike(function(pos, pos2, objects) elseif lua and lua.name == "mobs_mc:creeper" then mcl_util.replace_mob(obj, "mobs_mc:creeper_charged") else + -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_util.deal_damage(obj, 5, { type = "lightning_bolt" }) end end diff --git a/mods/ITEMS/mcl_armor/damage.lua b/mods/ITEMS/mcl_armor/damage.lua index ed616397d..e76f8034b 100644 --- a/mods/ITEMS/mcl_armor/damage.lua +++ b/mods/ITEMS/mcl_armor/damage.lua @@ -89,6 +89,7 @@ mcl_damage.register_modifier(function(obj, damage, reason) local thorns_damage = thorns_damage_regular + thorns_damage_irregular if thorns_damage > 0 and reason.type ~= "thorns" and reason.source ~= obj then + -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_util.deal_damage(reason.source, thorns_damage, {type = "thorns", direct = obj}) local thorns_item = thorns_pieces[math.random(#thorns_pieces)] diff --git a/mods/ITEMS/mcl_bows/arrow.lua b/mods/ITEMS/mcl_bows/arrow.lua index a03b875cb..10b7f6421 100644 --- a/mods/ITEMS/mcl_bows/arrow.lua +++ b/mods/ITEMS/mcl_bows/arrow.lua @@ -114,6 +114,7 @@ local function damage_particles(pos, is_critical) end function ARROW_ENTITY.on_step(self, dtime) + -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_burning.tick(self.object, dtime, self) self._time_in_air = self._time_in_air + .001 diff --git a/mods/ITEMS/mcl_bows/rocket.lua b/mods/ITEMS/mcl_bows/rocket.lua index d25c52647..e08db5323 100644 --- a/mods/ITEMS/mcl_bows/rocket.lua +++ b/mods/ITEMS/mcl_bows/rocket.lua @@ -312,6 +312,7 @@ local function damage_particles(pos, is_critical) end function ARROW_ENTITY.on_step(self, dtime) + -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_burning.tick(self.object, dtime, self) self._time_in_air = self._time_in_air + .001 From bce4d29737c46d5ef37a217a0ddf271e0edd1e95 Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Sun, 7 Aug 2022 10:44:13 +0800 Subject: [PATCH 02/34] [5.6][lightning] fix unsafe entitiy handling this does not excuse all on_strike callbacks to allow oversights. it must also track entity removal. --- mods/ENVIRONMENT/lightning/init.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mods/ENVIRONMENT/lightning/init.lua b/mods/ENVIRONMENT/lightning/init.lua index 48eefce4e..bd8bc265b 100644 --- a/mods/ENVIRONMENT/lightning/init.lua +++ b/mods/ENVIRONMENT/lightning/init.lua @@ -120,11 +120,10 @@ function lightning.strike(pos) if not pos then return false end - -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS - -- mcl_util.deal_damage inside one of on_strike_functions - local objects = get_objects_inside_radius(pos2, 3.5) if lightning.on_strike_functions then for _, func in pairs(lightning.on_strike_functions) do + -- allow on_strike callbacks to destroy entities by re-obtaining objects for each callback + local objects = get_objects_inside_radius(pos2, 3.5) func(pos, pos2, objects) end end @@ -176,7 +175,7 @@ lightning.register_on_strike(function(pos, pos2, objects) elseif lua and lua.name == "mobs_mc:creeper" then mcl_util.replace_mob(obj, "mobs_mc:creeper_charged") else - -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS + -- WARNING: unsafe entity handling. object may be removed immediately mcl_util.deal_damage(obj, 5, { type = "lightning_bolt" }) end end From 4b316923194506b4e897029900a259463f5cf0fa Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Sun, 7 Aug 2022 12:09:12 +0800 Subject: [PATCH 03/34] [5.6][boats] fix unsafe entity handling this probably does not affect normal gameplay, unless you can set boats on fire somehow --- mods/ENTITIES/mcl_boats/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_boats/init.lua b/mods/ENTITIES/mcl_boats/init.lua index cd8002b22..9775b8597 100644 --- a/mods/ENTITIES/mcl_boats/init.lua +++ b/mods/ENTITIES/mcl_boats/init.lua @@ -201,8 +201,9 @@ function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, d end function boat.on_step(self, dtime, moveresult) - -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_burning.tick(self.object, dtime, self) + -- mcl_burning.tick may remove object immediately + if not self.object:get_pos() then return end self._v = get_v(self.object:get_velocity()) * get_sign(self._v) local v_factor = 1 From bf80074d98d5399663ffa1034c301f0adf36f583 Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Sun, 7 Aug 2022 12:36:53 +0800 Subject: [PATCH 04/34] [5.6][mobs] fix unsafe entity handling (unsure) i'm not sure about this one, can't find a suitable test for it. --- mods/ENTITIES/mcl_mobs/api.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index d183d55c7..8cbe9b8ca 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3617,8 +3617,9 @@ local mob_step = function(self, dtime) check_item_pickup(self) check_aggro(self,dtime) if not self.fire_resistant then - -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_burning.tick(self.object, dtime, self) + -- mcl_burning.tick may remove object immediately + if not self.object:get_pos() then return end end local pos = self.object:get_pos() From 4f2789c498e35067633a5f12e41dcaef303615f8 Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Sun, 7 Aug 2022 12:43:24 +0800 Subject: [PATCH 05/34] [5.6][armor] fix unsafe entity handling (unsure) i'm not sure about this one, can't fnd a suitable test for it. --- mods/ITEMS/mcl_armor/damage.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_armor/damage.lua b/mods/ITEMS/mcl_armor/damage.lua index e76f8034b..012c32307 100644 --- a/mods/ITEMS/mcl_armor/damage.lua +++ b/mods/ITEMS/mcl_armor/damage.lua @@ -89,8 +89,9 @@ mcl_damage.register_modifier(function(obj, damage, reason) local thorns_damage = thorns_damage_regular + thorns_damage_irregular if thorns_damage > 0 and reason.type ~= "thorns" and reason.source ~= obj then - -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_util.deal_damage(reason.source, thorns_damage, {type = "thorns", direct = obj}) + -- mcl_util.deal_damage may remove object immediately + if not reason.source:get_pos() then return end local thorns_item = thorns_pieces[math.random(#thorns_pieces)] From 156aff21a1aa4ade6ec2164f3a2b1e88c7f86377 Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Sun, 7 Aug 2022 12:48:09 +0800 Subject: [PATCH 06/34] [5.6][bows] fix unsafe entity handling for arrows --- mods/ITEMS/mcl_bows/arrow.lua | 3 ++- mods/ITEMS/mcl_bows/rocket.lua | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_bows/arrow.lua b/mods/ITEMS/mcl_bows/arrow.lua index 10b7f6421..ad4a3f30e 100644 --- a/mods/ITEMS/mcl_bows/arrow.lua +++ b/mods/ITEMS/mcl_bows/arrow.lua @@ -114,8 +114,9 @@ local function damage_particles(pos, is_critical) end function ARROW_ENTITY.on_step(self, dtime) - -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_burning.tick(self.object, dtime, self) + -- mcl_burning.tick may remove object immediately + if not self.object:get_pos() then return end self._time_in_air = self._time_in_air + .001 diff --git a/mods/ITEMS/mcl_bows/rocket.lua b/mods/ITEMS/mcl_bows/rocket.lua index e08db5323..e846937d0 100644 --- a/mods/ITEMS/mcl_bows/rocket.lua +++ b/mods/ITEMS/mcl_bows/rocket.lua @@ -312,8 +312,9 @@ local function damage_particles(pos, is_critical) end function ARROW_ENTITY.on_step(self, dtime) - -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_burning.tick(self.object, dtime, self) + -- mcl_burning.tick may remove object immediately + if not self.object:get_pos() then return end self._time_in_air = self._time_in_air + .001 From 0e999d8bb9d0c8f12f4761739b67f9ddd0df7223 Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Sun, 7 Aug 2022 13:00:43 +0800 Subject: [PATCH 07/34] [5.6] remove incorrect marks. wrong, bad. these are fine. --- mods/CORE/mcl_explosions/init.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 92453a9d5..cb9af5c79 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -337,13 +337,11 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc if not obj:is_player() then return end - -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_util.deal_damage(obj, damage, {type = "explosion", direct = direct, source = source}) obj:add_velocity(vector.multiply(punch_dir, impact * 20)) end) else - -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_util.deal_damage(obj, damage, {type = "explosion", direct = direct, source = source}) if obj:is_player() or ent.tnt_knockback then From f6148068c54b0b51343f55b728b79abe0ba83b81 Mon Sep 17 00:00:00 2001 From: Sumyjkl Date: Sun, 7 Aug 2022 19:55:01 +1000 Subject: [PATCH 08/34] snow layers and blocks drop nothing by hand --- mods/ITEMS/mcl_core/nodes_base.lua | 4 ++-- mods/ITEMS/mcl_tools/init.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index 773aa92a9..2f464a2fc 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -1053,7 +1053,7 @@ for i=1,8 do mcl_core.clear_snow_dirt(npos, node) end, node_box = node_box, - groups = {shovely=1, attached_node=1,deco_block=1, dig_by_piston=1, snow_cover=1, top_snow=i}, + groups = {shovely=2, attached_node=1,deco_block=1, dig_by_piston=1, snow_cover=1, top_snow=i}, sounds = mcl_sounds.node_sound_snow_defaults(), on_construct = mcl_core.on_snow_construct, on_place = on_place, @@ -1072,7 +1072,7 @@ minetest.register_node("mcl_core:snowblock", { tiles = {"default_snow.png"}, is_ground_content = true, stack_max = 64, - groups = {shovely=1, building_block=1, snow_cover=1}, + groups = {shovely=2, building_block=1, snow_cover=1}, sounds = mcl_sounds.node_sound_snow_defaults(), on_construct = mcl_core.on_snow_construct, after_destruct = mcl_core.after_snow_destruct, diff --git a/mods/ITEMS/mcl_tools/init.lua b/mods/ITEMS/mcl_tools/init.lua index 6111d7b91..118020f0b 100644 --- a/mods/ITEMS/mcl_tools/init.lua +++ b/mods/ITEMS/mcl_tools/init.lua @@ -288,7 +288,7 @@ minetest.register_tool("mcl_tools:shovel_wood", { _repair_material = "group:wood", _mcl_toollike_wield = true, _mcl_diggroups = { - shovely = { speed = 2, level = 1, uses = 60 } + shovely = { speed = 2, level = 2, uses = 60 } }, }) minetest.register_tool("mcl_tools:shovel_stone", { From a34c9172c4f9ee3234e4de8d36e22a3e37ac878c Mon Sep 17 00:00:00 2001 From: PrairieAstronomer Date: Sat, 6 Aug 2022 20:38:15 -0600 Subject: [PATCH 09/34] Fixed light levelwarnings and texture alpha warnings in stonecutter, campfires, and beacon --- mods/ITEMS/mcl_beacons/init.lua | 5 +++-- mods/ITEMS/mcl_campfires/init.lua | 4 +++- mods/ITEMS/mcl_stonecutter/init.lua | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 08586bcef..c484c949d 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -98,7 +98,7 @@ minetest.register_node("mcl_beacons:beacon_beam", { } }, pointable= false, - light_source = 15, + light_source = 14, walkable = false, groups = {not_in_creative_inventory=1}, _mcl_blast_resistance = 1200, @@ -226,6 +226,7 @@ minetest.register_node("mcl_beacons:beacon", { collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, mesh = "mcl_beacon.b3d", tiles = {"beacon_UV.png"}, + use_texture_alpha = "clip", on_construct = function(pos) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() @@ -333,7 +334,7 @@ minetest.register_node("mcl_beacons:beacon", { end end end, - light_source = 15, + light_source = 14, groups = {handy=1}, drop = "mcl_beacons:beacon", sounds = mcl_sounds.node_sound_glass_defaults(), diff --git a/mods/ITEMS/mcl_campfires/init.lua b/mods/ITEMS/mcl_campfires/init.lua index e51ec9f54..195612533 100644 --- a/mods/ITEMS/mcl_campfires/init.lua +++ b/mods/ITEMS/mcl_campfires/init.lua @@ -11,7 +11,7 @@ local S = minetest.get_translator(minetest.get_current_modname()) local campfires = { - { name = "Campfire", lightlevel = 15, techname = "campfire", damage = 1, drops = "mcl_core:charcoal_lump 2" }, + { name = "Campfire", lightlevel = 14, techname = "campfire", damage = 1, drops = "mcl_core:charcoal_lump 2" }, { name = "Soul Campfire", lightlevel = 10, techname = "soul_campfire", damage = 2, drops = "mcl_blackstone:soul_soil" }, } @@ -25,6 +25,7 @@ for _, campfire in pairs(campfires) do drawtype = "mesh", mesh = "mcl_campfires_campfire.obj", tiles = {{name="mcl_campfires_log.png"},}, + use_texture_alpha = "clip", groups = { handy=1, axey=1, material_wood=1, not_in_creative_inventory=1, campfire=1, }, paramtype = "light", paramtype2 = "facedir", @@ -73,6 +74,7 @@ for _, campfire in pairs(campfires) do length=2.0 }} }, + use_texture_alpha = "clip", groups = { handy=1, axey=1, material_wood=1, campfire=1, lit_campfire=1 }, paramtype = "light", paramtype2 = "facedir", diff --git a/mods/ITEMS/mcl_stonecutter/init.lua b/mods/ITEMS/mcl_stonecutter/init.lua index 145bc7703..e75884990 100644 --- a/mods/ITEMS/mcl_stonecutter/init.lua +++ b/mods/ITEMS/mcl_stonecutter/init.lua @@ -31,6 +31,7 @@ minetest.register_node("mcl_stonecutter:stonecutter", { length=1 }} }, + use_texture_alpha = "clip", drawtype = "nodebox", paramtype = "light", paramtype2 = "facedir", From 866711a4aacc029e956a1378e2a1f98cb437575b Mon Sep 17 00:00:00 2001 From: opfromthestart Date: Sun, 7 Aug 2022 18:19:12 -0400 Subject: [PATCH 10/34] Changed to new get_sky method --- mods/ENVIRONMENT/lightning/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ENVIRONMENT/lightning/init.lua b/mods/ENVIRONMENT/lightning/init.lua index 14d8f5176..aeb227332 100644 --- a/mods/ENVIRONMENT/lightning/init.lua +++ b/mods/ENVIRONMENT/lightning/init.lua @@ -182,8 +182,9 @@ lightning.register_on_strike(function(pos, pos2, objects) for i = 1, #playerlist do local player = playerlist[i] local sky = {} + local sky_table = player:get_sky(true) - sky.bgcolor, sky.type, sky.textures = player:get_sky() + sky.bgcolor, sky.type, sky.textures = sky_table.base_color, sky_table.type, sky_table.textures local name = player:get_player_name() if ps[name] == nil then From 76839961c60008d29b99c21e5e79e9a34119ed2f Mon Sep 17 00:00:00 2001 From: opfromthestart Date: Mon, 8 Aug 2022 20:12:44 -0400 Subject: [PATCH 11/34] Adds fire and lava collision to boats --- mods/ENTITIES/mcl_boats/init.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mods/ENTITIES/mcl_boats/init.lua b/mods/ENTITIES/mcl_boats/init.lua index 087cd7eae..1f1d85274 100644 --- a/mods/ENTITIES/mcl_boats/init.lua +++ b/mods/ENTITIES/mcl_boats/init.lua @@ -24,6 +24,10 @@ local function is_ice(pos) return is_group(pos, "ice") end +local function is_fire(pos) + return is_group(pos, "set_on_fire") +end + local function get_sign(i) if i == 0 then return 0 @@ -216,6 +220,13 @@ function boat.on_step(self, dtime, moveresult) on_water = false if not in_water and is_ice(waterp) then on_ice = true + elseif is_fire({x=p.x, y=p.y-boat_y_offset, z=p.z}) then + if self.object:get_hp() <= 0 then + boat.on_death(self, nil) + self.object:remove() + return + end + self.object:set_hp(self.object:get_hp()-1) else v_slowdown = 0.04 v_factor = 0.5 From b8af222538411204ef6bfd54941561d1797879a0 Mon Sep 17 00:00:00 2001 From: opfromthestart Date: Mon, 8 Aug 2022 20:26:31 -0400 Subject: [PATCH 12/34] Fixed remaining get_sky calls --- mods/ENVIRONMENT/mcl_weather/rain.lua | 2 +- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/rain.lua b/mods/ENVIRONMENT/mcl_weather/rain.lua index 2cf95022e..83b5359ba 100644 --- a/mods/ENVIRONMENT/mcl_weather/rain.lua +++ b/mods/ENVIRONMENT/mcl_weather/rain.lua @@ -91,7 +91,7 @@ end function mcl_weather.rain.add_player(player) if mcl_weather.players[player:get_player_name()] == nil then local player_meta = {} - player_meta.origin_sky = {player:get_sky()} + player_meta.origin_sky = {player:get_sky(true)} mcl_weather.players[player:get_player_name()] = player_meta update_sound[player:get_player_name()]=true end diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index b70702b4c..f98ee18c0 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -246,7 +246,7 @@ mcl_weather.skycolor = { get_current_bg_color = function() local players = mcl_weather.skycolor.utils.get_players(nil) if players[1] then - return players[1]:get_sky() + return players[1]:get_sky(true).sky_color end return nil end From 5da6f6812fc3efa7fa878c739d0cc56d1a31c26c Mon Sep 17 00:00:00 2001 From: opfromthestart Date: Tue, 9 Aug 2022 12:23:44 -0400 Subject: [PATCH 13/34] faster boat death --- mods/ENTITIES/mcl_boats/init.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mods/ENTITIES/mcl_boats/init.lua b/mods/ENTITIES/mcl_boats/init.lua index f750e80eb..0b2d67730 100644 --- a/mods/ENTITIES/mcl_boats/init.lua +++ b/mods/ENTITIES/mcl_boats/init.lua @@ -223,12 +223,9 @@ function boat.on_step(self, dtime, moveresult) if not in_water and is_ice(waterp) then on_ice = true elseif is_fire({x=p.x, y=p.y-boat_y_offset, z=p.z}) then - if self.object:get_hp() <= 0 then - boat.on_death(self, nil) - self.object:remove() - return - end - self.object:set_hp(self.object:get_hp()-1) + boat.on_death(self, nil) + self.object:remove() + return else v_slowdown = 0.04 v_factor = 0.5 From 84691c393d83e6ebbf4603d6e8f4c32c35e07b21 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Sun, 7 Aug 2022 20:50:26 -0600 Subject: [PATCH 14/34] Pillager Outpost, Schematics by RandomLegoBrick --- mods/MAPGEN/mcl_structures/init.lua | 2 +- .../mcl_structures/pillager_outpost.lua | 67 ++++++++++++++++++ .../mcl_structures_pillager_outpost.mts | Bin 0 -> 1601 bytes 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 mods/MAPGEN/mcl_structures/pillager_outpost.lua create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_pillager_outpost.mts diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index 44d21cd96..e0186b88a 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -246,7 +246,7 @@ dofile(modpath.."/igloo.lua") dofile(modpath.."/woodland_mansion.lua") dofile(modpath.."/ruined_portal.lua") dofile(modpath.."/geode.lua") - +dofile(modpath.."/pillager_outpost.lua") mcl_structures.register_structure("desert_well",{ diff --git a/mods/MAPGEN/mcl_structures/pillager_outpost.lua b/mods/MAPGEN/mcl_structures/pillager_outpost.lua new file mode 100644 index 000000000..28c938cff --- /dev/null +++ b/mods/MAPGEN/mcl_structures/pillager_outpost.lua @@ -0,0 +1,67 @@ +local modname = minetest.get_current_modname() +local S = minetest.get_translator(modname) +local modpath = minetest.get_modpath(modname) + +mcl_structures.register_structure("pillager_outpost",{ + place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass","group:sand"}, + fill_ratio = 0.01, + flags = "place_center_x, place_center_z", + solid_ground = true, + make_foundation = true, + sidelen = 18, + y_offset = 0, + chunk_probability = 200, + y_max = mcl_vars.mg_overworld_max, + y_min = 1, + biomes = { "Desert", "Plains", "Savanna", "IcePlains", "Taiga" }, + filenames = { modpath.."/schematics/mcl_structures_pillager_outpost.mts" }, + loot = { + ["mcl_chests:chest_small" ] ={ + { + stacks_min = 2, + stacks_max = 3, + items = { + { itemstring = "mcl_farming:wheat_item", weight = 7, amount_min = 3, amount_max=5 }, + { itemstring = "mcl_farming:carrot_item", weight = 5, amount_min = 3, amount_max=5 }, + { itemstring = "mcl_farming:potato_item", weight = 5, amount_min = 2, amount_max=5 }, + } + }, + { + stacks_min = 1, + stacks_max = 2, + items = { + { itemstring = "mcl_experience:bottle", weight = 6, amount_min = 0, amount_max=1 }, + { itemstring = "mcl_bows:arrow", weight = 4, amount_min = 2, amount_max=7 }, + { itemstring = "mcl_mobitems:string", weight = 4, amount_min = 1, amount_max=6 }, + { itemstring = "mcl_core:iron_ingot", weight = 3, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_books:book", weight = 1, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) + end }, + } + }, + { + stacks_min = 1, + stacks_max = 3, + items = { + { itemstring = "mcl_core:darktree", amount_min = 2, amount_max=3 }, + } + }, + { + stacks_min = 1, + stacks_max = 1, + items = { + { itemstring = "mcl_bows:crossbow" }, + } + }} + }, + after_place = function (p,def,pr) + local p1 = vector.offset(p,-5,0,-5) + local p2 = vector.offset(p,-5,14,-5) + for _,n in pairs(minetest.find_nodes_in_area(p1,p2,{"group:wall"})) do + local def = minetest.registered_nodes[minetest.get_node(n).name:gsub("_%d+$","")] + if def and def.on_construct then + def.on_construct(n) + end + end + end +}) diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_pillager_outpost.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_pillager_outpost.mts new file mode 100644 index 0000000000000000000000000000000000000000..35424ad76d38c7262cd2aca076a0917fa0f6b9f5 GIT binary patch literal 1601 zcmeYb3HD`RVc=yDWZGH&!oOojfIUI^eFvN^O5@bkPYF=_`u~kZ9QFeTOVm5?Nj3bN~ zq(J&}67xz@i}H%Cpp5vmoc#PE22qe)a(+=N(3?e>1qG=oAk!K6;lj!JNl7`W3?guW z-2CF=N~kCiVPMLj0@4Z(9;^XnXhe)pEExpht^kEYNl|JlYE0!MCdI>K;*&r@Rgz!8 zAOq5c;s4~+%$&@;bVwATMm5xIun7zjAl)!|m<8qe`6)zs%z!}*?B*B!K9FV2@1iAId7wQs}~vYtkcLTP`G#Qid*$*8AF$w z*TiKnOe`;|yqd1n8)LfZzIcsHsPCzX5rBRwo}9KVk4LXxZ}{h0`sr@jaRRX&d zyLRSl!OYLcm5xgnOjmwieT6r>b;JG>M^_xWXgAsNz{%B|hTngDvph1R*!@w(v!b#i znx(M<#fI|F($BrOp0;!U+fu3Gl4%TAGPZkuyk=mfUu=HxTJM*zn0o0Le!CmLRC{)M zMLhS~bnfo1jKsNz@7&yz$-95i$JO!tr|%q%cr@ek+j`5=b?nXpanHA~$NSElywiPc z@xr~T^F+_LS+00I^YVh7VSch}w{JLevnn%xWnD^sq~$fQPoAF={_Rz*cy=ySHCb}I zR<@Q~a2Y62U)G+JKfLjy^kLig#iCX7XJ4z5NWT9(;nm-^~% zTGyJd?^mBZ5b@M_$|+0dnX`79&Rxi$Rh;)ST`jkKvZXNZhH!&ft4@EORJ6gOCR;(! zu1;UxfbF$UQifwVd}TJ zfA`k4#C)D3Z58ix?%b6|K~tN9KeAbl{|)eJ7T)DD!&%MZkMm{G)74?;jCAc&oo?19 z)jyhh*`|v(!8E_&+_Z#*8T%JMP_J{J)SGJdai-@ViRbf7qyL?;a!>azskLBQ$UDO* PzN&pw+#lwq$r4Ne9xKEr literal 0 HcmV?d00001 From 70277276b05bf547725a389202ceeff42e3f8874 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Tue, 9 Aug 2022 10:30:36 -0600 Subject: [PATCH 15/34] Adjusted spawn chance and fixed the walls on generation, thanks cora. --- mods/MAPGEN/mcl_structures/pillager_outpost.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/pillager_outpost.lua b/mods/MAPGEN/mcl_structures/pillager_outpost.lua index 28c938cff..596aa66c7 100644 --- a/mods/MAPGEN/mcl_structures/pillager_outpost.lua +++ b/mods/MAPGEN/mcl_structures/pillager_outpost.lua @@ -10,7 +10,7 @@ mcl_structures.register_structure("pillager_outpost",{ make_foundation = true, sidelen = 18, y_offset = 0, - chunk_probability = 200, + chunk_probability = 600, y_max = mcl_vars.mg_overworld_max, y_min = 1, biomes = { "Desert", "Plains", "Savanna", "IcePlains", "Taiga" }, @@ -54,9 +54,9 @@ mcl_structures.register_structure("pillager_outpost",{ } }} }, - after_place = function (p,def,pr) - local p1 = vector.offset(p,-5,0,-5) - local p2 = vector.offset(p,-5,14,-5) + after_place = function(p,def,pr) + local p1 = vector.offset(p,-7,0,-7) + local p2 = vector.offset(p,7,14,7) for _,n in pairs(minetest.find_nodes_in_area(p1,p2,{"group:wall"})) do local def = minetest.registered_nodes[minetest.get_node(n).name:gsub("_%d+$","")] if def and def.on_construct then From 9603ee606cae66a9818abb183818c610798c9845 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 9 Aug 2022 01:32:48 +0200 Subject: [PATCH 16/34] fix at mod loadtime warning in mcl_info --- mods/HUD/mcl_info/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/HUD/mcl_info/init.lua b/mods/HUD/mcl_info/init.lua index 5331a9bd6..71f8d8ad0 100644 --- a/mods/HUD/mcl_info/init.lua +++ b/mods/HUD/mcl_info/init.lua @@ -106,7 +106,7 @@ local function info() end after(refresh_interval, info) end -info() +minetest.after(0,info) minetest.register_on_leaveplayer(function(p) local name = p:get_player_name() From 701aee323857a52b87a01ec7e4cddf0c566af72c Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 9 Aug 2022 01:34:43 +0200 Subject: [PATCH 17/34] Add modname to beacons mod.conf --- mods/ITEMS/mcl_beacons/mod.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ITEMS/mcl_beacons/mod.conf b/mods/ITEMS/mcl_beacons/mod.conf index 139a264b3..a8b7a467a 100644 --- a/mods/ITEMS/mcl_beacons/mod.conf +++ b/mods/ITEMS/mcl_beacons/mod.conf @@ -1,2 +1,3 @@ +name = mcl_beacons author=chmodsayshello depends=mcl_formspec, mcl_init, mcl_wip, mesecons_mvps, mcl_core, mcl_sounds, awards, mcl_achievements, mcl_mobitems, mcl_nether From e8baa1ae00acf1d4952dfd2b455d430e60f28841 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 9 Aug 2022 01:35:57 +0200 Subject: [PATCH 18/34] Fix undeclared var warning in mcl_weather --- mods/ENVIRONMENT/mcl_weather/rain.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ENVIRONMENT/mcl_weather/rain.lua b/mods/ENVIRONMENT/mcl_weather/rain.lua index 83b5359ba..7dcc48637 100644 --- a/mods/ENVIRONMENT/mcl_weather/rain.lua +++ b/mods/ENVIRONMENT/mcl_weather/rain.lua @@ -2,6 +2,7 @@ local PARTICLES_COUNT_RAIN = tonumber(minetest.settings:get("mcl_weather_rain_pa local PARTICLES_COUNT_THUNDER = tonumber(minetest.settings:get("mcl_weather_thunder_particles")) or 900 local get_connected_players = minetest.get_connected_players +local mgname = minetest.get_mapgen_setting("mg_name") mcl_weather.rain = { -- max rain particles created at time From 34ecb782a855af100c775e03adbffd309e4d16fd Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 9 Aug 2022 21:47:11 +0200 Subject: [PATCH 19/34] Fix dispenser and dropper crashing in 5.4 --- mods/ITEMS/REDSTONE/mcl_dispensers/init.lua | 4 ++-- mods/ITEMS/REDSTONE/mcl_droppers/init.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua index 94f0fcd8d..dce69f26a 100644 --- a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua @@ -261,7 +261,7 @@ local dispenserdef = { local item_entity = minetest.add_item(droppos, dropitem) local drop_vel = vector.subtract(droppos, pos) local speed = 3 - item_entity:set_velocity(drop_vel * speed) + item_entity:set_velocity(vector.multiply(drop_vel,speed)) end else stack:take_item() @@ -278,7 +278,7 @@ local dispenserdef = { local item_entity = minetest.add_item(droppos, dropitem) local drop_vel = vector.subtract(droppos, pos) local speed = 3 - item_entity:set_velocity(drop_vel * speed) + item_entity:set_velocity(vector.multiply(drop_vel,speed)) stack:take_item() inv:set_stack("main", stack_id, stack) end diff --git a/mods/ITEMS/REDSTONE/mcl_droppers/init.lua b/mods/ITEMS/REDSTONE/mcl_droppers/init.lua index 6dac4495f..b9c46d6b8 100644 --- a/mods/ITEMS/REDSTONE/mcl_droppers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_droppers/init.lua @@ -143,7 +143,7 @@ local dropperdef = { local item_entity = minetest.add_item(droppos, dropitem) local drop_vel = vector.subtract(droppos, pos) local speed = 3 - item_entity:set_velocity(drop_vel * speed) + item_entity:set_velocity(vector.multiply(drop_vel,speed)) stack:take_item() inv:set_stack("main", stack_id, stack) end From 3ff9ed4419a06611fd2fac21f7782b98c7db131c Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Sun, 7 Aug 2022 17:45:39 +0800 Subject: [PATCH 20/34] [heads] refactor and trivial renames --- mods/ITEMS/mcl_heads/init.lua | 353 +++++++++++++++++++++------------- 1 file changed, 214 insertions(+), 139 deletions(-) diff --git a/mods/ITEMS/mcl_heads/init.lua b/mods/ITEMS/mcl_heads/init.lua index c14079393..14f79bfa9 100644 --- a/mods/ITEMS/mcl_heads/init.lua +++ b/mods/ITEMS/mcl_heads/init.lua @@ -1,5 +1,6 @@ local S = minetest.get_translator(minetest.get_current_modname()) +local minetest = minetest local mod_doc = minetest.get_modpath("doc") local mod_screwdriver = minetest.get_modpath("screwdriver") @@ -8,159 +9,233 @@ if minetest.get_modpath("mcl_armor") then equip_armor = mcl_armor.equip_on_use end --- Heads system +mcl_heads = {} -local function addhead(name, texture, desc, longdesc, rangemob, rangefactor) - local on_rotate_floor, on_rotate_wall - if mod_screwdriver then - on_rotate_floor = function(pos, node, user, mode, new_param2) - if mode == screwdriver.ROTATE_AXIS then - node.name = node.name .. "_wall" - node.param2 = minetest.dir_to_wallmounted(minetest.facedir_to_dir(node.param2)) - minetest.set_node(pos, node) - return true - end - end - on_rotate_wall = function(pos, node, user, mode, new_param2) - if mode == screwdriver.ROTATE_AXIS then - node.name = string.sub(node.name, 1, string.len(node.name)-5) - node.param2 = minetest.dir_to_facedir(minetest.wallmounted_to_dir(node.param2)) - minetest.set_node(pos, node) - return true - end +-- box of head nodes +mcl_heads.FLOOR_BOX = { -0.25, -0.5, -0.25, 0.25, 0.0, 0.25, } + +-- floor head node nodedef template ------------------------------------------------------------------------------------ + +--- node definition template for floor mod heads +mcl_heads.deftemplate_floor = { + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = mcl_heads.FLOOR_BOX, + }, + groups = { + handy = 1, + armor = 1, + armor_head = 1, + non_combat_armor = 1, + non_combat_armor_head = 1, + head = 1, + deco_block = 1, + dig_by_piston = 1, + }, + use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, + paramtype = "light", + paramtype2 = "facedir", + stack_max = 64, + sunlight_propagates = true, + sounds = mcl_sounds.node_sound_defaults{ + footstep = {name="default_hard_footstep", gain=0.3}, + }, + is_ground_content = false, + + _mcl_armor_element = "head", + _mcl_blast_resistance = 1, + _mcl_hardness = 1, + + on_secondary_use = equip_armor, +} + +function mcl_heads.deftemplate_floor.on_rotate(pos, node, user, mode, new_param2) + if mode == screwdriver.ROTATE_AXIS then + node.name = node.name .. "_wall" + node.param2 = minetest.dir_to_wallmounted(minetest.facedir_to_dir(node.param2)) + minetest.set_node(pos, node) + return true + end +end + +function mcl_heads.deftemplate_floor.on_place(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return itemstack + end + + local under = pointed_thing.under + local node = minetest.get_node(under) + local def = minetest.registered_nodes[node.name] + if not def then return itemstack end + + -- Allow pointed node's on_rightclick callback to override place. + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(under, node, placer, itemstack) or itemstack end end - minetest.register_node("mcl_heads:"..name, { - description = desc, - _doc_items_longdesc = longdesc, - drawtype = "nodebox", - is_ground_content = false, - node_box = { - type = "fixed", - fixed = { - { -0.25, -0.5, -0.25, 0.25, 0.0, 0.25, }, - }, - }, - groups = {handy = 1, armor = 1, armor_head = 1, non_combat_armor = 1, non_combat_armor_head = 1, head = 1, deco_block = 1, dig_by_piston = 1}, + local above = pointed_thing.above + local dir = {x = under.x - above.x, y = under.y - above.y, z = under.z - above.z} + local wdir = minetest.dir_to_wallmounted(dir) + + -- place floor mob head + if wdir == 0 or wdir == 1 then + return minetest.item_place(itemstack, placer, pointed_thing) + end + + -- place wall mob head + local itemstring = itemstack:get_name() + local placestack = ItemStack(itemstack) + placestack:set_name(itemstring .."_wall") + itemstack = minetest.item_place(placestack, placer, pointed_thing, wdir) + itemstack:set_name(itemstring) + return itemstack +end + +-- wall head node nodedef template ------------------------------------------------------------------------------------- + +--- node definition template for wall mod heads +mcl_heads.deftemplate_wall = { + drawtype = "nodebox", + node_box = { + type = "wallmounted", + wall_bottom = { -0.25, -0.5, -0.25, 0.25, 0.0, 0.25, }, + wall_top = { -0.25, 0.0, -0.25, 0.25, 0.5, 0.25, }, + wall_side = { -0.5, -0.25, -0.25, 0.0, 0.25, 0.25, }, + }, + groups = { + handy = 1, + head = 1, + deco_block = 1, + dig_by_piston = 1, + not_in_creative_inventory = 1, + }, + use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, + paramtype = "light", + paramtype2 = "wallmounted", + stack_max = 64, + sunlight_propagates = true, + sounds = mcl_sounds.node_sound_defaults{ + footstep = {name="default_hard_footstep", gain=0.3}, + }, + is_ground_content = false, + + _doc_items_create_entry = false, + _mcl_blast_resistance = 1, + _mcl_hardness = 1, +} + +function mcl_heads.deftemplate_wall.on_rotate(pos, node, user, mode, new_param2) + if mode == screwdriver.ROTATE_AXIS then + node.name = string.sub(node.name, 1, string.len(node.name)-5) + node.param2 = minetest.dir_to_facedir(minetest.wallmounted_to_dir(node.param2)) + minetest.set_node(pos, node) + return true + end +end + +-- API functions ------------------------------------------------------------------------------------------------------- + +--- @class HeadDef +--- @field name string identifier for node +--- @field texture string texture filename for node +--- @field description string translated description +--- @field longdesc string translated doc description +--- @field armor_texture string texture filename for armor +--- @field range_mob string name of mob affected by range reduction +--- @field range_factor number factor of range reduction + +--- registers a head +--- @param head_def HeadDef head node definition +function mcl_heads.register_head(head_def) + local name = "mcl_heads:" ..head_def.name + + -- register the floor head node + minetest.register_node(name, table.update(table.copy(mcl_heads.deftemplate_floor), { + description = head_def.description, + _doc_items_longdesc = head_def.longdesc, + -- The head textures are based off the textures of an actual mob. tiles = { -- Note: bottom texture is overlaid over top texture to get rid of possible transparency. -- This is required for skeleton skull and wither skeleton skull. - "[combine:16x16:-4,4="..texture, -- top - "([combine:16x16:-4,4="..texture..")^([combine:16x16:-12,4="..texture..")", -- bottom - "[combine:16x16:-12,0="..texture, -- left - "[combine:16x16:4,0="..texture, -- right - "[combine:16x16:-20,0="..texture, -- back - "[combine:16x16:-4,0="..texture, -- front + "[combine:16x16:-4,4=" ..head_def.texture, -- top + "([combine:16x16:-4,4=" ..head_def.texture..")^([combine:16x16:-12,4="..head_def.texture..")", -- bottom + "[combine:16x16:-12,0=" ..head_def.texture, -- left + "[combine:16x16:4,0=" ..head_def.texture, -- right + "[combine:16x16:-20,0=" ..head_def.texture, -- back + "[combine:16x16:-4,0=" ..head_def.texture, -- front }, - use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, - paramtype = "light", - stack_max = 64, - paramtype2 = "facedir", - sunlight_propagates = true, - walkable = true, - selection_box = { - type = "fixed", - fixed = { -0.25, -0.5, -0.25, 0.25, 0.0, 0.25, }, - }, - sounds = mcl_sounds.node_sound_defaults({ - footstep = {name="default_hard_footstep", gain=0.3} - }), - on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type ~= "node" then - -- no interaction possible with entities, for now. - return itemstack - end - local under = pointed_thing.under - local node = minetest.get_node(under) - local def = minetest.registered_nodes[node.name] - if not def then return itemstack end + _mcl_armor_mob_range_mob = head_def.range_mob, + _mcl_armor_mob_range_factor = head_def.range_factor, + _mcl_armor_texture = head_def.armor_texture + })) - -- Call on_rightclick if the pointed node defines it - if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then - return minetest.registered_nodes[node.name].on_rightclick(under, node, placer, itemstack) or itemstack - end - end - - local above = pointed_thing.above - local diff = {x = under.x - above.x, y = under.y - above.y, z = under.z - above.z} - local wdir = minetest.dir_to_wallmounted(diff) - - local itemstring = itemstack:get_name() - local fakestack = ItemStack(itemstack) - --local idef = fakestack:get_definition() - local retval - if wdir == 0 or wdir == 1 then - return minetest.item_place(itemstack, placer, pointed_thing) - else - retval = fakestack:set_name("mcl_heads:"..name.."_wall") - end - if not retval then - return itemstack - end - itemstack = minetest.item_place(fakestack, placer, pointed_thing, wdir) - itemstack:set_name(itemstring) - return itemstack - end, - on_secondary_use = equip_armor, - - on_rotate = on_rotate_floor, - - _mcl_armor_mob_range_mob = rangemob, - _mcl_armor_mob_range_factor = rangefactor, - _mcl_armor_element = "head", - _mcl_armor_texture = "mcl_heads_" .. name .. ".png", - _mcl_blast_resistance = 1, - _mcl_hardness = 1, - }) - - minetest.register_node("mcl_heads:"..name.."_wall", { - _doc_items_create_entry = false, - drawtype = "nodebox", - is_ground_content = false, - node_box = { - type = "wallmounted", - wall_bottom = { -0.25, -0.5, -0.25, 0.25, 0.0, 0.25, }, - wall_top = { -0.25, 0.0, -0.25, 0.25, 0.5, 0.25, }, - wall_side = { -0.5, -0.25, -0.25, 0.0, 0.25, 0.25, }, - }, - groups = {handy=1, head=1, deco_block=1, dig_by_piston=1, not_in_creative_inventory=1}, + -- register the wall head node + minetest.register_node(name .."_wall", table.update(table.copy(mcl_heads.deftemplate_wall), { -- The head textures are based off the textures of an actual mob. tiles = { - { name = "[combine:16x16:-4,-4="..texture, align_style = "world" }, -- front - { name = "[combine:16x16:-20,-4="..texture, align_style = "world" }, -- back - { name = "[combine:16x16:-8,-4="..texture, align_style = "world" }, -- left - { name = "[combine:16x16:0,-4="..texture, align_style = "world" }, -- right - { name = "([combine:16x16:-4,0="..texture..")^[transformR180", align_style = "node" }, -- top - { name = "([combine:16x16:-4,8="..texture..")^([combine:16x16:-12,8="..texture..")", align_style = "node" }, -- bottom + { name = "[combine:16x16:-4,-4=" ..head_def.texture, align_style = "world" }, -- front + { name = "[combine:16x16:-20,-4="..head_def.texture, align_style = "world" }, -- back + { name = "[combine:16x16:-8,-4=" ..head_def.texture, align_style = "world" }, -- left + { name = "[combine:16x16:0,-4=" ..head_def.texture, align_style = "world" }, -- right + { name = "([combine:16x16:-4,0=" ..head_def.texture ..")^[transformR180", align_style = "node" }, -- top + -- Note: bottom texture is overlaid over top texture to get rid of possible transparency. + -- This is required for skeleton skull and wither skeleton skull. + { name = "([combine:16x16:-4,8=" ..head_def.texture ..")^([combine:16x16:-12,8=" ..head_def.texture..")", align_style = "node" }, -- bottom }, - use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, - paramtype = "light", - stack_max = 64, - paramtype2 = "wallmounted", - sunlight_propagates = true, - walkable = true, - sounds = mcl_sounds.node_sound_defaults({ - footstep = {name="default_hard_footstep", gain=0.3} - }), - drop = "mcl_heads:"..name, - on_rotate = on_rotate_wall, - _mcl_blast_resistance = 1, - _mcl_hardness = 1, - }) - - if mod_doc then - doc.add_entry_alias("nodes", "mcl_heads:" .. name, "nodes", "mcl_heads:" .. name .. "_wall") - end + drop = name, + })) end --- Add heads -addhead("zombie", "mcl_heads_zombie_node.png", S("Zombie Head"), S("A zombie head is a small decorative block which resembles the head of a zombie. It can also be worn as a helmet, which reduces the detection range of zombies by 50%."), "mobs_mc:zombie", 0.5) -addhead("creeper", "mcl_heads_creeper_node.png", S("Creeper Head"), S("A creeper head is a small decorative block which resembles the head of a creeper. It can also be worn as a helmet, which reduces the detection range of creepers by 50%."), "mobs_mc:creeper", 0.5) +-- initial heads ------------------------------------------------------------------------------------------------------- + +mcl_heads.register_head{ + name = "zombie", + texture = "mcl_heads_zombie_node.png", + description = S("Zombie Head"), + longdesc = S("A zombie head is a small decorative block which resembles the head of a zombie. It can also be worn as a helmet, which reduces the detection range of zombies by 50%."), + armor_texture = "mcl_heads_zombie.png", + range_mob = "mobs_mc:zombie", + range_factor = 0.5, +} + +mcl_heads.register_head{ + name = "creeper", + texture = "mcl_heads_creeper_node.png", + description = S("Creeper Head"), + longdesc = S("A creeper head is a small decorative block which resembles the head of a creeper. It can also be worn as a helmet, which reduces the detection range of creepers by 50%."), + armor_texture = "mcl_heads_creeper.png", + range_mob = "mobs_mc:creeper", + range_factor = 0.5, +} + -- Original Minecraft name: “Head” -addhead("steve", "mcl_heads_steve_node.png", S("Human Head"), S("A human head is a small decorative block which resembles the head of a human (i.e. a player character). It can also be worn as a helmet for fun, but does not offer any protection.")) -addhead("skeleton", "mcl_heads_skeleton_node.png", S("Skeleton Skull"), S("A skeleton skull is a small decorative block which resembles the skull of a skeleton. It can also be worn as a helmet, which reduces the detection range of skeletons by 50%."), "mobs_mc:skeleton", 0.5) -addhead("wither_skeleton", "mcl_heads_wither_skeleton_node.png", S("Wither Skeleton Skull"), S("A wither skeleton skull is a small decorative block which resembles the skull of a wither skeleton. It can also be worn as a helmet for fun, but does not offer any protection.")) +mcl_heads.register_head{ + name = "steve", + texture = "mcl_heads_steve_node.png", + description = S("Human Head"), + longdesc = S("A human head is a small decorative block which resembles the head of a human (i.e. a player character). It can also be worn as a helmet for fun, but does not offer any protection."), + armor_texture = "mcl_heads_steve.png", +} + +mcl_heads.register_head{ + name = "skeleton", + texture = "mcl_heads_skeleton_node.png", + description = S("Skeleton Skull"), + longdesc = S("A skeleton skull is a small decorative block which resembles the skull of a skeleton. It can also be worn as a helmet, which reduces the detection range of skeletons by 50%."), + armor_texture = "mcl_heads_skeleton.png", + range_mob = "mobs_mc:skeleton", + range_factor = 0.5, +} + +mcl_heads.register_head{ + name = "wither_skeleton", + texture = "mcl_heads_wither_skeleton_node.png", + description = S("Wither Skeleton Skull"), + longdesc = S("A wither skeleton skull is a small decorative block which resembles the skull of a wither skeleton. It can also be worn as a helmet for fun, but does not offer any protection."), + armor_texture = "mcl_heads_wither_skeleton.png", +} From 44d234dd2c6c211649fae753d999990359753a8f Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Thu, 11 Aug 2022 17:12:18 +0800 Subject: [PATCH 21/34] [heads] implement 16 directional head node --- mods/ITEMS/mcl_heads/init.lua | 74 +++++++++++++++++-- .../mcl_heads/models/mcl_heads_floor22_5.obj | 42 +++++++++++ .../mcl_heads/models/mcl_heads_floor45.obj | 42 +++++++++++ .../mcl_heads/models/mcl_heads_floor67_5.obj | 42 +++++++++++ 4 files changed, 192 insertions(+), 8 deletions(-) create mode 100644 mods/ITEMS/mcl_heads/models/mcl_heads_floor22_5.obj create mode 100644 mods/ITEMS/mcl_heads/models/mcl_heads_floor45.obj create mode 100644 mods/ITEMS/mcl_heads/models/mcl_heads_floor67_5.obj diff --git a/mods/ITEMS/mcl_heads/init.lua b/mods/ITEMS/mcl_heads/init.lua index 14f79bfa9..25f1b9d2f 100644 --- a/mods/ITEMS/mcl_heads/init.lua +++ b/mods/ITEMS/mcl_heads/init.lua @@ -11,6 +11,9 @@ end mcl_heads = {} +-- rotations of head nodes within a quadrant (0° ≤ θ ≤ 90°) +mcl_heads.FLOOR_DEGREES = { [0]='', '22_5', '45', '67_5', } + -- box of head nodes mcl_heads.FLOOR_BOX = { -0.25, -0.5, -0.25, 0.25, 0.0, 0.25, } @@ -50,6 +53,38 @@ mcl_heads.deftemplate_floor = { on_secondary_use = equip_armor, } +mcl_heads.deftemplate_floor_angled = { + drawtype = "mesh", + selection_box = { + type = "fixed", + fixed = mcl_heads.FLOOR_BOX, + }, + collision_box = { + type = "fixed", + fixed = mcl_heads.FLOOR_BOX, + }, + groups = { + handy = 1, + head = 1, + deco_block = 1, + dig_by_piston = 1, + not_in_creative_inventory = 1, + }, + use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, + paramtype = "light", + paramtype2 = "facedir", + stack_max = 64, + sunlight_propagates = true, + sounds = mcl_sounds.node_sound_defaults{ + footstep = {name="default_hard_footstep", gain=0.3}, + }, + is_ground_content = false, + + _doc_items_create_entry = false, + _mcl_blast_resistance = 1, + _mcl_hardness = 1, +} + function mcl_heads.deftemplate_floor.on_rotate(pos, node, user, mode, new_param2) if mode == screwdriver.ROTATE_AXIS then node.name = node.name .. "_wall" @@ -80,16 +115,30 @@ function mcl_heads.deftemplate_floor.on_place(itemstack, placer, pointed_thing) local dir = {x = under.x - above.x, y = under.y - above.y, z = under.z - above.z} local wdir = minetest.dir_to_wallmounted(dir) - -- place floor mob head - if wdir == 0 or wdir == 1 then - return minetest.item_place(itemstack, placer, pointed_thing) - end - - -- place wall mob head local itemstring = itemstack:get_name() local placestack = ItemStack(itemstack) - placestack:set_name(itemstring .."_wall") - itemstack = minetest.item_place(placestack, placer, pointed_thing, wdir) + + -- place wall head node (elsewhere) + if wdir ~= 0 and wdir ~= 1 then + placestack:set_name(itemstring .."_wall") + itemstack = minetest.item_place(placestack, placer, pointed_thing, wdir) + -- place floor head node (floor and ceiling) + else + local fdir = minetest.dir_to_facedir(dir) + + -- determine the head node rotation based on player's yaw (in cw direction from North/Z+) + local yaw = math.pi*2 - placer:get_look_horizontal() + + local rotation_level = math.min(math.max(math.round((yaw / (math.pi*2)) * 16), 0), 15) + placestack:set_name(itemstring ..mcl_heads.FLOOR_DEGREES[rotation_level % 4]) + + -- determine the head node face direction based on rotation level + fdir = math.floor(rotation_level / 4) + + itemstack = minetest.item_place(placestack, placer, pointed_thing, fdir) + end + + -- restore item from angled and wall head nodes itemstack:set_name(itemstring) return itemstack end @@ -174,6 +223,15 @@ function mcl_heads.register_head(head_def) _mcl_armor_texture = head_def.armor_texture })) + -- register the angled floor head nodes + for i, d in ipairs(mcl_heads.FLOOR_DEGREES) do + minetest.register_node(name ..d, table.update(table.copy(mcl_heads.deftemplate_floor_angled), { + mesh = "mcl_heads_floor" ..d ..".obj", + tiles = { head_def.armor_texture }, + drop = name, + })) + end + -- register the wall head node minetest.register_node(name .."_wall", table.update(table.copy(mcl_heads.deftemplate_wall), { -- The head textures are based off the textures of an actual mob. diff --git a/mods/ITEMS/mcl_heads/models/mcl_heads_floor22_5.obj b/mods/ITEMS/mcl_heads/models/mcl_heads_floor22_5.obj new file mode 100644 index 000000000..8e48015fc --- /dev/null +++ b/mods/ITEMS/mcl_heads/models/mcl_heads_floor22_5.obj @@ -0,0 +1,42 @@ +# Blender v2.93.9 OBJ File: 'mcl_heads_floor_0.blend' +# www.blender.org +mtllib mcl_heads_floor22_5.mtl +o Cube.001 +v -0.326641 -0.500000 0.135299 +v -0.326641 0.000000 0.135299 +v -0.135299 -0.500000 -0.326641 +v -0.135299 0.000000 -0.326641 +v 0.135299 -0.500000 0.326641 +v 0.135299 0.000000 0.326641 +v 0.326641 -0.500000 -0.135299 +v 0.326641 0.000000 -0.135299 +vt 0.875000 0.500000 +vt 0.875000 0.750000 +vt 0.750000 0.750000 +vt 0.750000 0.500000 +vt 0.625000 0.750000 +vt 0.625000 0.500000 +vt 0.500000 0.750000 +vt 0.500000 0.500000 +vt 1.000000 0.500000 +vt 1.000000 0.750000 +vt 0.875000 0.750000 +vt 0.875000 1.000000 +vt 0.750000 1.000000 +vt 0.750000 0.750000 +vt 0.750000 1.000000 +vt 0.625000 1.000000 +vn -0.9239 0.0000 -0.3827 +vn 0.3827 0.0000 -0.9239 +vn 0.9239 0.0000 0.3827 +vn -0.3827 0.0000 0.9239 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 0.0000 +usemtl Material.001 +s off +f 1/1/1 2/2/1 4/3/1 3/4/1 +f 3/4/2 4/3/2 8/5/2 7/6/2 +f 7/6/3 8/5/3 6/7/3 5/8/3 +f 5/9/4 6/10/4 2/2/4 1/1/4 +f 3/11/5 7/12/5 5/13/5 1/14/5 +f 8/5/6 4/3/6 2/15/6 6/16/6 diff --git a/mods/ITEMS/mcl_heads/models/mcl_heads_floor45.obj b/mods/ITEMS/mcl_heads/models/mcl_heads_floor45.obj new file mode 100644 index 000000000..6300d4484 --- /dev/null +++ b/mods/ITEMS/mcl_heads/models/mcl_heads_floor45.obj @@ -0,0 +1,42 @@ +# Blender v2.93.9 OBJ File: 'mcl_heads_floor_0.blend' +# www.blender.org +mtllib mcl_heads_floor45.mtl +o Cube.002 +v -0.353553 -0.500000 0.000000 +v -0.353553 0.000000 0.000000 +v 0.000000 -0.500000 -0.353553 +v 0.000000 0.000000 -0.353553 +v 0.000000 -0.500000 0.353553 +v 0.000000 0.000000 0.353553 +v 0.353553 -0.500000 0.000000 +v 0.353553 0.000000 0.000000 +vt 0.875000 0.500000 +vt 0.875000 0.750000 +vt 0.750000 0.750000 +vt 0.750000 0.500000 +vt 0.625000 0.750000 +vt 0.625000 0.500000 +vt 0.500000 0.750000 +vt 0.500000 0.500000 +vt 1.000000 0.500000 +vt 1.000000 0.750000 +vt 0.875000 0.750000 +vt 0.875000 1.000000 +vt 0.750000 1.000000 +vt 0.750000 0.750000 +vt 0.750000 1.000000 +vt 0.625000 1.000000 +vn -0.7071 0.0000 -0.7071 +vn 0.7071 0.0000 -0.7071 +vn 0.7071 0.0000 0.7071 +vn -0.7071 0.0000 0.7071 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 0.0000 +usemtl Material.002 +s off +f 1/1/1 2/2/1 4/3/1 3/4/1 +f 3/4/2 4/3/2 8/5/2 7/6/2 +f 7/6/3 8/5/3 6/7/3 5/8/3 +f 5/9/4 6/10/4 2/2/4 1/1/4 +f 3/11/5 7/12/5 5/13/5 1/14/5 +f 8/5/6 4/3/6 2/15/6 6/16/6 diff --git a/mods/ITEMS/mcl_heads/models/mcl_heads_floor67_5.obj b/mods/ITEMS/mcl_heads/models/mcl_heads_floor67_5.obj new file mode 100644 index 000000000..0fe5567e3 --- /dev/null +++ b/mods/ITEMS/mcl_heads/models/mcl_heads_floor67_5.obj @@ -0,0 +1,42 @@ +# Blender v2.93.9 OBJ File: 'mcl_heads_floor_0.blend' +# www.blender.org +mtllib mcl_heads_floor67_5.mtl +o Cube.003 +v -0.326641 -0.500000 -0.135299 +v -0.326641 0.000000 -0.135299 +v 0.135299 -0.500000 -0.326641 +v 0.135299 0.000000 -0.326641 +v -0.135299 -0.500000 0.326641 +v -0.135299 0.000000 0.326641 +v 0.326641 -0.500000 0.135299 +v 0.326641 0.000000 0.135299 +vt 0.875000 0.500000 +vt 0.875000 0.750000 +vt 0.750000 0.750000 +vt 0.750000 0.500000 +vt 0.625000 0.750000 +vt 0.625000 0.500000 +vt 0.500000 0.750000 +vt 0.500000 0.500000 +vt 1.000000 0.500000 +vt 1.000000 0.750000 +vt 0.875000 0.750000 +vt 0.875000 1.000000 +vt 0.750000 1.000000 +vt 0.750000 0.750000 +vt 0.750000 1.000000 +vt 0.625000 1.000000 +vn -0.3827 0.0000 -0.9239 +vn 0.9239 0.0000 -0.3827 +vn 0.3827 0.0000 0.9239 +vn -0.9239 0.0000 0.3827 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 0.0000 +usemtl Material.003 +s off +f 1/1/1 2/2/1 4/3/1 3/4/1 +f 3/4/2 4/3/2 8/5/2 7/6/2 +f 7/6/3 8/5/3 6/7/3 5/8/3 +f 5/9/4 6/10/4 2/2/4 1/1/4 +f 3/11/5 7/12/5 5/13/5 1/14/5 +f 8/5/6 4/3/6 2/15/6 6/16/6 From 29d221eed58664c4877e0af1cc5791946b485eb0 Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Thu, 11 Aug 2022 17:15:39 +0800 Subject: [PATCH 22/34] [heads] remove unnecessarily duplicative textures these textures are unnecessary to texture the head nodes. we can reuse the available armor texture for both the headgear/helmet and the nodes. --- mods/ITEMS/mcl_heads/init.lua | 48 ++++++++---------- .../textures/mcl_heads_creeper_node.png | Bin 676 -> 0 bytes .../textures/mcl_heads_skeleton_node.png | Bin 432 -> 0 bytes .../textures/mcl_heads_steve_node.png | Bin 1852 -> 0 bytes .../mcl_heads_wither_skeleton_node.png | Bin 432 -> 0 bytes .../textures/mcl_heads_zombie_node.png | Bin 1112 -> 0 bytes 6 files changed, 22 insertions(+), 26 deletions(-) delete mode 100644 mods/ITEMS/mcl_heads/textures/mcl_heads_creeper_node.png delete mode 100644 mods/ITEMS/mcl_heads/textures/mcl_heads_skeleton_node.png delete mode 100644 mods/ITEMS/mcl_heads/textures/mcl_heads_steve_node.png delete mode 100644 mods/ITEMS/mcl_heads/textures/mcl_heads_wither_skeleton_node.png delete mode 100644 mods/ITEMS/mcl_heads/textures/mcl_heads_zombie_node.png diff --git a/mods/ITEMS/mcl_heads/init.lua b/mods/ITEMS/mcl_heads/init.lua index 25f1b9d2f..a971d7b91 100644 --- a/mods/ITEMS/mcl_heads/init.lua +++ b/mods/ITEMS/mcl_heads/init.lua @@ -189,10 +189,9 @@ end --- @class HeadDef --- @field name string identifier for node ---- @field texture string texture filename for node +--- @field texture string armor texture for node --- @field description string translated description --- @field longdesc string translated doc description ---- @field armor_texture string texture filename for armor --- @field range_mob string name of mob affected by range reduction --- @field range_factor number factor of range reduction @@ -210,24 +209,25 @@ function mcl_heads.register_head(head_def) tiles = { -- Note: bottom texture is overlaid over top texture to get rid of possible transparency. -- This is required for skeleton skull and wither skeleton skull. - "[combine:16x16:-4,4=" ..head_def.texture, -- top - "([combine:16x16:-4,4=" ..head_def.texture..")^([combine:16x16:-12,4="..head_def.texture..")", -- bottom - "[combine:16x16:-12,0=" ..head_def.texture, -- left - "[combine:16x16:4,0=" ..head_def.texture, -- right - "[combine:16x16:-20,0=" ..head_def.texture, -- back - "[combine:16x16:-4,0=" ..head_def.texture, -- front + -- Note: -x coords go right per-pixel, -y coords go down per-pixel + "[combine:16x16:-36,4=" ..head_def.texture, -- top + "([combine:16x16:-36,4=" ..head_def.texture..")^([combine:16x16:-44,4="..head_def.texture..")", -- bottom + "[combine:16x16:-28,0=" ..head_def.texture, -- left + "[combine:16x16:-44,0=" ..head_def.texture, -- right + "[combine:16x16:-52,0=" ..head_def.texture, -- back + "[combine:16x16:-36,0=" ..head_def.texture, -- front }, _mcl_armor_mob_range_mob = head_def.range_mob, _mcl_armor_mob_range_factor = head_def.range_factor, - _mcl_armor_texture = head_def.armor_texture + _mcl_armor_texture = head_def.texture })) -- register the angled floor head nodes for i, d in ipairs(mcl_heads.FLOOR_DEGREES) do minetest.register_node(name ..d, table.update(table.copy(mcl_heads.deftemplate_floor_angled), { mesh = "mcl_heads_floor" ..d ..".obj", - tiles = { head_def.armor_texture }, + tiles = { head_def.texture }, drop = name, })) end @@ -235,15 +235,16 @@ function mcl_heads.register_head(head_def) -- register the wall head node minetest.register_node(name .."_wall", table.update(table.copy(mcl_heads.deftemplate_wall), { -- The head textures are based off the textures of an actual mob. + -- Note: -x coords go right per-pixel, -y coords go down per-pixel tiles = { - { name = "[combine:16x16:-4,-4=" ..head_def.texture, align_style = "world" }, -- front - { name = "[combine:16x16:-20,-4="..head_def.texture, align_style = "world" }, -- back - { name = "[combine:16x16:-8,-4=" ..head_def.texture, align_style = "world" }, -- left - { name = "[combine:16x16:0,-4=" ..head_def.texture, align_style = "world" }, -- right - { name = "([combine:16x16:-4,0=" ..head_def.texture ..")^[transformR180", align_style = "node" }, -- top + { name = "[combine:16x16:-36,-4=" ..head_def.texture, align_style = "world" }, -- front + { name = "[combine:16x16:-52,-4="..head_def.texture, align_style = "world" }, -- back + { name = "[combine:16x16:-40,-4=" ..head_def.texture, align_style = "world" }, -- right + { name = "[combine:16x16:-32,-4=" ..head_def.texture, align_style = "world" }, -- left + { name = "([combine:16x16:-36,0=" ..head_def.texture ..")^[transformR180", align_style = "node" }, -- top -- Note: bottom texture is overlaid over top texture to get rid of possible transparency. -- This is required for skeleton skull and wither skeleton skull. - { name = "([combine:16x16:-4,8=" ..head_def.texture ..")^([combine:16x16:-12,8=" ..head_def.texture..")", align_style = "node" }, -- bottom + { name = "([combine:16x16:-36,0=" ..head_def.texture ..")^([combine:16x16:-44,8=" ..head_def.texture..")", align_style = "node" }, -- bottom }, drop = name, })) @@ -253,20 +254,18 @@ end mcl_heads.register_head{ name = "zombie", - texture = "mcl_heads_zombie_node.png", + texture = "mcl_heads_zombie.png", description = S("Zombie Head"), longdesc = S("A zombie head is a small decorative block which resembles the head of a zombie. It can also be worn as a helmet, which reduces the detection range of zombies by 50%."), - armor_texture = "mcl_heads_zombie.png", range_mob = "mobs_mc:zombie", range_factor = 0.5, } mcl_heads.register_head{ name = "creeper", - texture = "mcl_heads_creeper_node.png", + texture = "mcl_heads_creeper.png", description = S("Creeper Head"), longdesc = S("A creeper head is a small decorative block which resembles the head of a creeper. It can also be worn as a helmet, which reduces the detection range of creepers by 50%."), - armor_texture = "mcl_heads_creeper.png", range_mob = "mobs_mc:creeper", range_factor = 0.5, } @@ -274,26 +273,23 @@ mcl_heads.register_head{ -- Original Minecraft name: “Head” mcl_heads.register_head{ name = "steve", - texture = "mcl_heads_steve_node.png", + texture = "mcl_heads_steve.png", description = S("Human Head"), longdesc = S("A human head is a small decorative block which resembles the head of a human (i.e. a player character). It can also be worn as a helmet for fun, but does not offer any protection."), - armor_texture = "mcl_heads_steve.png", } mcl_heads.register_head{ name = "skeleton", - texture = "mcl_heads_skeleton_node.png", + texture = "mcl_heads_skeleton.png", description = S("Skeleton Skull"), longdesc = S("A skeleton skull is a small decorative block which resembles the skull of a skeleton. It can also be worn as a helmet, which reduces the detection range of skeletons by 50%."), - armor_texture = "mcl_heads_skeleton.png", range_mob = "mobs_mc:skeleton", range_factor = 0.5, } mcl_heads.register_head{ name = "wither_skeleton", - texture = "mcl_heads_wither_skeleton_node.png", + texture = "mcl_heads_wither_skeleton.png", description = S("Wither Skeleton Skull"), longdesc = S("A wither skeleton skull is a small decorative block which resembles the skull of a wither skeleton. It can also be worn as a helmet for fun, but does not offer any protection."), - armor_texture = "mcl_heads_wither_skeleton.png", } diff --git a/mods/ITEMS/mcl_heads/textures/mcl_heads_creeper_node.png b/mods/ITEMS/mcl_heads/textures/mcl_heads_creeper_node.png deleted file mode 100644 index 99b432ac67db7900cdbf4ad0075288fc59381168..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 676 zcmV;V0$crwP)-`Z<|gO2k=b4ojZ{2kvo1$J@UYc88LTiDHF~+Rm6Mu)TyY) z)R98Q*dPn_-@rrTf3D`-AS1co>B0Mm-}Vfd=lD;shQj@r z=MP=K%+%+sOqzF4(1Q0sBlbzNR~_(}zx;9zR2k=Df%Q8Wu}9MAZS;pe~+|*}NsHN*0S20Cu^Tfnz`KKSvxyq6ppYQpH`&%FbSA)AI&P#j{ zEpT7M!uLGe{&dgj#vN!-3ss8UX$mJz*JQ9Xz3A08w_{U-L#z%-ldW1XNd=Aa+;G!+ zY^6SGuusaj1;+XaQ=pkHuZ<8zP@yF?5DS#qYVr3js4GSLmU6IB={i%m6L^=M0E4(X ztqq}ZU6;plw-PE-qB;T2PT<&QnFd|{)4*V;PXs zW{(&H*w76z*mOpEpa`yi2KIRB0^3G205+WS9(WoJUQFM;vB^5TJ+`k2tb1Tmi=c8% zpV5~w3}1%65j^&Q{9j5;_^N10000< KMNUMnLSTaNDmEqn diff --git a/mods/ITEMS/mcl_heads/textures/mcl_heads_skeleton_node.png b/mods/ITEMS/mcl_heads/textures/mcl_heads_skeleton_node.png deleted file mode 100644 index 0af86cd6a5e79a56e21ea9fb18cc64e40cc99731..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 432 zcmV;h0Z;ykP)J${R5dg`bu`y)-C>?L6Z|>8%S`W(g^ikPBD@yH8E*mntaAu zcznz}1{I2thXU5v#kha}?&~+K5epVD{}i@B_kY5|3RMzVFX;-2*hBHW0lC2STmMVr zKWsL9I+itc6*MJd;SkHb)N>5@jH;x82s% zY!-&87AznHm}Cy#Ny{cUw?-+P`FPHr{SV?mvoMBdq0XXU4yB|URd0YO_m99_C)6JJ z%eHGm;qcZbv`h;m9!N4xSQ2L1gtxha7CQTy4doCh5IbXCdn?d5_mTK}d$EL1lsvZ= anE3-#<3ZF1Q5;kN0000bbSMJ~EDEo$_TqK^Ox z8bCex;P%oMNP7v;A~~dh+f#wUMu7lD^DycbP+KcSYQ*xzZDYxjNkvQ1B$wRfl7wZm z2WnTl%N0dcX)MiUzsKx{o%!bfpPBWsg*=j!ng>S)xRtqs`zeKkeE-xl9pC@vTNixn zV(HsTK?(Xb@VRK1224q9iFN>zr2;w�taCojsSmVH z=sP$vKq{5MsMaVJHyFHBsiGTo0A4x$MbDRiaQ^qGdX2UFO=5SOj=iHtA4XB~Em8~% zRt*t}h*ZioQmI6XLvreag}|-M9oE)AzEr7l=;0JXD2QCG@oXwZ`cR6X=#AxHd}oTK zd4#$}>$nb$79!<+BT5F3z5A4)O5sF2O9^73<&oIm%HMV4mRyHn_{ zBf)HDl~Sc@k(Mlr43F%iqP9N%;-5d_bIB-TTmsOR{&4Qwym9Go0Ic0@QmRzZ%2mn*jp@^qynboM;t=yZyCdcomEDmAe)q~(n?fXF zUd*sJ^5tw`e49w@3ECSGvPJsJV(W;=>S`v|I^2wXeRtEm3*Vgi8IF$6B3`? zTtKRoo=HbYy989{cZe%dlTnnFxS!1AZl3&^sF9RjMRJ0P%? z7AAAR-+ihh0!}m~5`G`o)isCyV6fK;Yljno-1q^KS8umFz{UZa!NlDE z;q`y|w)`O?iDAc$xaYDgIt;h(o5q;qx?yntc$yPUiDFT681JQTH{Q@27?b#V zfVyE=ykhE@=h(*yzt1st@BiO_iLKP`u~NI&ssv{h>V`q$Yfm%vP>iXEVx;2%#|_){ zJz;cejJjbUT+4SP+HT0WYYvD?8#itro407c{iqbCta{^hFxU&%^5g`8qTt>k-HRiyz7pa;1x$y%m{d<9) zD@&x~fvyO#o3)M+U}s)83!8I0nYr}`>2=`R?u6@?7pPAd1db#fWaid4jjtO9hFW5qySZdA*vnF({@JBLcd6_cXF(lyI?$`Ga68!4Q8k@nQQJ{L z_3qrwjzrRTA+k@aXdG3uzl{9Tt*>z^|qrjFE42HUQz%600DGTPE!Ct=GbNc00BTrL_t(| z0i}>J${R5dg`bu`y)-C>?L6Z|>8%S`W(g^ikPBD@yH8E*mntaAu zcznz}1{I2thXU5v#kha}?&~+K5epVD{}i@B_kY5|3RMzVFX;-2*hBHW0lC2STmMVr zKWsL9I+itc6*MJd;SkHb)N>5@jH;x82s% zY!-&87AznHm}Cy#Ny{cUw?-+P`FPHr{SV?mvoMBdq0XXU4yB|URd0YO_m99_C)6JJ z%eHGm;qcZbv`h;m9!N4xSQ2L1gtxha7CQTy4doCh5IbXCdn?d5_mTK}d$EL1lsvZ= anE3-#<3ZF1Q5;kN0000`LiLigq;2_Oo?wY4$Ae^wd}JpE6l5GSYwA)QF`^tQ=+= zS+qwiUS#jK%D%KDZS9)WHLKm*TJ1_p4C7*_wMMU;RkUD2YI{YHuG=glztyI}J1V*p z+GgbjN9`-FJf&vc+`p*YKJHjj%|)5)Z27V>iP+fUG`E?p*+6Ien`sx!%&v;_Y|01* zisU7WSp$9ORubeF%mDNc7ytzr{sR%|0H{&iGAM+Bf$6cQi(^OyW6k77zC{KCF4oMO z)YnD^p;{R`iVv+lUna?Z>th%4k=$yoNck(tMO8k58^!FP3Y(hOyTTmCY(`?1Yn z2uhGJj`8{Ic_z54MBumb8wJ)Y?cG1WxX*be(kQp!{Ym*I!Tl_6Sod+>QEk}9AU>a! zWx?y+4sCOeuV-plB-x;GLFlN(jvqT*L>05PbLnvTIPCcG-gMg2J#o{rH->LNYdD*M zc{8^Gx03Gbr7`DDi?aPuz3^#iSqk^PuiW)A6i``n)^KL*ii2E79Qal=xeM}FUwk&Bg6rP=>eC@V-K8Q|m~4khn~(T2@w9%`Lg8J>$A^N%yz#PxDfrt?aH)% zre)i|y!>;|U_0ZgrVmH|Gl}iJm(Iw4ycZ&mALlbAI{x<*ofQN3@jh_fsUXOE+UvHK#A1E(82 zCH&MBwH;5S*jX|U~ZV9ez$ILgY_%D9+K;Xr~}!@rrGlO-H>GTu0_f{}wEYs1Ekjki+s@*X{M zVAQ$QzL{}GgATKZs3Wgac{xA7zyI@z84OEb3NWZ#7Lh(?cYX&bzj(U(xvX Date: Thu, 11 Aug 2022 17:34:20 +0800 Subject: [PATCH 23/34] [heads] optimize textures `optipng -strip all -o7 -zm9` --- .../mcl_heads/textures/mcl_heads_steve.png | Bin 970 -> 382 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/mods/ITEMS/mcl_heads/textures/mcl_heads_steve.png b/mods/ITEMS/mcl_heads/textures/mcl_heads_steve.png index 361795a52b7b2e15923bea8f1a5b76bc2f60e9cd..471a8b3c82f753601954ecb79e11ff9c28499000 100644 GIT binary patch delta 366 zcmV-!0g?X72mS((8Gi!+005OkjW) zJ}gv0FkVbKmsv=oXI7|eRkC_xwtQf}iEhV`a?YH9+pm!S|Nnex_>lkr00DGTPE!Ct z=GbNc008hwL_t&-8STMaQUXB`MZr_I3kM;B{clu>vAb`n0e?RJX80#F*hx8ZLQft+wK!Eun_6oiT#24{HJkI8ic*ICRAbur}F_8Qtb~2Da3JE25$zHR1t7!xX zbC+z86cEE$W$~tfveW4{HIfb4YJ!Vpfra4`aF|3ZxjERNh7VE7;9CtxbuqJzWMmf` zGPx|Hr`D@JZD`C19HWeR<(qkWdV0G11jM>|RXv=xo&W#< M07*qoM6N<$g8#gmK>z>% delta 959 zcmV;w13>)#0?G%F8Gi-<005$$euMx300v@9M??Vs0RI60puMM)00009a7bBm000XU z000XU0RWnu7ytkO2XskIMF-^q5dsPl66y}8000A5NkltHiDx!}}I!(>~%-}2pkckkWz-uJ%u-o+SjPM*lMr?dhO z^d}q~a~Xk;-=95H{=+Z7jUDzpG3XA+WdtNKgQm7o)e&}@ov~JTk>zywUN$dw$!*o0 zBk7Mb1f+5C4#_~9>k73k8 z=j<8Y%MmXlHVAb-ml2TVG^y0<`#WVnIdQ=bf^gRNmv;wL+g6{=18v7aCv^`vZ8-R=R@AQ=YWbp=;8?e)ABRAV! z&!(p*F^pO#DP~e(4aa8RRmG$DH}L8 z4@(9=8h=J8Qz{!_kDwd%(82$$9DCR6>*fBJ!6~f}E^P7gc`lrpqoP+Sl?^6}Dsn;L z+VTolmu`{GD`fKuSC?*aZFvQ`pfFKXDU}T>dX)=j=2*OZK1`N-VSliM4qOtf=v7SH z3zL?jh>UBa*j8upOFyk~>O>YXp9A2*MwNS;e}D4*r{}P(PSor-Lk&#Z1HDQj8N+e| ze6PEbD2j;h1z2vtv3?sL|EG1O)oQaaKZk9)#Nsi&ySqm7X_MdoHdwvCfo7H1ux+k? zv&_=%yG)Tg(Xuv_b&0FWO^g~?4f>Royk-Z-5hnQRj{c6fC5bYD6 Date: Sun, 7 Aug 2022 00:44:02 +0200 Subject: [PATCH 24/34] make ruined portals rarer --- mods/MAPGEN/mcl_structures/ruined_portal.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/MAPGEN/mcl_structures/ruined_portal.lua b/mods/MAPGEN/mcl_structures/ruined_portal.lua index 002195f76..618cc407b 100644 --- a/mods/MAPGEN/mcl_structures/ruined_portal.lua +++ b/mods/MAPGEN/mcl_structures/ruined_portal.lua @@ -16,7 +16,7 @@ local def = { flags = "place_center_x, place_center_z, all_floors", solid_ground = true, make_foundation = true, - chunk_probability = 400, + chunk_probability = 800, y_max = mcl_vars.mg_overworld_max, y_min = 1, sidelen = 10, From cef559c57304ae9b5294916f3111a22bae3dcb5c Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 7 Aug 2022 01:03:54 +0200 Subject: [PATCH 25/34] Fix ruined portals y offset --- mods/MAPGEN/mcl_structures/ruined_portal.lua | 2 +- .../mcl_structures_ruined_portal_1.mts | Bin 524 -> 537 bytes .../mcl_structures_ruined_portal_2.mts | Bin 521 -> 563 bytes .../mcl_structures_ruined_portal_99.mts | Bin 521 -> 555 bytes 4 files changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/MAPGEN/mcl_structures/ruined_portal.lua b/mods/MAPGEN/mcl_structures/ruined_portal.lua index 618cc407b..00d2d682c 100644 --- a/mods/MAPGEN/mcl_structures/ruined_portal.lua +++ b/mods/MAPGEN/mcl_structures/ruined_portal.lua @@ -20,7 +20,7 @@ local def = { y_max = mcl_vars.mg_overworld_max, y_min = 1, sidelen = 10, - y_offset = -4, + y_offset = -5, filenames = { modpath.."/schematics/mcl_structures_ruined_portal_1.mts", modpath.."/schematics/mcl_structures_ruined_portal_2.mts", diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ruined_portal_1.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ruined_portal_1.mts index ae37576dc259184903dd7af589154b8c066aeeda..55a6f2ae306ebb6575b0e82769f9c91cf5b160c9 100644 GIT binary patch delta 347 zcmV-h0i^zn1epX4O;l4&00aOB01W^Me~}DGk!wE|6>Vc|Ut@1_WjbtOc41#;Y;SjI zZfB9HNq^my?G}O{42GGrwEvZt%dLm<;a);T4C^#bhcg@R9tKXO4jGv-TXRh86dQ>d zxEc1q5RG2D;?>wYxu2!J1ZwMD19zi3$lrlVsn_q|q{yQ%`_Y(s`O!?wt;yGZpl(Rb z(Z4ZS+M__NB5GUfnVKq4_l6p)O^aTd+EV%(GJjHHt!q%f*BWh$ngX>Yw?;79lA<~m4@hkmWYdcjC)>a!ctW7zpW2}?*8FYSzWFo)Z%o=Ro!#Wa3 zdoeKy+!E;!sPSo#mXd|k33$MbSdv8fhl=M{d~j*)kYeAue>c|(d1}amy63LT3?!F? t)F{@sX}8g&xJ!CakF5}9Rg0RLg_vWZrD$Q#9PwO=(l1QWx)%%=Rg>b-sLKEV delta 334 zcmV-U0kQs>1dId>O;l4&00aOB01N;Lkqt-|6>Vc|Ut@1_WjbtOc41#;Y;SjIZfB8H zK#{9Rf4!FN7J?uQhBu~S|0^%oTMqFjh*T#!@NAZI+AHcJ+DR2?kx>hm+GsA|M9<2HGBpW9ZIq+QFm|Yo`{kSQ#zQv8EV(8qy6}JMi$0ZSh16-DdHro)v39$Qs{~PuRtd zf04CKZOjSOdafCAM@OyQ$F*LwZr#|r4K3d&`y z4x_~&$B%=cLS#zXvP$K4zeUIhj1yRUs@5fHZAL5of#-+lmqg_*Tg~pMnalMWryepm zrDvr@*-S!FvwLUn*A->MIVGz>qK)PxNp74I&pqK(g`9jI)a)HJSk8E&$DEEU%scvj z@jT@XdB%m$B=W7Cj@5~-2cFCG=I7HfhX1(Udoto*TJKzZm4AKzGzO0{#T+X=xw8?$ ztsQ5L8R1+LtR3~1lX&{3dQUPtb(m%u`i{2Y95tA#nCG8JvyEyJud5x;E_Br{zn-FljYn&gdVF0^$`p3*Wsm}_ z1WZ2^cfwk!cf+Kg(wTjbdTvE0BU*nZP|Y>wV{Q-mDMv-gpw!5E0i2D!S=Rw~uS4xYy0JYBVi!ohkgCJ@*?m7qwD&Z(N$umK{x8|k4*%c#VFFfb zoQA)zohF0Q0G_i~0?-_&}s zm3L|<9<#lYtYi6f#m`j-^q9hyOY+Pyo8KsWrQ+~G(4Zt^-iQmDZFdbFX&4N5Ax64^ycf1iux$G`0LN-&YK%=^*-i6+0pCo&zD|3Z@E-P z+IHt>tv%89=fsQ;NgCa-dTp!zvBdZ7yp+;g2AEha`{yb%uvQpvA2&1CypS8VqREvk!UY-BTd=I1B HZAEPWe!{39 From f1c70fe19da3f1d0a48b92aecb6a91dc91b54cf3 Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 7 Aug 2022 01:30:49 +0200 Subject: [PATCH 26/34] grass border for water lake --- mods/MAPGEN/mcl_terrain_features/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/MAPGEN/mcl_terrain_features/init.lua b/mods/MAPGEN/mcl_terrain_features/init.lua index 18f242e36..052f99c8d 100644 --- a/mods/MAPGEN/mcl_terrain_features/init.lua +++ b/mods/MAPGEN/mcl_terrain_features/init.lua @@ -205,7 +205,7 @@ mcl_structures.register_structure("water_lake",{ y_max = mcl_vars.mg_overworld_max, y_min = minetest.get_mapgen_setting("water_level"), place_func = function(pos,def,pr) - return makelake(pos,5,"mcl_core:water_source",{"group:material_stone", "group:sand", "group:dirt","group:grass_block"},nil,pr) + return makelake(pos,5,"mcl_core:water_source",{"group:material_stone", "group:sand", "group:dirt","group:grass_block"},"mcl_core:dirt_with_grass",pr) end }) From 4f96b38fa3a96668da35b5ba4ed0de54811e4603 Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 1 Aug 2022 01:43:23 +0200 Subject: [PATCH 27/34] Make foundations less cubic --- mods/MAPGEN/mcl_structures/api.lua | 90 ++++++++++++++++++++++-------- 1 file changed, 68 insertions(+), 22 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index af08caf07..6850255b3 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -38,6 +38,73 @@ function mcl_structures.find_highest_y(pp) return y end +local function smooth_cube(nn,pos,plane,amnt) + local r = {} + local amnt = amnt or 9 + table.sort(nn,function(a, b) + if false or plane then + return vector.distance(vector.new(pos.x,0,pos.z), vector.new(a.x,0,a.z)) < vector.distance(vector.new(pos.x,0,pos.z), vector.new(b.x,0,b.z)) + else + return vector.distance(pos, a) < vector.distance(pos, b) + end + end) + for i=1,math.max(1,#nn-amnt) do table.insert(r,nn[i]) end + return r +end + +local function get_foundation_nodes(ground_p1,ground_p2,pos,sidelen) + local replace = {"air","group:liquid","mcl_core:snow","group:tree","group:leaves","group:plant"} + local nn = smooth_cube(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-30,0),replace),vector.offset(pos,0,-30,0),true,sidelen * 64) + local stone = {} + local filler = {} + local top = {} + local dust = {} + for l,v in pairs(nn) do + if v.y == ground_p1.y - 1 then + table.insert(filler,v) + table.insert(top,vector.offset(v,0,1,0)) + table.insert(dust,vector.offset(v,0,2,0)) + elseif v.y < ground_p1.y -1 and v.y > ground_p2.y -4 then table.insert(filler,v) + elseif v.y < ground_p2.y - 3 and v.y > ground_p2.y -5 then + if math.random(3) == 1 then + table.insert(filler,v) + else + table.insert(stone,v) + end + else + table.insert(stone,v) + end + end + return stone,filler,top,dust +end + +local function foundation(ground_p1,ground_p2,pos,sidelen) + local stone,filler,top,dust = get_foundation_nodes(ground_p1,ground_p2,pos,sidelen) + local node_stone = "mcl_core:stone" + local node_filler = "mcl_core:dirt" + local node_top = "mcl_core:dirt_with_grass" or minetest.get_node(ground_p1).name + local node_dust = nil + + if minetest.get_mapgen_setting("mg_name") ~= "v6" then + local b = minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)] + --minetest.log(dump(b.node_top)) + if b then + if b.node_top then node_top = b.node_top end + if b.node_filler then node_filler = b.node_filler end + if b.node_stone then node_stone = b.node_stone end + if b.node_dust then node_dust = b.node_dust end + end + end + + minetest.bulk_set_node(top,{name=node_top}) + + if node_dust then + minetest.bulk_set_node(dust,{name=node_dust}) + end + minetest.bulk_set_node(filler,{name=node_filler}) + minetest.bulk_set_node(stone,{name=node_stone}) +end + function mcl_structures.place_structure(pos, def, pr, blockseed) if not def then return end local logging = not def.terrain_feature @@ -55,28 +122,7 @@ function mcl_structures.place_structure(pos, def, pr, blockseed) local solid = minetest.find_nodes_in_area(ground_p1,ground_p2,{"group:solid"}) if #solid < ( def.sidelen * def.sidelen ) then if def.make_foundation then - local node_stone = "mcl_core:stone" - local node_filler = "mcl_core:dirt" - local node_top = "mcl_core:dirt_with_grass" or minetest.get_node(ground_p1).name - local node_dust = nil - - if minetest.get_mapgen_setting("mg_name") ~= "v6" then - local b = minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)] - --minetest.log(dump(b.node_top)) - if b then - if b.node_top then node_top = b.node_top end - if b.node_filler then node_filler = b.node_filler end - if b.node_stone then node_stone = b.node_stone end - if b.node_dust then node_dust = b.node_dust end - end - end - local replace = {"air","group:liquid","mcl_core:snow","group:tree","group:leaves"} - minetest.bulk_set_node(minetest.find_nodes_in_area(ground_p1,ground_p2,replace),{name=node_top}) - if node_dust then - minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,1,0),vector.offset(ground_p2,0,1,0),{"air"}),{name=node_dust}) - end - minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-4,0),replace),{name=node_filler}) - minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-5,0),vector.offset(ground_p2,0,-30,0),replace),{name=node_stone}) + foundation(vector.offset(pos,-def.sidelen/2 - 3,-1,-def.sidelen/2 - 3),vector.offset(pos,def.sidelen/2 + 3,-1,def.sidelen/2 + 3),pos,def.sidelen) else if logging then minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pp).." not placed. No solid ground.") From b7f26e2ddca9b7e88c89210332a4b41e8d589505 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 9 Aug 2022 19:28:30 +0200 Subject: [PATCH 28/34] Add setting to selectively disable strucutres --- mods/MAPGEN/mcl_structures/api.lua | 8 ++++++++ settingtypes.txt | 3 +++ 2 files changed, 11 insertions(+) diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 6850255b3..c883c4d7a 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -1,5 +1,12 @@ mcl_structures.registered_structures = {} +local disabled_structures = minetest.settings:get("mcl_disabled_structures") +if disabled_structures then disabled_structures = disabled_structures:split(",") +else disabled_structures = {} end + +function mcl_structures.is_disabled(structname) + if table.indexof(disabled_structures,structname) ~= -1 then return true end +end function mcl_structures.fill_chests(p1,p2,loot,pr) for it,lt in pairs(loot) do @@ -168,6 +175,7 @@ function mcl_structures.place_structure(pos, def, pr, blockseed) end function mcl_structures.register_structure(name,def,nospawn) --nospawn means it will be placed by another (non-nospawn) structure that contains it's structblock i.e. it will not be placed by mapgen directly + if mcl_structures.is_disabled(name) then return end local structblock = "mcl_structures:structblock_"..name local flags = "place_center_x, place_center_z, force_placement" local y_offset = 0 diff --git a/settingtypes.txt b/settingtypes.txt index 35db8bde7..7c8bc651e 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -39,6 +39,9 @@ mcl_doTileDrops (Blocks have drops) bool true # If enabled, TNT explosions destroy blocks. mcl_tnt_griefing (TNT destroys blocks) bool true +# Comma separated list of disabled structure names +mcl_disabled_structures (Disabled structures) string + [Players] # If enabled, players respawn at the bed they last lay on instead of normal # spawn. From 0bcbea4ce3de2a826a14707724645393795aef50 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 10 Aug 2022 13:52:19 +0200 Subject: [PATCH 29/34] Add lots of water lakes to mangrove swamps --- mods/MAPGEN/mcl_terrain_features/init.lua | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/mods/MAPGEN/mcl_terrain_features/init.lua b/mods/MAPGEN/mcl_terrain_features/init.lua index 052f99c8d..eab33e78e 100644 --- a/mods/MAPGEN/mcl_terrain_features/init.lua +++ b/mods/MAPGEN/mcl_terrain_features/init.lua @@ -29,7 +29,7 @@ local function airtower(pos,tbl,h) end end -local function makelake(pos,size,liquid,placein,border,pr) +local function makelake(pos,size,liquid,placein,border,pr,noair) local node_under = minetest.get_node(vector.offset(pos,0,-1,0)) local p1 = vector.offset(pos,-size,-1,-size) local p2 = vector.offset(pos,size,-1,size) @@ -70,7 +70,7 @@ local function makelake(pos,size,liquid,placein,border,pr) end if border == nil or border == "mcl_core:dirt" then border = "mcl_core:dirt_with_grass" end end - if an.name ~= liquid then + if not noair and an.name ~= liquid then table.insert(br,pp) if un.name ~= liquid then airtower(pp,air,55) @@ -209,6 +209,27 @@ mcl_structures.register_structure("water_lake",{ end }) +mcl_structures.register_structure("water_lake_mangrove_swamp",{ + place_on = {"mcl_mud:mud"}, + biomes = { "MangroveSwamp" }, + terrain_feature = true, + noise_params = { + offset = 0, + scale = 0.0032, + spread = {x = 250, y = 250, z = 250}, + seed = 6343241353, + octaves = 3, + persist = 0.001, + flags = "absvalue", + }, + flags = "place_center_x, place_center_z, force_placement", + y_max = mcl_vars.mg_overworld_max, + y_min = minetest.get_mapgen_setting("water_level"), + place_func = function(pos,def,pr) + return makelake(pos,3,"mcl_core:water_source",{"group:material_stone", "group:sand", "group:dirt","group:grass_block","mcl_mud:mud"},"mcl_mud:mud",pr,true) + end +}) + local pool_adjacents = { vector.new(1,0,0), vector.new(-1,0,0), From 79ce9f89d34ea20121d1e2063ce7d94be6fbbb1d Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 10 Aug 2022 15:14:51 +0200 Subject: [PATCH 30/34] More adaptive foundation height --- mods/MAPGEN/mcl_structures/api.lua | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index c883c4d7a..e57d4f6be 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -59,9 +59,24 @@ local function smooth_cube(nn,pos,plane,amnt) return r end -local function get_foundation_nodes(ground_p1,ground_p2,pos,sidelen) - local replace = {"air","group:liquid","mcl_core:snow","group:tree","group:leaves","group:plant"} - local nn = smooth_cube(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-30,0),replace),vector.offset(pos,0,-30,0),true,sidelen * 64) +local function find_ground(pos,nn,gn) + local r = 0 + for _,v in pairs(nn) do + local p=vector.new(v) + repeat + local n = minetest.get_node(p).name + p = vector.offset(p,0,-1,0) + until not n or n == "mcl_core:bedrock" or n == "ignore" or n == gn + --minetest.log(tostring(pos.y - p.y)) + if pos.y - p.y > r then r = pos.y - p.y end + end + return r +end + +local function get_foundation_nodes(ground_p1,ground_p2,pos,sidelen,node_stone) + local replace = {"air","group:liquid","mcl_core:snow","group:tree","group:leaves","group:plant","grass_block","group:dirt"} + local depth = find_ground(pos,minetest.find_nodes_in_area(ground_p1,ground_p2,replace),node_stone) + local nn = smooth_cube(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-depth,0),replace),vector.offset(pos,0,-depth,0),true,sidelen * 64) local stone = {} local filler = {} local top = {} @@ -86,7 +101,6 @@ local function get_foundation_nodes(ground_p1,ground_p2,pos,sidelen) end local function foundation(ground_p1,ground_p2,pos,sidelen) - local stone,filler,top,dust = get_foundation_nodes(ground_p1,ground_p2,pos,sidelen) local node_stone = "mcl_core:stone" local node_filler = "mcl_core:dirt" local node_top = "mcl_core:dirt_with_grass" or minetest.get_node(ground_p1).name @@ -103,7 +117,8 @@ local function foundation(ground_p1,ground_p2,pos,sidelen) end end - minetest.bulk_set_node(top,{name=node_top}) + local stone,filler,top,dust = get_foundation_nodes(ground_p1,ground_p2,pos,sidelen,node_stone) + minetest.bulk_set_node(top,{name=node_top},node_stone) if node_dust then minetest.bulk_set_node(dust,{name=node_dust}) From 6101de8d68e186664eddf70418b8b5960cae8d87 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 10 Aug 2022 20:00:30 +0200 Subject: [PATCH 31/34] Fix parrot punch spam --- mods/ENTITIES/mobs_mc/parrot.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/parrot.lua b/mods/ENTITIES/mobs_mc/parrot.lua index 80a5b9318..9ee03ac58 100644 --- a/mods/ENTITIES/mobs_mc/parrot.lua +++ b/mods/ENTITIES/mobs_mc/parrot.lua @@ -118,7 +118,7 @@ end mcl_mobs:register_mob("mobs_mc:parrot", { description = S("Parrot"), - type = "npc", + type = "passive", spawn_class = "passive", pathfinding = 1, hp_min = 6, From 374e30b4a55bfaac152f153b15b5ae1905eafe36 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 10 Aug 2022 20:05:25 +0200 Subject: [PATCH 32/34] stay on players shoulder in when flying in creative --- mods/ENTITIES/mobs_mc/parrot.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/parrot.lua b/mods/ENTITIES/mobs_mc/parrot.lua index 9ee03ac58..d4b6c12e6 100644 --- a/mods/ENTITIES/mobs_mc/parrot.lua +++ b/mods/ENTITIES/mobs_mc/parrot.lua @@ -92,7 +92,8 @@ local function check_perch(self,dtime) local n1 = minetest.get_node(vector.offset(p:get_pos(),0,-0.6,0)).name local n2 = minetest.get_node(vector.offset(p:get_pos(),0,0,0)).name local n3 = minetest.get_node(vector.offset(p:get_pos(),0,1,0)).name - if n1 == "air" or minetest.get_item_group(n2,"water") > 0 or minetest.get_item_group(n2,"lava") > 0 then + if ( n1 == "air" or minetest.get_item_group(n2,"water") > 0 or minetest.get_item_group(n2,"lava") > 0) and + not minetest.is_creative_enabled(p:get_player_name()) then o:set_detach() self.detach_timer = 0 return From f0837bdee62453b78806f3e440e0af315e407e99 Mon Sep 17 00:00:00 2001 From: opfromthestart Date: Mon, 8 Aug 2022 14:17:30 -0400 Subject: [PATCH 33/34] Swimming collides with ice properly --- mods/PLAYER/mcl_playerplus/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index c3876269c..7ca56eb17 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -377,8 +377,8 @@ minetest.register_globalstep(function(dtime) set_properties_conditional(player,{collisionbox = {-0.312,0,-0.312,0.312,0.8,0.312}, eye_height = 0.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }}) -- control body bone when swimming set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(degrees(dir_to_pitch(player_velocity)) - 90,-player_vel_yaw + yaw + 180,0)) - elseif get_item_group(mcl_playerinfo[name].node_head, "opaque") == 0 - and get_item_group(mcl_playerinfo[name].node_head_top, "opaque") == 0 then + elseif get_item_group(mcl_playerinfo[name].node_head, "solid") == 0 + and get_item_group(mcl_playerinfo[name].node_head_top, "solid") == 0 then -- sets eye height, and nametag color accordingly is_swimming = false set_properties_conditional(player,{collisionbox = {-0.312,0,-0.312,0.312,1.8,0.312}, eye_height = 1.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }}) From 16c9a83a964165af9c4a351811d4106badd5efa5 Mon Sep 17 00:00:00 2001 From: Sumyjkl Date: Fri, 12 Aug 2022 21:46:17 +1000 Subject: [PATCH 34/34] fix items floating into the air under rare circumstances --- mods/ENTITIES/mcl_item_entity/init.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index 5a82ca1fd..ccf1d2dca 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -847,8 +847,7 @@ minetest.register_entity(":__builtin:item", { elseif self._flowing == true and not is_in_water and not is_floating then -- Disable flowing physics if not on/in flowing liquid self._flowing = false - local pos = self.object:get_pos() - disable_physics(self.object, self, false, false) + disable_physics(self.object, self, true) return end