Exemplo n.º 1
0
void Item::setRespawn( Event *ev )
{
	if ( ev->NumArgs() < 1 )
		return;
	
	setRespawn( ev->GetInteger( 1 ) );
}
Exemplo n.º 2
0
HoldableItem::HoldableItem()
{
	if ( LoadingSavegame )
	{
		// all data will be setup by the archive function
		return;
	}

	amount = 0;

	setRespawn( true );
	setRespawnTime( 60 );
}
Exemplo n.º 3
0
Rune::Rune()
{
	if ( LoadingSavegame )
	{
		// all data will be setup by the archive function
		return;
	}

	setRespawn( false );

	_mpItemType = MP_ITEM_TYPE_RUNE;

	_originalOriginSet = false;
}
Exemplo n.º 4
0
Powerup::Powerup()
{
	if ( LoadingSavegame )
	{
		// all data will be setup by the archive function
		return;
	}

	setRespawn( true );
	setRespawnTime( 60 );

	_mpItemType = MP_ITEM_TYPE_POWERUP;

	_timeLeft = 0.0f;
}
Exemplo n.º 5
0
void Item::SetOwner( Sentient *ent )
{
	assert( ent );
	if ( !ent )
	{
		// return to avoid any buggy behaviour
		return;
	}
	
	owner = ent;
	edict->s.parent = ent->entnum;
	setRespawn( false );
	
	setSolidType( SOLID_NOT );
	hideModel();
	CancelEventsOfType( EV_Touch );
	CancelEventsOfType( EV_Item_DropToFloor );
	CancelEventsOfType( EV_Remove );
	//	ItemPickup( ent );
}
Exemplo n.º 6
0
//--------------------------------------------------------------
// Name:		Item()
// Class:		Item
//
// Description:	Constructor
//
// Parameters:	None
//
// Returns:		None
//--------------------------------------------------------------
Item::Item()
{
	str fullname;
	animate = new Animate( this );

	if ( LoadingSavegame )
		return;

	setSolidType( SOLID_NOT );

	// Set default respawn behavior
	// Derived classes should use setRespawn
	// if they want to override the default behavior
	setRespawn( false );
	setRespawnTime( 20 );

	if ( multiplayerManager.inMultiplayer() )
	{
		setRespawn( true );
		edict->s.renderfx |= RF_FULLBRIGHT;
	}

	//
	// we want the bounds of this model auto-rotated
	//
	flags |= FlagRotatedbounds;

	//
	// set a minimum mins and maxs for the model
	//
	if ( size.length() < 10.0f )
	{
		mins = Vector(-10, -10, 0);
		maxs = Vector(10, 10, 20);
	}

	//
	// reset the mins and maxs to pickup the FlagRotatedbounds flag
	//
	setSize( mins, maxs );

	if ( !LoadingSavegame )
	{
		// Items can't be immediately dropped to floor, because they might
		// be on an entity that hasn't spawned yet.
		PostEvent( EV_Item_DropToFloor, EV_POSTSPAWN );
	}

	respondto = TRIGGER_PLAYERS;

	// items should collide with everything that the player does
	edict->clipmask	 = MASK_PLAYERSOLID;

	bot_inventory_index = 0; // INVENTORY_NONE
	item_index = 0;
	maximum_amount = 1.0f;
	playrespawn = false;

	// this is an item entity

	if ( g_gametype->integer == GT_SINGLE_PLAYER )
		edict->s.eType = ET_MODELANIM;
	else
		edict->s.eType = ET_ITEM;

	// Set our default skill level 
	_skillLevel = 1.0f;
	amount = 1.0f;
	no_remove = false;
	setName( "Unknown Item" );

	look_at_me = true;
	coolitem = false;
	coolitemforced = false;

	has_been_looked_at = false;

	_nextPickupTime = 0.0f;

	_mpItemType = MP_ITEM_TYPE_NORMAL;

	_iconIndex = -1;

	_missingSkin = 0;

	if ( !LoadingSavegame )
	{
		PostEvent( EV_Item_PostSpawn, EV_POSTSPAWN );
	}
}