From 8da02e452688ef82e2bb9dda909dc36e0b3aaa2a Mon Sep 17 00:00:00 2001 From: Andrew McWatters Date: Wed, 11 May 2016 19:17:25 -0700 Subject: [PATCH] Code drop --- src/engine/client/camera.lua | 1 + src/engine/client/init.lua | 6 ++++++ src/engine/shared/baselib.lua | 6 ++---- src/engine/shared/entities/init.lua | 1 + src/engine/shared/entities/player.lua | 4 ++++ 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/engine/client/camera.lua b/src/engine/client/camera.lua index 39241132..c1465f42 100644 --- a/src/engine/client/camera.lua +++ b/src/engine/client/camera.lua @@ -138,6 +138,7 @@ function getZoom() end function resetZoom() + setZoom( 2 ) end function screenToWorld( x, y ) diff --git a/src/engine/client/init.lua b/src/engine/client/init.lua index 96343d32..55c115d3 100644 --- a/src/engine/client/init.lua +++ b/src/engine/client/init.lua @@ -94,6 +94,7 @@ function disconnect() -- Retrieve subsystems local entities = _G.entities local game = _G.game + local region = _G.region local engine = _G.engine -- Shutdown entities @@ -111,6 +112,11 @@ function disconnect() end end + -- Unload all regions + if ( region ) then + region.unloadAll() + end + -- Shutdown server engine interface if ( engine ) then if ( engine.server ) then diff --git a/src/engine/shared/baselib.lua b/src/engine/shared/baselib.lua index 73be994e..46f977e6 100644 --- a/src/engine/shared/baselib.lua +++ b/src/engine/shared/baselib.lua @@ -33,15 +33,13 @@ function type( object ) return rawtype( object ) end -local base = nil - function typeof( object, class ) if ( type( object ) == class ) then return true end - if ( rawtype( object ) == "table" and object.__base ) then - base = getbaseclass( object ) + if ( rawtype( object ) == "table" ) then + local base = getbaseclass( object ) while ( base ~= nil ) do if ( base.__type == class ) then return true diff --git a/src/engine/shared/entities/init.lua b/src/engine/shared/entities/init.lua index 707210db..386a0855 100644 --- a/src/engine/shared/entities/init.lua +++ b/src/engine/shared/entities/init.lua @@ -159,6 +159,7 @@ function shutdown() _G.entity.lastEntIndex = 0 if ( _G.player ) then + _G.player.removeAll() _G.player.lastPlayerId = 0 end diff --git a/src/engine/shared/entities/player.lua b/src/engine/shared/entities/player.lua index bb332724..f3d58145 100644 --- a/src/engine/shared/entities/player.lua +++ b/src/engine/shared/entities/player.lua @@ -59,6 +59,10 @@ function player.getInOrNearRegion( region ) return #t > 0 and t or nil end +function player.removeAll() + table.clear( player.players ) +end + function player:player() character.character( self )