mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-09-12 00:56:53 +02:00
Fix global variable references and exit mob_step if missing pos
This commit is contained in:
parent
08cbd95a5e
commit
10a3d06360
@ -308,7 +308,7 @@ local function dir_to_pitch(dir)
|
|||||||
return -math.atan2(-dir.y, xz)
|
return -math.atan2(-dir.y, xz)
|
||||||
end
|
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 pos = self.object:get_pos()
|
||||||
|
|
||||||
local stop_look_at_player_chance = math.random(833/self.curiosity)
|
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
|
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 final_rotation = vector.zero()
|
||||||
local oldp,oldr = self.object:get_bone_position(self.head_swivel)
|
local oldp,oldr = self.object:get_bone_position(self.head_swivel)
|
||||||
|
@ -823,7 +823,7 @@ end
|
|||||||
function mob_class:step_damage (dtime, pos)
|
function mob_class:step_damage (dtime, pos)
|
||||||
if not self.fire_resistant then
|
if not self.fire_resistant then
|
||||||
mcl_burning.tick(self.object, dtime, self)
|
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
|
if self:check_for_death("fire", {type = "fire"}) then
|
||||||
return true
|
return true
|
||||||
|
@ -63,7 +63,7 @@ local function barrel_open(pos, node, clicker)
|
|||||||
|
|
||||||
minetest.swap_node(pos, { name = "mcl_barrels:barrel_open", param2 = node.param2 })
|
minetest.swap_node(pos, { name = "mcl_barrels:barrel_open", param2 = node.param2 })
|
||||||
open_barrels[playername] = pos
|
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
|
end
|
||||||
|
|
||||||
local function close_forms(pos)
|
local function close_forms(pos)
|
||||||
@ -81,7 +81,7 @@ local function update_after_close(pos)
|
|||||||
if not node then return end
|
if not node then return end
|
||||||
if node.name == "mcl_barrels:barrel_open" then
|
if node.name == "mcl_barrels:barrel_open" then
|
||||||
minetest.swap_node(pos, {name = "mcl_barrels:barrel_closed", param2 = node.param2})
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ local function set_water_palette(minp,maxp,data2,area,biomemap,nodes)
|
|||||||
return lvm_used
|
return lvm_used
|
||||||
end
|
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 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)
|
local nodes = minetest.find_nodes_in_area(minp, maxp, nodes)
|
||||||
for n=1, #nodes do
|
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)
|
local pr = PseudoRandom(blockseed)
|
||||||
if minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min then
|
if minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min then
|
||||||
-- Set param2 of seagrass to 3.
|
-- 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
|
end
|
||||||
return lvm_used
|
return lvm_used
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user