Frag grenade W.I.P.
This commit is contained in:
parent
5eb5fe978e
commit
f6d084263d
|
@ -2,14 +2,50 @@ AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
|
|
||||||
|
ENT.Fuse = 0
|
||||||
|
|
||||||
|
local size = Vector( 4, 4, 4 )
|
||||||
|
local sizem = -size
|
||||||
|
|
||||||
function ENT:Initialize()
|
function ENT:Initialize()
|
||||||
|
self:SetModel( "models/weapons/w_eq_fraggrenade_thrown.mdl" )
|
||||||
|
if SERVER then
|
||||||
|
self:PhysicsInitBox( sizem, size, SOLID_VPHYSICS )
|
||||||
|
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||||
|
self:SetCollisionGroup( COLLISION_GROUP_PROJECTILE )
|
||||||
|
local phys = self:GetPhysicsObject()
|
||||||
|
if IsValid(phys) then
|
||||||
|
phys:SetMaterial("Brick")
|
||||||
|
phys:Wake()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self:SetModelScale( 2 )
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:Think()
|
function ENT:Think()
|
||||||
|
if SERVER and self.Fuse <= CurTime() then
|
||||||
|
self:Explode()
|
||||||
|
self:Remove()
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local explosionflags = 0x2 + 0x4 + 0x80
|
||||||
function ENT:Explode()
|
function ENT:Explode()
|
||||||
|
local effectdata = EffectData()
|
||||||
|
effectdata:SetOrigin( self:GetPos() )
|
||||||
|
effectdata:SetFlags( explosionflags )
|
||||||
|
util.Effect( "Explosion", effectdata )
|
||||||
|
|
||||||
|
local dmg = DamageInfo()
|
||||||
|
dmg:SetDamage( 125 )
|
||||||
|
dmg:SetAttacker( self:GetOwner() )
|
||||||
|
util.BlastDamageInfo( dmg, self:GetPos(), 140 )
|
||||||
return
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
function ENT:PhysicsCollide( data, phys )
|
||||||
|
if ( data.Speed > 100 ) then phys:SetVelocity( data.OurNewVelocity/2 ) end
|
||||||
end
|
end
|
|
@ -2,11 +2,3 @@ AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
ENT.Base = "bgrenade"
|
ENT.Base = "bgrenade"
|
||||||
|
|
||||||
function ENT:Think()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
function ENT:Explode()
|
|
||||||
return
|
|
||||||
end
|
|
|
@ -637,6 +637,54 @@ WEAPONS["spas12"] = {
|
||||||
Features = "firearm",
|
Features = "firearm",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WEAPONS["cqb70"] = {
|
||||||
|
Name = "CQB-70",
|
||||||
|
Description = "meow",
|
||||||
|
Type = "shotgun",
|
||||||
|
|
||||||
|
WModel = "models/weapons/w_shot_cs3.mdl",
|
||||||
|
HoldType = "rpg",
|
||||||
|
GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 },
|
||||||
|
|
||||||
|
Sound_Fire = "AA12.Fire",
|
||||||
|
Sound_DryFire = "Common.Dryfire.Rifle",
|
||||||
|
Sound_MagOut = "AA12.MagOut",
|
||||||
|
Sound_MagIn = "AA12.MagIn",
|
||||||
|
|
||||||
|
Delay = (60/120),
|
||||||
|
Firemodes = FIREMODE_SEMI,
|
||||||
|
Ammo = 4,
|
||||||
|
Damage = 10,
|
||||||
|
Pellets = 8,
|
||||||
|
Spread = 150/60,
|
||||||
|
|
||||||
|
Features = "firearm",
|
||||||
|
}
|
||||||
|
|
||||||
|
WEAPONS["m12ak"] = {
|
||||||
|
Name = "M12AK",
|
||||||
|
Description = "meow",
|
||||||
|
Type = "shotgun",
|
||||||
|
|
||||||
|
WModel = "models/weapons/w_shot_saiga.mdl",
|
||||||
|
HoldType = "rpg",
|
||||||
|
GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 },
|
||||||
|
|
||||||
|
Sound_Fire = "AA12.Fire",
|
||||||
|
Sound_DryFire = "Common.Dryfire.Rifle",
|
||||||
|
Sound_MagOut = "AA12.MagOut",
|
||||||
|
Sound_MagIn = "AA12.MagIn",
|
||||||
|
|
||||||
|
Delay = (60/160),
|
||||||
|
Firemodes = FIREMODE_SEMI,
|
||||||
|
Ammo = 5,
|
||||||
|
Damage = 10,
|
||||||
|
Pellets = 8,
|
||||||
|
Spread = 150/60,
|
||||||
|
|
||||||
|
Features = "firearm",
|
||||||
|
}
|
||||||
|
|
||||||
WEAPONS["aa12"] = {
|
WEAPONS["aa12"] = {
|
||||||
Name = "AA-12",
|
Name = "AA-12",
|
||||||
Description = "meow",
|
Description = "meow",
|
||||||
|
@ -784,8 +832,31 @@ WEAPONS["qbblsw"] = {
|
||||||
-- Grenades
|
-- Grenades
|
||||||
-- Nothing here is guaranteed.
|
-- Nothing here is guaranteed.
|
||||||
|
|
||||||
local function GrenadeFire()
|
local function GrenadeFire( self )
|
||||||
print("yay")
|
local p = self:GetOwner()
|
||||||
|
if self:GetDelay1() > CurTime() then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
self:SetDelay1( CurTime() + 0.1 )
|
||||||
|
|
||||||
|
self:TPFire()
|
||||||
|
|
||||||
|
-- PROTO: See to getting this done better. Maybe it's spawned while priming the nade for low CL-SV/phys delay?
|
||||||
|
if SERVER then
|
||||||
|
local GENT = ents.Create( "bgrenade_frag" )
|
||||||
|
GENT:SetOwner( p )
|
||||||
|
GENT:SetPos( p:EyePos() + (p:EyeAngles():Forward()*16) )
|
||||||
|
GENT:SetAngles( p:EyeAngles() + Angle( 0, 0, -90 ) )
|
||||||
|
GENT.Fuse = CurTime() + 4
|
||||||
|
GENT:Spawn()
|
||||||
|
|
||||||
|
local velocity = p:EyeAngles():Forward() * 1500
|
||||||
|
velocity:Mul( Lerp( math.TimeFraction( 90, 0, p:EyeAngles().p ), 0, 1 ) )
|
||||||
|
-- velocity:Add( p:EyeAngles():Up() * 500 * Lerp( math.TimeFraction( 0, -90, p:EyeAngles().p ), 0, 1 ) )
|
||||||
|
|
||||||
|
GENT:GetPhysicsObject():SetVelocity( velocity )
|
||||||
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -802,6 +873,8 @@ WEAPONS["g_frag"] = {
|
||||||
Fire = GrenadeFire,
|
Fire = GrenadeFire,
|
||||||
|
|
||||||
WModel = "models/weapons/w_eq_flashbang.mdl",
|
WModel = "models/weapons/w_eq_flashbang.mdl",
|
||||||
|
HoldType = "grenade",
|
||||||
|
GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 },
|
||||||
|
|
||||||
Features = "grenade",
|
Features = "grenade",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue