Permalink
Browse files

Camera duplicator fix

Fixes camera duplication issue ( See
http://www.youtube.com/watch?v=yRX_JKeSpRc )
  • Loading branch information...
1 parent a48fda2 commit 3686f7ef2263faf8644031bad56b16381fa4c94a @robotboy655 robotboy655 committed Jan 16, 2014
Showing with 8 additions and 13 deletions.
  1. +8 −13 garrysmod/gamemodes/sandbox/entities/weapons/gmod_tool/stools/camera.lua
@@ -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
ent:SetKey( key )
- ent.controlkey = key
+ ent.controlkey = key
+
+ for id, camera in pairs( ents.FindByClass( "gmod_cameraprop" ) ) do
+ if ( camera.controlkey && camera.controlkey == key ) then
+ camera:Remove()
+ end
+ end
end
ent:SetPlayer( ply )
-
ent.toggle = toggle
ent.locked = locked
-
ent:Spawn()
-
+
ent:SetTracking( NULL, Vector(0) )
ent:SetLocked( locked )
@@ -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

0 comments on commit 3686f7e

Please sign in to comment.