source-sdk-2013-mapbase/sp/src/game/shared/mapbase/vscript_funcs_shared.h
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

125 lines
3.7 KiB
C++

//========= Mapbase - https://github.com/mapbase-source/source-sdk-2013 =================
//
// Purpose: See vscript_funcs_shared.cpp
//
// $NoKeywords: $
//=============================================================================
#ifndef VSCRIPT_FUNCS_SHARED
#define VSCRIPT_FUNCS_SHARED
#ifdef _WIN32
#pragma once
#endif
//-----------------------------------------------------------------------------
// Exposes csurface_t to VScript
//-----------------------------------------------------------------------------
class CSurfaceScriptAccessor
{
public:
CSurfaceScriptAccessor( csurface_t &surf ) { m_surf = &surf; m_surfaceData = g_pScriptVM->RegisterInstance( physprops->GetSurfaceData( m_surf->surfaceProps ) ); }
~CSurfaceScriptAccessor() { delete m_surfaceData; }
// cplane_t stuff
const char* Name() const { return m_surf->name; }
HSCRIPT SurfaceProps() const { return m_surfaceData; }
void Destroy() { delete this; }
private:
csurface_t *m_surf;
HSCRIPT m_surfaceData;
};
//-----------------------------------------------------------------------------
// Exposes cplane_t to VScript
//-----------------------------------------------------------------------------
class CPlaneTInstanceHelper : public IScriptInstanceHelper
{
bool Get( void *p, const char *pszKey, ScriptVariant_t &variant )
{
cplane_t *pi = ((cplane_t *)p);
if (FStrEq(pszKey, "normal"))
variant = pi->normal;
else if (FStrEq(pszKey, "dist"))
variant = pi->dist;
else
return false;
return true;
}
//bool Set( void *p, const char *pszKey, ScriptVariant_t &variant );
};
//-----------------------------------------------------------------------------
// Exposes trace_t to VScript
//-----------------------------------------------------------------------------
class CTraceInfoAccessor
{
public:
~CTraceInfoAccessor()
{
if (m_surfaceAccessor)
{
CSurfaceScriptAccessor *pScriptSurface = HScriptToClass<CSurfaceScriptAccessor>( m_surfaceAccessor );
//g_pScriptVM->RemoveInstance( m_surfaceAccessor );
delete pScriptSurface;
}
//if (m_planeAccessor)
//{
// g_pScriptVM->RemoveInstance( m_planeAccessor );
//}
}
// CGrameTrace stuff
bool DidHitWorld() const { return m_tr.DidHitWorld(); }
bool DidHitNonWorldEntity() const { return m_tr.DidHitNonWorldEntity(); }
int GetEntityIndex() const { return m_tr.GetEntityIndex(); }
bool DidHit() const { return m_tr.DidHit(); }
float FractionLeftSolid() const { return m_tr.fractionleftsolid; }
int HitGroup() const { return m_tr.hitgroup; }
int PhysicsBone() const { return m_tr.physicsbone; }
HSCRIPT Entity() const { return ToHScript(m_tr.m_pEnt); }
int HitBox() const { return m_tr.hitbox; }
// CBaseTrace stuff
bool IsDispSurface() { return m_tr.IsDispSurface(); }
bool IsDispSurfaceWalkable() { return m_tr.IsDispSurfaceWalkable(); }
bool IsDispSurfaceBuildable() { return m_tr.IsDispSurfaceBuildable(); }
bool IsDispSurfaceProp1() { return m_tr.IsDispSurfaceProp1(); }
bool IsDispSurfaceProp2() { return m_tr.IsDispSurfaceProp2(); }
const Vector& StartPos() const { return m_tr.startpos; }
const Vector& EndPos() const { return m_tr.endpos; }
float Fraction() const { return m_tr.fraction; }
int Contents() const { return m_tr.contents; }
int DispFlags() const { return m_tr.dispFlags; }
bool AllSolid() const { return m_tr.allsolid; }
bool StartSolid() const { return m_tr.startsolid; }
HSCRIPT Surface() { return m_surfaceAccessor; }
void SetSurface( HSCRIPT hSurfAccessor ) { m_surfaceAccessor = hSurfAccessor; }
HSCRIPT Plane() { return m_planeAccessor; }
void SetPlane( HSCRIPT hPlaneAccessor ) { m_planeAccessor = hPlaneAccessor; }
trace_t &GetTrace() { return m_tr; }
void Destroy() { delete this; }
private:
trace_t m_tr;
HSCRIPT m_surfaceAccessor;
HSCRIPT m_planeAccessor;
};
#endif