Permalink
Browse files

Fixed camera tool bug

I can't believe I did this mistake.
* Fixed being able to remove other peoples cameras with Camera Tool if
the key on both cameras is the same
* Fixed physics crash when unfreezing invalid physics objects
* Fixed a problem with new Get/SetVehicleClass functions
  • Loading branch information...
1 parent 2c0cef7 commit 411e9872a5b96364def66f02551ee03c9c4652e9 @robotboy655 robotboy655 committed Feb 15, 2015
@@ -132,7 +132,7 @@ function GM:HandlePlayerDriving( ply )
local pVehicle = ply:GetVehicle()
- if ( !pVehicle.HandleAnimation ) then
+ if ( !pVehicle.HandleAnimation && pVehicle.GetVehicleClass ) then
local c = pVehicle:GetVehicleClass()
local t = list.Get( "Vehicles" )[ c ]
if ( t && t.Members && t.Members.HandleAnimation ) then
@@ -119,7 +119,7 @@ function meta:UnfreezePhysicsObjects()
-- We can't directly test to see if EnableMotion is false right now
-- but IsMovable seems to do the job just fine.
-- We only test so the count isn't wrong
- if ( v.phys && !v.phys:IsMoveable() ) then
+ if ( IsValid( v.phys ) && !v.phys:IsMoveable() ) then
-- We need to freeze/unfreeze all physobj's in jeeps to stop it spazzing
if ( v.ent:GetClass() == "prop_vehicle_jeep" ) then
@@ -9,7 +9,7 @@ TOOL.ClientConVar[ "toggle" ] = "1"
cleanup.Register( "cameras" )
local function MakeCamera( ply, key, locked, toggle, Data )
-
+
local ent = ents.Create( "gmod_cameraprop" )
if ( !IsValid( ent ) ) then return end
@@ -18,9 +18,9 @@ local function MakeCamera( ply, key, locked, toggle, Data )
if ( key ) then
for id, camera in pairs( ents.FindByClass( "gmod_cameraprop" ) ) do
- if ( camera.controlkey && camera.controlkey == key ) then
- camera:Remove()
- end
+ if ( !camera.controlkey || camera.controlkey != key ) then continue end
+ if ( IsValid( ply ) && IsValid( camera:GetPlayer() ) && ply != camera:GetPlayer() ) then continue end
+ camera:Remove()
end
ent:SetKey( key )
@@ -70,7 +70,6 @@ function TOOL:LeftClick( trace )
local ply = self:GetOwner()
local locked = self:GetClientNumber( "locked" )
local toggle = self:GetClientNumber( "toggle" )
- local pid = ply:UniqueID()
local ent = MakeCamera( ply, key, locked, toggle, { Pos = trace.StartPos, Angle = ply:EyeAngles() } )

0 comments on commit 411e987

Please sign in to comment.