Permalink
Browse files

Loading saves in singleplayer now restores position

And plays FANCY load sound
  • Loading branch information...
1 parent 3773572 commit 08f0e5f53757f26962db839bd22b75eb135510e7 @robotboy655 robotboy655 committed Apr 20, 2016
Showing with 6 additions and 6 deletions.
  1. +6 −6 garrysmod/gamemodes/sandbox/gamemode/save_load.lua
@@ -17,7 +17,7 @@ if ( SERVER ) then
ServerLog( "Player is saving too quickly! " .. tostring( ply ) .. "\n" )
- return end
+ return end
ply.m_NextSave = CurTime() + 10
@@ -45,7 +45,7 @@ if ( SERVER ) then
net.Start( "GModSave" )
net.WriteBool( i == parts )
net.WriteBool( ShowSave )
-
+
net.WriteUInt( size, 16 )
net.WriteData( compressed_save:sub( start + 1, endbyte + 1 ), size )
net.Send( ply )
@@ -59,12 +59,12 @@ if ( SERVER ) then
savedata = util.Decompress( savedata )
- if ( !isstring( savedata ) ) then
+ if ( !isstring( savedata ) ) then
MsgN( "gm_load: Couldn't load save!" )
return
end
- gmsave.LoadMap( savedata, nil )
+ gmsave.LoadMap( savedata, game.SinglePlayer() && Entity( 1 ) || nil )
end )
@@ -74,7 +74,7 @@ else
net.Receive( "GModSave", function( len, client )
local done = net.ReadBool()
local showsave = net.ReadBool()
-
+
local len = net.ReadUInt( 16 )
local data = net.ReadData( len )
@@ -86,7 +86,7 @@ else
local uncompressed = util.Decompress( buffer )
- if ( !uncompressed ) then
+ if ( !uncompressed ) then
MsgN( "Received save - but couldn't decompress!?" )
buffer = ""
return

0 comments on commit 08f0e5f

Please sign in to comment.