Files
source-sdk-2013/sp/src/game/shared/mapbase/vscript_funcs_hl2.cpp
Blixibon 87cd9b24bb Mapbase v6.1
- Added postprocess_controller entity from later versions of Source
- Added env_dof_controller entity from later versions of Source
- Added SDK_Engine_Post and DepthOfField shaders from the Momentum repo/Alien Swarm SDK
- Fixed auto-breaking game_text/choreo text not null terminating
- Fixed console groups showing up at the wrong developer levels
- Added more mesages to console groups, including a new "NPC AI" console group
- Fixed typos and added elaboration in various cvars, console messages, etc.
- Fixed npc_metropolice not using frag grenades correctly when allowed to use them
- Fixed npc_metropolice not registering stitching squad slots in AI
- Fixed SetModel input late precache warning
- Fixed env_global_light angles resetting upon loading a save
- Fixed an issue with ScriptKeyValuesRead using the wrong name and having a memory leak
- Allowed VScript functions which return null strings to actually return null instead of empty strings
- Added VScript member variable documentation
- Fixed VScript documentation lines sometimes mixing together
- Fixed VScript singletons having a ! at the beginning of descriptions
- Added Color struct to VScript and allowed color-related inputs to use it
- Added more VScript functions for weapons, ammo, ragdolling, and response contexts
- Added GameRules singleton for VScript
- Exposed AI interaction system to VScript
- Recovered some lost documentation from older revisions of the Mapbase wiki
- Added a way to get the current game's load type in VScript
- Fixed Precache/SpawnEntityFromTable not accounting for a few important field types
- Added VScript functions for getting a player's eye vectors
- Fixed a crash caused by removing the active weapon of a Combine soldier while it's firing
- Changed the way metrocops deploy their manhacks so they could use their manhack death response properly
- Fixed "Use Server" keyvalue on game_convar_mod not working
- Adjusted CAI_Expresser in VScript
2020-12-17 03:38:23 +00:00

64 lines
1.8 KiB
C++

//========= Mapbase - https://github.com/mapbase-source/source-sdk-2013 ============//
//
// Purpose: VScript functions for Half-Life 2.
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "hl2_gamerules.h"
#ifndef CLIENT_DLL
#include "eventqueue.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#ifndef CLIENT_DLL
extern CBaseEntity *CreatePlayerLoadSave( Vector vOrigin, float flDuration, float flHoldTime, float flLoadTime );
HSCRIPT ScriptGameOver( const char *pszMessage, float flDelay, float flFadeTime, float flLoadTime, int r, int g, int b )
{
CBaseEntity *pPlayer = AI_GetSinglePlayer();
if (pPlayer)
{
UTIL_ShowMessage( pszMessage, ToBasePlayer( pPlayer ) );
ToBasePlayer( pPlayer )->NotifySinglePlayerGameEnding();
}
else
{
// TODO: How should MP handle this?
return NULL;
}
CBaseEntity *pReload = CreatePlayerLoadSave( vec3_origin, flFadeTime, flLoadTime + 1.0f, flLoadTime );
if (pReload)
{
pReload->SetRenderColor( r, g, b, 255 );
g_EventQueue.AddEvent( pReload, "Reload", flDelay, pReload, pReload );
}
return ToHScript( pReload );
}
bool ScriptMegaPhyscannonActive()
{
return HL2GameRules()->MegaPhyscannonActive();
}
#endif
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHalfLife2::RegisterScriptFunctions( void )
{
BaseClass::RegisterScriptFunctions();
#ifndef CLIENT_DLL
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptGameOver, "GameOver", "Ends the game and reloads the last save." );
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptMegaPhyscannonActive, "MegaPhyscannonActive", "Checks if supercharged gravity gun mode is enabled." );
#endif
}