UFO = {} UFO.settings = {} UFO.settings.TraceLength = 600 UFO.settings.UFOModel = "models/props_junk/wood_crate001a.mdl" UFO.settings.HoverSound = "npc/scanner/cbot_fly_loop.wav" UFO.settings.ShootSound = "npc/strider/fire.wav" UFO.settings.LaserCannonSound = { "ambient/levels/labs/electric_explosion2.wav", "ambient/levels/labs/electric_explosion3.wav", "ambient/levels/labs/electric_explosion4.wav" } --UFO.settings.UFONewMass = 30 UFO.settings.PushForce_Z_NEG = Vector(0,0,-410) UFO.settings.PushForce_Z_POS = Vector(0,0,410) UFO.settings.PushForce_Y_NEG = Vector(0,-410,0) UFO.settings.PushForce_Y_POS = Vector(0,410,0) UFO.settings.PushForce_X_NEG = Vector(-410,0,0) UFO.settings.PushForce_X_POS = Vector(410,0,0) UFO.settings.TorqueForce = Vector(0,0,9999) UFO.EntInfo = {} UFO.EntInfo.Ents = {} UFO.EntInfo.Ents.EntID = 0 UFO.EntInfo.Ents.IsShooting = false UFO.EntInfo.Ents.CurrentDirection = 0 UFO.EntInfo.Ents.UOwner = 0 UFO.Debug = {} --------- Bugs begin here :< function UFO:Spawn(ply) ply = player.GetByID(ply) local UFOE = ents.Create( "prop_physics" ) if ( not UFOE:IsValid() ) then return end local vStart = ply:GetShootPos() local vForward = ply:GetAimVector() local trace = {} trace.start = vStart trace.endpos = vStart + (vForward * 2048) trace.filter = ply local tr = util.TraceLine( trace ) UFOE:SetModel(UFO.settings.UFOModel) UFOE:SetPos(tr.HitPos) UFOE:Spawn() UFOE:Activate() local UFOID = UFOE:EntIndex() undo.Create("UFO") undo.AddEntity(UFOE) undo.SetPlayer(ply) undo.Finish() --[[ table.insert(UFO.EntInfo.Ents.EntID,UFOID) table.insert(UFO.EntInfo.Ents.IsShooting,false) table.insert(UFO.EntInfo.Ents.CurrentDirection,1) table.insert(UFO.EntInfo.Ents.UOwner,ply) ]] NewID = table.getn(UFO.EntInfo.Ents) + 1 UFO.EntInfo.Ents[NewID].EntID = UFOID UFO.EntInfo.Ents[NewID].IsShooting = false UFO.EntInfo.Ents[NewID].CurrentDirection = nil UFO.EntInfo.Ents[NewID].Owner = ply -- assert(NewID,"EEEP! 8") return UFOID end