nc_skins-cd2025/api_rescale.lua
Aaron Suen 2ba34c454e Initial skins mod based on NCC server mod
- Currently all skins must be pre-loaded into the mod texture
  folder at startup time; server restart required to change a
  player skin.
- Currently has partial support for the wieldhand (uninjured only)
- Some configuration added (adjustable rescaling, optional priv)
2021-07-27 07:01:18 -04:00

20 lines
635 B
Lua

-- LUALOCALS < ---------------------------------------------------------
local minetest, tonumber
= minetest, tonumber
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
local api = _G[modname]
local function scalecore(skin, suff)
local scale = tonumber(minetest.settings:get(modname .. "_" .. suff))
if not (scale and scale > 0) then return skin end
return skin .. "^[resize:" .. scale .. "x" .. scale
end
function api.rescale(skin)
if not skin then return skin end
skin = scalecore(skin, "downscale")
skin = scalecore(skin, "upscale")
return skin
end