mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-06 04:05:32 +03:00
bf182e1c5d
baseentity_shared.cpp baseentity.cpp c_baseentity.h c_baseentity.cpp c_world.h - Fixed critical ScriptSetContextThink bugs - Added C_BaseEntity::SetContextThink (ScriptSetContextThink) - Added C_BaseEntity::SetSize - Added C_BaseEntity::SetModel - Added C_BaseEntity::Destroy baseentity.h baseentity.cpp - Removed duplicate functions ScriptSetSize and ScriptUtilRemove player.cpp - Moved player script instance registration before player_spawn event vscript_server.cpp - Added CEntities::FindByClassNearestFacing vscript_funcs_shared.cpp - Added GetFrameCount - Added IntervalPerTick vscript_singletons.cpp - Better game event descriptors for CScriptGameEventListener - Added ::effects (CEffectsScriptHelper) - Added ::Convars (CScriptConvarAccessor) vscript_shared.cpp - Fixed clientside entity printing in script VM mapbase_con_groups.h mapbase_con_groups.cpp - Improved performance by changing string comparisons to direct array access vscript_bindings_base.h vscript_bindings_base.cpp - Added CScriptKeyValues::SubKeysToTable vscript_bindings_math.cpp - Added ::SimpleSplineRemapVal - Added ::SimpleSplineRemapValClamped - Added ::Bias - Added ::Gain - Added ::SmoothCurve - Added ::SmoothCurve_Tweak - Added ::ExponentialDecay vscript_squirrel.nut - Added ::Lerp - Added ::FLerp - Added ::SimpleSpline vscript_squirrel.cpp - Added Vector::_unm - Added Vector::Set - Added Vector::Add - Added Vector::Subtract - Added Vector::Multiply - Added Vector::Divide - Added Vector::DistTo - Added Vector::DistToSqr - Added Vector::IsEqualTo - Added Vector::WithinAABox - Added Vector::FromKVString - Changed vector print syntax
95 lines
2.9 KiB
C++
95 lines
2.9 KiB
C++
//========= Copyright Valve Corporation, All rights reserved. ============//
|
|
//
|
|
// Purpose: A global class that holds a prioritized queue of entity I/O events.
|
|
// Events can be posted with a nonzero delay, which determines how long
|
|
// they are held before being dispatched to their recipients.
|
|
//
|
|
// The queue is serviced once per server frame.
|
|
//
|
|
//=============================================================================//
|
|
|
|
#ifndef EVENTQUEUE_H
|
|
#define EVENTQUEUE_H
|
|
#ifdef _WIN32
|
|
#pragma once
|
|
#endif
|
|
|
|
#include "mempool.h"
|
|
|
|
struct EventQueuePrioritizedEvent_t
|
|
{
|
|
float m_flFireTime;
|
|
string_t m_iTarget;
|
|
string_t m_iTargetInput;
|
|
EHANDLE m_pActivator;
|
|
EHANDLE m_pCaller;
|
|
int m_iOutputID;
|
|
EHANDLE m_pEntTarget; // a pointer to the entity to target; overrides m_iTarget
|
|
|
|
variant_t m_VariantValue; // variable-type parameter
|
|
|
|
EventQueuePrioritizedEvent_t *m_pNext;
|
|
EventQueuePrioritizedEvent_t *m_pPrev;
|
|
|
|
DECLARE_SIMPLE_DATADESC();
|
|
|
|
DECLARE_FIXEDSIZE_ALLOCATOR( PrioritizedEvent_t );
|
|
};
|
|
|
|
class CEventQueue
|
|
{
|
|
public:
|
|
// pushes an event into the queue, targeting a string name (m_iName), or directly by a pointer
|
|
#ifdef MAPBASE_VSCRIPT
|
|
int AddEvent( const char *target, const char *action, variant_t Value, float fireDelay, CBaseEntity *pActivator, CBaseEntity *pCaller, int outputID = 0 );
|
|
int AddEvent( CBaseEntity *target, const char *action, variant_t Value, float fireDelay, CBaseEntity *pActivator, CBaseEntity *pCaller, int outputID = 0 );
|
|
#else
|
|
void AddEvent( const char *target, const char *action, variant_t Value, float fireDelay, CBaseEntity *pActivator, CBaseEntity *pCaller, int outputID = 0 );
|
|
void AddEvent( CBaseEntity *target, const char *action, variant_t Value, float fireDelay, CBaseEntity *pActivator, CBaseEntity *pCaller, int outputID = 0 );
|
|
#endif
|
|
void AddEvent( CBaseEntity *target, const char *action, float fireDelay, CBaseEntity *pActivator, CBaseEntity *pCaller, int outputID = 0 );
|
|
|
|
void CancelEvents( CBaseEntity *pCaller );
|
|
void CancelEventOn( CBaseEntity *pTarget, const char *sInputName );
|
|
bool HasEventPending( CBaseEntity *pTarget, const char *sInputName );
|
|
|
|
// services the queue, firing off any events who's time hath come
|
|
void ServiceEvents( void );
|
|
|
|
// debugging
|
|
void ValidateQueue( void );
|
|
|
|
// serialization
|
|
int Save( ISave &save );
|
|
int Restore( IRestore &restore );
|
|
|
|
CEventQueue();
|
|
~CEventQueue();
|
|
|
|
void Init( void );
|
|
void Clear( void ); // resets the list
|
|
|
|
void Dump( void );
|
|
|
|
#ifdef MAPBASE_VSCRIPT
|
|
void CancelEventsByInput( CBaseEntity *pTarget, const char *szInput );
|
|
bool RemoveEvent( int event );
|
|
float GetTimeLeft( int event );
|
|
#endif // MAPBASE_VSCRIPT
|
|
|
|
private:
|
|
|
|
void AddEvent( EventQueuePrioritizedEvent_t *event );
|
|
void RemoveEvent( EventQueuePrioritizedEvent_t *pe );
|
|
|
|
DECLARE_SIMPLE_DATADESC();
|
|
EventQueuePrioritizedEvent_t m_Events;
|
|
int m_iListCount;
|
|
};
|
|
|
|
extern CEventQueue g_EventQueue;
|
|
|
|
|
|
#endif // EVENTQUEUE_H
|
|
|