mirror of
https://github.com/SpaxscE/simfphys_armed.git
synced 2025-03-04 03:13:26 -05:00
tracer,sound + deflect on prop_physics
This commit is contained in:
parent
fc84fabe4c
commit
3d7bc75878
@ -31,7 +31,8 @@ function EFFECT:Init( data )
|
||||
self:SetRenderBoundsWS( self.StartPos, self.EndPos )
|
||||
|
||||
self.TracerTime = math.min( 1, self.StartPos:Distance( self.EndPos ) / 15000 )
|
||||
self.Length = math.Rand( 0.1, 0.15 )
|
||||
|
||||
self.Length = math.Rand( 0.05, 0.1 )
|
||||
|
||||
-- Die when it reaches its target
|
||||
self.DieTime = CurTime() + self.TracerTime
|
||||
|
@ -1,8 +1,9 @@
|
||||
include("shared.lua")
|
||||
|
||||
function ENT:Initialize()
|
||||
self.PixVis = util.GetPixelVisibleHandle()
|
||||
ENT.mat = Material( "sprites/animglow02" )
|
||||
ENT.mat2 = Material( "effects/simfphys_armed/spark" )
|
||||
|
||||
function ENT:Initialize()
|
||||
self.Materials = {
|
||||
"particle/smokesprites_0001",
|
||||
"particle/smokesprites_0002",
|
||||
@ -23,16 +24,21 @@ function ENT:Initialize()
|
||||
}
|
||||
|
||||
self.OldPos = self:GetPos()
|
||||
|
||||
self.emitter = ParticleEmitter(self.OldPos, false )
|
||||
end
|
||||
|
||||
local mat = Material( "sprites/animglow02" )
|
||||
function ENT:Draw()
|
||||
if not self.Dir or not self.Size then return end
|
||||
|
||||
if self.Size > 5 then return end
|
||||
|
||||
local pos = self:GetPos()
|
||||
|
||||
render.SetMaterial( self.mat2 )
|
||||
render.DrawBeam( pos, self.OldPos - self.Dir * 250, self.Size * 5, 1, 0, Color( 255, 255, 255, 255 ) )
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
local curtime = CurTime()
|
||||
local pos = self:GetPos()
|
||||
|
||||
if pos ~= self.OldPos then
|
||||
@ -50,6 +56,9 @@ function ENT:doFX( newpos, oldpos )
|
||||
local Dir = Sub:GetNormalized()
|
||||
local Len = Sub:Length()
|
||||
|
||||
self.Dir = Dir
|
||||
self.Size = self:GetSize()
|
||||
|
||||
for i = 1, Len, 15 do
|
||||
local pos = oldpos + Dir * i
|
||||
|
||||
@ -57,24 +66,25 @@ function ENT:doFX( newpos, oldpos )
|
||||
|
||||
if particle then
|
||||
particle:SetGravity( Vector(0,0,100) + VectorRand() * 50 )
|
||||
particle:SetVelocity( -self:GetForward() * 500 )
|
||||
particle:SetVelocity( -Dir * 500 )
|
||||
particle:SetAirResistance( 600 )
|
||||
particle:SetDieTime( math.Rand(0.1,0.5) )
|
||||
particle:SetStartAlpha( 80 )
|
||||
particle:SetStartSize( (math.Rand(6,12) / 20) * self:GetSize() )
|
||||
particle:SetEndSize( (math.Rand(20,30) / 20) * self:GetSize() )
|
||||
particle:SetStartSize( (math.Rand(6,12) / 20) * self.Size )
|
||||
particle:SetEndSize( (math.Rand(20,30) / 20) * self.Size )
|
||||
particle:SetRoll( math.Rand( -1, 1 ) )
|
||||
particle:SetColor( 120,120,120 )
|
||||
particle:SetCollide( false )
|
||||
end
|
||||
|
||||
local particle = self.emitter:Add( mat, pos )
|
||||
if self.Size > 5 then
|
||||
local particle = self.emitter:Add( self.mat, pos )
|
||||
if particle then
|
||||
particle:SetVelocity( -self:GetForward() * 300 + self:GetVelocity())
|
||||
particle:SetVelocity( -Dir * 300 + self:GetVelocity())
|
||||
particle:SetDieTime( 0.1 )
|
||||
particle:SetAirResistance( 0 )
|
||||
particle:SetStartAlpha( 255 )
|
||||
particle:SetStartSize( self:GetSize() )
|
||||
particle:SetStartSize( self.Size )
|
||||
particle:SetEndSize( 0 )
|
||||
particle:SetRoll( math.Rand(-1,1) )
|
||||
particle:SetColor( 255,255,255 )
|
||||
@ -83,6 +93,7 @@ function ENT:doFX( newpos, oldpos )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
local effectdata = EffectData()
|
||||
|
@ -46,6 +46,12 @@ function ENT:Initialize()
|
||||
self.Vel = self:GetForward() * 200
|
||||
end
|
||||
|
||||
local CanDeflectOn = {
|
||||
["gmod_sent_vehicle_fphysics_base"] = true,
|
||||
["gmod_sent_vehicle_fphysics_wheel"] = true,
|
||||
["prop_physics"] = true,
|
||||
}
|
||||
|
||||
function ENT:Think()
|
||||
local curtime = CurTime()
|
||||
self:NextThink( curtime )
|
||||
@ -72,7 +78,7 @@ function ENT:Think()
|
||||
|
||||
self.DeflectAng = self.DeflectAng or 25
|
||||
|
||||
if hitangle < self.DeflectAng and not self.Bounced and (simfphys.IsCar( trace.Entity ) or trace.Entity:GetClass() == "gmod_sent_vehicle_fphysics_wheel") then
|
||||
if hitangle < self.DeflectAng and not self.Bounced and CanDeflectOn[ trace.Entity:GetClass() ] then
|
||||
|
||||
local thVel = self.Vel:Length()
|
||||
|
||||
@ -119,7 +125,9 @@ function ENT:Think()
|
||||
end
|
||||
|
||||
local attackingEnt = IsValid( self.AttackingEnt ) and self.AttackingEnt or self
|
||||
util.BlastDamage( attackingEnt, self.Attacker, tr.HitPos,self.BlastRadius,self.BlastDamage)
|
||||
local attacker = IsValid( self.Attacker ) and self.Attacker or self
|
||||
|
||||
util.BlastDamage( attackingEnt, attacker, tr.HitPos,self.BlastRadius,self.BlastDamage)
|
||||
|
||||
util.Decal("scorch", tr.HitPos - tr.HitNormal, tr.HitPos + tr.HitNormal)
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user