[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()

View File

@ -3,7 +3,7 @@ local TS = 16 -- texture size
mcl_paintings.paintings = {
[1] = {
[1] = {
{ cx = 0, cy = 0 },
{ cx = 0, cy = 0 },
{ cx = TS, cy = 0 },
{ cx = 2*TS, cy = 0 },
{ cx = 3*TS, cy = 0 },
@ -26,7 +26,7 @@ mcl_paintings.paintings = {
{ cx = 0, cy = 4*TS },
{ cx = TS, cy = 4*TS },
},
[2] = {
[2] = {
{ cx = 0, cy = 8*TS },
{ cx = 2*TS, cy = 8*TS },
{ cx = 4*TS, cy = 8*TS },
@ -35,7 +35,7 @@ mcl_paintings.paintings = {
{ cx = 10*TS, cy = 8*TS },
},
[3] = 2,
[4] = {
[4] = {
{ cx = 0, cy = 6*TS },
},
},