Here's the magnusson spawner's code: the smiley is a colon capitol D
AddCSLuaFile("shared.lua")
AddCSLuaFile("cl_init.lua")
include("shared.lua")
ENT.LastSB = nil
ENT.Spinning = false
function ENT:Initialize()
self.Entity:SetModel("models/magnusson_teleporter.mdl")
self.Entity:PhysicsInit(SOLID_VPHYSICS)
self.Entity:SetSolid(SOLID_VPHYSICS)
local phy = self.Entity:GetPhysicsObject()
if phy:IsValid() then phy:EnableMotion(false) end
end
function ENT:SpawnFunction(ply,tr)
if !tr.HitWorld then return end
local sbs = ents.Create("magnuspawner")
sbs:SetPos(tr.HitPos)
sbs:Spawn()
return sbs
end
function ENT:Think()
if self.Spinning then return end
local sAng = self.Entity:GetAngles()
if self.LastSB == nil || (self.LastSB && self.LastSB:IsValid() && self.LastSB:GetPos():Distance(self:SBPos()) > 20) then
self.Spinning = true
local spSeq = self.Entity:LookupSequence("spinup")
self.Entity:ResetSequence(spSeq)
timer.Simple(7,self.SpawnSB,self.Entity)
end
end
function ENT:SpawnSB()
if !(self.Entity != nil && self.Entity:IsValid()) then return end
local sb = ents.Create("weapon_striderbuster")
--sb:SetKeyValue("spawnflags","72")
sb:SetPos(self:SBPos())
local sA = self.Entity:GetAngles():Right():Angle()
sb:SetAngles(sA)
sb:Spawn()
-- weld it on in case we have a moving magnuspawner ( on a vehicle :D )
local const = constraint.Weld(self.Entity,sb,0,0,2000,false)
self.LastSB = sb
self.Spinning = false
end
function ENT:SBPos()
local sAng = self.Entity:GetAngles()
return self.Entity:GetPos() - sAng:Right() * 4 + sAng:Up() * 48
end