Module:ClockPhase

local p = {} function p.base( f )

local arg = require( 'Module:ProcessArgs' ).merge( true )[1] or 0

local num = tonumber(arg)

if type(num) == "number" then

local pos = (num % 24000) / 24000 return f:expandTemplate{ title = 'Sprite', args = { image = 'ClockSprite.png', sheetsize = 256, size = 16, pos = math.floor((pos * 64 + 48) % 64) + 1, scale = 2, }   }

else

local keys = { day = 1000, noon = 6000, sunset = 12000, night = 13000, midnight = 18000, sunrise = 23000 }

local word = string.lower(arg)

if keys[word] ~= nil then num = (keys[word] % 24000) / 24000 else num = 0 end

return f:expandTemplate{ title = 'Sprite', args = { image = 'ClockSprite.png', sheetsize = 256, size = 16, pos = math.floor((num * 64 + 48) % 64) + 1, scale = 2, }   }

end end return p