From 221ee0fcf1da898fffbfaeda1fddb1c22491a3da Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Sun, 7 Aug 2022 00:13:03 +0800 Subject: [PATCH 01/19] [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/19] [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/19] [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/19] [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/19] [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/19] [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/19] [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/19] 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/19] 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/19] 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/19] 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/19] 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/19] 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/19] 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/19] 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/19] 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/19] 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/19] 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/19] 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