Skip to content

Commit

Permalink
Fixed #25
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmcwatters committed May 22, 2015
1 parent 0cee7a1 commit d65028f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 57 deletions.
17 changes: 17 additions & 0 deletions src/engine/server/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local concommand = concommand
local convar = convar
local debug = debug
local getmetatable = getmetatable
local ipairs = ipairs
local filesystem = filesystem
local network = engine.server.network
_G.networkserver = network
Expand Down Expand Up @@ -201,11 +202,27 @@ if ( _AXIS ) then
end
end

local function sendEntities( player )
local entities = _G.entity.getAll()
for i, v in ipairs( entities ) do
if ( v ~= player ) then
local payload = payload( "entitySpawned" )
payload:set( "classname", v:getClassname() )
payload:set( "entIndex", v.entIndex )
payload:set( "networkVars", v:getNetworkVarTypeLenValues() )
player:send( payload )
end
end
end

local function onReceiveClientInfo( payload )
local player = payload:getPlayer()
local viewportWidth = payload:get( "viewportWidth" )
local viewportHeight = payload:get( "viewportHeight" )
player:setViewportSize( viewportWidth, viewportHeight )

sendEntities( player )

player:initialSpawn()
end

Expand Down
14 changes: 0 additions & 14 deletions src/engine/shared/entities/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -242,20 +242,6 @@ end

function player:onConnect()
require( "engine.shared.hook" )

if ( _SERVER ) then
local entities = entity.getAll()
for i, v in ipairs( entities ) do
if ( v ~= self ) then
local payload = payload( "entitySpawned" )
payload:set( "classname", v:getClassname() )
payload:set( "entIndex", v.entIndex )
payload:set( "networkVars", v:getNetworkVarTypeLenValues() )
self:send( payload )
end
end
end

game.call( "shared", "onPlayerConnect", self )
end

Expand Down
45 changes: 2 additions & 43 deletions src/game/client/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
--============================================================================--

require( "engine.client.camera" )
-- require( "shaders.gaussianblur" )

local camera = camera
local gui = gui
Expand All @@ -18,45 +17,20 @@ local _G = _G
module( "game.client" )

function createDefaultPanels()
-- Initialize region title
-- local hudregiontitle = gui.hudregiontitle( _G.g_Viewport )
-- hudregiontitle:activate()

local hudnametags = gui.hudnametags( _G.g_Viewport )

-- Initialize move indicator
local hudmoveindicator = gui.hudmoveindicator( _G.g_Viewport )

-- Initialize chat
-- local hudchat = gui.hudchat( _G.g_Viewport )
-- _G.g_HudChat = hudchat
end

function draw()
if ( not playerInitialized ) then
return
end

-- if ( not blur ) then
-- blur = shader.getShader( "gaussianblur" )
-- blurSigma = 0
-- end
--
-- if ( blurSigma > 0 ) then
-- blur:draw( function()
-- region.drawWorld()
-- _G.entity.drawAll()
-- end )
-- else
region.drawWorld()
_G.entity.drawAll()
-- end
region.drawWorld()
_G.entity.drawAll()
end

function load( arg )
-- blur = shader.getShader( "gaussianblur" )
-- blurSigma = 0

_G.g_Viewport = gui.viewport( _G.g_RootPanel )
_G.g_DebugOverlay = gui.debugoverlaypanel( _G.g_Viewport )
end
Expand All @@ -65,11 +39,9 @@ function onAxisSignin()
end

function onMainMenuActivate()
-- drawBlur = true
end

function onMainMenuClose()
-- drawBlur = false
end

function quit()
Expand All @@ -85,17 +57,4 @@ end
shutdown = quit

function update( dt )
-- if ( drawBlur and blurSigma <= 18 ) then
-- blurSigma = blurSigma + 3
-- if ( blurSigma > 18 ) then
-- blurSigma = 18
-- end
-- blur:set( "sigma", blurSigma )
-- elseif ( blurSigma > 0 ) then
-- blurSigma = blurSigma - 3
-- if ( blurSigma < 0 ) then
-- blurSigma = 0
-- end
-- blur:set( "sigma", blurSigma )
-- end
end

0 comments on commit d65028f

Please # to comment.