#ifndef __FLASHLIGHT_H__
#define __FLASHLIGHT_H__

#include "g_local.h"
#include "inventoryitem.h"

class Flashlight : public InventoryItem
{
private:
	EntityPtr lightent;
	EntityPtr lightent2;

public:
	int lighton;

	CLASS_PROTOTYPE( Flashlight );

	Flashlight();
	~Flashlight();
	virtual void    Use( Event *ev );
	void            EmitLight( Event *ev );
	virtual qboolean Pickupable( Entity *other );
	virtual Item *ItemPickup( Entity *other );
	virtual void Pickup( Event *ev );

	virtual void    Archive( Archiver &arc );
	virtual void    Unarchive( Archiver &arc );
};

inline void Flashlight::Archive( Archiver &arc )
{
	InventoryItem::Archive( arc );

	arc.WriteSafePointer( lightent );
	arc.WriteSafePointer( lightent2 );
	arc.WriteInteger( lighton );
}

inline void Flashlight::Unarchive( Archiver &arc )
{
	InventoryItem::Unarchive( arc );

	arc.ReadSafePointer( &lightent );
	arc.ReadSafePointer( &lightent2 );
	lighton = arc.ReadInteger();
}

#endif
