mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2025-01-07 15:49:32 +01:00
Fix all luacheck findings except two empty if branches, two references to math.round and the *_physics variables from optional mods (each guarded by modpath checks)
This commit is contained in:
parent
24ca1b20a8
commit
cc125d8eac
8 changed files with 8 additions and 20 deletions
|
@ -463,7 +463,7 @@ local function register_minecart_craftitem(itemstring, def)
|
|||
stack_max = 1,
|
||||
_mcl_dropper_on_drop = dropper_place_minecart,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if not pointed_thing.type == "node" then
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ local function hopper_take_item(self, dtime)
|
|||
if objs then
|
||||
mcl_log("there is an itemstring. Number of objs: ".. #objs)
|
||||
|
||||
for k, v in pairs(objs) do
|
||||
for _, v in pairs(objs) do
|
||||
local ent = v:get_luaentity()
|
||||
|
||||
if ent and not ent._removed and ent.itemstring and ent.itemstring ~= "" then
|
||||
|
@ -87,7 +87,6 @@ local function hopper_take_item(self, dtime)
|
|||
mcl_log("We have more than enough space. Now holds: " .. new_stack_size)
|
||||
|
||||
inv:set_stack("main", i, stack)
|
||||
items_remaining = 0
|
||||
|
||||
ent.object:get_luaentity().itemstring = ""
|
||||
ent.object:remove()
|
||||
|
|
|
@ -212,8 +212,8 @@ local function get_rail_connections(pos, opt)
|
|||
|
||||
-- Check for sloped rail one block down
|
||||
local below_neighbor = vector.offset(neighbor, 0, -1, 0)
|
||||
local node = force_get_node(below_neighbor)
|
||||
local nodedef = minetest.registered_nodes[node.name]
|
||||
node = force_get_node(below_neighbor)
|
||||
nodedef = minetest.registered_nodes[node.name]
|
||||
if mcl_minecarts.is_rail(below_neighbor) and ( legacy or get_path(nodedef, "_mcl_minecarts", "get_next_dir" ) ) then
|
||||
local rev_dir = vector.direction(dir, vector.zero())
|
||||
if ignore_neighbor_connections or is_connection(below_neighbor, rev_dir) then
|
||||
|
@ -229,7 +229,7 @@ local function apply_connection_rules(node, nodedef, pos, rules, connections)
|
|||
-- Select the best allowed connection
|
||||
local rule = nil
|
||||
local score = 0
|
||||
for k,r in pairs(rules) do
|
||||
for _,r in pairs(rules) do
|
||||
if check_connection_rule(pos, connections, r) then
|
||||
if r.score > score then
|
||||
--print("Best rule so far is "..dump(r))
|
||||
|
@ -351,7 +351,6 @@ local function update_rail_connections(pos, opt)
|
|||
if opt and opt.convert_neighbors == false then return end
|
||||
|
||||
-- Check if the open end of this rail runs into a corner or a tee and convert that node into a tee or a cross
|
||||
local neighbors = {}
|
||||
for i=1,#CONNECTIONS do
|
||||
local dir = CONNECTIONS[i]
|
||||
if is_connection(pos, dir) then
|
||||
|
@ -367,11 +366,6 @@ local function update_rail_connections(pos, opt)
|
|||
end
|
||||
mod.update_rail_connections = update_rail_connections
|
||||
|
||||
local north = vector.new(0,0,1)
|
||||
local south = vector.new(0,0,-1)
|
||||
local east = vector.new(1,0,0)
|
||||
local west = vector.new(-1,0,0)
|
||||
|
||||
local function is_ahead_slope(pos, dir)
|
||||
local ahead = vector.add(pos,dir)
|
||||
if mcl_minecarts.is_rail(ahead) then return false end
|
||||
|
@ -518,7 +512,7 @@ function mod.reverse_cart_direction(staticdata)
|
|||
staticdata.distance = 1 - (staticdata.distance or 0)
|
||||
|
||||
-- recalculate direction
|
||||
local next_dir,_ = mod:get_rail_direction(staticdata.connected_at, next_dir)
|
||||
next_dir = mod:get_rail_direction(staticdata.connected_at, next_dir)
|
||||
staticdata.dir = next_dir
|
||||
end
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ local function handle_cart_enter_exit(staticdata, pos, next_dir, event)
|
|||
if luaentity then
|
||||
local hook = luaentity["_mcl_minecarts_"..event]
|
||||
if hook then hook(luaentity, pos, staticdata) end
|
||||
else
|
||||
--else
|
||||
--minetest.log("warning", "TODO: change _mcl_minecarts_"..event.." calling so it is not dependent on the existence of a luaentity")
|
||||
end
|
||||
end
|
||||
|
@ -145,7 +145,7 @@ local function handle_cart_collision(cart1_staticdata, prev_pos, next_dir)
|
|||
local carts = minetest.deserialize(meta:get_string("_mcl_minecarts_carts")) or {}
|
||||
local cart_uuid = nil
|
||||
local dirty = false
|
||||
for uuid,v in pairs(carts) do
|
||||
for uuid,_ in pairs(carts) do
|
||||
-- Clean up dead carts
|
||||
local data = get_cart_data(uuid)
|
||||
if not data or not data.connected_at then
|
||||
|
@ -160,7 +160,6 @@ local function handle_cart_collision(cart1_staticdata, prev_pos, next_dir)
|
|||
meta:set_string("_mcl_minecarts_carts",minetest.serialize(carts))
|
||||
end
|
||||
|
||||
meta = minetest.get_meta(vector.add(pos,next_dir))
|
||||
if not cart_uuid then return end
|
||||
|
||||
-- Don't collide with the train car in front of you
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local mod = mcl_minecarts
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local mod = mcl_minecarts
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local mod = mcl_minecarts
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local mod = mcl_minecarts
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
|
|
Loading…
Reference in a new issue