tidy some luacheckrc warnings

This commit is contained in:
tenplus1 2022-10-31 15:05:34 +00:00
parent edf846c34c
commit d4145ddd3d
2 changed files with 11 additions and 19 deletions

28
api.lua
View File

@ -1,5 +1,3 @@
local MP = minetest.get_modpath(minetest.get_current_modname())
-- Check for translation method
local S
if minetest.get_translator ~= nil then
@ -27,7 +25,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = {
mod = "redo",
version = "20221027",
version = "20221031",
intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {}
}
@ -55,7 +53,6 @@ local atan = function(x)
end
local table_copy = table.copy
local table_remove = table.remove
local vadd = vector.add
local vdirection = vector.direction
local vmultiply = vector.multiply
local vsubtract = vector.subtract
@ -80,7 +77,6 @@ local spawn_monster_protected = settings:get_bool("mobs_spawn_monster_protected"
local remove_far = settings:get_bool("remove_far_mobs") ~= false
local mob_area_spawn = settings:get_bool("mob_area_spawn")
local difficulty = tonumber(settings:get("mob_difficulty")) or 1.0
local show_health = settings:get_bool("mob_show_health") ~= false
local max_per_block = tonumber(settings:get("max_objects_per_block") or 99)
local mob_nospawn_range = tonumber(settings:get("mob_nospawn_range") or 12)
local active_limit = tonumber(settings:get("mob_active_limit") or 0)
@ -446,7 +442,7 @@ local line_of_sight = function(self, pos1, pos2, stepsize)
stepsize = stepsize or 1
local s, pos = minetest.line_of_sight(pos1, pos2, stepsize)
local s = minetest.line_of_sight(pos1, pos2, stepsize)
-- normal walking and flying mobs can see you through air
if s == true then
@ -1289,7 +1285,7 @@ print("on: " .. self.standing_on
local yaw = self.object:get_yaw() or 0
local turn = random(0, 2) + 1.35
yaw = self:set_yaw(yaw + turn, 12)
self:set_yaw(yaw + turn, 12)
self.jump_count = 0
end
@ -1316,7 +1312,6 @@ local entity_physics = function(pos, radius)
if dist < 1 then dist = 1 end
local damage = floor((4 / dist) * radius)
local ent = objs[n]:get_luaentity()
-- punches work on entities AND players
objs[n]:punch(objs[n], 1.0, {
@ -2245,7 +2240,7 @@ function mob_class:do_states(dtime)
yaw = yaw + random(-0.5, 0.5)
end
yaw = self:set_yaw(yaw, 8)
self:set_yaw(yaw, 8)
end
self:set_velocity(0)
@ -2309,14 +2304,14 @@ function mob_class:do_states(dtime)
end
end
yaw = self:set_yaw(yaw, 8)
self:set_yaw(yaw, 8)
-- otherwise randomly turn
elseif self.randomly_turn and random(100) <= 30 then
yaw = yaw + random(-0.5, 0.5)
yaw = self:set_yaw(yaw, 8)
self:set_yaw(yaw, 8)
-- for flying/swimming mobs randomly move up and down also
if self.fly_in
@ -2412,7 +2407,7 @@ function mob_class:do_states(dtime)
if self.attack_type == "explode" then
yaw = yaw_to_pos(self, p)
yaw_to_pos(self, p)
local node_break_radius = self.explosion_radius or 1
local entity_damage_radius = self.explosion_damage_radius
@ -2581,7 +2576,7 @@ function mob_class:do_states(dtime)
p = {x = p1.x, y = p1.y, z = p1.z}
end
yaw = yaw_to_pos(self, p)
yaw_to_pos(self, p)
-- move towards enemy if beyond mob reach
if dist > (self.reach + (self.reach_ext or 0)) then
@ -2675,7 +2670,7 @@ function mob_class:do_states(dtime)
local vec = {x = p.x - s.x, y = p.y - s.y, z = p.z - s.z}
yaw = yaw_to_pos(self, p)
yaw_to_pos(self, p)
self:set_velocity(0)
@ -2835,7 +2830,6 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
local weapon = hitter:get_wielded_item()
local weapon_def = weapon:get_definition() or {}
local punch_interval = 1.4
-- calculate mob damage
local damage = 0
@ -2897,7 +2891,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
end
-- add weapon wear
punch_interval = tool_capabilities.full_punch_interval or 1.4
local punch_interval = tool_capabilities.full_punch_interval or 1.4
-- toolrank support
local wear = floor((punch_interval / 75) * 9000)
@ -2995,7 +2989,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
and self.order ~= "stand" then
local lp = hitter:get_pos()
local yaw = yaw_to_pos(self, lp, 3)
yaw = yaw_to_pos(self, lp, 3)
self.state = "runaway"
self.runaway_timer = 0

View File

@ -733,8 +733,6 @@ External Settings for "minetest.conf"
spawn number e.g. mobs_animal:cow = 1000,5
'mob_difficulty' sets difficulty level (health and hit damage
multiplied by this number), defaults to 1.0.
'mob_show_health' if false then punching mob will not show health status
(true by default)
'mob_chance_multiplier' multiplies chance of all mobs spawning and can be set
to 0.5 to have mobs spawn more or 2.0 to spawn less.
e.g. 1 in 7000 * 0.5 = 1 in 3500 so better odds of