source-sdk-2013-mapbase/sp/src/game/shared/basegrenade_shared.h

166 lines
4.3 KiB
C
Raw Normal View History

2013-12-02 19:31:46 -08:00
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef BASEGRENADE_SHARED_H
#define BASEGRENADE_SHARED_H
#ifdef _WIN32
#pragma once
#endif
#include "baseprojectile.h"
2013-12-02 19:31:46 -08:00
#if defined( CLIENT_DLL )
#define CBaseGrenade C_BaseGrenade
#include "c_basecombatcharacter.h"
#else
#include "basecombatcharacter.h"
#include "player_pickup.h"
#endif
#define BASEGRENADE_EXPLOSION_VOLUME 1024
class CTakeDamageInfo;
#if !defined( CLIENT_DLL )
class CBaseGrenade : public CBaseProjectile, public CDefaultPlayerPickupVPhysics
2013-12-02 19:31:46 -08:00
#else
class CBaseGrenade : public CBaseProjectile
2013-12-02 19:31:46 -08:00
#endif
{
DECLARE_CLASS( CBaseGrenade, CBaseProjectile );
2013-12-02 19:31:46 -08:00
public:
CBaseGrenade(void);
~CBaseGrenade(void);
DECLARE_PREDICTABLE();
DECLARE_NETWORKCLASS();
#if !defined( CLIENT_DLL )
DECLARE_DATADESC();
#endif
Mapbase v6.0 - Fixed path_track paths saving as pointers instead of handles - Fixed player animations not falling to base class correctly - Fixed logic_externaldata creating garbage in trailing spaces - Added "SetHandModelSkin" input - Added unique colors for various types of console message, adjustable via convars - Added the ability to use map-specific weapon scripts - Added a way to display (placeholder) text entirely from Faceposer scenes - Added "autobreak" keyvalue to game_text, which automatically breaks long text into different lines - Added the ability to change a game_text's font (very limited) - Added LightToggle input to point_spotlight - Added Enable/DisableSprites on npc_manhack - Added ai_goal_police behavior from metrocops to Combine soldiers and citizens - Added func_precipitation particle rain systems from the Alien Swarm SDK - Added new func_precipitation spawnflags for controlling behavior in particle types - Added "mapbase_version" cvar which shows the version of Mapbase a mod might be running on - Fixed an oversight with NPC crouch activities which was causing npc_metropolice to stop firing in standoffs - Added toggleable patches to npc_combine AI which make soldiers less likely to stand around without shooting or rush to melee when not needed - Added key for custom logo font on env_credits scripts - Added SetSpeed and SetPushDir inputs for trigger_push - Added a bunch of I/O/KV to func_fish_pool to allow for more control over the fish - Added OnLostEnemy/Player support for npc_combine_camera - Added enhanced save/restore for the Response System, toggleable via convar - Added a convar which allows users to disable weapon autoswitching when picking up ammo - Split VScript base script into its own file - Added VScript descriptions for NPC squads and the manager class which handles them - Moved several classes, functions, etc. to the VScript library itself for future usage in other projects, like VBSP - Added VScript to VBSP with basic map file interfacing - Made some VScript documentation more clear due to deprecation of online documentation - Added VScript "hook" registration, creating a standardized system which shows up in script_help documentation - Added VScript-driven custom weapons - Added clientside VScript scopes - Added a bunch of weapon-related VScript functions - Split a bunch of cluttered VScript stuff into different files - Added VScript functions for "following" entities/bonemerging - Added VScript functions for grenades - Added a few more VScript trigger functions - Added OnDeath hook for VScript - Fixed documentation for aliased functions in VScript - Fixed $bumpmask not working on SDK_LightmappedGeneric - Made vertex blend swapping in Hammer use a constant instead of a combo (makes it easier to compile the shader, especially for $bumpmask's sake) - Fixed brush phong, etc. causing SDK_WorldVertexTransition to stop working - Added limited support for $envmapmask in the bumpmapping shader - Fixed more issues with parallax corrected cubemaps and instances - Made instance variable recursion consistent with VMFII
2020-11-26 02:26:55 +00:00
#ifdef MAPBASE_VSCRIPT
DECLARE_ENT_SCRIPTDESC();
#endif
2013-12-02 19:31:46 -08:00
virtual void Precache( void );
virtual void Explode( trace_t *pTrace, int bitsDamageType );
void Smoke( void );
void BounceTouch( CBaseEntity *pOther );
void SlideTouch( CBaseEntity *pOther );
void ExplodeTouch( CBaseEntity *pOther );
void DangerSoundThink( void );
void PreDetonate( void );
virtual void Detonate( void );
void DetonateUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void TumbleThink( void );
virtual Vector GetBlastForce() { return vec3_origin; }
virtual void BounceSound( void );
virtual int BloodColor( void ) { return DONT_BLEED; }
virtual void Event_Killed( const CTakeDamageInfo &info );
virtual float GetShakeAmplitude( void ) { return 25.0; }
virtual float GetShakeRadius( void ) { return 750.0; }
// Damage accessors.
virtual float GetDamage()
{
return m_flDamage;
}
virtual float GetDamageRadius()
{
return m_DmgRadius;
}
virtual void SetDamage(float flDamage)
{
m_flDamage = flDamage;
}
virtual void SetDamageRadius(float flDamageRadius)
{
m_DmgRadius = flDamageRadius;
}
// Bounce sound accessors.
void SetBounceSound( const char *pszBounceSound )
{
m_iszBounceSound = MAKE_STRING( pszBounceSound );
}
CBaseCombatCharacter *GetThrower( void );
void SetThrower( CBaseCombatCharacter *pThrower );
CBaseEntity *GetOriginalThrower() { return m_hOriginalThrower; }
Mapbase v6.0 - Fixed path_track paths saving as pointers instead of handles - Fixed player animations not falling to base class correctly - Fixed logic_externaldata creating garbage in trailing spaces - Added "SetHandModelSkin" input - Added unique colors for various types of console message, adjustable via convars - Added the ability to use map-specific weapon scripts - Added a way to display (placeholder) text entirely from Faceposer scenes - Added "autobreak" keyvalue to game_text, which automatically breaks long text into different lines - Added the ability to change a game_text's font (very limited) - Added LightToggle input to point_spotlight - Added Enable/DisableSprites on npc_manhack - Added ai_goal_police behavior from metrocops to Combine soldiers and citizens - Added func_precipitation particle rain systems from the Alien Swarm SDK - Added new func_precipitation spawnflags for controlling behavior in particle types - Added "mapbase_version" cvar which shows the version of Mapbase a mod might be running on - Fixed an oversight with NPC crouch activities which was causing npc_metropolice to stop firing in standoffs - Added toggleable patches to npc_combine AI which make soldiers less likely to stand around without shooting or rush to melee when not needed - Added key for custom logo font on env_credits scripts - Added SetSpeed and SetPushDir inputs for trigger_push - Added a bunch of I/O/KV to func_fish_pool to allow for more control over the fish - Added OnLostEnemy/Player support for npc_combine_camera - Added enhanced save/restore for the Response System, toggleable via convar - Added a convar which allows users to disable weapon autoswitching when picking up ammo - Split VScript base script into its own file - Added VScript descriptions for NPC squads and the manager class which handles them - Moved several classes, functions, etc. to the VScript library itself for future usage in other projects, like VBSP - Added VScript to VBSP with basic map file interfacing - Made some VScript documentation more clear due to deprecation of online documentation - Added VScript "hook" registration, creating a standardized system which shows up in script_help documentation - Added VScript-driven custom weapons - Added clientside VScript scopes - Added a bunch of weapon-related VScript functions - Split a bunch of cluttered VScript stuff into different files - Added VScript functions for "following" entities/bonemerging - Added VScript functions for grenades - Added a few more VScript trigger functions - Added OnDeath hook for VScript - Fixed documentation for aliased functions in VScript - Fixed $bumpmask not working on SDK_LightmappedGeneric - Made vertex blend swapping in Hammer use a constant instead of a combo (makes it easier to compile the shader, especially for $bumpmask's sake) - Fixed brush phong, etc. causing SDK_WorldVertexTransition to stop working - Added limited support for $envmapmask in the bumpmapping shader - Fixed more issues with parallax corrected cubemaps and instances - Made instance variable recursion consistent with VMFII
2020-11-26 02:26:55 +00:00
#ifdef MAPBASE_VSCRIPT
HSCRIPT ScriptGetThrower( void ) { return ToHScript( GetThrower() ); }
void ScriptSetThrower( HSCRIPT hThrower ) { SetThrower( ToEnt(hThrower) ? ToEnt(hThrower)->MyCombatCharacterPointer() : NULL ); }
HSCRIPT ScriptGetOriginalThrower() { return ToHScript( GetOriginalThrower() ); }
float GetDetonateTime() { return m_flDetonateTime; }
bool HasWarnedAI() { return m_bHasWarnedAI; }
bool IsLive() { return m_bIsLive; }
float GetWarnAITime() { return m_flWarnAITime; }
#endif
2013-12-02 19:31:46 -08:00
#if !defined( CLIENT_DLL )
// Allow +USE pickup
int ObjectCaps()
{
return (BaseClass::ObjectCaps() | FCAP_IMPULSE_USE | FCAP_USE_IN_RADIUS);
}
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
#ifdef MAPBASE
void InputSetDamage( inputdata_t &inputdata );
void InputDetonate( inputdata_t &inputdata );
#endif
2013-12-02 19:31:46 -08:00
#endif
public:
IMPLEMENT_NETWORK_VAR_FOR_DERIVED( m_vecVelocity );
IMPLEMENT_NETWORK_VAR_FOR_DERIVED( m_fFlags );
bool m_bHasWarnedAI; // whether or not this grenade has issued its DANGER sound to the world sound list yet.
CNetworkVar( bool, m_bIsLive ); // Is this grenade live, or can it be picked up?
CNetworkVar( float, m_DmgRadius ); // How far do I do damage?
CNetworkVar( float, m_flNextAttack );
float m_flDetonateTime; // Time at which to detonate.
float m_flWarnAITime; // Time at which to warn the AI
protected:
CNetworkVar( float, m_flDamage ); // Damage to inflict.
string_t m_iszBounceSound; // The sound to make on bouncing. If not NULL, overrides the BounceSound() function.
#if defined(MAPBASE) && !defined(CLIENT_DLL)
COutputEvent m_OnDetonate;
COutputVector m_OnDetonate_OutPosition;
#endif
2013-12-02 19:31:46 -08:00
private:
CNetworkHandle( CBaseEntity, m_hThrower ); // Who threw this grenade
EHANDLE m_hOriginalThrower; // Who was the original thrower of this grenade
CBaseGrenade( const CBaseGrenade & ); // not defined, not accessible
};
#endif // BASEGRENADE_SHARED_H