From 10a3d06360773b2c592efd78acdbd5f66dc5e6a6 Mon Sep 17 00:00:00 2001 From: ancientmarinerdev Date: Thu, 18 May 2023 12:52:27 +0100 Subject: [PATCH] Fix global variable references and exit mob_step if missing pos --- mods/ENTITIES/mcl_mobs/effects.lua | 4 ++-- mods/ENTITIES/mcl_mobs/physics.lua | 2 +- mods/ITEMS/mcl_barrels/init.lua | 4 ++-- mods/MAPGEN/mcl_mapgen_core/init.lua | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/effects.lua b/mods/ENTITIES/mcl_mobs/effects.lua index 1a1578834..7953e6a47 100644 --- a/mods/ENTITIES/mcl_mobs/effects.lua +++ b/mods/ENTITIES/mcl_mobs/effects.lua @@ -308,7 +308,7 @@ local function dir_to_pitch(dir) return -math.atan2(-dir.y, xz) end -local function who_are_you_looking_at (self) +local function who_are_you_looking_at (self, dtime) local pos = self.object:get_pos() local stop_look_at_player_chance = math.random(833/self.curiosity) @@ -361,7 +361,7 @@ function mob_class:check_head_swivel(dtime) if not self.head_swivel or type(self.head_swivel) ~= "string" then return end - who_are_you_looking_at (self) + who_are_you_looking_at (self, dtime) local final_rotation = vector.zero() local oldp,oldr = self.object:get_bone_position(self.head_swivel) diff --git a/mods/ENTITIES/mcl_mobs/physics.lua b/mods/ENTITIES/mcl_mobs/physics.lua index 090b921c7..1fbe1e24d 100644 --- a/mods/ENTITIES/mcl_mobs/physics.lua +++ b/mods/ENTITIES/mcl_mobs/physics.lua @@ -823,7 +823,7 @@ end function mob_class:step_damage (dtime, pos) if not self.fire_resistant then mcl_burning.tick(self.object, dtime, self) - if not self.object:get_pos() then return end -- mcl_burning.tick may remove object immediately + if not self.object:get_pos() then return true end -- mcl_burning.tick may remove object immediately if self:check_for_death("fire", {type = "fire"}) then return true diff --git a/mods/ITEMS/mcl_barrels/init.lua b/mods/ITEMS/mcl_barrels/init.lua index 3cde964d7..714a80f09 100644 --- a/mods/ITEMS/mcl_barrels/init.lua +++ b/mods/ITEMS/mcl_barrels/init.lua @@ -63,7 +63,7 @@ local function barrel_open(pos, node, clicker) minetest.swap_node(pos, { name = "mcl_barrels:barrel_open", param2 = node.param2 }) open_barrels[playername] = pos - minetest.sound_play({name="mcl_barrels_default_barrel_open", pos=node_pos, gain=0.5, max_hear_distance=16}, true) + minetest.sound_play({name="mcl_barrels_default_barrel_open", pos=pos, gain=0.5, max_hear_distance=16}, true) end local function close_forms(pos) @@ -81,7 +81,7 @@ local function update_after_close(pos) if not node then return end if node.name == "mcl_barrels:barrel_open" then minetest.swap_node(pos, {name = "mcl_barrels:barrel_closed", param2 = node.param2}) - minetest.sound_play({name="mcl_barrels_default_barrel_close", pos=node_pos, gain=0.5, max_hear_distance=16}, true) + minetest.sound_play({name="mcl_barrels_default_barrel_close", pos=pos, gain=0.5, max_hear_distance=16}, true) end end diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index e6420f91d..c3eef6a26 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -335,7 +335,7 @@ local function set_water_palette(minp,maxp,data2,area,biomemap,nodes) return lvm_used end -local function set_seagrass_param2(minp,maxp,data2,area,biomemap,nodes) +local function set_seagrass_param2(minp,maxp,data2,area,nodes) local aream = VoxelArea:new({MinEdge={x=minp.x, y=0, z=minp.z}, MaxEdge={x=maxp.x, y=0, z=maxp.z}}) local nodes = minetest.find_nodes_in_area(minp, maxp, nodes) for n=1, #nodes do @@ -440,7 +440,7 @@ local function block_fixes_seagrass(vm, data, data2, emin, emax, area, minp, max local pr = PseudoRandom(blockseed) if minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min then -- Set param2 of seagrass to 3. - lvm_used = set_seagrass_param2(minp,maxp,data2,area,biomemap,{"group:seagrass"}) + lvm_used = set_seagrass_param2(minp, maxp, data2, area, {"group:seagrass"}) end return lvm_used end