1
0
Fork 0

Clean up some luacheck warnings in mcl_mobs

objects
Wuzzy 2020-01-20 16:08:59 +01:00
parent bc7b86b61a
commit 3788b66b47
2 changed files with 8 additions and 19 deletions

View File

@ -8,7 +8,6 @@ mobs.version = "20180531" -- don't rely too much on this, rarely updated, if eve
local MAX_MOB_NAME_LENGTH = 30 local MAX_MOB_NAME_LENGTH = 30
-- Localize -- Localize
local MP = minetest.get_modpath(minetest.get_current_modname())
local S = minetest.get_translator("mcl_mobs") local S = minetest.get_translator("mcl_mobs")
-- CMI support check -- CMI support check
@ -83,8 +82,6 @@ local stuck_timeout = 3 -- how long before mob gets stuck in place and starts se
local stuck_path_timeout = 10 -- how long will mob follow path before giving up local stuck_path_timeout = 10 -- how long will mob follow path before giving up
-- default nodes -- default nodes
local node_fire = "mcl_fire:fire"
local node_permanent_flame = "mcl_fire:eternal_fire"
local node_ice = "mcl_core:ice" local node_ice = "mcl_core:ice"
local node_snowblock = "mcl_core:snowblock" local node_snowblock = "mcl_core:snowblock"
local node_snow = "mcl_core:snow" local node_snow = "mcl_core:snow"
@ -340,7 +337,7 @@ end
-- are we flying in what we are suppose to? (taikedz) -- are we flying in what we are suppose to? (taikedz)
local flight_check = function(self, pos_w) local flight_check = function(self)
local nod = self.standing_in local nod = self.standing_in
local def = minetest.registered_nodes[nod] local def = minetest.registered_nodes[nod]
@ -886,7 +883,7 @@ local do_jump = function(self)
local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5) local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5)
-- what is in front of mob? -- what is in front of mob?
local nod = node_ok({ nod = node_ok({
x = pos.x + dir_x, x = pos.x + dir_x,
y = pos.y + 0.5, y = pos.y + 0.5,
z = pos.z + dir_z z = pos.z + dir_z
@ -1781,7 +1778,7 @@ local follow_flop = function(self)
if p.x > s.x then yaw = yaw + pi end if p.x > s.x then yaw = yaw + pi end
yaw = set_yaw(self, yaw, 6) set_yaw(self, yaw, 6)
-- anyone but standing npc's can move along -- anyone but standing npc's can move along
if dist > self.reach if dist > self.reach
@ -3825,9 +3822,6 @@ function mobs:protect(self, clicker)
end end
local mob_obj = {}
local mob_sta = {}
-- feeding, taming and breeding (thanks blert2112) -- feeding, taming and breeding (thanks blert2112)
function mobs:feed_tame(self, clicker, feed_count, breed, tame) function mobs:feed_tame(self, clicker, feed_count, breed, tame)
if not self.follow then if not self.follow then

View File

@ -121,7 +121,7 @@ end)
function mobs.attach(entity, player) function mobs.attach(entity, player)
local attach_at, eye_offset = {}, {} local attach_at, eye_offset
entity.player_rotation = entity.player_rotation or {x = 0, y = 0, z = 0} entity.player_rotation = entity.player_rotation or {x = 0, y = 0, z = 0}
entity.driver_attach_at = entity.driver_attach_at or {x = 0, y = 0, z = 0} entity.driver_attach_at = entity.driver_attach_at or {x = 0, y = 0, z = 0}
@ -183,10 +183,10 @@ end
function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime) function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
local rot_steer, rot_view = math.pi/2, 0 local rot_view = 0
if entity.player_rotation.y == 90 then if entity.player_rotation.y == 90 then
rot_steer, rot_view = 0, math.pi/2 rot_view = math.pi/2
end end
local acce_y = 0 local acce_y = 0
@ -293,7 +293,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
-- Set position, velocity and acceleration -- Set position, velocity and acceleration
local p = entity.object:get_pos() local p = entity.object:get_pos()
local new_velo = {x = 0, y = 0, z = 0} local new_velo
local new_acce = {x = 0, y = -9.8, z = 0} local new_acce = {x = 0, y = -9.8, z = 0}
p.y = p.y - 0.5 p.y = p.y - 0.5
@ -390,11 +390,6 @@ function mobs.fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim)
local velo = entity.object:get_velocity() local velo = entity.object:get_velocity()
local dir = entity.driver:get_look_dir() local dir = entity.driver:get_look_dir()
local yaw = entity.driver:get_look_horizontal() + 1.57 -- offset fix between old and new commands local yaw = entity.driver:get_look_horizontal() + 1.57 -- offset fix between old and new commands
local rot_steer, rot_view = math.pi / 2, 0
if entity.player_rotation.y == 90 then
rot_steer, rot_view = 0, math.pi / 2
end
if ctrl.up then if ctrl.up then
entity.object:set_velocity({ entity.object:set_velocity({