source-sdk-2013-mapbase/sp/src/game/server/playerinfomanager.cpp
Blixibon 63323222fe Mapbase v4.3
- Fixed a crash with multiple trigger_look targets
- Fixed an issue where some zombie submodel server ragdolls are not solid to the world
- Fixed a crash with certain instance classes being loaded in a savegame before the class is registered
- Added some of Tony Sergi's missing Source 2007 fixes (contributed by Kris)
- Added "ClientCommand" hook for VScript to allow handling of unknown console commands
- Added "PlayerRunCommand" hook for VScript to control player movement
- Added new button-related script functions for players (GetButtons, DisableButtons, etc.)
- Added CUserCmd accessor in VScript for the "PlayerRunCommand" hook
- Added "GetWaterLevel" function for VScript
- Exposed "Ignite" to VScript for controlling how a fire starts
- Fixed NPCs being unable to unholster weapons
- Fixed Mapbase crashing when Steam isn't running
- Fixed issues with angled/updating sky_camera save/restore
- Added VBSP "-skyboxcubemap" parameter to enable skybox default cubemaps + "-defaultcubemapres" to control their resolution
- Added ability to disable VScript in a map (and fixed a few potential complications from disabling VScript)
- Made clientside VScript only initialize after world is spawned in order to receive serverside script language in time
- Added tons of VScript functions to CBaseAnimating related to bodygroups, sequences, etc.
- Added VScript functions to players for getting user ID and player name, similar to logic_playerinfo
- Added a few L4D2 script functions missing from the ASW SDK
- Added "Localize" singleton with a single "GetTokenAsUTF8" function for getting localization strings
- Disabled r_hunkalloclightmaps by the request of various users (apparently this completely removes the "Engine hunk overflow" error and allows for really high-res lightmaps)
- Fixed npc_antlionguard NPC_TranslateActivity not hooking into base class (allows for VScript manipulation)
- Added various unused antlion guard activities to npc_antlionguard AI, allowing for usage as registered activities
- Added keyvalue to set LOS mask on combine_mine
- Added +USE bounding box limiter to prop_interactable
2020-07-16 15:43:30 +00:00

114 lines
2.9 KiB
C++

//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: implementation of player info manager
//
//=============================================================================//
#include "cbase.h"
#include "player.h"
#include "playerinfomanager.h"
#include "edict.h"
#if defined( TF_DLL )
#include "tf_shareddefs.h"
#elif defined( CSTRIKE_DLL )
#include "weapon_csbase.h"
#elif defined( DOD_DLL )
#include "weapon_dodbase.h"
#elif defined( SDK_DLL )
#include "weapon_sdkbase.h"
#endif
extern CGlobalVars *gpGlobals;
static CPlayerInfoManager s_PlayerInfoManager;
static CPluginBotManager s_BotManager;
namespace
{
//
// Old version support
//
//Tony; pulled out version 1 and 2 support for orange box, we're starting fresh now with v3 player and v2 of the bot interface.
}
IPlayerInfo *CPlayerInfoManager::GetPlayerInfo( edict_t *pEdict )
{
CBasePlayer *pPlayer = ( ( CBasePlayer * )CBaseEntity::Instance( pEdict ));
if ( pPlayer )
return pPlayer->GetPlayerInfo();
else
return NULL;
}
IPlayerInfo *CPlayerInfoManager::GetPlayerInfo( int index )
{
return GetPlayerInfo( engine->PEntityOfEntIndex( index ) );
}
// Games implementing advanced bot support should override this.
int CPlayerInfoManager::AliasToWeaponId(const char *weaponName)
{
//Tony; TF doesn't support this. Should it?
#if defined ( CSTRIKE_DLL ) || defined ( DOD_DLL ) || defined ( SDK_DLL )
return AliasToWeaponID(weaponName);
#endif
return -1;
}
// Games implementing advanced bot support should override this.
const char *CPlayerInfoManager::WeaponIdToAlias(int weaponId)
{
#if defined( TF_DLL )
return WeaponIdToAlias(weaponId);
#elif defined ( CSTRIKE_DLL ) || defined ( DOD_DLL ) || defined ( SDK_DLL )
return WeaponIDToAlias(weaponId);
#endif
return "MOD_DIDNT_IMPLEMENT_ME";
}
CGlobalVars *CPlayerInfoManager::GetGlobalVars()
{
return gpGlobals;
}
IBotController *CPluginBotManager::GetBotController( edict_t *pEdict )
{
CBasePlayer *pPlayer = ( ( CBasePlayer * )CBaseEntity::Instance( pEdict ));
if ( pPlayer && pPlayer->IsBot() )
{
return pPlayer->GetBotController();
}
else
{
return NULL;
}
}
edict_t *CPluginBotManager::CreateBot( const char *botname )
{
edict_t *pEdict = engine->CreateFakeClient( botname );
if (!pEdict)
{
Msg( "Failed to create Bot.\n");
return NULL;
}
// Allocate a player entity for the bot, and call spawn
CBasePlayer *pPlayer = ((CBasePlayer*)CBaseEntity::Instance( pEdict ));
pPlayer->ClearFlags();
pPlayer->AddFlag( FL_CLIENT | FL_FAKECLIENT );
pPlayer->ChangeTeam( TEAM_UNASSIGNED );
pPlayer->AddEFlags( EFL_PLUGIN_BASED_BOT ); // Mark it as a plugin based bot
pPlayer->RemoveAllItems( true );
pPlayer->Spawn();
return pEdict;
}
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CPlayerInfoManager, IPlayerInfoManager, INTERFACEVERSION_PLAYERINFOMANAGER, s_PlayerInfoManager);
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CPluginBotManager, IBotManager, INTERFACEVERSION_PLAYERBOTMANAGER, s_BotManager);