mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-23 20:09:45 +03:00
Added VScript functions for ropes
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "cbase.h"
|
||||
#include "activitylist.h"
|
||||
#include "in_buttons.h"
|
||||
#include "rope_shared.h"
|
||||
#ifdef CLIENT_DLL
|
||||
#include "c_ai_basenpc.h"
|
||||
#else
|
||||
@@ -310,6 +311,22 @@ void RegisterSharedScriptConstants()
|
||||
ScriptRegisterConstant( g_pScriptVM, MOVETYPE_OBSERVER, "Move type used in GetMoveType(), etc." );
|
||||
ScriptRegisterConstant( g_pScriptVM, MOVETYPE_CUSTOM, "Move type used in GetMoveType(), etc." );
|
||||
|
||||
//
|
||||
// Ropes
|
||||
//
|
||||
ScriptRegisterConstant( g_pScriptVM, ROPE_RESIZE, "Try to keep the rope dangling the same amount even as the rope length changes. (for use in rope flags)" );
|
||||
ScriptRegisterConstant( g_pScriptVM, ROPE_BARBED, "Hack option to draw like a barbed wire. (for use in rope flags)" );
|
||||
ScriptRegisterConstant( g_pScriptVM, ROPE_COLLIDE, "Collide with the world. (for use in rope flags)" );
|
||||
ScriptRegisterConstant( g_pScriptVM, ROPE_SIMULATE, "Is the rope valid? (for use in rope flags)" );
|
||||
ScriptRegisterConstant( g_pScriptVM, ROPE_BREAKABLE, "Can the endpoints detach? (for use in rope flags)" );
|
||||
ScriptRegisterConstant( g_pScriptVM, ROPE_USE_WIND, "Wind simulation on this rope. (for use in rope flags)" );
|
||||
ScriptRegisterConstant( g_pScriptVM, ROPE_INITIAL_HANG, "By default, ropes will simulate for a bit internally when they are created so they sag, but dynamically created ropes for things like harpoons don't want this. (for use in rope flags)" );
|
||||
ScriptRegisterConstant( g_pScriptVM, ROPE_PLAYER_WPN_ATTACH, "If this flag is set, then the second attachment must be a player. The rope will attach to \"buff_attach\" on the player's active weapon. This is a flag because it requires special code on the client to find the weapon. (for use in rope flags)" );
|
||||
ScriptRegisterConstant( g_pScriptVM, ROPE_NO_GRAVITY, "Disable gravity on this rope. (for use in rope flags)" );
|
||||
ScriptRegisterConstant( g_pScriptVM, ROPE_NUMFLAGS, "The number of rope flags recognized by the game." );
|
||||
|
||||
ScriptRegisterConstantNamed( g_pScriptVM, Vector( ROPE_GRAVITY ), "ROPE_GRAVITY", "Default rope gravity vector." );
|
||||
|
||||
#ifdef GAME_DLL
|
||||
//
|
||||
// Sound Types, Contexts, and Channels
|
||||
|
||||
@@ -22,7 +22,10 @@
|
||||
#include "globalstate.h"
|
||||
#include "vscript_server.h"
|
||||
#include "soundent.h"
|
||||
#endif // !CLIENT_DLL
|
||||
#include "rope.h"
|
||||
#else
|
||||
#include "c_rope.h"
|
||||
#endif // CLIENT_DLL
|
||||
|
||||
#include "con_nprint.h"
|
||||
#include "particle_parse.h"
|
||||
@@ -738,6 +741,19 @@ static void ScriptDecalTrace( HSCRIPT hTrace, const char *decalName )
|
||||
UTIL_DecalTrace( &traceInfo->GetTrace(), decalName );
|
||||
}
|
||||
|
||||
static HSCRIPT ScriptCreateRope( HSCRIPT hStart, HSCRIPT hEnd, int iStartAttachment, int iEndAttachment, float ropeWidth, const char *pMaterialName, int numSegments, int ropeFlags )
|
||||
{
|
||||
#ifdef CLIENT_DLL
|
||||
C_RopeKeyframe *pRope = C_RopeKeyframe::Create( ToEnt( hStart ), ToEnt( hEnd ), iStartAttachment, iEndAttachment, ropeWidth, pMaterialName, numSegments, ropeFlags );
|
||||
#else
|
||||
CRopeKeyframe *pRope = CRopeKeyframe::Create( ToEnt( hStart ), ToEnt( hEnd ), iStartAttachment, iEndAttachment, ropeWidth, pMaterialName, numSegments );
|
||||
if (pRope)
|
||||
pRope->m_RopeFlags |= ropeFlags; // HACKHACK
|
||||
#endif
|
||||
|
||||
return ToHScript( pRope );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Simple particle effect dispatch
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -902,6 +918,8 @@ void RegisterSharedScriptFunctions()
|
||||
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptDecalTrace, "DecalTrace", "Creates a dynamic decal based on the given trace info. The trace information can be generated by TraceLineComplex() and the decal name must be from decals_subrect.txt." );
|
||||
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptDispatchParticleEffect, "DoDispatchParticleEffect", SCRIPT_ALIAS( "DispatchParticleEffect", "Dispatches a one-off particle system" ) );
|
||||
|
||||
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptCreateRope, "CreateRope", "Creates a single rope between two entities. Can optionally follow specific attachments." );
|
||||
|
||||
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptMatcherMatch, "Matcher_Match", "Compares a string to a query using Mapbase's matcher system, supporting wildcards, RS matchers, etc." );
|
||||
ScriptRegisterFunction( g_pScriptVM, Matcher_NamesMatch, "Compares a string to a query using Mapbase's matcher system using wildcards only." );
|
||||
ScriptRegisterFunction( g_pScriptVM, AppearsToBeANumber, "Checks if the given string appears to be a number." );
|
||||
|
||||
Reference in New Issue
Block a user