Files
source-sdk-2013/sp/src/game/server/hl2/npc_manhack.h
Blixibon eb014cce6c 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

297 lines
8.5 KiB
C++

//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef NPC_MANHACK_H
#define NPC_MANHACK_H
#ifdef _WIN32
#pragma once
#endif
#include "ai_basenpc_physicsflyer.h"
#include "Sprite.h"
#include "SpriteTrail.h"
#include "player_pickup.h"
// Start with the engine off and folded up.
#define SF_MANHACK_PACKED_UP (1 << 16)
#define SF_MANHACK_NO_DAMAGE_EFFECTS (1 << 17)
#define SF_MANHACK_USE_AIR_NODES (1 << 18)
#define SF_MANHACK_CARRIED (1 << 19) // Being carried by a metrocop
#define SF_MANHACK_NO_DANGER_SOUNDS (1 << 20)
enum
{
MANHACK_EYE_STATE_IDLE,
MANHACK_EYE_STATE_CHASE,
MANHACK_EYE_STATE_CHARGE,
MANHACK_EYE_STATE_STUNNED,
};
//-----------------------------------------------------------------------------
// Attachment points.
//-----------------------------------------------------------------------------
#define MANHACK_GIB_HEALTH 30
#define MANHACK_INACTIVE_HEALTH 25
#define MANHACK_MAX_SPEED 500
#define MANHACK_BURST_SPEED 650
#define MANHACK_NPC_BURST_SPEED 800
//-----------------------------------------------------------------------------
// Movement parameters.
//-----------------------------------------------------------------------------
#define MANHACK_WAYPOINT_DISTANCE 25 // Distance from waypoint that counts as arrival.
class CSprite;
class SmokeTrail;
class CSoundPatch;
//-----------------------------------------------------------------------------
// Manhack
//-----------------------------------------------------------------------------
class CNPC_Manhack : public CNPCBaseInteractive<CAI_BasePhysicsFlyingBot>, public CDefaultPlayerPickupVPhysics
{
DECLARE_CLASS( CNPC_Manhack, CNPCBaseInteractive<CAI_BasePhysicsFlyingBot> );
DECLARE_SERVERCLASS();
public:
CNPC_Manhack();
~CNPC_Manhack();
Class_T Classify(void);
bool CorpseGib( const CTakeDamageInfo &info );
void Event_Dying(void);
void Event_Killed( const CTakeDamageInfo &info );
int OnTakeDamage_Alive( const CTakeDamageInfo &info );
int OnTakeDamage_Dying( const CTakeDamageInfo &info );
void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr, CDmgAccumulator *pAccumulator );
void TranslateNavGoal( CBaseEntity *pEnemy, Vector &chasePosition );
float GetDefaultNavGoalTolerance();
void UpdateOnRemove( void );
void KillSprites( float flDelay );
void OnStateChange( NPC_STATE OldState, NPC_STATE NewState );
virtual bool CreateVPhysics( void );
virtual void DeathSound( const CTakeDamageInfo &info );
virtual bool ShouldGib( const CTakeDamageInfo &info );
Activity NPC_TranslateActivity( Activity baseAct );
virtual int TranslateSchedule( int scheduleType );
int MeleeAttack1Conditions ( float flDot, float flDist );
void HandleAnimEvent( animevent_t *pEvent );
bool OverrideMove(float flInterval);
void MoveToTarget(float flInterval, const Vector &MoveTarget);
void MoveExecute_Alive(float flInterval);
void MoveExecute_Dead(float flInterval);
int MoveCollisionMask(void);
void TurnHeadRandomly( float flInterval );
void CrashTouch( CBaseEntity *pOther );
void StartEngine( bool fStartSound );
virtual Vector BodyTarget( const Vector &posSrc, bool bNoisy = true ) { return WorldSpaceCenter(); }
virtual float GetHeadTurnRate( void ) { return 45.0f; } // Degrees per second
void CheckCollisions(float flInterval);
virtual void GatherEnemyConditions( CBaseEntity *pEnemy );
void PlayFlySound(void);
virtual void StopLoopingSounds(void);
void Precache(void);
void RunTask( const Task_t *pTask );
void Spawn(void);
void Activate();
void StartTask( const Task_t *pTask );
void BladesInit();
void SoundInit( void );
void StartEye( void );
bool HandleInteraction(int interactionType, void* data, CBaseCombatCharacter* sourceEnt);
void PostNPCInit( void );
void GatherConditions();
void PrescheduleThink( void );
void SpinBlades(float flInterval);
void Slice( CBaseEntity *pHitEntity, float flInterval, trace_t &tr );
void Bump( CBaseEntity *pHitEntity, float flInterval, trace_t &tr );
void Splash( const Vector &vecSplashPos );
float ManhackMaxSpeed( void );
virtual void VPhysicsShadowCollision( int index, gamevcollisionevent_t *pEvent );
void VPhysicsCollision( int index, gamevcollisionevent_t *pEvent );
void HitPhysicsObject( CBaseEntity *pOther );
virtual void ClampMotorForces( Vector &linear, AngularImpulse &angular );
unsigned int PhysicsSolidMaskForEntity( void ) const;
// Create smoke trail!
void CreateSmokeTrail();
void DestroySmokeTrail();
void Ignite( float flFlameLifetime, bool bNPCOnly, float flSize, bool bCalledByLevelDesigner ) { return; }
void InputDisableSwarm( inputdata_t &inputdata );
void InputUnpack( inputdata_t &inputdata );
#ifdef MAPBASE
void InputEnableSprites( inputdata_t &inputdata );
void InputDisableSprites( inputdata_t &inputdata );
#endif
// CDefaultPlayerPickupVPhysics
virtual void OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t reason );
virtual void OnPhysGunDrop( CBasePlayer *pPhysGunUser, PhysGunDrop_t Reason );
CBasePlayer *HasPhysicsAttacker( float dt );
float GetMaxEnginePower();
// INPCInteractive Functions
#ifdef MAPBASE
virtual bool CanInteractWith( CAI_BaseNPC *pUser );
#else
virtual bool CanInteractWith( CAI_BaseNPC *pUser ) { return false; } // Disabled for now (sjb)
#endif
virtual bool HasBeenInteractedWith() { return m_bHackedByAlyx; }
virtual void NotifyInteraction( CAI_BaseNPC *pUser )
{
// Turn the sprites off and on again so their colors will change.
KillSprites(0.0f);
m_bHackedByAlyx = true;
StartEye();
#ifdef MAPBASE
m_OnHacked.FireOutput(pUser, this);
#endif
}
virtual void InputPowerdown( inputdata_t &inputdata )
{
m_iHealth = 0;
}
DEFINE_CUSTOM_AI;
DECLARE_DATADESC();
private:
bool IsInEffectiveTargetZone( CBaseEntity *pTarget );
void MaintainGroundHeight( void );
void StartBurst( const Vector &vecDirection );
void StopBurst( bool bInterruptSchedule = false );
void UpdatePanels( void );
void SetEyeState( int state );
void ShowHostile( bool hostile = true );
bool IsFlyingActivity( Activity baseAct );
// Computes the slice bounce velocity
void ComputeSliceBounceVelocity( CBaseEntity *pHitEntity, trace_t &tr );
// Take damage from being thrown by a physcannon
void TakeDamageFromPhyscannon( CBasePlayer *pPlayer );
// Take damage from a vehicle:
void TakeDamageFromVehicle( int index, gamevcollisionevent_t *pEvent );
// Take damage from physics impacts
void TakeDamageFromPhysicsImpact( int index, gamevcollisionevent_t *pEvent );
// Are we being held by the physcannon?
bool IsHeldByPhyscannon( );
void StartLoitering( const Vector &vecLoiterPosition );
void StopLoitering() { m_vecLoiterPosition = vec3_invalid; m_fTimeNextLoiterPulse = gpGlobals->curtime; }
bool IsLoitering() { return m_vecLoiterPosition != vec3_invalid; }
void Loiter();
//
// Movement variables.
//
Vector m_vForceVelocity; // Someone forced me to move
Vector m_vTargetBanking;
Vector m_vForceMoveTarget; // Will fly here
float m_fForceMoveTime; // If time is less than this
Vector m_vSwarmMoveTarget; // Will fly here
float m_fSwarmMoveTime; // If time is less than this
float m_fEnginePowerScale; // scale all thrust by this amount (usually 1.0!)
float m_flNextEngineSoundTime;
float m_flEngineStallTime;
float m_flNextBurstTime;
float m_flBurstDuration;
Vector m_vecBurstDirection;
float m_flWaterSuspendTime;
int m_nLastSpinSound;
// physics influence
CHandle<CBasePlayer> m_hPhysicsAttacker;
float m_flLastPhysicsInfluenceTime;
// Death
float m_fSparkTime;
float m_fSmokeTime;
bool m_bDirtyPitch; // indicates whether we want the sound pitch updated.(sjb)
bool m_bShowingHostile;
bool m_bBladesActive;
bool m_bIgnoreClipbrushes;
float m_flBladeSpeed;
CSprite *m_pEyeGlow;
CSprite *m_pLightGlow;
CHandle<SmokeTrail> m_hSmokeTrail;
#ifdef MAPBASE
EHANDLE m_hPrevOwner;
bool m_bNoSprites;
#endif
int m_iPanel1;
int m_iPanel2;
int m_iPanel3;
int m_iPanel4;
int m_nLastWaterLevel;
bool m_bDoSwarmBehavior;
bool m_bGib;
bool m_bHeld;
bool m_bHackedByAlyx;
Vector m_vecLoiterPosition;
float m_fTimeNextLoiterPulse;
float m_flBumpSuppressTime;
CNetworkVar( int, m_nEnginePitch1 );
CNetworkVar( int, m_nEnginePitch2 );
CNetworkVar( float, m_flEnginePitch1Time );
CNetworkVar( float, m_flEnginePitch2Time );
};
#endif //NPC_MANHACK_H