AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include ("shared.lua")
function ENT:Initialize()
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
end
function ENT:SpawnFunction(ply, tr)
if (!tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * 36 //tr.hitpos = where the trace hits
local ent = ents.Create("gmod_light")
ent:Spawn()
ent:Activate()
ent:SetSolid(0)
local lamp = ents.Create("prop_physics")
lamp:SetModel("models/props_interiors/Furniture_Lamp01a.mdl")
lamp:Spawn()
lamp:SetPos(tr.HitPos +tr.HitNormal * 36)
local vect1 = Vector(0,0,30)
ent:SetPos(lamp:GetPos() + vect1)
ent:SetParent(lamp)
local efentfec = EffectData()
efentfec:SetStart( SpawnPos ) // not sure if we need a start and origin (endpoint) for this effect, but whatever
efentfec:SetOrigin( SpawnPos )
efentfec:SetScale( 1 )
//efentfec:SetEntity(lamp)
util.Effect( "cball_explode", efentfec )
undo.Create("effect")
undo.AddEntity(lamp)
undo.AddEntity(ent)
undo.SetPlayer(ply)
undo.SetCustomUndoText("Undone Effect")
undo.Finish()
end
function ENT:Use( activator, caller)
if (activator:IsPlayer()) then
print("works")
end
end