#include <game/server/gamecontroller.hpp>
#include <game/server/entity.hpp>

enum {
	FB_MAX_GOALS = 2,
	FB_MAX_BALLS = 2
};

class GAMECONTROLLER_FB : public GAMECONTROLLER
{
public:
	class BALL *balls[FB_MAX_BALLS];
	vec2 goal_pos[FB_MAX_GOALS];
	int num_goals;
	
	GAMECONTROLLER_FB ();
	virtual void tick ();
	
	virtual bool on_entity (int index, vec2 pos);
	virtual int on_character_death (class PLAYER *victim, class PLAYER *killer, int weapon);
	virtual bool handle_goal (BALL *b, int goal);
	virtual void on_player_disconnect (const PLAYER *const p);
};

class BALL : public ENTITY
{
public:
	static const int phys_size = 14;
	CHARACTER *carrier;
	PLAYER *last_carrier;
	int last_carrier_team;
	vec2 vel;
	vec2 stand_pos;
	
	int team;
	int at_stand;
	int drop_tick;
	int grab_tick;
	int idle_tick;
	
	BALL (int _team, vec2 _pos);

	virtual void reset ();
	virtual void snap (int snapping_client);
};
