master
AlmTech 5 years ago
parent 1a9b325174
commit 2d25c23b1e
  1. 10
      gamemode/engine/core/server/sv_player_spawning.lua
  2. 2
      gamemode/engine/derma/menus/menu_character.lua
  3. 3
      gamemode/engine/lib/server/sv_networking.lua
  4. 2
      gamemode/settings/sh_settings.lua
  5. 2
      gamemode/settings/sv_settings.lua

@ -9,8 +9,7 @@ hook.Add( "PlayerDeath", "Quantum_Player_SaveDeathPos", function( pl )
pl.deathpos = pl:GetPos()
end)
hook.Add( "PlayerSpawn", "Quantum_Player_Respawn", function( pl )
if( pl.isloaded && pl.deathpos ) then
local function getNearestSpawn( pl )
local spawnposdist = {}
for id, spawnpoint in pairs( Quantum.Server.Settings.SpawnLocations[ game.GetMap() ] ) do
spawnposdist[id] = { dist = spawnpoint.pos:Distance( pl.deathpos ), spawnpos = spawnpoint.pos, angle = spawnpoint.ang }
@ -30,6 +29,13 @@ hook.Add( "PlayerSpawn", "Quantum_Player_Respawn", function( pl )
spawnangle = spawn.angle
end
end
return spawnpos, spawnangle
end
hook.Add( "PlayerSpawn", "Quantum_Player_Respawn", function( pl )
if( pl.isloaded && pl.deathpos ) then
local spawnpos, spawnangle = getNearestSpawn( pl )
Quantum.Debug( "Respawning player at nearest spawnpoint." )
pl:SetPos( spawnpos )

@ -466,6 +466,7 @@ function menu.open( dt )
p.mdl:SetLookAt( eyepos )
end
if( table.Count( dt.cont ) < Quantum.CharacterLimit ) then
-- create char button
local cr = vgui.Create( "DButton", p )
cr:SetText("Create New Character")
@ -484,6 +485,7 @@ function menu.open( dt )
end
cr.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
end
if( selectedChar ) then
-- Delete char button

@ -64,11 +64,10 @@ local netfuncs = {
if( #args.name > 16 ) then
Quantum.Debug( "Player " .. tostring( pl ) .. " character name too long. Unable to create." )
return
elseif( pl.charcount + 1 > Quantum.Server.Settings.CharacterLimit ) then -- character limit
elseif( pl.charcount + 1 > Quantum.CharacterLimit ) then -- character limit
Quantum.Debug( "Player " .. tostring( pl ) .. " tried to exceed their character limit." )
return
end
print(pl.charcount + 1)
Quantum.Server.Char.Load( pl, pl.charcount + 1, args )
end,
enterWorldChar = function( pl, args )

@ -5,6 +5,8 @@
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
Quantum.CharacterLimit = 5
Quantum.Models = {
NPC = {},
Player = {

@ -7,8 +7,6 @@
Quantum.Server.Settings = {}
Quantum.Server.Settings.CharacterLimit = 5
Quantum.Server.Settings.VoiceChatRange = 400
Quantum.Server.Settings.MaxHealth = 100

Loading…
Cancel
Save