#pragma once

#include "rivet.h"

struct DemolitionPack__ModelResource :
	public Rivet::ModelResource
{
	Scalar
		blastRadiusSquared;
	Scalar
		detectionRadiusSquared;
	Scalar
		fuseTime;
	Scalar
		concussiveForce;
};

//##########################################################################
//####################    DemolitionPack       #############################
//##########################################################################

class DemolitionPack :
	public Rivet
{
public:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
	static Derivation *GetClassDerivations();
	static SharedData DefaultData;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Attribute Support
//
#if 0
public:
	enum {
		NextAttributeID
	};

private:
	static const IndexEntry AttributePointers[];

protected:
	//static AttributeIndexSet	AttributeIndex
	static AttributeIndexSet& GetAttributeIndex();
#endif

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Model support
//
public:
	enum {
		DefaultFlags = Mover::DefaultFlags|NoCollisionTestFlag
	};

	typedef void (DemolitionPack::*Performance)(Scalar time_slice);

	void
		SetPerformance(Performance performance)
			{
				Check(this);
				activePerformance = (Simulation::Performance)performance;
			}

	void
		MoveAndHunt(Scalar time_slice);
	void
		Hunt(Scalar time_slice);
	void
		ProcessCollision(
			Scalar time_slice,
			BoxedSolidCollision &collision,
			const Point3D &old_position,
			Damage *damage
		);

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Construction and Destruction
//
public:
	typedef DemolitionPack__ModelResource ModelResource;
	 
	static DemolitionPack*
		Make(MakeMessage *creation_message);

	DemolitionPack(
		MakeMessage *creation_message,
		SharedData &virtual_data = DefaultData
	);
	~DemolitionPack();

	Logical
  	TestInstance() const;

static int
	CreateModelResource(
		ResourceFile *resource_file,
		const char *model_name,
		NotationFile *model_file,
		const ResourceDirectories *directories,
		ModelResource* model = NULL
	);

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Local Data
//
public:
	Scalar
		blastRadiusSquared;

	Scalar
		detectionRadiusSquared;

	Scalar
		fuseTime;

	Scalar
		concussiveForce;
};
