mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-23 20:09:45 +03:00
Mapbase v6.0
- Fixed path_track paths saving as pointers instead of handles - Fixed player animations not falling to base class correctly - Fixed logic_externaldata creating garbage in trailing spaces - Added "SetHandModelSkin" input - Added unique colors for various types of console message, adjustable via convars - Added the ability to use map-specific weapon scripts - Added a way to display (placeholder) text entirely from Faceposer scenes - Added "autobreak" keyvalue to game_text, which automatically breaks long text into different lines - Added the ability to change a game_text's font (very limited) - Added LightToggle input to point_spotlight - Added Enable/DisableSprites on npc_manhack - Added ai_goal_police behavior from metrocops to Combine soldiers and citizens - Added func_precipitation particle rain systems from the Alien Swarm SDK - Added new func_precipitation spawnflags for controlling behavior in particle types - Added "mapbase_version" cvar which shows the version of Mapbase a mod might be running on - Fixed an oversight with NPC crouch activities which was causing npc_metropolice to stop firing in standoffs - Added toggleable patches to npc_combine AI which make soldiers less likely to stand around without shooting or rush to melee when not needed - Added key for custom logo font on env_credits scripts - Added SetSpeed and SetPushDir inputs for trigger_push - Added a bunch of I/O/KV to func_fish_pool to allow for more control over the fish - Added OnLostEnemy/Player support for npc_combine_camera - Added enhanced save/restore for the Response System, toggleable via convar - Added a convar which allows users to disable weapon autoswitching when picking up ammo - Split VScript base script into its own file - Added VScript descriptions for NPC squads and the manager class which handles them - Moved several classes, functions, etc. to the VScript library itself for future usage in other projects, like VBSP - Added VScript to VBSP with basic map file interfacing - Made some VScript documentation more clear due to deprecation of online documentation - Added VScript "hook" registration, creating a standardized system which shows up in script_help documentation - Added VScript-driven custom weapons - Added clientside VScript scopes - Added a bunch of weapon-related VScript functions - Split a bunch of cluttered VScript stuff into different files - Added VScript functions for "following" entities/bonemerging - Added VScript functions for grenades - Added a few more VScript trigger functions - Added OnDeath hook for VScript - Fixed documentation for aliased functions in VScript - Fixed $bumpmask not working on SDK_LightmappedGeneric - Made vertex blend swapping in Hammer use a constant instead of a combo (makes it easier to compile the shader, especially for $bumpmask's sake) - Fixed brush phong, etc. causing SDK_WorldVertexTransition to stop working - Added limited support for $envmapmask in the bumpmapping shader - Fixed more issues with parallax corrected cubemaps and instances - Made instance variable recursion consistent with VMFII
This commit is contained in:
202
sp/src/game/shared/mapbase/weapon_custom_scripted.h
Normal file
202
sp/src/game/shared/mapbase/weapon_custom_scripted.h
Normal file
@@ -0,0 +1,202 @@
|
||||
//========= Mapbase - https://github.com/mapbase-source/source-sdk-2013 =================
|
||||
//
|
||||
// Purpose: VScript-driven custom weapon class.
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#ifndef VSCRIPT_FUNCS_MATH
|
||||
#define VSCRIPT_FUNCS_MATH
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "basecombatweapon_shared.h"
|
||||
#ifdef CLIENT_DLL
|
||||
#include "vscript_client.h"
|
||||
#endif
|
||||
|
||||
// The base class of the scripted weapon is game-specific.
|
||||
#if defined(HL2_DLL) || defined(HL2_CLIENT_DLL)
|
||||
#include "basehlcombatweapon_shared.h"
|
||||
#define SCRIPTED_WEAPON_DERIVED_FROM CBaseHLCombatWeapon
|
||||
#else
|
||||
#define SCRIPTED_WEAPON_DERIVED_FROM CBaseCombatWeapon
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT_DLL
|
||||
#define CWeaponCustomScripted C_WeaponCustomScripted
|
||||
#endif
|
||||
|
||||
#define DECLARE_CACHED_HOOK(name) static ScriptHook_t g_Hook_##name; \
|
||||
HSCRIPT m_Func_##name;
|
||||
|
||||
class CWeaponCustomScripted : public SCRIPTED_WEAPON_DERIVED_FROM
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS( CWeaponCustomScripted, SCRIPTED_WEAPON_DERIVED_FROM );
|
||||
DECLARE_NETWORKCLASS();
|
||||
DECLARE_PREDICTABLE();
|
||||
|
||||
CWeaponCustomScripted();
|
||||
|
||||
bool RunWeaponHook( ScriptHook_t &hook, HSCRIPT &cached, ScriptVariant_t *retVal = NULL, ScriptVariant_t *pArgs = NULL );
|
||||
|
||||
bool KeyValue( const char *szKeyName, const char *szValue );
|
||||
bool GetKeyValue( const char *szKeyName, char *szValue, int iMaxLen );
|
||||
|
||||
// Base script has a function for this
|
||||
//void Precache( void );
|
||||
|
||||
void Spawn( void );
|
||||
|
||||
bool IsPredicted( void ) const { return m_iszClientScripts[0] != '\0'; }
|
||||
|
||||
const char* GetWeaponScriptName() { return m_iszWeaponScriptName[0] != '\0' ? m_iszWeaponScriptName : BaseClass::GetWeaponScriptName(); }
|
||||
|
||||
// Weapon selection
|
||||
bool HasAnyAmmo( void ); // Returns true is weapon has ammo
|
||||
bool HasPrimaryAmmo( void ); // Returns true is weapon has ammo
|
||||
bool HasSecondaryAmmo( void ); // Returns true is weapon has ammo
|
||||
|
||||
bool CanHolster( void ); // returns true if the weapon can be holstered
|
||||
bool CanDeploy( void ); // return true if the weapon's allowed to deploy
|
||||
bool Deploy( void ); // returns true is deploy was successful
|
||||
bool Holster( CBaseCombatWeapon *pSwitchingTo = NULL );
|
||||
|
||||
// Weapon behaviour
|
||||
void ItemPreFrame( void ); // called each frame by the player PreThink
|
||||
void ItemPostFrame( void ); // called each frame by the player PostThink
|
||||
void ItemBusyFrame( void ); // called each frame by the player PostThink, if the player's not ready to attack yet
|
||||
void ItemHolsterFrame( void ); // called each frame by the player PreThink, if the weapon is holstered
|
||||
void WeaponIdle( void ); // called when no buttons pressed
|
||||
void HandleFireOnEmpty(); // Called when they have the attack button down
|
||||
|
||||
// Reloading
|
||||
void CheckReload( void );
|
||||
void FinishReload( void );
|
||||
void AbortReload( void );
|
||||
bool Reload( void );
|
||||
void Reload_NPC( void );
|
||||
|
||||
// Weapon firing
|
||||
void PrimaryAttack( void ); // do "+ATTACK"
|
||||
void SecondaryAttack( void ); // do "+ATTACK2"
|
||||
|
||||
// Firing animations
|
||||
Activity GetPrimaryAttackActivity( void );
|
||||
Activity GetSecondaryAttackActivity( void );
|
||||
Activity GetDrawActivity( void );
|
||||
float GetDefaultAnimSpeed( void );
|
||||
|
||||
// Bullet launch information
|
||||
const Vector& GetBulletSpread( void );
|
||||
Vector GetBulletSpread( WeaponProficiency_t proficiency );
|
||||
float GetFireRate( void );
|
||||
int GetMinBurst();
|
||||
int GetMaxBurst();
|
||||
float GetMinRestTime();
|
||||
float GetMaxRestTime();
|
||||
|
||||
void AddViewKick( void );
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
bool WeaponLOSCondition( const Vector &ownerPos, const Vector &targetPos, bool bSetConditions );
|
||||
int WeaponRangeAttack1Condition( float flDot, float flDist );
|
||||
int WeaponRangeAttack2Condition( float flDot, float flDist );
|
||||
int WeaponMeleeAttack1Condition( float flDot, float flDist );
|
||||
int WeaponMeleeAttack2Condition( float flDot, float flDist );
|
||||
#endif
|
||||
|
||||
ALLOW_SCRIPT_ACCESS();
|
||||
private:
|
||||
|
||||
// Weapon selection
|
||||
DECLARE_CACHED_HOOK( HasAnyAmmo );
|
||||
DECLARE_CACHED_HOOK( HasPrimaryAmmo );
|
||||
DECLARE_CACHED_HOOK( HasSecondaryAmmo );
|
||||
|
||||
DECLARE_CACHED_HOOK( CanHolster );
|
||||
DECLARE_CACHED_HOOK( CanDeploy );
|
||||
DECLARE_CACHED_HOOK( Deploy );
|
||||
DECLARE_CACHED_HOOK( Holster );
|
||||
|
||||
// Weapon behaviour
|
||||
DECLARE_CACHED_HOOK( ItemPreFrame );
|
||||
DECLARE_CACHED_HOOK( ItemPostFrame );
|
||||
DECLARE_CACHED_HOOK( ItemBusyFrame );
|
||||
DECLARE_CACHED_HOOK( ItemHolsterFrame );
|
||||
DECLARE_CACHED_HOOK( WeaponIdle );
|
||||
DECLARE_CACHED_HOOK( HandleFireOnEmpty );
|
||||
|
||||
// Reloading
|
||||
DECLARE_CACHED_HOOK( CheckReload );
|
||||
DECLARE_CACHED_HOOK( FinishReload );
|
||||
DECLARE_CACHED_HOOK( AbortReload );
|
||||
DECLARE_CACHED_HOOK( Reload );
|
||||
DECLARE_CACHED_HOOK( Reload_NPC );
|
||||
|
||||
// Weapon firing
|
||||
DECLARE_CACHED_HOOK( PrimaryAttack );
|
||||
DECLARE_CACHED_HOOK( SecondaryAttack );
|
||||
|
||||
// Firing animations
|
||||
DECLARE_CACHED_HOOK( GetPrimaryAttackActivity );
|
||||
DECLARE_CACHED_HOOK( GetSecondaryAttackActivity );
|
||||
DECLARE_CACHED_HOOK( GetDrawActivity );
|
||||
DECLARE_CACHED_HOOK( GetDefaultAnimSpeed );
|
||||
|
||||
// Bullet launch information
|
||||
DECLARE_CACHED_HOOK( GetBulletSpread );
|
||||
DECLARE_CACHED_HOOK( GetBulletSpreadForProficiency );
|
||||
DECLARE_CACHED_HOOK( GetFireRate );
|
||||
DECLARE_CACHED_HOOK( GetMinBurst );
|
||||
DECLARE_CACHED_HOOK( GetMaxBurst );
|
||||
DECLARE_CACHED_HOOK( GetMinRestTime );
|
||||
DECLARE_CACHED_HOOK( GetMaxRestTime );
|
||||
|
||||
DECLARE_CACHED_HOOK( AddViewKick );
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
DECLARE_CACHED_HOOK( WeaponLOSCondition );
|
||||
DECLARE_CACHED_HOOK( WeaponRangeAttack1Condition );
|
||||
DECLARE_CACHED_HOOK( WeaponRangeAttack2Condition );
|
||||
DECLARE_CACHED_HOOK( WeaponMeleeAttack1Condition );
|
||||
DECLARE_CACHED_HOOK( WeaponMeleeAttack2Condition );
|
||||
#endif
|
||||
|
||||
DECLARE_CACHED_HOOK( ActivityList );
|
||||
DECLARE_CACHED_HOOK( ActivityListCount );
|
||||
|
||||
private:
|
||||
|
||||
CNetworkString( m_iszClientScripts, 256 );
|
||||
CNetworkString( m_iszWeaponScriptName, 256 );
|
||||
|
||||
protected:
|
||||
|
||||
DECLARE_ACTTABLE();
|
||||
DECLARE_DATADESC();
|
||||
DECLARE_ENT_SCRIPTDESC();
|
||||
};
|
||||
|
||||
/*
|
||||
class CWeaponCustomScripted1 : public CWeaponCustomScripted
|
||||
{
|
||||
DECLARE_PREDICTABLE();
|
||||
};
|
||||
class CWeaponCustomScripted2 : public CWeaponCustomScripted
|
||||
{
|
||||
DECLARE_PREDICTABLE();
|
||||
};
|
||||
class CWeaponCustomScripted3 : public CWeaponCustomScripted
|
||||
{
|
||||
DECLARE_PREDICTABLE();
|
||||
};
|
||||
class CWeaponCustomScripted4 : public CWeaponCustomScripted
|
||||
{
|
||||
DECLARE_PREDICTABLE();
|
||||
};
|
||||
*/
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user