mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 12:31:05 +01:00
Some more missing arg fixes
This commit is contained in:
parent
bc496a8682
commit
7bd0b5a9b1
5 changed files with 11 additions and 10 deletions
|
@ -303,6 +303,7 @@ end
|
|||
function mob_class:on_step(dtime)
|
||||
self.lifetimer = self.lifetimer - dtime
|
||||
local pos = self.object:get_pos()
|
||||
if not pos then return end
|
||||
if self:check_despawn(pos) then return true end
|
||||
|
||||
local d = 0.85
|
||||
|
@ -363,8 +364,8 @@ function mob_class:on_step(dtime)
|
|||
self:follow_flop()
|
||||
--set animation speed relitive to velocity
|
||||
self:set_animation_speed()
|
||||
self:check_smooth_rotation()
|
||||
self:check_head_swivel()
|
||||
self:check_smooth_rotation(dtime)
|
||||
self:check_head_swivel(dtime)
|
||||
|
||||
self:do_jump()
|
||||
self:set_armor_texture()
|
||||
|
|
|
@ -279,10 +279,10 @@ local function dir_to_pitch(dir)
|
|||
return -math.atan2(-dir.y, xz)
|
||||
end
|
||||
|
||||
function mob_class:check_head_swivel()
|
||||
if self.head_swivel and type(self.head_swivel) == "string" then
|
||||
function mob_class:check_head_swivel(dtime)
|
||||
if not self.head_swivel or type(self.head_swivel) ~= "string" then return end
|
||||
local final_rotation = vector.new(0,0,0)
|
||||
local oldp,oldr = self.object:get_bone_position(self.head_swivel)
|
||||
local pos = self.object:get_pos()
|
||||
|
||||
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 10)) do
|
||||
if obj:is_player() and not self.attack or obj:get_luaentity() and obj:get_luaentity().name == self.name and self ~= obj:get_luaentity() then
|
||||
|
|
|
@ -59,6 +59,7 @@ end
|
|||
function mob_class:check_item_pickup()
|
||||
if self.pick_up and #self.pick_up > 0 or self.wears_armor then
|
||||
local p = self.object:get_pos()
|
||||
if not p then return end
|
||||
for _,o in pairs(minetest.get_objects_inside_radius(p,2)) do
|
||||
local l=o:get_luaentity()
|
||||
if l and l.name == "__builtin:item" then
|
||||
|
|
|
@ -1355,7 +1355,7 @@ function mob_class:do_states(dtime)
|
|||
end
|
||||
end
|
||||
|
||||
function mob_class:check_smooth_rotation()
|
||||
function mob_class:check_smooth_rotation(dtime)
|
||||
-- smooth rotation by ThomasMonroe314
|
||||
if self._turn_to then
|
||||
self:set_yaw( self._turn_to, .1)
|
||||
|
|
|
@ -39,6 +39,7 @@ local function within_limits(pos, radius)
|
|||
wmin = wmin - radius
|
||||
wmax = wmax + radius
|
||||
end
|
||||
if not pos then return true end
|
||||
for _,v in pairs(pos) do
|
||||
if v < wmin or v > wmax then return false end
|
||||
end
|
||||
|
@ -582,6 +583,7 @@ function mob_class:do_env_damage()
|
|||
end
|
||||
|
||||
local pos = self.object:get_pos()
|
||||
if not pos then return end
|
||||
|
||||
self.time_of_day = minetest.get_timeofday()
|
||||
|
||||
|
@ -592,10 +594,7 @@ function mob_class:do_env_damage()
|
|||
return true
|
||||
end
|
||||
|
||||
local sunlight = 10
|
||||
if within_limits(pos,0) then
|
||||
sunlight = minetest.get_natural_light(pos, self.time_of_day)
|
||||
end
|
||||
local sunlight = minetest.get_natural_light(pos, self.time_of_day)
|
||||
|
||||
-- bright light harms mob
|
||||
if self.light_damage ~= 0 and (sunlight or 0) > 12 then
|
||||
|
|
Loading…
Reference in a new issue