ANIM = {
	STAND = 0x01, -- Any animation that isn't provided defaults to this. Make sure it exists!
	WALK = 0x02,
	JUMP = 0x03,
	LAND = 0x04, -- Jumping, but going down
	FALL = 0x05, -- Falling upside-down, for cutscenes
	SIT  = 0x06, -- Sitting with legs folded, for cutscenes
	UP   = 0x10, -- Looking up (combined with other animations)
	DOWN = 0x20 -- Looking down (combined with other animations)
}
ANIM.CHECK = ANIM.STAND|ANIM.DOWN -- Facing away from the camera, for checking NPCs
ANIM.DEAD = ANIM.FALL|ANIM.DOWN -- Face-down on the floor, for cutscenes

skins = {}

local function loadSkin(script)
	skins[script] = include("MyChar/"..script..".lua")
	skins[script].name = script
	if not skins[script]
		if not skins.default
			error("Failed to load default skin.")
		end
		skins[script] = {}
		for k,v in ipairs(skins.default)
			skins[script][k] = v
		end
		skins[script].name = script
		if CLIENT
			-- Only difference in most skins is a different sprite sheet.
			-- Only the CLIENT needs to deal with this, the server just sees it as an exact copy.
			skins[script].sheet = pbm.load("MyChar/"..script)
		end
		return
	end

	if CLIENT
		local function skinDefault(a,want,default) a[want] = a[want] or a[default] end
		-- With all these defaults, the absolute minimum recommended animations are:
		-- Stand, Walk, Jump, Back, Dead.
		local a = skins[script].anims
		skinDefault(a,ANIM.WALK|ANIM.UP,ANIM.WALK) -- Walking while looking up defaults to walk
		skinDefault(a,ANIM.JUMP|ANIM.UP,ANIM.JUMP) -- Jumping while looking up defaults to jump
		skinDefault(a,ANIM.JUMP|ANIM.DOWN,ANIM.JUMP) -- Jumping while looking down defaults to jump
		skinDefault(a,ANIM.LAND|ANIM.UP,ANIM.JUMP|ANIM.UP) -- Landing while looking up defaults to jumping while looking up
		skinDefault(a,ANIM.LAND|ANIM.DOWN,ANIM.JUMP|ANIM.DOWN) -- Landing while looking down defaults to jumping while looking down
		skinDefault(a,ANIM.FALL,ANIM.LAND|ANIM.DOWN) -- Falling on your head defaults to landing while looking down
		skinDefault(a,ANIM.DEAD,ANIM.SIT) -- Flopped on the floor defaults to sitting on the floor
		-- Everything else defaults to standing.
	end
end

loadSkin("default")
