Fix luacheck findings for this PR: remove unused variables, remove overwritten value, add missing dependencies, fix undefined variable usage

This commit is contained in:
teknomunk 2024-09-21 19:21:25 -05:00
parent 26062a9d26
commit 76d654762a
16 changed files with 7 additions and 57 deletions

View file

@ -45,7 +45,6 @@ function mcl_util.rotate_axis_and_place(itemstack, placer, pointed_thing, infini
itemstack, pointed_thing)
return
end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
local wield_name = itemstack:get_name()
local above = pointed_thing.above

View file

@ -464,7 +464,6 @@ function mcl_mobs.register_arrow(name, def)
self.object:set_velocity(dir * vel)
self._puncher = puncher
end,
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},
automatic_face_movement_dir = def.rotate
and (def.rotate - (math.pi / 180)) or false,

View file

@ -1,5 +1,5 @@
name = mcl_mobs
author = PilzAdam
description = Adds a mob API for mods to add animals or monsters, etc.
depends = mcl_particles, mcl_luck
depends = mcl_particles, mcl_luck, vl_projectile
optional_depends = mcl_weather, mcl_explosions, mcl_hunger, mcl_worlds, invisibility, lucky_block, cmi, doc_identifier, mcl_armor, mcl_portals, mcl_experience, mcl_sculk

View file

@ -388,6 +388,7 @@ local arrow_entity = {
if data._owner then
vl_projectile_data.owner = minetest.get_player_by_name(data._owner)
end
self._vl_projectile = vl_projectile_data
if data.shootername then
local shooter = minetest.get_player_by_name(data.shootername)

View file

@ -1,6 +1,5 @@
local S = minetest.get_translator(minetest.get_current_modname())
local GRAVITY = 9.81
local BOW_DURABILITY = 385
-- Charging time in microseconds

View file

@ -6,7 +6,6 @@ mcl_bows_s = {}
-- ["mcl_bows:arrow"] = "mcl_bows:arrow_entity",
-- }
local GRAVITY = 9.81
local BOW_DURABILITY = 385
-- Charging time in microseconds

View file

@ -6,9 +6,6 @@ local vector = vector
-- Time in seconds after which a stuck arrow is deleted
local ROCKET_TIMEOUT = 1
-- Time after which stuck arrow is rechecked for being stuck
local STUCK_RECHECK_TIME = 0.1
local YAW_OFFSET = -math.pi/2
local function damage_explosion(self, damagemulitplier)
@ -249,39 +246,6 @@ minetest.register_craftitem("mcl_bows:rocket", {
end,
})
-- Destroy arrow entity self at pos and drops it as an item
local function spawn_item(self, pos)
if not minetest.is_creative_enabled("") then
local item = minetest.add_item(pos, "mcl_bows:rocket")
item:set_velocity({x=0, y=0, z=0})
item:set_yaw(self.object:get_yaw())
end
mcl_burning.extinguish(self.object)
self.object:remove()
end
local function damage_particles(pos, is_critical)
if is_critical then
minetest.add_particlespawner({
amount = 15,
time = 0.1,
minpos = {x=pos.x-0.5, y=pos.y-0.5, z=pos.z-0.5},
maxpos = {x=pos.x+0.5, y=pos.y+0.5, z=pos.z+0.5},
minvel = {x=-0.1, y=-0.1, z=-0.1},
maxvel = {x=0.1, y=0.1, z=0.1},
minacc = {x=0, y=0, z=0},
maxacc = {x=0, y=0, z=0},
minexptime = 1,
maxexptime = 2,
minsize = 1.5,
maxsize = 1.5,
collisiondetection = false,
vertical = false,
texture = "mcl_particles_crit.png^[colorize:#bc7a57:127",
})
end
end
local arrow_entity = mcl_bows.arrow_entity
local rocket_entity = table.copy(arrow_entity)
table.update(rocket_entity,{

View file

@ -213,7 +213,7 @@ function mcl_potions.register_lingering(name, descr, color, def)
},
on_collide_with_entity = on_collide,
on_collide_with_solid = function(self, pos, node)
if mod_target and n == "mcl_target:target_off" then
if mod_target and node.name == "mcl_target:target_off" then
mcl_target.hit(vector.round(pos), 0.4) --4 redstone ticks
end

View file

@ -182,7 +182,7 @@ function mcl_potions.register_splash(name, descr, color, def)
on_collide_with_solid = function(self, pos, node)
splash_effects(self, pos, def, 4)
if node.name == "mcl_target:target_off" then
if mod_target and node.name == "mcl_target:target_off" then
mcl_target.hit(pos, 0.4) -- 4 redstone ticks
end
end,

View file

@ -1,7 +1,5 @@
local S = minetest.get_translator(minetest.get_current_modname())
local mod_target = minetest.get_modpath("mcl_target")
local math = math
local YAW_OFFSET = -math.pi/2
@ -15,10 +13,6 @@ end
local how_to_shoot = minetest.registered_items["mcl_bows:arrow"]._doc_items_usagehelp
local mod_awards = minetest.get_modpath("awards") and minetest.get_modpath("mcl_achievements")
local mod_button = minetest.get_modpath("mesecons_button")
local enable_pvp = minetest.settings:get_bool("enable_pvp")
local arrow_longdesc = minetest.registered_items["mcl_bows:arrow"]._doc_items_longdesc or ""
local arrow_tt = minetest.registered_items["mcl_bows:arrow"]._tt_help or ""

View file

@ -1,5 +1,4 @@
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
local S = minetest.get_translator(modname)
local mod_target = minetest.get_modpath("mcl_target")

View file

@ -65,6 +65,7 @@ vl_projectile.register("mcl_throwing:ender_pearl_entity",{
local dir = vector.zero()
local v = self.object:get_velocity()
local node_def = minetest.registered_nodes[node.name]
if node_def and node_def.walkable then
local vc = vector.normalize(v) -- vector for calculating
-- Node is walkable, we have to find a place somewhere outside of that node

View file

@ -6,8 +6,6 @@ local modpath = minetest.get_modpath(minetest.get_current_modname())
-- Snowballs and other throwable items
--
local GRAVITY = tonumber(minetest.settings:get("movement_gravity"))
local entity_mapping = {}
local velocities = {}

View file

@ -1,5 +1,4 @@
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
local S = minetest.get_translator(modname)
local how_to_throw = S("Use the punch key to throw.")

View file

@ -284,7 +284,7 @@ local function handle_entity_collision(self, entity_def, projectile_def, object)
-- Light things on fire
if mcl_burning.is_burning(self.object) then
mcl_burning.set_on_fire(obj, 5)
mcl_burning.set_on_fire(self.object, 5)
end
end
@ -320,8 +320,6 @@ end
function mod.collides_with_entities(self, dtime, entity_def, projectile_def)
local pos = self.object:get_pos()
local hit = nil
local objects = minetest.get_objects_inside_radius(pos, 1.5)
for i = 1,#objects do
local object = objects[i]

View file

@ -1,3 +1,3 @@
name = vl_projectile
depends = mcl_util
optional_depends = vl_physics
optional_depends = vl_physics, mcl_shields, mcl_burning