Permalink
Browse files

Fixed Trails Tool Undo

  • Loading branch information...
1 parent 2a2f269 commit 9aebac4e4551fcb8736af32bfc77090728882785 @robotboy655 robotboy655 committed Jan 19, 2014
Showing with 10 additions and 7 deletions.
  1. +10 −7 garrysmod/gamemodes/sandbox/entities/weapons/gmod_tool/stools/trails.lua
@@ -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
@@ -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

0 comments on commit 9aebac4

Please sign in to comment.