1
0
Fork 0

[mcl_item_entity] fix warnings

This commit is contained in:
AFCMS 2021-05-25 00:43:42 +02:00
parent 8286fd2a4d
commit fddaacdeae
2 changed files with 10 additions and 17 deletions

View File

@ -426,13 +426,9 @@ minetest.register_entity(":__builtin:item", {
if itemtable then if itemtable then
itemname = stack:to_table().name itemname = stack:to_table().name
end end
local item_texture = nil
local item_type = ""
local glow local glow
local def = minetest.registered_items[itemname] local def = minetest.registered_items[itemname]
if def then if def then
item_texture = def.inventory_image
item_type = def.type
description = def.description description = def.description
glow = def.light_source glow = def.light_source
end end

View File

@ -1,3 +1,5 @@
local vector = vector
function mcl_minecarts:get_sign(z) function mcl_minecarts:get_sign(z)
if z == 0 then if z == 0 then
return 0 return 0
@ -38,11 +40,9 @@ end
function mcl_minecarts:check_front_up_down(pos, dir_, check_down, railtype) function mcl_minecarts:check_front_up_down(pos, dir_, check_down, railtype)
local dir = vector.new(dir_) local dir = vector.new(dir_)
local cur = nil
-- Front -- Front
dir.y = 0 dir.y = 0
cur = vector.add(pos, dir) local cur = vector.add(pos, dir)
if mcl_minecarts:is_rail(cur, railtype) then if mcl_minecarts:is_rail(cur, railtype) then
return dir return dir
end end
@ -65,9 +65,9 @@ end
function mcl_minecarts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype) function mcl_minecarts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
local pos = vector.round(pos_) local pos = vector.round(pos_)
local cur = nil local cur
local left_check, right_check = true, true local left_check, right_check = true, true
-- Check left and right -- Check left and right
local left = {x=0, y=0, z=0} local left = {x=0, y=0, z=0}
local right = {x=0, y=0, z=0} local right = {x=0, y=0, z=0}
@ -78,7 +78,7 @@ function mcl_minecarts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
left.z = dir.x left.z = dir.x
right.z = -dir.x right.z = -dir.x
end end
if ctrl then if ctrl then
if old_switch == 1 then if old_switch == 1 then
left_check = false left_check = false
@ -100,13 +100,13 @@ function mcl_minecarts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
right_check = true right_check = true
end end
end end
-- Normal -- Normal
cur = mcl_minecarts:check_front_up_down(pos, dir, true, railtype) cur = mcl_minecarts:check_front_up_down(pos, dir, true, railtype)
if cur then if cur then
return cur return cur
end end
-- Left, if not already checked -- Left, if not already checked
if left_check then if left_check then
cur = mcl_minecarts:check_front_up_down(pos, left, false, railtype) cur = mcl_minecarts:check_front_up_down(pos, left, false, railtype)
@ -114,7 +114,7 @@ function mcl_minecarts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
return cur return cur
end end
end end
-- Right, if not already checked -- Right, if not already checked
if right_check then if right_check then
cur = mcl_minecarts:check_front_up_down(pos, right, false, railtype) cur = mcl_minecarts:check_front_up_down(pos, right, false, railtype)
@ -122,7 +122,6 @@ function mcl_minecarts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
return cur return cur
end end
end end
-- Backwards -- Backwards
if not old_switch then if not old_switch then
cur = mcl_minecarts:check_front_up_down(pos, { cur = mcl_minecarts:check_front_up_down(pos, {
@ -134,7 +133,5 @@ function mcl_minecarts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
return cur return cur
end end
end end
return {x=0, y=0, z=0} return {x=0, y=0, z=0}
end end