Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER then
- AddCSLuaFile("shared.lua")
- end
- ENT.Type = "anim"
- ENT.Model = Model("models/Items/combine_rifle_ammo01.mdl")
- ENT.Stuck = false
- ENT.Weaponised = false
- ENT.PunchMax = 6
- ENT.PunchRemaining = 6
- function ENT:Initialize()
- self.Entity:SetHealth(50)
- self.Entity:SetModel("models/Items/combine_rifle_ammo01.mdl")
- self.Entity:PhysicsInit(SOLID_VPHYSICS)
- self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
- self.Entity:SetSolid(SOLID_VPHYSICS)
- self.Entity:DrawShadow(false)
- self.Entity:SetCollisionGroup(COLLISION_GROUP_WORLD)
- local phys = self.Entity:GetPhysicsObject():EnableMotion(false)
- self:SetColor(Color(25, 122, 21, 255))
- --self:StartEffects()
- --self:Explosive()
- self.Entity:EmitSound("C4.Plant")
- end
- local matTripmineLaser = Material( "sprites/bluelaser1" )
- local matLight = Material( "models/roller/rollermine_glow" )
- local colBeam = Color( 100, 100, 210, 30 )
- local colLaser = Color( 100, 100, 240, 30 )
- function ENT:Think()
- local t = {}
- t.start = self:GetPos()
- t.endpos = t.start + self:GetUp() * 4096
- t.filter = self
- local tr = util.TraceLine(t)
- self.endpos = tr.HitPos
- --[[if tr.HitNonWorld then
- if SERVER then
- local ply = self.Owner
- local ignore = {ply, self}
- if not IsValid(ply) then return end
- for k, v in pairs(player.GetAll()) do
- if v:GetRole() == ROLE_TRAITOR then
- table.insert(ignore, v)
- end
- if (not table.HasValue(ignore,tr.Entity)) and tr.Entity:IsPlayer() then
- self:Explosive()
- self:Remove()
- end
- end
- end
- end --]]
- end
- ENT.OurHealth = 50
- function ENT:OnTakeDamage(dmg)
- self:TakePhysicsDamage(dmg)
- if(self.OurHealth <= 0) then return; end
- self.OurHealth = self.OurHealth - dmg:GetDamage()
- if(self.OurHealth <= 0) then
- self:Explosive()
- self:Remove()
- end
- end
- function ENT:Draw()
- if not self.endpos then
- return
- end
- render.SetMaterial( matTripmineLaser )
- local TexOffset = 6
- local Distance = self.endpos:Distance( self:GetPos() )
- render.DrawBeam( self.endpos, self.Entity:GetPos(), 6, TexOffset, TexOffset+Distance, colBeam )
- render.DrawBeam( self.endpos, self.Entity:GetPos(), 3, TexOffset, TexOffset+Distance, colBeam )
- render.SetMaterial( matLight )
- local Size = math.Rand( 3, 5 )
- local Normal = (self.Entity:GetPos()-self.endpos):GetNormal() * 0.1
- render.DrawQuadEasy( self.endpos + Normal, Normal, Size, Size, colLaser, 0 )
- self.Entity:DrawModel()
- end
- function ENT:StartTouch( ent )
- if (ent:IsPlayer()) then
- if (ent:GetRole() != ROLE_TRAITOR) then
- self:Explosive()
- self:Remove()
- end
- end
- end
- function ENT:Explosive()
- local phexp = ents.Create("env_explosion")
- if IsValid(phexp) then
- phexp:SetPos(self:GetPos())
- phexp:SetKeyValue("magnitude", 100)
- phexp:SetKeyValue("radius", 128)
- phexp:SetKeyValue("spawnflags", 1 + 2)
- phexp:Spawn()
- phexp:Fire("Explode", "", 0)
- end
- local phyexp = ents.Create("env_physexplosion")
- phyexp:SetPos(self:GetPos())
- phyexp:SetKeyValue("magnitude", 100)
- phyexp:SetKeyValue("radius", 128)
- phyexp:SetKeyValue("spawnflags", 1 + 2)
- phyexp:Spawn()
- phyexp:Fire("Explode", "", 0)
- local norm = self:GetAngles():Up() * -1
- util.BlastDamage(self, self:GetOwner(), self:GetPos(), 200, 50)
- local effect = EffectData()
- effect:SetStart(self:GetPos())
- effect:SetOrigin(self:GetPos())
- effect:SetNormal(norm * -1)
- effect:SetRadius(16)
- effect:SetScale(1)
- util.Effect("ManhackSparks", effect, true, true)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement