fix formatting || compass_image local

This commit is contained in:
chmodsayshello 2022-04-26 12:49:34 +00:00
parent 5c8f94d620
commit 0c2562b88c
1 changed files with 10 additions and 12 deletions

View File

@ -9,13 +9,11 @@ local compass_frames = 32
-- Timer for random compass spinning
local random_timer = 0
local random_timer_trigger = 0.5 -- random compass spinning tick in seconds. Incr ease if there are performance problems
local random_timer_trigger = 0.5 -- random compass spinning tick in seconds. Increase if there are performance problems
local random_frame = math.random(0, compass_frames-1)
function mcl_compass.get_compass_image(pos, dir, itemstack)
local compass_image = ""
-- Compasses do not work in certain zones
local lodestone_pos = minetest.string_to_pos(itemstack:get_meta():get_string("pointsto"))
if lodestone_pos then --lodestone meta present
@ -80,15 +78,15 @@ minetest.register_globalstep(function(dtime)
local pos = player:get_pos()
for j,stack in pairs(player:get_inventory():get_list("main")) do
compass_image = mcl_compass.get_compass_image(pos, player:get_look_horizontal(), stack)
if minetest.get_item_group(stack:get_name(), "compass") ~= 0 and
minetest.get_item_group(stack:get_name(), "compass")-1 ~= compass_image then
local itemname = "mcl_compass:"..compass_image
stack:set_name(itemname)
player:get_inventory():set_stack("main", j, stack)
end
if minetest.get_item_group(stack:get_name(), "compass") ~= 0 then
local compass_image = mcl_compass.get_compass_image(pos, player:get_look_horizontal(), stack)
if minetest.get_item_group(stack:get_name(), "compass")-1 ~= compass_image then
local itemname = "mcl_compass:"..compass_image
stack:set_name(itemname)
player:get_inventory():set_stack("main", j, stack)
end
end
end
end
end