-- battery meter.
-- this is absolutely impossible to get working custom.
-- and since it's me, you know it's REALLY impossible.
-- also consider that the pump pro dev team didn't bother doing it either.

local Player = ...
assert( Player );

local proxy = SCREENMAN:GetTopScreen():GetLifeMeter(Player);

local batMeter = Def.ActorFrame{
	Condition=GAMESTATE:IsSideJoined(Player) or GAMESTATE:IsPlayerEnabled(Player) or GAMESTATE:IsDemonstration();
	OnCommand=cmd(runcommandsonleaves,cmd(addy,-40;linear,0.2;addy,40));
	OffCommand=cmd(runcommandsonleaves,cmd(linear,1;diffusealpha,0));
	
	LoadActor( THEME:GetPathB("","_frame 3x3"), "_square blackinset transparent normal", 295, 10);
	
	-- // battery meter start //
	--[[
	theory on how this works:
	
	1) Proxy the lives.
	2) ???
	3) Profit from not blowing your brains out over reduplicating code
	]]
	LoadFont("_frutiger lt std 55 roman 24px")..{
		InitCommand=cmd(diffuse,PlayerColor(Player);diffusebottomedge,PlayerMidColor(Player));
		OnCommand=cmd(playcommand,"Update");
		UpdateCommand=function(self)
			self:settext( proxy:GetLife() );
		end;
		JudgmentMessageCommand=cmd(playcommand,"Update");
		LifeChangedMessageCommand=cmd(playcommand,"Update");
	};
};

return batMeter;