add lua scripts to the download file list
fixed sentrygun not being able to retarget closer targets fixed sentrygun to favor all visible players over buildables
This commit is contained in:
parent
54b4a348e5
commit
3e9f94be1a
|
@ -1373,6 +1373,7 @@ void CBaseAnimating::UpdateStepOrigin()
|
|||
{
|
||||
CAI_BaseNPC *pNPC = MyNPCPointer();
|
||||
// FIXME: There needs to be a default step height somewhere
|
||||
|
||||
float height = 18.0f;
|
||||
if (pNPC)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "doors.h"
|
||||
#include "recipientfilter.h"
|
||||
#include "triggers.h"
|
||||
#include "filesystem.h"
|
||||
#include "sharedInterface.h"
|
||||
|
||||
// Lua includes
|
||||
extern "C"
|
||||
|
@ -363,24 +365,27 @@ namespace FFLib
|
|||
strcat(realscript, script);
|
||||
strcat(realscript, ".lua");
|
||||
*/
|
||||
|
||||
Q_snprintf( realscript, sizeof( realscript ), "maps/includes/%s.lua", script );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Try a precache, rumor has it this will cause the engine to send the lua files to clients
|
||||
if(PRECACHE_LUA_FILES)
|
||||
{
|
||||
if(filesystem->FileExists(realscript))
|
||||
{
|
||||
Util_AddDownload(realscript);
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if( !CFFScriptManager::LoadFile( _scriptman.GetLuaState(), realscript ) )
|
||||
{
|
||||
// Try looking in the maps directory
|
||||
Q_snprintf( realscript, sizeof( realscript ), "maps/%s.lua", script );
|
||||
if(CFFScriptManager::LoadFile( _scriptman.GetLuaState(), realscript ))
|
||||
{
|
||||
// Try a precache, rumor has it this will cause the engine to send the lua files to clients
|
||||
//engine->PrecacheGeneric(realscript, true);
|
||||
CFFScriptManager::LoadFile( _scriptman.GetLuaState(), realscript );
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// // Try a precache, rumor has it this will cause the engine to send the lua files to clients
|
||||
// engine->PrecacheGeneric(realscript, true);
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
Msg("[SCRIPT] Warning: Invalid filename: %s\n", script);
|
||||
|
|
|
@ -216,15 +216,20 @@ void CFFScriptManager::LevelInit(const char* szMapName)
|
|||
if ( !filename[0] )
|
||||
Q_snprintf( filename, sizeof(filename), "maps/%s.lua", szMapName );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Try a precache, rumor has it this will cause the engine to send the lua files to clients
|
||||
if(PRECACHE_LUA_FILES)
|
||||
{
|
||||
if(filesystem->FileExists(filename))
|
||||
{
|
||||
Util_AddDownload(filename);
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
m_ScriptExists = LoadFile(L, filename);
|
||||
EndScriptLoad();
|
||||
|
||||
// Try a precache, rumor has it this will cause the engine to send the lua files to clients
|
||||
/*if(m_ScriptExists)
|
||||
{
|
||||
engine->PrecacheGeneric(filename, true);
|
||||
}*/
|
||||
|
||||
// spawn the helper entity
|
||||
CFFEntitySystemHelper::Create();
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "checksum_crc.h"
|
||||
#endif
|
||||
|
||||
#define PRECACHE_LUA_FILES 1
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// forward declarations
|
||||
struct lua_State;
|
||||
|
|
|
@ -500,24 +500,41 @@ CBaseEntity *SG_IsBetterTarget( CBaseEntity *cur, CBaseEntity *latest, float dis
|
|||
return cur;
|
||||
|
||||
if( !cur )
|
||||
{
|
||||
lastdistance = distance;
|
||||
return latest;
|
||||
}
|
||||
|
||||
// A player is always preferable to a buildable
|
||||
if( latest->IsPlayer() && !cur->IsPlayer() )
|
||||
{
|
||||
lastdistance = distance;
|
||||
return latest;
|
||||
}
|
||||
|
||||
// If we're on a player already, don't consider non players
|
||||
// Do we want to do this?
|
||||
if(cur->IsPlayer() && !latest->IsPlayer())
|
||||
return cur;
|
||||
|
||||
// Check radio tagged players
|
||||
if( latest->IsPlayer() && cur->IsPlayer() )
|
||||
{
|
||||
if( ToFFPlayer( latest )->IsRadioTagged() && !ToFFPlayer( cur )->IsRadioTagged() )
|
||||
{
|
||||
lastdistance = distance;
|
||||
return latest;
|
||||
}
|
||||
else if( !ToFFPlayer( latest )->IsRadioTagged() && ToFFPlayer( cur )->IsRadioTagged() )
|
||||
return cur;
|
||||
}
|
||||
|
||||
// Go for the nearest
|
||||
if( distance < lastdistance )
|
||||
{
|
||||
lastdistance = distance;
|
||||
return latest;
|
||||
}
|
||||
|
||||
return cur;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "ndebugoverlay.h"
|
||||
#include "engine/ivdebugoverlay.h"
|
||||
#include "datacache/imdlcache.h"
|
||||
#include "networkstringtable_gamedll.h"
|
||||
#include "util.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
|
@ -3100,6 +3101,24 @@ void CC_CollisionTest( void )
|
|||
}
|
||||
static ConCommand collision_test("collision_test", CC_CollisionTest, "Tests collision system", FCVAR_CHEAT );
|
||||
|
||||
|
||||
bool Util_AddDownload(const char *pszFile)
|
||||
{
|
||||
INetworkStringTable *pDownloadablesTable = networkstringtable->FindTable( "downloadables" );
|
||||
|
||||
if ( pDownloadablesTable )
|
||||
{
|
||||
bool bSave = engine->LockNetworkStringTables( false );
|
||||
int iRet = pDownloadablesTable->FindStringIndex( pszFile );
|
||||
|
||||
//Don't add duplicates.
|
||||
if ( iRet == INVALID_STRING_INDEX )
|
||||
{
|
||||
pDownloadablesTable->AddString( pszFile, strlen( pszFile ) + 1 );
|
||||
engine->LockNetworkStringTables( bSave );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -616,4 +616,6 @@ AngularImpulse WorldToLocalRotation( const VMatrix &localToWorld, const Vector &
|
|||
|
||||
bool UTIL_LoadAndSpawnEntitiesFromScript( CUtlVector <CBaseEntity*> &entities, const char *pScriptFile, const char *pBlock, bool bActivate = true );
|
||||
|
||||
bool Util_AddDownload(const char *pszFile);
|
||||
|
||||
#endif // UTIL_H
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// $LastChangedBy: DrEvil $
|
||||
// $LastChangedDate: 2007-03-07 08:28:59 -0800 (Wed, 07 Mar 2007) $
|
||||
// $LastChangedRevision: 1697 $
|
||||
// $LastChangedBy: drevil $
|
||||
// $LastChangedDate: 2007-10-16 21:53:00 -0700 (Tue, 16 Oct 2007) $
|
||||
// $LastChangedRevision: 2149 $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __MESSAGEHELPER_H__
|
||||
#define __MESSAGEHELPER_H__
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct SubscriberHandle
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// $LastChangedBy: DrEvil $
|
||||
// $LastChangedDate: 2007-08-31 23:25:33 -0700 (Fri, 31 Aug 2007) $
|
||||
// $LastChangedRevision: 2142 $
|
||||
// $LastChangedBy: drevil $
|
||||
// $LastChangedDate: 2007-10-13 14:55:48 -0700 (Sat, 13 Oct 2007) $
|
||||
// $LastChangedRevision: 2148 $
|
||||
//
|
||||
// about: Generic Bot Events
|
||||
//
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// $LastChangedBy: DrEvil $
|
||||
// $LastChangedDate: 2007-08-31 23:25:33 -0700 (Fri, 31 Aug 2007) $
|
||||
// $LastChangedRevision: 2142 $
|
||||
// $LastChangedBy: drevil $
|
||||
// $LastChangedDate: 2007-10-13 14:55:48 -0700 (Sat, 13 Oct 2007) $
|
||||
// $LastChangedRevision: 2148 $
|
||||
//
|
||||
// Title: TF Config
|
||||
//
|
||||
|
|
|
@ -1551,12 +1551,7 @@ namespace Omnibot
|
|||
if(!pEntity->CollisionProp() || pEntity->entindex() == 0)
|
||||
return InvalidEntity;
|
||||
|
||||
Vector vOrig(0.f, 0.f, 0.f);
|
||||
if(pEntity->CollisionProp()->IsBoundsDefinedInEntitySpace())
|
||||
vOrig = pEntity->GetAbsOrigin();
|
||||
|
||||
vMins = vOrig + pEntity->CollisionProp()->OBBMins();;
|
||||
vMaxs = vOrig + pEntity->CollisionProp()->OBBMaxs();
|
||||
pEntity->CollisionProp()->WorldSpaceAABB(&vMins, &vMaxs);
|
||||
}
|
||||
|
||||
_aabb.m_Mins[0] = vMins.x;
|
||||
|
|
Loading…
Reference in New Issue