mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-23 20:09:45 +03:00
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
This commit is contained in:
@@ -302,7 +302,11 @@ void CBaseEntityOutput::FireOutput(variant_t Value, CBaseEntity *pActivator, CBa
|
||||
ev->m_flDelay,
|
||||
STRING(ev->m_iParameter) );
|
||||
|
||||
#ifdef MAPBASE
|
||||
ConColorMsg( 2, Color(CON_COLOR_DEV_VERBOSE), "%s", szBuffer );
|
||||
#else
|
||||
DevMsg( 2, "%s", szBuffer );
|
||||
#endif
|
||||
ADD_DEBUG_HISTORY( HISTORY_ENTITY_IO, szBuffer );
|
||||
}
|
||||
else
|
||||
@@ -321,7 +325,11 @@ void CBaseEntityOutput::FireOutput(variant_t Value, CBaseEntity *pActivator, CBa
|
||||
STRING(ev->m_iTargetInput),
|
||||
STRING(ev->m_iParameter) );
|
||||
|
||||
#ifdef MAPBASE
|
||||
ConColorMsg( 2, Color(CON_COLOR_DEV_VERBOSE), "%s", szBuffer );
|
||||
#else
|
||||
DevMsg( 2, "%s", szBuffer );
|
||||
#endif
|
||||
ADD_DEBUG_HISTORY( HISTORY_ENTITY_IO, szBuffer );
|
||||
}
|
||||
|
||||
@@ -342,7 +350,12 @@ void CBaseEntityOutput::FireOutput(variant_t Value, CBaseEntity *pActivator, CBa
|
||||
{
|
||||
char szBuffer[256];
|
||||
Q_snprintf( szBuffer, sizeof(szBuffer), "Removing from action list: (%s,%s) -> (%s,%s)\n", pCaller ? STRING(pCaller->m_iClassname) : "NULL", pCaller ? STRING(pCaller->GetEntityName()) : "NULL", STRING(ev->m_iTarget), STRING(ev->m_iTargetInput));
|
||||
|
||||
#ifdef MAPBASE
|
||||
ConColorMsg( 2, Color(CON_COLOR_DEV_VERBOSE), "%s", szBuffer );
|
||||
#else
|
||||
DevMsg( 2, "%s", szBuffer );
|
||||
#endif
|
||||
ADD_DEBUG_HISTORY( HISTORY_ENTITY_IO, szBuffer );
|
||||
bRemove = true;
|
||||
}
|
||||
@@ -836,7 +849,12 @@ void CEventQueue::Dump( void )
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: adds the action into the correct spot in the priority queue, targeting entity via string name
|
||||
//-----------------------------------------------------------------------------
|
||||
void CEventQueue::AddEvent( const char *target, const char *targetInput, variant_t Value, float fireDelay, CBaseEntity *pActivator, CBaseEntity *pCaller, int outputID )
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
intptr_t
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
CEventQueue::AddEvent( const char *target, const char *targetInput, variant_t Value, float fireDelay, CBaseEntity *pActivator, CBaseEntity *pCaller, int outputID )
|
||||
{
|
||||
// build the new event
|
||||
EventQueuePrioritizedEvent_t *newEvent = new EventQueuePrioritizedEvent_t;
|
||||
@@ -854,12 +872,21 @@ void CEventQueue::AddEvent( const char *target, const char *targetInput, variant
|
||||
newEvent->m_iOutputID = outputID;
|
||||
|
||||
AddEvent( newEvent );
|
||||
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
return reinterpret_cast<intptr_t>(newEvent); // POINTER_TO_INT
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: adds the action into the correct spot in the priority queue, targeting entity via pointer
|
||||
//-----------------------------------------------------------------------------
|
||||
void CEventQueue::AddEvent( CBaseEntity *target, const char *targetInput, variant_t Value, float fireDelay, CBaseEntity *pActivator, CBaseEntity *pCaller, int outputID )
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
intptr_t
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
CEventQueue::AddEvent( CBaseEntity *target, const char *targetInput, variant_t Value, float fireDelay, CBaseEntity *pActivator, CBaseEntity *pCaller, int outputID )
|
||||
{
|
||||
// build the new event
|
||||
EventQueuePrioritizedEvent_t *newEvent = new EventQueuePrioritizedEvent_t;
|
||||
@@ -877,6 +904,10 @@ void CEventQueue::AddEvent( CBaseEntity *target, const char *targetInput, varian
|
||||
newEvent->m_iOutputID = outputID;
|
||||
|
||||
AddEvent( newEvent );
|
||||
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
return reinterpret_cast<intptr_t>(newEvent);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CEventQueue::AddEvent( CBaseEntity *target, const char *action, float fireDelay, CBaseEntity *pActivator, CBaseEntity *pCaller, int outputID )
|
||||
@@ -1072,7 +1103,11 @@ void CEventQueue::ServiceEvents( void )
|
||||
|
||||
char szBuffer[256];
|
||||
Q_snprintf( szBuffer, sizeof(szBuffer), "unhandled input: (%s) -> (%s), from (%s,%s); target entity not found\n", STRING(pe->m_iTargetInput), STRING(pe->m_iTarget), pClass, pName );
|
||||
#ifdef MAPBASE
|
||||
ConColorMsg( 2, Color(CON_COLOR_DEV_VERBOSE), "%s", szBuffer );
|
||||
#else
|
||||
DevMsg( 2, "%s", szBuffer );
|
||||
#endif
|
||||
ADD_DEBUG_HISTORY( HISTORY_ENTITY_IO, szBuffer );
|
||||
}
|
||||
|
||||
@@ -1220,6 +1255,80 @@ void ServiceEventQueue( void )
|
||||
}
|
||||
|
||||
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
//-----------------------------------------------------------------------------
|
||||
// Remove events on entity by input.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CEventQueue::CancelEventsByInput( CBaseEntity *pTarget, const char *szInput )
|
||||
{
|
||||
if ( !pTarget )
|
||||
return;
|
||||
|
||||
string_t iszDebugName = MAKE_STRING( pTarget->GetDebugName() );
|
||||
EventQueuePrioritizedEvent_t *pCur = m_Events.m_pNext;
|
||||
|
||||
while ( pCur )
|
||||
{
|
||||
bool bRemove = false;
|
||||
|
||||
if ( pTarget == pCur->m_pEntTarget || pCur->m_iTarget == iszDebugName )
|
||||
{
|
||||
if ( !V_strncmp( STRING(pCur->m_iTargetInput), szInput, strlen(szInput) ) )
|
||||
{
|
||||
bRemove = true;
|
||||
}
|
||||
}
|
||||
|
||||
EventQueuePrioritizedEvent_t *pPrev = pCur;
|
||||
pCur = pCur->m_pNext;
|
||||
|
||||
if ( bRemove )
|
||||
{
|
||||
RemoveEvent(pPrev);
|
||||
delete pPrev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CEventQueue::RemoveEvent( intptr_t event )
|
||||
{
|
||||
if ( !event )
|
||||
return false;
|
||||
|
||||
EventQueuePrioritizedEvent_t *pe = reinterpret_cast<EventQueuePrioritizedEvent_t*>(event); // INT_TO_POINTER
|
||||
|
||||
for ( EventQueuePrioritizedEvent_t *pCur = m_Events.m_pNext; pCur; pCur = pCur->m_pNext )
|
||||
{
|
||||
if ( pCur == pe )
|
||||
{
|
||||
RemoveEvent(pCur);
|
||||
delete pCur;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
float CEventQueue::GetTimeLeft( intptr_t event )
|
||||
{
|
||||
if ( !event )
|
||||
return 0.f;
|
||||
|
||||
EventQueuePrioritizedEvent_t *pe = reinterpret_cast<EventQueuePrioritizedEvent_t*>(event); // INT_TO_POINTER
|
||||
|
||||
for ( EventQueuePrioritizedEvent_t *pCur = m_Events.m_pNext; pCur; pCur = pCur->m_pNext )
|
||||
{
|
||||
if ( pCur == pe )
|
||||
{
|
||||
return (pCur->m_flFireTime - gpGlobals->curtime);
|
||||
}
|
||||
}
|
||||
|
||||
return 0.f;
|
||||
}
|
||||
#endif // MAPBASE_VSCRIPT
|
||||
|
||||
|
||||
// save data description for the event queue
|
||||
BEGIN_SIMPLE_DATADESC( CEventQueue )
|
||||
|
||||
Reference in New Issue
Block a user