diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/ai_dynamiclink.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/ai_dynamiclink.h')
| -rw-r--r-- | game/server/ai_dynamiclink.h | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/game/server/ai_dynamiclink.h b/game/server/ai_dynamiclink.h new file mode 100644 index 0000000..cefec66 --- /dev/null +++ b/game/server/ai_dynamiclink.h @@ -0,0 +1,125 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: A link that can be turned on and off. Unlike normal links +// dyanimc links must be entities so they and receive messages. +// They update the state of the actual links. Allows us to save +// a lot of memory by not making all links into entities +// +// $Workfile: $ +// $Date: $ +// +//----------------------------------------------------------------------------- +// $Log: $ +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef AI_DYNAMICLINK_H +#define AI_DYNAMICLINK_H +#pragma once + +enum DynamicLinkState_t +{ + LINK_OFF = 0, + LINK_ON = 1, +}; + +class CAI_Link; + +//============================================================================= +// >> CAI_DynanicLink +//============================================================================= +class CAI_DynamicLink : public CServerOnlyEntity +{ + DECLARE_CLASS( CAI_DynamicLink, CServerOnlyEntity ); +public: + static void InitDynamicLinks(void); + static void ResetDynamicLinks(void); + static void PurgeDynamicLinks(void); + static void GenerateControllerLinks(); + + static bool gm_bInitialized; + + static CAI_DynamicLink* GetDynamicLink(int nSrcID, int nDstID); + + static CAI_DynamicLink* m_pAllDynamicLinks; // A linked list of all dynamic link + CAI_DynamicLink* m_pNextDynamicLink; // The next dynamic link in the list of dynamic links + + int m_nSrcEditID; // the node that 'owns' this link + int m_nDestEditID; // the node on the other end of the link. + + int m_nSrcID; // the node that 'owns' this link + int m_nDestID; // the node on the other end of the link. + DynamicLinkState_t m_nLinkState; // + string_t m_strAllowUse; // Only this entity name or classname may use the link + bool m_bInvertAllow; // Instead of only allowing the m_strAllowUse entity, exclude only it + + bool m_bFixedUpIds; + bool m_bNotSaved; + int m_nLinkType; + + void SetLinkState( void ); + bool IsLinkValid( void ); + + CAI_Link * FindLink(); + + int ObjectCaps(); + + // ---------------- + // Inputs + // ---------------- + void InputTurnOn( inputdata_t &inputdata ); + void InputTurnOff( inputdata_t &inputdata ); + DECLARE_DATADESC(); + + CAI_DynamicLink(); + ~CAI_DynamicLink(); +}; + +//============================================================================= +// >> CAI_DynanicLinkVolume +//============================================================================= +class CAI_DynamicLinkController : public CServerOnlyEntity +{ + DECLARE_CLASS( CAI_DynamicLinkController, CServerOnlyEntity ); +public: + void GenerateLinksFromVolume(); + + // ---------------- + // Inputs + // ---------------- + void InputTurnOn( inputdata_t &inputdata ); + void InputTurnOff( inputdata_t &inputdata ); + void InputSetAllowed( inputdata_t &inputdata ); + void InputSetInvert( inputdata_t &inputdata ); + + CUtlVector< CHandle<CAI_DynamicLink> > m_ControlledLinks; + DynamicLinkState_t m_nLinkState; + string_t m_strAllowUse; // Only this entity name or classname may use the link + bool m_bInvertAllow; // Instead of only allowing the m_strAllowUse entity, exclude only it + bool m_bUseAirLinkRadius; + + DECLARE_DATADESC(); +}; + +//============================================================================= +//============================================================================= +class CAI_RadialLinkController : public CBaseEntity +{ + DECLARE_CLASS( CAI_RadialLinkController, CBaseEntity ); + +public: + void Spawn(); + void Activate(); + void PollMotionThink(); + void ModifyNodeLinks( bool bMakeStale ); + +public: + float m_flRadius; + Vector m_vecAtRestOrigin; + bool m_bAtRest; + + DECLARE_DATADESC(); +}; + +#endif // AI_DYNAMICLINK_H
\ No newline at end of file |