Skip to content

Commit

Permalink
Merge pull request #572 from robotboy655/emitter
Browse files Browse the repository at this point in the history
Tool fixes
  • Loading branch information
garrynewman committed Jan 21, 2014
2 parents 99ae118 + 9aebac4 commit ebdb94f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 27 deletions.
Expand Up @@ -74,13 +74,10 @@ function ENT:SetLocked( locked )
self.PhysgunDisabled = true
local phys = self:GetPhysicsObject()
if ( phys:IsValid() ) then
phys:EnableMotion( false )
end
self:SetMoveType( MOVETYPE_NONE )
self:SetSolid( SOLID_BBOX )
self:SetCollisionGroup( COLLISION_GROUP_WORLD )
else
Expand Down Expand Up @@ -217,7 +214,7 @@ end
function ENT:Draw()
if ( self.ShouldDraw == 0 ) then return end
if ( GetConVarNumber( "cl_drawcameras" ) == 0 ) then return end
-- Don't draw the camera if we're taking pics
local ply = LocalPlayer()
Expand Down
Expand Up @@ -14,27 +14,26 @@ local function MakeCamera( ply, key, locked, toggle, Data )

if ( !IsValid( ent ) ) then return end

if ( key && IsValid( ply ) && IsValid( ply[ "Camera"..key ] ) ) then
ply[ "Camera"..key ]:Remove();
ply[ "Camera"..key ] = nil
end

duplicator.DoGeneric( ent, Data )

if ( key ) then
for id, camera in pairs( ents.FindByClass( "gmod_cameraprop" ) ) do
if ( camera.controlkey && camera.controlkey == key ) then
camera:Remove()
end
end

ent:SetKey( key )
ent.controlkey = key
ent.controlkey = key
end

ent:SetPlayer( ply )


ent.toggle = toggle
ent.locked = locked


ent:Spawn()

ent:SetTracking( NULL, Vector(0) )
ent:SetLocked( locked )

Expand All @@ -54,10 +53,6 @@ local function MakeCamera( ply, key, locked, toggle, Data )

ply:AddCleanup( "cameras", ent )

if ( key ) then
ply[ "Camera"..key ] = ent
end

end

return ent
Expand Down
Expand Up @@ -110,7 +110,7 @@ if ( SERVER ) then
emitter:SetDelay( delay )
emitter:SetToggle( toggle )
emitter:SetOn( starton )
emitter:SetScale( scale )
emitter:SetScale( scale or 1 )

emitter:Spawn()

Expand Down
Expand Up @@ -17,7 +17,7 @@ cleanup.Register( "trails" )

local function SetTrails( Player, Entity, Data )

if ( Entity.SToolTrail ) then
if ( IsValid( Entity.SToolTrail ) ) then

Entity.SToolTrail:Remove()
Entity.SToolTrail = nil
Expand Down Expand Up @@ -96,14 +96,17 @@ function TOOL:LeftClick( trace )

end

local Trail = SetTrails( self:GetOwner(), trace.Entity, { Color = Color( r, g, b, a ),
Length = length,
StartSize = startsize,
EndSize = endsize,
Material = Mat } )
local Trail = SetTrails( self:GetOwner(), trace.Entity, {
Color = Color( r, g, b, a ),
Length = length,
StartSize = startsize,
EndSize = endsize,
Material = Mat
} )

undo.Create("Trail")
undo.AddEntity( Trail )
undo.SetPlayer( ply )
undo.SetPlayer( self:GetOwner() )
undo.Finish()

return true
Expand Down

0 comments on commit ebdb94f

Please sign in to comment.