Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddCSLuaFile( "cl_init.lua" )
- AddCSLuaFile( "shared.lua" )
- include( 'shared.lua' )
- resource.AddFile( "materials/VGUI/entities/sent_gasbomb.vmt" );
- resource.AddFile( "materials/VGUI/entities/sent_gasbomb.vtf" );
- local isarmed = 0
- local caninuke = 1
- local canbeeb = 1
- util.PrecacheSound( "ambient/explosions/explode_3.wav" )
- util.PrecacheSound( "ambient/explosions/explode_5.wav" )
- function ENT:Initialize()
- self.Entity:SetModel( "models/weapons/w_eq_smokegrenade.mdl" )
- self.Entity:PhysicsInit( SOLID_VPHYSICS )
- self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
- self.Entity:SetSolid( SOLID_VPHYSICS )
- local phys = self.Entity:GetPhysicsObject()
- if not (WireAddon == nil) then self.Inputs = Wire_CreateInputs(self.Entity, { "Detonate!", "Arm"}) end
- if not (WireAddon == nil) then self.Outputs = Wire_CreateOutputs(self.Entity, { "Armed"}) end
- if (phys:IsValid()) then
- phys:Wake()
- end
- end
- function ENT:TriggerInput(iname, value) --wire inputs
- if (iname == "Detonate!") then
- if value == 1 then
- if self.isarmed == 1 then
- self:MakeGas()
- end
- end
- end
- if (iname == "Arm") then
- if value == 1 then
- self.isarmed = 1
- end
- if value == 0 then
- self.isarmed = 0
- end
- end
- end
- function ENT:SpawnFunction( ply, tr)
- if ( !tr.Hit ) then return end
- local SpawnPos = tr.HitPos + tr.HitNormal * 16
- local ent = ents.Create( "sent_sarin" )
- ent:SetPos( SpawnPos )
- ent:Spawn()
- ent:Activate()
- return ent
- end
- function ENT:PhysicsCollide( data, physobj )
- if ( self.isarmed == 1 ) then
- if data.Speed > 600 and data.DeltaTime > 0.15 then -- if it hits an object at over 600 speed
- self:MakeGas()
- end
- end
- end
- function ENT:OnTakeDamage(dmginfo)
- self.Entity:TakePhysicsDamage( dmginfo )
- end
- function ENT:Think()
- if ( self.isarmed == 1 ) then
- self:SetOverlayText( " ARMED " )
- else
- self:SetOverlayText( " Unarmed " )
- end
- if not (WireAddon == nil) then Wire_TriggerOutput(self.Entity, "Armed", self.isarmed) end
- end
- --function ENT:Kaboom()
- -- if self.isarmed == 1 then
- -- if self.caninuke == 1 then
- -- self:MakeGas()
- -- self.Entity:Remove()
- -- end
- -- end
- --end
- function ENT:OnRemove()
- self.caninuke = 0
- end
- function ENT:MakeGas()
- if caninuke == 1 then
- self.Entity:EmitSound(Sound("BaseSmokeEffect.Sound"))
- local CL = ents.Create("env_steam")
- CL:SetKeyValue("spreadspeed","350")
- CL:SetKeyValue("speed","20")
- CL:SetKeyValue("startsize","125")
- CL:SetKeyValue("endsize","200")
- CL:SetKeyValue("rate","250")
- CL:SetKeyValue("Jetlength","50")
- CL:SetKeyValue("angles","90")
- CL:SetKeyValue("rendercolor","255 255 255")
- CL:SetPos( self.Entity:GetPos() )
- CL:Fire("turnon","",0)
- CL:Fire("kill","",15)
- CL:Spawn()
- CL:Activate()
- local b = ents.Create( "point_hurt" )
- b:SetKeyValue("targetname", "fier" )
- b:SetKeyValue("DamageRadius", "800" )
- b:SetKeyValue("Damage", "3.5" )
- b:SetKeyValue("DamageDelay", "0.1" )
- b:SetKeyValue("DamageType", "262144" )
- b:SetPos( self.Entity:GetPos() )
- b:Spawn()
- b:Fire("turnon", "", 0)
- b:Fire("turnoff", "", 15)
- self.Entity:Remove()
- end
- end
- function ENT:Use()
- self.isarmed = 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement