Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddCSLuaFile( "cl_init.lua" )
- AddCSLuaFile( "shared.lua" )
- include( 'shared.lua' )
- function ENT:SpawnFunction( ply, tr )
- if ( !tr.Hit ) then return end
- local SpawnPos = tr.HitPos + tr.HitNormal * 16
- local ent = ents.Create( "ent_plasma" )
- ent:SetPos( SpawnPos )
- ent:Spawn()
- ent:Activate()
- return ent
- end
- /*---------------------------------------------------------
- Name: Initialize
- ---------------------------------------------------------*/
- function ENT:Initialize()
- self.Entity:SetModel( "models/Items/AR2_Grenade.mdl" )
- self.Entity:SetSolid(SOLID_VPHYSICS)
- self.Entity:PhysicsInit(SOLID_VPHYSICS)
- self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
- local phys = self.Entity:GetPhysicsObject()
- self.Angles = self.Entity:GetAngles()
- if phys:IsValid( ) then
- phys:EnableGravity( false )
- phys:Wake( )
- end
- self.Start = CurTime()
- end
- /*---------------------------------------------------------
- Name: PhysicsCollide
- ---------------------------------------------------------*/
- function ENT:PhysicsCollide( data, physobj )
- local target = data.HitEntity
- local BadNpc = 0
- if target:IsPlayer()then
- target.PlyHp = target:Health()
- self:Remove()
- else
- self.Entity:GetPhysicsObject():EnableMotion( false )
- self.Entity:SetAngles(self.Angles)
- inactive = true
- end
- end
- /*---------------------------------------------------------
- Name: OnTakeDamage
- ---------------------------------------------------------*/
- function ENT:OnTakeDamage( dmginfo )
- end
- /*---------------------------------------------------------
- Name: Use
- ---------------------------------------------------------*/
- function ENT:Use( activator, caller )
- end
- function ENT:PhysicsUpdate( PhysObj )
- if self.Start < CurTime( ) - ( 10 / GetConVarNumber( "phys_timescale" ) ) then
- self.Entity:Remove( )
- return
- end
- local Trace = {
- start = self.Entity:GetPos( ),
- endpos = self.Entity:GetPos( ) + ( self.Entity:GetForward( ) * 20 ),
- filter = self.Entity
- }
- local TraceRes = util.TraceLine( Trace )
- if TraceRes.Hit or TraceRes.HitWorld then
- if TraceRes.Entity:GetClass( ) ~= "ent_plasma" then
- local Bullet = {
- Src = self.Entity:GetPos( ),
- Dir = self.Entity:GetForward( ),
- Spread = 0,
- Num = 1,
- Damage = self.Damage,
- Force = self.Force,
- Tracer = 0,
- TracerName = "Pistol"
- }
- self.Owner:FireBulletsOld( Bullet )
- self.Entity:Remove( )
- return false
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement