Files
source-sdk-2013/sp/src/game/server/eventqueue.h
samisalreadytaken 599a93e7bc vscript additions and fixes:
baseanimating.h
baseanimating.cpp
   - Added CBaseAnimating::SequenceDuration (ScriptSequenceDuration)
   - Added CBaseAnimating::GetPlaybackRate
   - Added CBaseAnimating::SetPlaybackRate
   - Added CBaseAnimating::GetCycle
   - Added CBaseAnimating::SetCycle

triggers.h
triggers.cpp
   - Fixed CTriggerCamera::ScriptSetFov setting player FOV while disabled
   - Added CBaseTrigger::Enable
   - Added CBaseTrigger::Disable
   - Added CBaseTrigger::TouchTest
   - Added CBaseTrigger::IsTouching (ScriptIsTouching)

vscript_server.nut
vscript_server.cpp
   - Added CEntities::FindByClassnameWithinBox
   - Added ::SendToConsoleServer
   - Added ::CancelEntityIOEvent
   - Added ::GetEntityIOEventTimeLeft
   - Moved ScriptDispatchParticleEffect to shared code

eventqueue.h
cbase.h
cbase.cpp
   - Set entity I/O con output colour
   - Added (CEventQueue::CancelEventsByInput)
   - Added (CEventQueue::RemoveEvent)
   - Added (CEventQueue::GetTimeLeft)

baseentity.h
baseentity.cpp
   - Added CBaseEntity::SetTransmitState
   - Added CBaseEntity::GetTransmitState
   - Added CBaseEntity::AcceptInput (ScriptAcceptInput)
   - Added CBaseEntity::FireOutput (ScriptFireOutput)
   - Added CBaseEntity::GetMaxOutputDelay
   - Added CBaseEntity::CancelEventsByInput
   - Added player_use event on InputUse
   - Fixed InputKill on players

ivscript.h
vscript_squirrel.cpp
   - Added IScriptVM::ArrayAppend
   - Fixed buffer overflow crash
   - Increased print buffer to 2048 from 256
   - Set vscript print output colour

vscript_funcs_shared.cpp
   - Added CNetMsgScriptHelper
     (CScriptGameEventListener)
   - Added ::ListenToGameEvent
   - Added ::StopListeningToGameEvent
   - Added ::StopListeningToAllGameEvents
   - Added ::FireGameEvent
   - Added ::FireGameEventLocal
     (CScriptSaveRestoreUtil)
   - Added ::SaveTable
   - Added ::RestoreTable
   - Added ::ClearSavedTable
   - Added callbacks ::OnSave, ::OnRestore
     (CScriptReadWriteFile)
   - Added ::StringToFile
   - Added ::FileToString
   - Added GlobalSys::GetCommandLine
   - Added GlobalSys::CommandLineCheck
   - Added GlobalSys::CommandLineCheckStr
   - Added GlobalSys::CommandLineCheckFloat
   - Added GlobalSys::CommandLineCheckInt
   - Added ::GetCPUUsage
   - Added ::NXPrint
   - Added ::Msg (ScriptMsg)
   - Removed misplaced condition checks
   - Fixed ScriptEntitiesInBox, *AtPoint, *InSphere

logic_eventlistener.cpp
   - Removed redundant dev msg

gamestringpool.cpp
   - Fixed string pool dump sort
2020-10-27 02:22:18 +03:00

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
intptr_t AddEvent( const char *target, const char *action, variant_t Value, float fireDelay, CBaseEntity *pActivator, CBaseEntity *pCaller, int outputID = 0 );
intptr_t 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( intptr_t event );
float GetTimeLeft( intptr_t 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