mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-07-06 01:15:03 +03:00
- Added custom map compile tools (vbsp, vvis, vrad) - Changed blink fix (shouldn't change anything in-game) - Added auto-completion to ent_create, npc_create, and the main set of "npc_" debug commands - Added ent_create_aimed, an ent_create equivalent of npc_create_aimed - Made hunters start using the "vs. player" melee animation against smaller NPCs that look weird with the "stab" attack - Added "explosion_sparks" convar, which fixes broken code for giving explosions sparks (disabled by default because of how different it looks) - Made interaction code capable of being dispatched on any entity, not just combat characters - Added npc_barnacle_ignite convar, which lets barnacles be ignited by flares - Fixed certain NPCs getting out of the way for the player when they hate them - Fixed auto-generated "speak" scene responses not using parameters that work on real VCDs - Made "stop_on_nonidle" capable of being used in any mod, not just HL2 episodic mods - Selectable color for ragdoll boogie/point_ragdollboogie - Fixed PickupWeaponInstant not firing weapon pickup outputs - Introduced inputs and keyvalues for "lerping" to math_counter_advanced - Fixed ClearConsole on logic_console - logic_convar should now detect client convars correctly - New NormalizeAngles input on math_vector - logic_modelinfo LookupActivity input - math_generate fixed and expanded to be more like math_counter - Added a WIP game logging system for playtesting maps - Introduced logic_playerinfo, an entity that can read a player's name or ID - Fixed some new filters not working with filter_multi - Added radius pickup spawnflag to func_physbox - Added "Preserve name" spawnflag to weapons - Added cc_achievement_debug message for when an achievement doesn't exist - Made npc_combine_s not speak while in logic_choreographed_scenes - Fixed zombie torsos/legs/headcrabs not being serverside when zombie is forced to server ragdoll - Expanded and cleaned up npc_zombie_custom - Fixed func_commandredirects not cleaning up correctly and sometimes crashing the game - Allowed player squad commands to go through +USE-held objects - Added a bunch of I/O/KV to trigger_waterydeath for better configuration - Changed save comment system to use the chapter title from world properties, and the ability to suppress the title popup that normally results from it - Adjusted game_convar_mod for MP planning - Removed the func_precipitation custom particle/splash code for now, as it was causing problems - Fixed env_global_light not accepting lightcolor - Added "Additional Buttons" to player_speedmod - Added save comment to RPC - Added env_projectedtexture attenuation - Added scripted_sequence OnPreIdleSequence - Added OnCrab to zombies - Added skill_changed game event (may need further testing) - Added a fix for viewmodels flipping under extreme FOV values - Added code that allows mappers to change the skin on shotgunners without it usually flipping back randomly - Fixed a very, very, very major shader performance issue - New SetAbsOrigin/Angles inputs on all entities, analogous to SetLocalOrigin/Angles - Code improvements for I/O involving angles - logic_entity_position improvements/fixes, including a new OutAngles output that outputs the angles on position calls - Alternate collision/player avoidance spawnflag obsoletion enforcement disabled - Enable/DisableHazardLights inputs on the EP2 jalopy, equivalent to the keyvalue - Miscellaneous shader formatting adjustments and fixes - Fixed AlwaysDrawOff on env_projectedtexture not being a valid input
260 lines
7.4 KiB
C++
260 lines
7.4 KiB
C++
//========= Copyright Valve Corporation, All rights reserved. ============//
|
|
//
|
|
// Purpose:
|
|
//
|
|
//=============================================================================//
|
|
|
|
#ifndef NPC_BARNACLE_H
|
|
#define NPC_BARNACLE_H
|
|
#ifdef _WIN32
|
|
#pragma once
|
|
#endif
|
|
|
|
#include "ai_basenpc.h"
|
|
#include "studio.h"
|
|
#include "physics_prop_ragdoll.h"
|
|
|
|
class CNPC_Barnacle;
|
|
|
|
|
|
#define BARNACLE_PULL_SPEED 80
|
|
#define BARNACLE_KILL_VICTIM_DELAY 5 // how many seconds after pulling prey in to gib them.
|
|
|
|
// Tongue
|
|
#define BARNACLE_TONGUE_POINTS 8
|
|
|
|
#define BARNACLE_MIN_PULL_TIME 3.0f
|
|
|
|
#define NUM_BARNACLE_GIBS 4
|
|
|
|
#define SF_BARNACLE_CHEAP_DEATH (1<<16) // Don't spawn as many gibs
|
|
#define SF_BARNACLE_AMBUSH (1<<17) // Start with tongue retracted and wait for input.
|
|
|
|
// when true, causes the barnacle's visible tongue to offset
|
|
// from the physical one when pulling the player.
|
|
#define BARNACLE_USE_TONGUE_OFFSET 1
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: This is the entity we place at the top & bottom of the tongue, to create a vphysics spring
|
|
//-----------------------------------------------------------------------------
|
|
class CBarnacleTongueTip : public CBaseAnimating
|
|
{
|
|
DECLARE_CLASS( CBarnacleTongueTip, CBaseAnimating );
|
|
|
|
public:
|
|
DECLARE_DATADESC();
|
|
|
|
virtual void Spawn( void );
|
|
virtual void Precache( void );
|
|
virtual void UpdateOnRemove( );
|
|
virtual void VPhysicsUpdate( IPhysicsObject *pPhysics );
|
|
|
|
virtual int UpdateTransmitState( void );
|
|
bool CreateSpring( CBaseAnimating *pTongueRoot );
|
|
static CBarnacleTongueTip *CreateTongueTip( CNPC_Barnacle *pBarnacle, CBaseAnimating *pTongueRoot, const Vector &vecOrigin, const QAngle &vecAngles );
|
|
static CBarnacleTongueTip *CreateTongueRoot( const Vector &vecOrigin, const QAngle &vecAngles );
|
|
|
|
IPhysicsSpring *m_pSpring;
|
|
|
|
private:
|
|
CHandle<CNPC_Barnacle> m_hBarnacle;
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose:
|
|
//-----------------------------------------------------------------------------
|
|
class CNPC_Barnacle : public CAI_BaseNPC
|
|
{
|
|
DECLARE_CLASS( CNPC_Barnacle, CAI_BaseNPC );
|
|
public:
|
|
DECLARE_SERVERCLASS();
|
|
DECLARE_DATADESC();
|
|
|
|
CNPC_Barnacle();
|
|
~CNPC_Barnacle();
|
|
|
|
void Spawn( void );
|
|
virtual void Activate( void );
|
|
void Precache( void );
|
|
Class_T Classify ( void );
|
|
virtual void ComputeWorldSpaceSurroundingBox( Vector *pVecWorldMins, Vector *pVecWorldMaxs );
|
|
virtual void HandleAnimEvent( animevent_t *pEvent );
|
|
void Event_Killed( const CTakeDamageInfo &info );
|
|
int OnTakeDamage_Alive( const CTakeDamageInfo &info );
|
|
void PlayerHasIlluminatedNPC( CBasePlayer *pPlayer, float flDot );
|
|
|
|
#ifdef MAPBASE
|
|
bool AllowedToIgnite( void );
|
|
#endif
|
|
|
|
// The tongue's vphysics updated
|
|
void OnTongueTipUpdated();
|
|
|
|
private:
|
|
void SetAltitude( float flAltitude );
|
|
void SpawnDeathGibs( void );
|
|
|
|
void InitTonguePosition( void );
|
|
CBaseEntity* TongueTouchEnt ( float *pflLength );
|
|
void BarnacleThink ( void );
|
|
void SwallowPrey( void );
|
|
void WaitTillDead ( void );
|
|
void AttachTongueToTarget( CBaseEntity *pTouchEnt, Vector vecGrabPos );
|
|
CRagdollProp *AttachRagdollToTongue( CBaseAnimating *pAnimating );
|
|
void RemoveRagdoll( bool bDestroyRagdoll );
|
|
void LostPrey( bool bRemoveRagdoll );
|
|
void BitePrey( void );
|
|
|
|
// Updates the tongue length
|
|
void UpdateTongue( void );
|
|
|
|
// Spit out the prey; add physics force!
|
|
void SpitPrey();
|
|
|
|
void SprayBlood();
|
|
|
|
// What type of enemy do we have?
|
|
bool IsEnemyAPlayer();
|
|
bool IsEnemyARagdoll();
|
|
bool IsEnemyAPhysicsObject();
|
|
bool IsEnemyAnNPC();
|
|
|
|
bool CanPickup( CBaseCombatCharacter *pBCC );
|
|
|
|
// Allows the ragdoll to settle before biting it
|
|
bool WaitForRagdollToSettle( float flBiteZOffset );
|
|
|
|
// Allows the physics prop to settle before biting it
|
|
bool WaitForPhysicsObjectToSettle( float flBiteZOffset );
|
|
|
|
// Play a scream right before biting
|
|
void PlayLiftingScream( float flBiteZOffset );
|
|
|
|
// Pulls the prey upward toward the mouth
|
|
void PullEnemyTorwardsMouth( bool bAdjustEnemyOrigin );
|
|
|
|
// Lift the prey stuck to our tongue up towards our mouth
|
|
void LiftPrey( void );
|
|
void LiftPlayer( float flBiteZOffset );
|
|
void LiftRagdoll( float flBiteZOffset );
|
|
void LiftPhysicsObject( float flBiteZOffset );
|
|
void LiftNPC( float flBiteZOffset );
|
|
|
|
void UpdatePlayerConstraint( void );
|
|
|
|
void InputDropTongue( inputdata_t &inputdata );
|
|
void InputSetDropTongueSpeed( inputdata_t &inputdata );
|
|
void DropTongue( void );
|
|
|
|
|
|
|
|
#ifdef MAPBASE
|
|
|
|
#if HL2_EPISODIC
|
|
/// Decides whether something should poison the barnacle upon eating
|
|
static bool IsPoisonous( CBaseEntity *pVictim );
|
|
const impactdamagetable_t &GetPhysicsImpactDamageTable( void );
|
|
#endif
|
|
|
|
// Regular HL2 DLL has these now
|
|
void InputLetGo( inputdata_t &inputdata );
|
|
COutputEHANDLE m_OnGrab, m_OnRelease;
|
|
|
|
#else
|
|
#if HL2_EPISODIC
|
|
/// Decides whether something should poison the barnacle upon eating
|
|
static bool IsPoisonous( CBaseEntity *pVictim );
|
|
|
|
void InputLetGo( inputdata_t &inputdata );
|
|
COutputEHANDLE m_OnGrab, m_OnRelease;
|
|
|
|
const impactdamagetable_t &GetPhysicsImpactDamageTable( void );
|
|
#endif
|
|
#endif
|
|
|
|
CNetworkVar( float, m_flAltitude );
|
|
int m_cGibs; // barnacle loads up on gibs each time it kills something.
|
|
bool m_bLiftingPrey; // true when the prey's on the tongue and being lifted to the mouth
|
|
bool m_bSwallowingPrey; // if it's a human, true while the barnacle chews it and swallows it whole.
|
|
float m_flDigestFinish; // time at which we've finished digesting something we chewed
|
|
float m_flVictimHeight;
|
|
int m_iGrabbedBoneIndex;
|
|
bool m_bPlayedPullSound;
|
|
bool m_bPlayerWasStanding;
|
|
|
|
static const char *m_szGibNames[NUM_BARNACLE_GIBS];
|
|
|
|
// Tongue spline points
|
|
CNetworkVar( Vector, m_vecRoot );
|
|
CNetworkVar( Vector, m_vecTip );
|
|
CNetworkVar( Vector, m_vecTipDrawOffset );
|
|
|
|
// Tongue tip & root
|
|
CHandle<CBarnacleTongueTip> m_hTongueRoot;
|
|
CHandle<CBarnacleTongueTip> m_hTongueTip;
|
|
CHandle<CRagdollProp> m_hRagdoll;
|
|
matrix3x4_t m_pRagdollBones[MAXSTUDIOBONES];
|
|
IPhysicsConstraint *m_pConstraint;
|
|
float m_flRestUnitsAboveGround;
|
|
int m_nSpitAttachment;
|
|
EHANDLE m_hLastSpitEnemy;
|
|
int m_nShakeCount;
|
|
|
|
float m_flNextBloodTime;
|
|
#ifndef _XBOX
|
|
int m_nBloodColor;
|
|
#endif
|
|
Vector m_vecBloodPos;
|
|
|
|
float m_flBarnaclePullSpeed;
|
|
float m_flLocalTimer;
|
|
|
|
Vector m_vLastEnemyPos;
|
|
float m_flLastPull;
|
|
CSimpleSimTimer m_StuckTimer;
|
|
#ifndef MAPBASE // Handled by interactions now
|
|
bool m_bSwallowingBomb;
|
|
#endif
|
|
#ifdef HL2_EPISODIC
|
|
bool m_bSwallowingPoison;
|
|
#endif
|
|
|
|
#if BARNACLE_USE_TONGUE_OFFSET
|
|
// Static because only one barnacle can be holding the player
|
|
// at a time, and because it's not really a big deal if it
|
|
// resets to zero after reload.
|
|
const static Vector m_svPlayerHeldTipOffset;
|
|
#endif
|
|
|
|
DEFINE_CUSTOM_AI;
|
|
};
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// What type of enemy do we have?
|
|
//-----------------------------------------------------------------------------
|
|
inline bool CNPC_Barnacle::IsEnemyAPlayer()
|
|
{
|
|
return GetEnemy() && GetEnemy()->IsPlayer();
|
|
}
|
|
|
|
inline bool CNPC_Barnacle::IsEnemyARagdoll()
|
|
{
|
|
return m_hRagdoll != NULL;
|
|
}
|
|
|
|
inline bool CNPC_Barnacle::IsEnemyAPhysicsObject()
|
|
{
|
|
return !m_hRagdoll && GetEnemy() && !GetEnemy()->IsPlayer() &&
|
|
!GetEnemy()->MyNPCPointer() && (GetEnemy()->GetMoveType() == MOVETYPE_VPHYSICS);
|
|
}
|
|
|
|
inline bool CNPC_Barnacle::IsEnemyAnNPC()
|
|
{
|
|
return !IsEnemyARagdoll() && (GetEnemy()->MyNPCPointer() != NULL);
|
|
}
|
|
|
|
|
|
#endif // NPC_BARNACLE_H
|