57 lines
1.2 KiB
C++
57 lines
1.2 KiB
C++
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||
|
// All rights reserved.
|
||
|
//
|
||
|
// This source is may not be distributed and/or modified without
|
||
|
// expressly written permission by Ritual Entertainment, Inc.
|
||
|
//
|
||
|
// DESCRIPTION:
|
||
|
// Silencer Powerup
|
||
|
|
||
|
#include "silencer.h"
|
||
|
#include "sentient.h"
|
||
|
|
||
|
CLASS_DECLARATION( InventoryItem, Silencer, "powerups_silencer" )
|
||
|
|
||
|
ResponseDef Silencer::Responses[] =
|
||
|
{
|
||
|
{ &EV_Trigger_Effect, ( Response )Silencer::PickupSilencer },
|
||
|
{ NULL, NULL }
|
||
|
};
|
||
|
|
||
|
Silencer::Silencer
|
||
|
(
|
||
|
)
|
||
|
|
||
|
{
|
||
|
setModel( "silencer.def" );
|
||
|
icon_name = "i_silencer";
|
||
|
icon_index = gi.imageindex( icon_name.c_str() );
|
||
|
Set( 1 );
|
||
|
}
|
||
|
|
||
|
Silencer::~Silencer()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void Silencer::PickupSilencer
|
||
|
(
|
||
|
Event *ev
|
||
|
)
|
||
|
|
||
|
{
|
||
|
Sentient *sen;
|
||
|
Entity *other;
|
||
|
|
||
|
other = ev->GetEntity( 1 );
|
||
|
if ( ItemPickup( other ) )
|
||
|
{
|
||
|
if ( other->isSubclassOf( Sentient ) )
|
||
|
{
|
||
|
sen = ( Sentient * )other;
|
||
|
// Make the user lower and raise the weapon so that the silencer will attach
|
||
|
sen->UpdateSilencedWeapons();
|
||
|
|
||
|
sen->flags |= FL_SILENCER;
|
||
|
}
|
||
|
}
|
||
|
}
|