Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,60 +10,53 @@ function ENT:Initialize()
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if phys:IsValid() then phys:Wake() end
self.Death = CurTime() + 90

timer.Simple(90, function() if self.Entity then self.Entity:Remove() end end)
end

function ENT:SpawnFunction( ply, tr )
if ( !tr.Hit ) then return end
local ent = ents.Create("ent_sglowstick_fly")
ent:SetPos( tr.HitPos + tr.HitNormal * 16 )
ent:Spawn()
ent:Activate()

return ent
if ( !tr.Hit ) then return end

local ent = ents.Create("ent_sglowstick_fly")
ent:SetPos( tr.HitPos + tr.HitNormal * 16 )
ent:Spawn()
ent:Activate()

return ent
end

function testProp(ply)
ent = ents.Create("prop_physics")
ent:SetPos(ply:GetPos() + Vector(5,0,0))
ent:SetModel("models/hunter/blocks/cube1x2x1.mdl")
ent:Spawn()
/*function testProp(ply)
ent = ents.Create("prop_physics")
ent:SetPos(ply:GetPos() + Vector(5,0,0))
ent:SetModel("models/hunter/blocks/cube1x2x1.mdl")
ent:Spawn()
end
concommand.Add("testprop",testProp)
concommand.Add("testprop",testProp)*/

function ENT:PhysicsCollide( data, physobj )
if IsValid(self:GetParent()) then return end
if data.HitEntity then
ent = data.HitEntity
if ent:IsWorld() then
self:SetMoveType(MOVETYPE_NONE)
self:SetPos(data.HitPos - data.HitNormal * 1.2)
flip = 1
if data.HitNormal.y > 0 then
flip = -1
end
self:SetAngles(Angle(0,data.HitNormal.y + data.HitNormal.x,-data.HitNormal.z * flip) * 90)
elseif !ent:IsPlayer() and !ent:IsWeapon() then
self:SetPos(data.HitPos - data.HitNormal * 1.2)
flip = 1
if data.HitNormal.y > 0 then
flip = -1
end
self:SetAngles(Angle(0,data.HitNormal.y + data.HitNormal.x,-data.HitNormal.z * flip) * 90)
self:SetParent(ent)
end
end
end

function ENT:OnRemove()
end

function ENT:Think()
if self.Death && self.Death < CurTime() then
self:Remove()
if IsValid(self:GetParent()) then return end
if data.HitEntity then
ent = data.HitEntity
if ent:IsWorld() then
self:SetMoveType(MOVETYPE_NONE)
self:SetPos(data.HitPos - data.HitNormal * 1.2)

flip = 1
if data.HitNormal.y > 0 then flip = -1 end

self:SetAngles(Angle(0,data.HitNormal.y + data.HitNormal.x,-data.HitNormal.z * flip) * 90)
elseif !ent:IsPlayer() and !ent:IsWeapon() then
self:SetPos(data.HitPos - data.HitNormal * 1.2)

flip = 1
if data.HitNormal.y > 0 then flip = -1 end

self:SetAngles(Angle(0,data.HitNormal.y + data.HitNormal.x,-data.HitNormal.z * flip) * 90)
self:SetParent(ent)
end
end
end

function ENT:Use( activator, caller )
self.Entity:Remove()
end
end