mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-23 20:09:45 +03:00
Merged dev changes 9/7/2019
- Experimental RPC stuff for the future - Fixed players running over allies with vehicles (kind of) - Modified redirect filter infrastructure to support when there's no target filter (meaning it will just make sure the entity exists) - Fixed SDK_EyeRefract - Fixed env_beam SetStart/EndEntity - New "OnStateChange" output on NPCs - scripted_face removed (use generic facing VCDs instead) - Fixed RPC - Miscellaneous code cleanup
This commit is contained in:
@@ -2288,157 +2288,6 @@ int CAI_ScriptedSentence::StartSentence( CAI_BaseNPC *pTarget )
|
||||
}
|
||||
|
||||
#ifdef MAPBASE
|
||||
class CAI_ScriptedFace : public CPointEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS( CAI_ScriptedFace, CPointEntity );
|
||||
|
||||
CAI_ScriptedFace();
|
||||
|
||||
// Input handlers
|
||||
void InputBeginFacing( inputdata_t &inputdata );
|
||||
//void InputCancelFacing( inputdata_t &inputdata );
|
||||
|
||||
DECLARE_DATADESC();
|
||||
|
||||
void Begin(CBaseEntity *pActivator, CBaseEntity *pCaller);
|
||||
|
||||
private:
|
||||
string_t m_iszFaceTarget;
|
||||
|
||||
// False = Entity, True = Position
|
||||
bool m_bTargetType;
|
||||
|
||||
bool m_bGrabAll;
|
||||
|
||||
float m_flImportance;
|
||||
float m_flDuration;
|
||||
|
||||
COutputEvent m_OnBeginFace;
|
||||
};
|
||||
|
||||
|
||||
BEGIN_DATADESC( CAI_ScriptedFace )
|
||||
|
||||
DEFINE_KEYFIELD( m_iszFaceTarget, FIELD_STRING, "SetFaceTarget" ),
|
||||
DEFINE_KEYFIELD( m_bTargetType, FIELD_BOOLEAN, "TargetType" ),
|
||||
DEFINE_KEYFIELD( m_bGrabAll, FIELD_BOOLEAN, "GrabAll" ),
|
||||
DEFINE_KEYFIELD( m_flImportance, FIELD_FLOAT, "Importance" ),
|
||||
DEFINE_KEYFIELD( m_flDuration, FIELD_FLOAT, "Duration" ),
|
||||
|
||||
// Inputs
|
||||
DEFINE_INPUTFUNC(FIELD_VOID, "BeginFacing", InputBeginFacing),
|
||||
|
||||
// Outputs
|
||||
DEFINE_OUTPUT(m_OnBeginFace, "OnBeginFace"),
|
||||
|
||||
END_DATADESC()
|
||||
|
||||
|
||||
|
||||
LINK_ENTITY_TO_CLASS( scripted_face, CAI_ScriptedFace );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input :
|
||||
// Output :
|
||||
//-----------------------------------------------------------------------------
|
||||
CAI_ScriptedFace::CAI_ScriptedFace()
|
||||
{
|
||||
m_flDuration = 5.0f;
|
||||
m_flImportance = 9999;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input :
|
||||
// Output :
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAI_ScriptedFace::Begin(CBaseEntity *pActivator, CBaseEntity *pCaller)
|
||||
{
|
||||
Vector position;
|
||||
CBaseEntity *pFaceTarget;
|
||||
|
||||
if (m_bTargetType)
|
||||
UTIL_StringToVector(position.Base(), STRING(m_iszFaceTarget));
|
||||
|
||||
CBaseEntity *pTarget;
|
||||
CAI_BaseNPC *pNPC;
|
||||
if (m_bGrabAll)
|
||||
{
|
||||
pTarget = gEntList.FindEntityGeneric(NULL, STRING(m_target), this, pActivator, pCaller);
|
||||
while (pTarget)
|
||||
{
|
||||
pNPC = pTarget->MyNPCPointer();
|
||||
if (!pNPC)
|
||||
{
|
||||
Warning("%s tried to grab %s, but it is not a NPC!\n", GetDebugName(), pTarget->GetDebugName());
|
||||
pTarget = gEntList.FindEntityGeneric(pTarget, STRING(m_target), this, pActivator, pCaller);
|
||||
continue;
|
||||
}
|
||||
|
||||
DevMsg("Grabbed one of many\n");
|
||||
|
||||
if (!m_bTargetType)
|
||||
{
|
||||
pFaceTarget = gEntList.FindEntityByNameNearest(STRING(m_iszFaceTarget), pTarget->GetLocalOrigin(), 0, this, pActivator, pCaller);
|
||||
if (pFaceTarget)
|
||||
{
|
||||
pNPC->GetMotor()->AddFacingTarget(pFaceTarget, m_flImportance, m_flDuration);
|
||||
pNPC->GetMotor()->SetIdealYawToTarget( pFaceTarget->GetAbsOrigin() );
|
||||
m_OnBeginFace.FireOutput(pFaceTarget, pTarget);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pNPC->GetMotor()->AddFacingTarget(position, m_flImportance, m_flDuration);
|
||||
}
|
||||
|
||||
pTarget = gEntList.FindEntityGeneric(pTarget, STRING(m_target), this, pActivator, pCaller);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pTarget = gEntList.FindEntityGeneric(NULL, STRING(m_target), this, pActivator, pCaller);
|
||||
if (pTarget)
|
||||
{
|
||||
pNPC = pTarget->MyNPCPointer();
|
||||
if (!pNPC)
|
||||
{
|
||||
Warning("%s tried to grab %s, but it is not a NPC!\n", GetDebugName(), pTarget->GetDebugName());
|
||||
pTarget = gEntList.FindEntityGeneric(pTarget, STRING(m_target), this, pActivator, pCaller);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_bTargetType)
|
||||
{
|
||||
pFaceTarget = gEntList.FindEntityByNameNearest(STRING(m_iszFaceTarget), pTarget->GetLocalOrigin(), 0, this, pActivator, pCaller);
|
||||
if (pFaceTarget)
|
||||
{
|
||||
pNPC->GetMotor()->AddFacingTarget(pFaceTarget, m_flImportance, m_flDuration);
|
||||
m_OnBeginFace.FireOutput(pFaceTarget, pTarget);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pNPC->GetMotor()->AddFacingTarget(position, m_flImportance, m_flDuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input :
|
||||
// Output :
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAI_ScriptedFace::InputBeginFacing( inputdata_t &inputdata )
|
||||
{
|
||||
Begin(inputdata.pActivator, inputdata.pCaller);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// This isn't exclusive to NPCs, so it could be moved if needed.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user