[mcl_paintings] fix warnings

This commit is contained in:
AFCMS 2021-05-23 15:13:44 +02:00
parent 335405f131
commit b6dd8d5c44
2 changed files with 14 additions and 12 deletions

View File

@ -4,9 +4,11 @@ dofile(minetest.get_modpath(minetest.get_current_modname()).."/paintings.lua")
local S = minetest.get_translator("mcl_paintings")
local math = math
local wood = "[combine:16x16:-192,0=mcl_paintings_paintings.png"
local is_protected = function(pos, name)
local function is_protected(pos, name)
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return true
@ -17,7 +19,7 @@ end
-- Check if there's a painting for provided painting size.
-- If yes, returns the arguments.
-- If not, returns the next smaller available painting.
local shrink_painting = function(x, y)
local function shrink_painting(x, y)
if x > 4 or y > 4 then
return nil
end
@ -43,7 +45,7 @@ local shrink_painting = function(x, y)
end
end
local get_painting = function(x, y, motive)
local function get_painting(x, y, motive)
local painting = mcl_paintings.paintings[y] and mcl_paintings.paintings[y][x] and mcl_paintings.paintings[y][x][motive]
if not painting then
return nil
@ -53,7 +55,7 @@ local get_painting = function(x, y, motive)
return "[combine:"..sx.."x"..sy..":"..px..","..py.."=mcl_paintings_paintings.png"
end
local get_random_painting = function(x, y)
local function get_random_painting(x, y)
if not mcl_paintings.paintings[y] or not mcl_paintings.paintings[y][x] then
return nil
end
@ -65,7 +67,7 @@ local get_random_painting = function(x, y)
return get_painting(x, y, r), r
end
local size_to_minmax = function(size)
--[[local function size_to_minmax(size)
local min, max
if size == 2 then
min = -0.5
@ -81,13 +83,13 @@ local size_to_minmax = function(size)
max = 0.5
end
return min, max
end
end]]
local size_to_minmax_entity = function(size)
local function size_to_minmax_entity(size)
return -size/2, size/2
end
local set_entity = function(object)
local function set_entity(object)
local ent = object:get_luaentity()
local wallm = ent._facing
local xsize = ent._xsize
@ -169,7 +171,7 @@ minetest.register_entity("mcl_paintings:painting", {
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
-- Drop as item on punch
if puncher and puncher:is_player() then
kname = puncher:get_player_name()
local kname = puncher:get_player_name()
local pos = self._pos
if not pos then
pos = self.object:get_pos()