flechette support

This commit is contained in:
ClockEFFX 2023-12-12 14:33:20 -05:00 committed by GitHub
parent 848025b1de
commit be917befdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 4 deletions

View File

@ -13,4 +13,4 @@ E2Helper.Descriptions[ "shootRPG" ] = "Fires a RPG missile with specified positi
E2Helper.Descriptions[ "shootSMGGrenade" ] = "Fires a SMG grenade with specified position, velocity, damage, and blast radius\nNOTE: Damage is subject to falloff\nReturns the grenade entity"
-- ep2
E2Helper.Descriptions[ "shootFlechette" ] = "Fires a hunter flechette (WIP)"
E2Helper.Descriptions[ "shootFlechette" ] = "Fires a flechette with specified position, and velocity\nReturns the flechette entity"

View File

@ -153,10 +153,19 @@ PROJECTILECORE.SMGGRENADE_DELAY = PROJECTILECORE.CVARS.SMGGRENADE_DELAY:GetFloat
-- ep2 convars
PROJECTILECORE.CVARS.FLECHETTE_ENABLED = CreateConVar( "projcore_flechette_enabled", "0", FCVAR_ARCHIVE, "Allow E2 to shoot hunter flechettes (EP2 required)", 0, 1 )
-- flechette
PROJECTILECORE.CVARS.FLECHETTE_ENABLED = CreateConVar( "projcore_flechette_enabled", "1", FCVAR_ARCHIVE, "Allow E2 to shoot hunter flechettes (EP2 required)", 0, 1 )
PROJECTILECORE.FLECHETTE_ENABLED = PROJECTILECORE.CVARS.FLECHETTE_ENABLED:GetBool()
PROJECTILECORE.CVARS.FLECHETTE_MAXVEL = CreateConVar( "projcore_flechette_maxvel", "2000", FCVAR_ARCHIVE, "Maximum velocity E2 fired flechettes are allowed to have (set to -1 for no limit)" )
PROJECTILECORE.FLECHETTE_MAXVEL = PROJECTILECORE.CVARS.FLECHETTE_MAXVEL:GetInt()
PROJECTILECORE.CVARS.FLECHETTE_DELAY = CreateConVar( "projcore_flechette_delay", "0.1", FCVAR_ARCHIVE, "Minimum time between flechette shots" )
PROJECTILECORE.FLECHETTE_DELAY = PROJECTILECORE.CVARS.FLECHETTE_DELAY:GetFloat()
@ -901,9 +910,12 @@ function PROJECTILECORE.SHOOTFLECHETTE( ent, chip, pos, vel )
flech:Activate()
local dir = Vector( vel[ 1 ], vel[ 2 ], vel[ 3 ] )
flech:SetVelocity( dir )
flech:SetAngles( dir:Angle() )
local maxvel = PROJECTILECORE.FLECHETTE_MAXVEL
dir = maxvel > -1 and PROJECTILECORE.CLAMPVECTOR( dir, maxvel ) or dir
flech:SetVelocity( dir )