Finished intro cinematic & added main menu

master
AlmTech Software 5 years ago
parent e08205fb05
commit 546a1beaf8
  1. 78
      gamemode/cl_init.lua
  2. 64
      gamemode/engine/core/client/cl_fonts.lua
  3. 8
      gamemode/engine/core/client/cl_sounds.lua
  4. 58
      gamemode/engine/core/server/sv_player_damage.lua
  5. 42
      gamemode/engine/core/server/sv_player_init.lua
  6. 52
      gamemode/engine/core/server/sv_player_spawning.lua
  7. 2
      gamemode/engine/core/server/sv_player_voice.lua
  8. 29
      gamemode/engine/core/sh_player_binds.lua
  9. 36
      gamemode/engine/derma/cl_menu.lua
  10. 110
      gamemode/engine/derma/lib/cl_menu_dialogueBox.lua
  11. 78
      gamemode/engine/derma/lib/cl_menu_pages.lua
  12. 115
      gamemode/engine/derma/lib/cl_menu_theme.lua
  13. 8
      gamemode/engine/derma/lib/cl_network.lua
  14. 826
      gamemode/engine/derma/menus/menu_character.lua
  15. 250
      gamemode/engine/derma/menus/menu_intro.lua
  16. 77
      gamemode/engine/derma/menus/menu_main.lua
  17. 85
      gamemode/engine/lib/client/cl_cinematic.lua
  18. 140
      gamemode/engine/lib/server/sv_character.lua
  19. 40
      gamemode/engine/lib/server/sv_inventory.lua
  20. 2
      gamemode/engine/lib/server/sv_networking.lua
  21. 16
      gamemode/engine/lib/server/sv_openmenu.lua
  22. 22
      gamemode/engine/lib/sh_items.lua
  23. 20
      gamemode/engine/sh_debug.lua
  24. 190
      gamemode/init.lua
  25. 86
      gamemode/settings/sh_settings.lua
  26. 60
      gamemode/settings/sv_settings.lua

@ -6,56 +6,56 @@
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
if CLIENT then
include( "shared.lua" )
--local gmfolder = GAMEMODE.FolderName || GM.FolderName
Quantum.Client = {}
Quantum.Client.Cache = {}
Quantum.Client.ResolutionScale = ScrH() / 1080
Quantum.Client.ServerBannerPath = "gamemodes/" .. GM.FolderName .. "/gamemode/content/materials/quantum/server_banner.png"
local function loadCoreFiles()
local fol = GM.FolderName .. "/gamemode/engine/core/"
local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" )
for _, file in pairs( shFiles ) do
include( "shared.lua" )
--local gmfolder = GAMEMODE.FolderName || GM.FolderName
Quantum.Client = {}
Quantum.Client.Cache = {}
Quantum.Client.ResolutionScale = ScrH() / 1080
Quantum.Client.ServerBannerPath = "gamemodes/" .. GM.FolderName .. "/gamemode/content/materials/quantum/server_banner.png"
local function loadCoreFiles()
local fol = GM.FolderName .. "/gamemode/engine/core/"
local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" )
for _, file in pairs( shFiles ) do
include( fol .. file )
end
end
local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" )
for _, file in pairs( clFiles ) do
include( fol .. "client/" .. file )
end
end
local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" )
for _, file in pairs( clFiles ) do
include( fol .. "client/" .. file )
end
end
local function loadLibFiles()
local fol = GM.FolderName .. "/gamemode/engine/lib/"
local function loadLibFiles()
local fol = GM.FolderName .. "/gamemode/engine/lib/"
local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" )
for _, file in pairs( shFiles ) do
local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" )
for _, file in pairs( shFiles ) do
AddCSLuaFile( fol .. file )
include( fol .. file )
end
end
local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" )
for _, file in pairs( clFiles ) do
include( fol .. "client/" .. file )
end
end
local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" )
for _, file in pairs( clFiles ) do
include( fol .. "client/" .. file )
end
end
local function loadAllDermaMenus()
local fol = GM.FolderName .. "/gamemode/engine/derma/"
include( fol .. "cl_menu.lua" )
end
local function loadAllDermaMenus()
local fol = GM.FolderName .. "/gamemode/engine/derma/"
include( fol .. "cl_menu.lua" )
end
function Quantum.Client.Load()
function Quantum.Client.Load()
local fol = GM.FolderName .. "/gamemode/engine/core/"
loadCoreFiles()
loadLibFiles()
loadAllDermaMenus()
loadCoreFiles()
loadLibFiles()
loadAllDermaMenus()
Quantum.Debug( "Loaded all files." )
end
Quantum.Debug( "Loaded all files." )
end
Quantum.Client.Load()
Quantum.Client.Load()
end

@ -6,63 +6,63 @@
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
surface.CreateFont( "q_HUD", {
font = "Arial",
size = 30 * Quantum.Client.ResolutionScale,
antialias = true,
outline = true
font = "Arial",
size = 30 * Quantum.Client.ResolutionScale,
antialias = true,
outline = true
})
surface.CreateFont( "q_text", {
font = "Arial",
size = 22 * Quantum.Client.ResolutionScale,
antialias = true
font = "Arial",
size = 22 * Quantum.Client.ResolutionScale,
antialias = true
})
surface.CreateFont( "q_text2", {
font = "Arial",
size = 26 * Quantum.Client.ResolutionScale,
antialias = true
font = "Arial",
size = 26 * Quantum.Client.ResolutionScale,
antialias = true
})
surface.CreateFont( "q_button", {
font = "Arial",
size = 27 * Quantum.Client.ResolutionScale,
antialias = true
font = "Arial",
size = 27 * Quantum.Client.ResolutionScale,
antialias = true
})
surface.CreateFont( "q_button_m", {
font = "Arial",
size = 30 * Quantum.Client.ResolutionScale,
antialias = true
font = "Arial",
size = 30 * Quantum.Client.ResolutionScale,
antialias = true
})
surface.CreateFont( "q_button2", {
font = "Arial",
size = 35 * Quantum.Client.ResolutionScale,
antialias = true
font = "Arial",
size = 35 * Quantum.Client.ResolutionScale,
antialias = true
})
surface.CreateFont( "q_charNameText", {
font = "Arial",
outline = true,
size = 28 * Quantum.Client.ResolutionScale,
antialias = true
font = "Arial",
outline = true,
size = 28 * Quantum.Client.ResolutionScale,
antialias = true
})
surface.CreateFont( "q_info", {
font = "Arial",
size = 30 * Quantum.Client.ResolutionScale,
antialias = true
font = "Arial",
size = 30 * Quantum.Client.ResolutionScale,
antialias = true
})
surface.CreateFont( "q_header", {
font = "Constantia Bold Italic",
size = 50 * Quantum.Client.ResolutionScale,
antialias = true
font = "Constantia Bold Italic",
size = 50 * Quantum.Client.ResolutionScale,
antialias = true
})
surface.CreateFont( "q_header_s", {
font = "Constantia Bold Italic",
size = 42 * Quantum.Client.ResolutionScale,
antialias = true
font = "Constantia Bold Italic",
size = 42 * Quantum.Client.ResolutionScale,
antialias = true
})

@ -6,8 +6,8 @@
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
sound.Add( {
name = "Quantum_Music_TriangeAtDawn",
channel = CHAN_STATIC,
volume = 0.75,
sound = "music/HL2_song23_SuitSong3.mp3"
name = "Quantum_Music_TriangeAtDawn",
channel = CHAN_STATIC,
volume = 0.75,
sound = "music/HL2_song23_SuitSong3.mp3"
} )

@ -6,52 +6,52 @@
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
local damagescales = {
[HITGROUP_HEAD] = Quantum.Server.Settings.DamageScale[HITGROUP_HEAD],
[HITGROUP_CHEST] = Quantum.Server.Settings.DamageScale[HITGROUP_CHEST],
[HITGROUP_STOMACH] = Quantum.Server.Settings.DamageScale[HITGROUP_STOMACH],
[HITGROUP_LEFTARM] = Quantum.Server.Settings.DamageScale[HITGROUP_LEFTARM],
[HITGROUP_RIGHTARM] = Quantum.Server.Settings.DamageScale[HITGROUP_RIGHTARM],
[HITGROUP_LEFTLEG] = Quantum.Server.Settings.DamageScale[HITGROUP_LEFTLEG],
[HITGROUP_RIGHTLEG] = Quantum.Server.Settings.DamageScale[HITGROUP_RIGHTLEG]
[HITGROUP_HEAD] = Quantum.Server.Settings.DamageScale[HITGROUP_HEAD],
[HITGROUP_CHEST] = Quantum.Server.Settings.DamageScale[HITGROUP_CHEST],
[HITGROUP_STOMACH] = Quantum.Server.Settings.DamageScale[HITGROUP_STOMACH],
[HITGROUP_LEFTARM] = Quantum.Server.Settings.DamageScale[HITGROUP_LEFTARM],
[HITGROUP_RIGHTARM] = Quantum.Server.Settings.DamageScale[HITGROUP_RIGHTARM],
[HITGROUP_LEFTLEG] = Quantum.Server.Settings.DamageScale[HITGROUP_LEFTLEG],
[HITGROUP_RIGHTLEG] = Quantum.Server.Settings.DamageScale[HITGROUP_RIGHTLEG]
}
function GM:ScalePlayerDamage( pl, hitgroup, dmginfo ) -- This is used for getting shot etc
if( damagescales[hitgroup] ~= nil ) then dmginfo:ScaleDamage( damagescales[hitgroup] ) end
Quantum.Debug( tostring(pl) .. " got damaged ( " .. tostring(hitgroup) .. " : " .. tostring( math.Round( dmginfo:GetDamage() ) ) .. " )" )
if( damagescales[hitgroup] ~= nil ) then dmginfo:ScaleDamage( damagescales[hitgroup] ) end
Quantum.Debug( tostring(pl) .. " got damaged ( " .. tostring(hitgroup) .. " : " .. tostring( math.Round( dmginfo:GetDamage() ) ) .. " )" )
end
function GM:GetFallDamage( pl, vel )
Quantum.Debug( tostring(pl) .. " got damaged ( Fall Damage : " .. tostring( math.Round( vel / 8 ) ) .. " )" )
return vel / 8 -- Makes the player take more "realistic" fall damage
Quantum.Debug( tostring(pl) .. " got damaged ( Fall Damage : " .. tostring( math.Round( vel / 8 ) ) .. " )" )
return vel / 8 -- Makes the player take more "realistic" fall damage
end
function GM:PlayerDeathSound() return true end
hook.Add( "EntityTakeDamage", "Quantum_PlayerDamage_SoundEffect", function( pl, dmginfo )
if( pl:IsPlayer() && dmginfo:GetDamage() >= 25 ) then
local soundlist = {
pain = Quantum.Server.Settings.PainSounds.Male, -- replace later with correct gender for the playermodel/character
idlepain = Quantum.Server.Settings.IdlePainSounds.Male -- same for this one
}
pl:EmitSound( Quantum.Server.Settings.PainSounds.Male[ math.random( 1, #Quantum.Server.Settings.PainSounds.Male ) ] )
if( pl:IsPlayer() && dmginfo:GetDamage() >= 25 ) then
local soundlist = {
pain = Quantum.Server.Settings.PainSounds.Male, -- replace later with correct gender for the playermodel/character
idlepain = Quantum.Server.Settings.IdlePainSounds.Male -- same for this one
}
pl:EmitSound( Quantum.Server.Settings.PainSounds.Male[ math.random( 1, #Quantum.Server.Settings.PainSounds.Male ) ] )
if( timer.Exists( "Quantum_PlayerHurtSounds_" .. tostring( pl ) ) ) then timer.Remove( "Quantum_PlayerHurtSounds_" .. tostring( pl ) ) end -- if it already exists remove it
timer.Create( "Quantum_PlayerHurtSounds_" .. tostring( pl ), 4, 0, function()
if( timer.Exists( "Quantum_PlayerHurtSounds_" .. tostring( pl ) ) ) then timer.Remove( "Quantum_PlayerHurtSounds_" .. tostring( pl ) ) end -- if it already exists remove it
timer.Create( "Quantum_PlayerHurtSounds_" .. tostring( pl ), 4, 0, function()
local rannum = math.random( 0, 100 )
if( rannum >= Quantum.Server.Settings.DamageHurtSoundRepeatChance ) then -- Make the player "moan" for a while when hurt
pl:EmitSound( Quantum.Server.Settings.IdlePainSounds.Male[ math.random( 1, #Quantum.Server.Settings.IdlePainSounds.Male ) ] )
end
local rannum = math.random( 0, 100 )
if( rannum >= Quantum.Server.Settings.DamageHurtSoundRepeatChance ) then -- Make the player "moan" for a while when hurt
pl:EmitSound( Quantum.Server.Settings.IdlePainSounds.Male[ math.random( 1, #Quantum.Server.Settings.IdlePainSounds.Male ) ] )
end
end)
end)
timer.Simple( 60, function()
timer.Remove( "Quantum_PlayerHurtSounds_" .. tostring( pl ) ) -- remove the timer for the player
end)
timer.Simple( 60, function()
timer.Remove( "Quantum_PlayerHurtSounds_" .. tostring( pl ) ) -- remove the timer for the player
end)
end
end
end)
hook.Add( "PlayerDeath", "Quantum_PlayerDamage_RemoveIdleSounds", function( pl )
if( timer.Exists( "Quantum_PlayerHurtSounds_" .. tostring( pl ) ) ) then timer.Remove( "Quantum_PlayerHurtSounds_" .. tostring( pl ) ) end
if( timer.Exists( "Quantum_PlayerHurtSounds_" .. tostring( pl ) ) ) then timer.Remove( "Quantum_PlayerHurtSounds_" .. tostring( pl ) ) end
end)

@ -10,33 +10,33 @@ Quantum.Server.Player = {}
local ply = FindMetaTable( "Player" )
function GM:PlayerInitialSpawn( ply )
ply.isloaded = false -- REMOVE THIS WHEN MYSQL DB IS ADDED
ply.cache = {}
-- load in all of the players characters and stuff from the MySQL DB
ply.isloaded = false -- REMOVE THIS WHEN MYSQL DB IS ADDED
ply.cache = {}
-- load in all of the players characters and stuff from the MySQL DB
end
local function setUpPlayer( ply )
if( ply:GetModel() ~= nil ) then
ply:SetupHands()
else
Quantum.Error( tostring(ply) .. " doesn't have a valid model. Unable to set up hands!" )
end
local char = Quantum.Server.Char.GetCurrentCharacter( ply )
local charnametxt = " spawned."
if( char ~= nil ) then
charnametxt = " spawned as '" .. char.name .. "'."
end
Quantum.Debug( tostring( ply ) .. charnametxt )
if( ply:GetModel() ~= nil ) then
ply:SetupHands()
else
Quantum.Error( tostring(ply) .. " doesn't have a valid model. Unable to set up hands!" )
end
local char = Quantum.Server.Char.GetCurrentCharacter( ply )
local charnametxt = " spawned."
if( char ~= nil ) then
charnametxt = " spawned as '" .. char.name .. "'."
end
Quantum.Debug( tostring( ply ) .. charnametxt )
end
function GM:PlayerSpawn( ply )
if( ply.isloaded ) then -- replace logic ( reversed )
ply:Spectate( OBS_MODE_FIXED )
Quantum.Net.OpenMenu( ply, "character", Quantum.Server.Char.GetPlayerChars( ply ) )
else
ply:UnSpectate()
setUpPlayer( ply )
end
if( ply.isloaded ) then -- replace logic ( reversed )
ply:Spectate( OBS_MODE_FIXED )
Quantum.Net.OpenMenu( ply, "character", Quantum.Server.Char.GetPlayerChars( ply ) )
else
ply:UnSpectate()
setUpPlayer( ply )
end
end

@ -6,39 +6,39 @@
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
hook.Add( "PlayerDeath", "Quantum_Player_SaveDeathPos", function( pl )
pl.deathpos = pl:GetPos()
pl.deathpos = pl:GetPos()
end)
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 }
end
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 }
end
local maxdist, spawnpos, spawnangle
for id, spawn in pairs( spawnposdist ) do -- Loop through everything and pick the nearest spawnpoint
if( maxdist ~= nil ) then
if( maxdist >= spawn.dist ) then
maxdist = spawn.dist
spawnpos = spawn.spawnpos
spawnangle = spawn.angle
end
else
maxdist = spawn.dist
spawnpos = spawn.spawnpos
spawnangle = spawn.angle
end
end
return spawnpos, spawnangle
local maxdist, spawnpos, spawnangle
for id, spawn in pairs( spawnposdist ) do -- Loop through everything and pick the nearest spawnpoint
if( maxdist ~= nil ) then
if( maxdist >= spawn.dist ) then
maxdist = spawn.dist
spawnpos = spawn.spawnpos
spawnangle = spawn.angle
end
else
maxdist = spawn.dist
spawnpos = spawn.spawnpos
spawnangle = spawn.angle
end
end
return spawnpos, spawnangle
end
hook.Add( "PlayerSpawn", "Quantum_Player_Respawn", function( pl )
if( pl.isloaded && pl.deathpos ) then
if( pl.isloaded && pl.deathpos ) then
local spawnpos, spawnangle = getNearestSpawn( pl )
local spawnpos, spawnangle = getNearestSpawn( pl )
Quantum.Debug( "Respawning player at nearest spawnpoint." )
pl:SetPos( spawnpos )
pl:SetAngles( spawnangle )
end
Quantum.Debug( "Respawning player at nearest spawnpoint." )
pl:SetPos( spawnpos )
pl:SetAngles( spawnangle )
end
end)

@ -6,5 +6,5 @@
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
function GM:PlayerCanHearPlayersVoice( lis, talk )
if( lis:GetPos():Distance( talk:GetPos() ) > Quantum.Server.Settings.VoiceChatRange ) then return false, true end
if( lis:GetPos():Distance( talk:GetPos() ) > Quantum.Server.Settings.VoiceChatRange ) then return false, true end
end

@ -8,22 +8,19 @@
if SERVER then
local keyfuncs = {
[IN_USE] = function( pl )
Quantum.Debug( tostring( pl ) .. " pressed IN_USE" )
end,
["openCharMenu"] = function( pl )
Quantum.Net.OpenMenu( pl, "character", Quantum.Server.Char.GetPlayerChars_cl( pl ) )
end,
["introTest"] = function( pl )
Quantum.Net.OpenMenu( pl, "intro", Quantum.Server.Char.GetPlayerChars_cl( pl ) )
end
}
local keyfuncs = {
["openCharMenu"] = function( pl )
Quantum.Net.OpenMenu( pl, "character", Quantum.Server.Char.GetPlayerChars_cl( pl ) )
end,
["mainMenu"] = function( pl )
Quantum.Net.OpenMenu( pl, "main", Quantum.Server.Char.GetPlayerChars_cl( pl ) )
end
}
function GM:KeyRelease( ply, key )
if( keyfuncs[key] ) then keyfuncs[key]( ply ) end
end
function GM:ShowHelp( ply ) keyfuncs["openCharMenu"]( ply ) end
function GM:ShowTeam( ply ) keyfuncs["introTest"]( ply ) end
function GM:KeyRelease( ply, key )
if( keyfuncs[key] ) then keyfuncs[key]( ply ) end
end
function GM:ShowHelp( ply ) keyfuncs["openCharMenu"]( ply ) end
function GM:ShowTeam( ply ) keyfuncs["mainMenu"]( ply ) end
end

@ -7,28 +7,28 @@
Quantum.Client.Menu = {}
local libs = {
["net"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_network.lua",
["page"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_menu_pages.lua",
["theme"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_menu_theme.lua",
["dialogue"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_menu_dialogueBox.lua"
["net"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_network.lua",
["page"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_menu_pages.lua",
["theme"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_menu_theme.lua",
["dialogue"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_menu_dialogueBox.lua"
}
Quantum.Client.Menu.GetAPI = function( lib ) return include( libs[lib] ) end
net.Receive( "quantum_menu_net", function( len, pl )
local dt = net.ReadTable()
if( Quantum.Client.Cache[dt.id] ~= nil && #Quantum.Client.Cache[dt.id] >= 1 ) then
table.Merge( Quantum.Client.Cache[dt.id], dt )
else
Quantum.Client.Cache[dt.id] = dt || { id = dt.id }
end
local dt = net.ReadTable()
if( Quantum.Client.Cache[dt.id] ~= nil && #Quantum.Client.Cache[dt.id] >= 1 ) then
table.Merge( Quantum.Client.Cache[dt.id], dt )
else
Quantum.Client.Cache[dt.id] = dt || { id = dt.id }
end
if( Quantum.Client.EnableDebug ) then -- debug
Quantum.Debug( "Datatable size: " .. len .. "b (" .. len/8 .. "B)" )
Quantum.Debug( "--Datatable contents--")
PrintTable( dt )
Quantum.Debug( "--End of datatable contens--" )
end
if( Quantum.Client.EnableDebug ) then -- debug
Quantum.Debug( "Datatable size: " .. len .. "b (" .. len/8 .. "B)" )
Quantum.Debug( "--Datatable contents--")
PrintTable( dt )
Quantum.Debug( "--End of datatable contens--" )
end
local menu = include( GAMEMODE.FolderName .. "/gamemode/engine/derma/menus/menu_" .. dt.id .. ".lua" )
menu.open( dt )
local menu = include( GAMEMODE.FolderName .. "/gamemode/engine/derma/menus/menu_" .. dt.id .. ".lua" )
menu.open( dt )
end)

@ -13,69 +13,69 @@ local padding_s = 4 * scale
local theme = Quantum.Client.Menu.GetAPI( "theme" )
function log.createinfobox( logdata, parent )
local fw, fh = parent:GetSize()
local logtitle = logdata[1].title
local logtext = logdata[1].text
local fw, fh = parent:GetSize()
local logtitle = logdata[1].title
local logtext = logdata[1].text
local box = vgui.Create( "DPanel", parent )
box:SetSize( 775 * scale, 200 * scale )
box.Paint = function( self ) theme.sharpblurpanel( self ) end
box.w, box.h = box:GetSize()
box:SetPos( fw/2 - box.w/2, fh*0.8 - box.h/2 )
box.x, box.y = box:GetPos()
local box = vgui.Create( "DPanel", parent )
box:SetSize( 775 * scale, 200 * scale )
box.Paint = function( self ) theme.sharpblurpanel( self ) end
box.w, box.h = box:GetSize()
box:SetPos( fw/2 - box.w/2, fh*0.8 - box.h/2 )
box.x, box.y = box:GetPos()
local header = vgui.Create( "DLabel", parent )
header:SetFont( "q_header_s" )
header:SetTextColor( Color( 255, 255, 255, 220 ) )
header:SizeToContents()
header.w, header.h = header:GetSize()
header:SetPos( box.x, ( box.y - header.h ) - padding/2 )
header.Think = function( self )
if( logdata[Quantum.Client.Cam.Temp.scene_index] ~= nil ) then
if( logdata[Quantum.Client.Cam.Temp.scene_index].title ~= nil ) then
self:SetVisible( true )
self:SetText( logdata[Quantum.Client.Cam.Temp.scene_index].title )
surface.SetFont( self:GetFont() )
local tw, th = surface.GetTextSize( self:GetText() )
self:SetSize( tw * 1.1, th * 1.1 )
end
end
end
header.Paint = function( self )
theme.sharpblurpanel( self )
end
header:SetContentAlignment( 5 )
local header = vgui.Create( "DLabel", parent )
header:SetFont( "q_header_s" )
header:SetTextColor( Color( 255, 255, 255, 220 ) )
header:SizeToContents()
header.w, header.h = header:GetSize()
header:SetPos( box.x, ( box.y - header.h ) - padding/2 )
header.Think = function( self )
if( logdata[Quantum.Client.Cam.Temp.scene_index] ~= nil ) then
if( logdata[Quantum.Client.Cam.Temp.scene_index].title ~= nil ) then
self:SetVisible( true )
self:SetText( logdata[Quantum.Client.Cam.Temp.scene_index].title )
surface.SetFont( self:GetFont() )
local tw, th = surface.GetTextSize( self:GetText() )
self:SetSize( tw * 1.1, th * 1.1 )
end
end
end
header.Paint = function( self )
theme.sharpblurpanel( self )
end
header:SetContentAlignment( 5 )
local scroll = vgui.Create( "DScrollPanel", box )
scroll:SetSize( box:GetSize() )
scroll.Paint = function( self ) end
local sb = scroll:GetVBar()
sb.Paint = function( self ) end
function sb.btnGrip:Paint()
theme.button( self, Color( 0, 0, 0, 0 ) )
end
sb.btnUp:SetSize(0,0)
sb.btnDown:SetSize(0,0)
scroll.w, scroll.h = scroll:GetSize()
local scroll = vgui.Create( "DScrollPanel", box )
scroll:SetSize( box:GetSize() )
scroll.Paint = function( self ) end
local sb = scroll:GetVBar()
sb.Paint = function( self ) end
function sb.btnGrip:Paint()
theme.button( self, Color( 0, 0, 0, 0 ) )
end
sb.btnUp:SetSize(0,0)
sb.btnDown:SetSize(0,0)
scroll.w, scroll.h = scroll:GetSize()
local text = vgui.Create( "DLabel", scroll )
text:SetText( logtext )
text:SetFont( "q_info" )
text:SetTextColor( Color( 240, 240, 240, 255 ) )
text:SetSize( scroll.w * 0.95, scroll.h * 0.95 )
text:SetWrap( true )
local text = vgui.Create( "DLabel", scroll )
text:SetText( logtext )
text:SetFont( "q_info" )
text:SetTextColor( Color( 240, 240, 240, 255 ) )
text:SetSize( scroll.w * 0.95, scroll.h * 0.95 )
text:SetWrap( true )
text.w, text.h = text:GetSize()
text.w, text.h = text:GetSize()
text:SetPos( scroll.w/2 - text.w/2, 0 )
text:SetPos( scroll.w/2 - text.w/2, 0 )
text.Think = function( self )
if( logdata[Quantum.Client.Cam.Temp.scene_index] ~= nil ) then
self:SetText( logdata[Quantum.Client.Cam.Temp.scene_index].text )
end
end
text.Think = function( self )
if( logdata[Quantum.Client.Cam.Temp.scene_index] ~= nil ) then
self:SetText( logdata[Quantum.Client.Cam.Temp.scene_index].text )
end
end
return box
return box
end
return log

@ -14,45 +14,45 @@ local theme = Quantum.Client.Menu.GetAPI( "theme" )
function page.New( parent, args )
-- check the vars
args.w, args.h = parent:GetSize()
args.x, args.y = 0, 0
args.closeW = args.closeW || 90 * scale
args.closeH = args.closeH || 20 * scale
args.closeX = args.closeX || padding
args.closeY = args.closeY || padding
--
local p = vgui.Create( "DPanel", parent )
p.w, p.h = args.w, args.h
p.x, p.y = args.x, args.y
p:SetSize( p.w, p.h )
p:SetPos( p.x, p.y )
p.Paint = args.Paint || function( self, w, h )
-- Draw nothing, unless this function is overwritten
end
p.OnClose = args.OnClose || function() end
local close = vgui.Create( "DButton", p )
close:SetText( args.CloseButtonText || "Close" )
close:SetTextColor( args.CloseButtonTextColor || Color( 0, 0, 0, 255 ) )
close:SetFont( args.CloseButtonFont || "q_text" )
--close:SetSize( args.closeW, args.closeH )
close:SizeToContents()
local closeW, closeH = close:GetSize()
close:SetSize( closeW + padding*2, closeH )
close:SetPos( args.closeX, args.closeY )
close.DoClick = function()
surface.PlaySound( "UI/buttonclick.wav" )
p:Remove()
end
close.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
close.Paint = args.CloseButtonPaint || function( self, w, h )
theme.sharpbutton( self )
end
return p, close
-- check the vars
args.w, args.h = parent:GetSize()
args.x, args.y = 0, 0
args.closeW = args.closeW || 90 * scale
args.closeH = args.closeH || 20 * scale
args.closeX = args.closeX || padding
args.closeY = args.closeY || padding
--
local p = vgui.Create( "DPanel", parent )
p.w, p.h = args.w, args.h
p.x, p.y = args.x, args.y
p:SetSize( p.w, p.h )
p:SetPos( p.x, p.y )
p.Paint = args.Paint || function( self, w, h )
-- Draw nothing, unless this function is overwritten
end
p.OnClose = args.OnClose || function() end
local close = vgui.Create( "DButton", p )
close:SetText( args.CloseButtonText || "Close" )
close:SetTextColor( args.CloseButtonTextColor || Color( 0, 0, 0, 255 ) )
close:SetFont( args.CloseButtonFont || "q_text" )
--close:SetSize( args.closeW, args.closeH )
close:SizeToContents()
local closeW, closeH = close:GetSize()
close:SetSize( closeW + padding*2, closeH )
close:SetPos( args.closeX, args.closeY )
close.DoClick = function()
surface.PlaySound( "UI/buttonclick.wav" )
p:Remove()
end
close.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
close.Paint = args.CloseButtonPaint || function( self, w, h )
theme.sharpbutton( self )
end
return p, close
end
return page

@ -12,8 +12,9 @@ local padding_s = math.Round( 4 * scale )
local blur = Material("pp/blurscreen")
local function renderBlur( p, a, d )
local x, y = p:LocalToScreen( 0, 0 )
function theme.renderblur( p, a, d )
local x, y = p:LocalToScreen( 0, 0 )
surface.SetDrawColor( 255, 255, 255 )
surface.SetMaterial( blur )
@ -26,87 +27,87 @@ local function renderBlur( p, a, d )
end
function theme.borderpanel( p, color )
local w, h = p:GetSize()
local clr = color || Color( 20, 20, 20, 100 )
local w, h = p:GetSize()
local clr = color || Color( 20, 20, 20, 100 )
surface.SetDrawColor( clr )
surface.DrawOutlinedRect( 0, 0, w, h )
surface.SetDrawColor( clr )
surface.DrawOutlinedRect( 0, 0, w, h )
end
function theme.panel( p, color )
local w, h = p:GetSize()
local clr = color || Color( 0, 0, 0, 200 )
local bclr = Color( 50, 50, 50, 105 )
local w, h = p:GetSize()
local clr = color || Color( 0, 0, 0, 200 )
local bclr = Color( 50, 50, 50, 105 )
draw.RoundedBox( 6, 0, 0, w, h, bclr ) -- border
draw.RoundedBox( 4, padding_s/2, padding_s/2, w - padding_s, h - padding_s, clr ) -- inner
draw.RoundedBox( 6, 0, 0, w, h, bclr ) -- border
draw.RoundedBox( 4, padding_s/2, padding_s/2, w - padding_s, h - padding_s, clr ) -- inner
end
function theme.blurpanel( p, color )
local w, h = p:GetSize()
local clr = color || Color( 0, 0, 0, 200 )
local bclr = Color( 50, 50, 50, 105 )
renderBlur( p, 2, 7 )
local w, h = p:GetSize()
local clr = color || Color( 0, 0, 0, 200 )
local bclr = Color( 50, 50, 50, 105 )
theme.renderblur( p, 2, 7 )
draw.RoundedBox( 6, 0, 0, w, h, bclr ) -- border
draw.RoundedBox( 4, padding_s/2, padding_s/2, w - padding_s, h - padding_s, clr ) -- inner
draw.RoundedBox( 6, 0, 0, w, h, bclr ) -- border
draw.RoundedBox( 4, padding_s/2, padding_s/2, w - padding_s, h - padding_s, clr ) -- inner
end
function theme.sharpblurpanel( p, color )
local w, h = p:GetSize()
local clr = color || Color( 0, 0, 0, 200 )
surface.SetDrawColor( clr )
surface.DrawRect( 0, 0, w, h )
renderBlur( p, 2, 7 )
theme.borderpanel( p, Color( 255, 255, 255, 255 ) )
local w, h = p:GetSize()
local clr = color || Color( 0, 0, 0, 200 )
surface.SetDrawColor( clr )
surface.DrawRect( 0, 0, w, h )
theme.renderblur( p, 2, 7 )
theme.borderpanel( p, Color( 255, 255, 255, 255 ) )
end
function theme.button( b, color )
local w, h = b:GetSize()
local clr = color || Color( 235, 64, 52, 255 )
local bclr = Color( 50, 50, 50, 255 )
if( b:IsHovered() ) then
bclr = Color( 205, 205, 205, 255 )
else
bclr = Color( 50, 50, 50, 255 )
end
draw.RoundedBox( 6, 0, 0, w, h, bclr ) -- border
draw.RoundedBox( 4, padding_s/2, padding_s/2, w - padding_s, h - padding_s, clr ) -- inner
local w, h = b:GetSize()
local clr = color || Color( 235, 64, 52, 255 )
local bclr = Color( 50, 50, 50, 255 )
if( b:IsHovered() ) then
bclr = Color( 205, 205, 205, 255 )
else
bclr = Color( 50, 50, 50, 255 )
end
draw.RoundedBox( 6, 0, 0, w, h, bclr ) -- border
draw.RoundedBox( 4, padding_s/2, padding_s/2, w - padding_s, h - padding_s, clr ) -- inner
end
function theme.sharpbutton( b, inClr )
local w, h = b:GetSize()
inClr = inClr || Color( 235, 64, 52, 255 )
local w, h = b:GetSize()
inClr = inClr || Color( 235, 64, 52, 255 )
if( !b:IsHovered() ) then
surface.SetDrawColor( 205, 205, 205, 255 )
else
surface.SetDrawColor( 120, 120, 120, 255 )
end
if( !b:IsHovered() ) then
surface.SetDrawColor( 205, 205, 205, 255 )
else
surface.SetDrawColor( 120, 120, 120, 255 )
end
surface.DrawOutlinedRect( 0, 0, w, h )
surface.DrawOutlinedRect( 0, 0, w, h )
surface.SetDrawColor( inClr )
surface.DrawRect( padding_s/2, padding_s/2, w - padding_s, h - padding_s )
surface.SetDrawColor( inClr )
surface.DrawRect( padding_s/2, padding_s/2, w - padding_s, h - padding_s )
end
function theme.skipbutton( b, inClr )
local w, h = b:GetSize()
inClr = inClr || Color( 0, 0, 0, 0 )
if( !b:IsHovered() ) then
surface.SetDrawColor( 205, 205, 205, 2 )
b:SetTextColor( Color( 255, 255, 255, 2 ) )
else
surface.SetDrawColor( 120, 120, 120, 255 )
b:SetTextColor( Color( 255, 255, 255, 255 ) )
end
local w, h = b:GetSize()
inClr = inClr || Color( 0, 0, 0, 0 )
if( !b:IsHovered() ) then
surface.SetDrawColor( 205, 205, 205, 2 )
b:SetTextColor( Color( 255, 255, 255, 2 ) )
else
surface.SetDrawColor( 120, 120, 120, 255 )
b:SetTextColor( Color( 255, 255, 255, 255 ) )
end
surface.DrawOutlinedRect( 0, 0, w, h )
surface.DrawOutlinedRect( 0, 0, w, h )
surface.SetDrawColor( inClr )
surface.DrawRect( padding_s/2, padding_s/2, w - padding_s, h - padding_s )
surface.SetDrawColor( inClr )
surface.DrawRect( padding_s/2, padding_s/2, w - padding_s, h - padding_s )
end
return theme

@ -8,10 +8,10 @@
local snm = {} -- Safe. Networked. Message
function snm.RunNetworkedFunc( func, args )
net.Start( "quantum_menu_button_net" ) -- used for menu buttons etc
net.WriteString( func ) -- don't worry! it's very secure :D
net.WriteTable( args )
net.SendToServer()
net.Start( "quantum_menu_button_net" ) -- used for menu buttons etc
net.WriteString( func ) -- don't worry! it's very secure :D
net.WriteTable( args )
net.SendToServer()
end
return snm

@ -18,174 +18,174 @@ local padding_s = 4 * resScale
local errorMdl = "models/player.mdl"
local function getClassModels( class )
if( Quantum.Classes[class] ) then
return Quantum.Classes[class].Models
else
Quantum.Error( "Unable to get models from class[" .. tostring( class ) .. "]." )
end
if( Quantum.Classes[class] ) then
return Quantum.Classes[class].Models
else
Quantum.Error( "Unable to get models from class[" .. tostring( class ) .. "]." )
end
end
local function getMaxModel( tbl, index ) return tbl[math.Clamp( index, 1, #tbl )] end
local function renderSelectedButton( b, sel )
if( sel ) then
b:SetTextColor( Color( 255, 239, 158 ) )
else
b:SetTextColor( Color( 255, 255, 255 ) )
end
if( sel ) then
b:SetTextColor( Color( 255, 239, 158 ) )
else
b:SetTextColor( Color( 255, 255, 255 ) )
end
end
local function getNextIndex( index, isNext, min, max )
if( isNext ) then
if( index + 1 > max ) then
return min -- integer overflow LUL
else
return index + 1
end
else
if( index - 1 < min ) then -- integer underflow
return max
else
return index - 1
end
end
if( isNext ) then
if( index + 1 > max ) then
return min -- integer overflow LUL
else
return index + 1
end
else
if( index - 1 < min ) then -- integer underflow
return max
else
return index - 1
end
end
end
local function checkNameString( name )
local strTbl = string.Explode( "", name )
for i, char in pairs( strTbl ) do
if( i == 1 || strTbl[ math.Clamp( i-1, 1, #strTbl ) ] == " " ) then -- if it is the first letter then make it a capital one
strTbl[i] = string.upper( char ) -- or if it is a space inbetween make it a capital one aswell
end
for n, char_ in pairs( strTbl ) do
if( n >= #strTbl && char == " " && strTbl[n-1] ~= " " ) then strTbl[i] = " " end -- remove the spaces at the end
end
end
return table.concat( strTbl ) -- return the "fixed" name
local strTbl = string.Explode( "", name )
for i, char in pairs( strTbl ) do
if( i == 1 || strTbl[ math.Clamp( i-1, 1, #strTbl ) ] == " " ) then -- if it is the first letter then make it a capital one
strTbl[i] = string.upper( char ) -- or if it is a space inbetween make it a capital one aswell
end
for n, char_ in pairs( strTbl ) do
if( n >= #strTbl && char == " " && strTbl[n-1] ~= " " ) then strTbl[i] = " " end -- remove the spaces at the end
end
end
return table.concat( strTbl ) -- return the "fixed" name
end
local pages = {
charCreate = function( parent )
local pW, pH = parent:GetSize()
local args = {
CloseButtonText = "Return",
CloseButtonFont = "q_text",
}
local p, c = page.New( parent, args )
p:SetVisible( true )
charCreate = function( parent )
local pW, pH = parent:GetSize()
local args = {
CloseButtonText = "Return",
CloseButtonFont = "q_text",
}
local p, c = page.New( parent, args )
p:SetVisible( true )
p.w, p.h = p:GetSize()
c:SetSize( 85 * resScale, 25 * resScale )
c.w, c.h = c:GetSize()
c:SetPos( (p.w - c.w) - padding*4, (p.h - c.h) - padding*4 )
c.DoClick = function()
surface.PlaySound( "UI/buttonclick.wav" )
parent.page:SetVisible( true )
p:Remove()
end
local scene = {
["rp_truenorth_v1a_livin"] = {
[1] = {
fov = 75,
velocity = 10,
pos1 = Vector(11504.430664, 3809.523193, 72.031250),
ang1 = Angle(5, 112.406662, 0.000000)
}
}
}
Quantum.Client.Cam.Start( scene[game.GetMap()], true )
local banner = vgui.Create( "DImage", p )
banner:SetImage( Quantum.Client.ServerBannerPath )
banner:SizeToContents()
banner.w, banner.h = banner:GetSize()
banner:SetSize( (banner.w * resScale)/2.8, (banner.h * resScale)/2.8 )
banner.w, banner.h = banner:GetSize()
banner:SetPos( (p.w - banner.w) + padding*2, 0 )
c:SetSize( 85 * resScale, 25 * resScale )
c.w, c.h = c:GetSize()
c:SetPos( (p.w - c.w) - padding*4, (p.h - c.h) - padding*4 )
c.DoClick = function()
surface.PlaySound( "UI/buttonclick.wav" )
parent.page:SetVisible( true )
p:Remove()
end
local scene = {
["rp_truenorth_v1a_livin"] = {
[1] = {
fov = 75,
velocity = 10,
pos1 = Vector(11504.430664, 3809.523193, 72.031250),
ang1 = Angle(5, 112.406662, 0.000000)
}
}
}
Quantum.Client.Cam.Start( scene[game.GetMap()], true )
local banner = vgui.Create( "DImage", p )
banner:SetImage( Quantum.Client.ServerBannerPath )
banner:SizeToContents()
banner.w, banner.h = banner:GetSize()
banner:SetSize( (banner.w * resScale)/2.8, (banner.h * resScale)/2.8 )
banner.w, banner.h = banner:GetSize()
banner:SetPos( (p.w - banner.w) + padding*2, 0 )
local ip = vgui.Create( "DPanel", p ) -- input panel
ip:SetSize( 400 * resScale, p.h * 0.9 )
ip.w, ip.h = ip:GetSize()
ip:SetPos( padding*4, p.h/2 - ip.h/2 )
ip.Paint = function( self ) theme.blurpanel(self) end
ip.x, ip.y = ip:GetPos()
local header = vgui.Create( "DLabel", p )
header:SetText( "Character Creation" )
header:SetFont( "q_header" )
header:SetTextColor( Color( 255, 255, 255, 255 ) )
header:SizeToContents()
header.w, header.h = header:GetSize()
header:SetPos( (ip.x + ip.w/2) - header.w/2, header.h/2 )
-- character model panel
local mdl = vgui.Create( "DModelPanel", p )
ip.x, ip.y = ip:GetPos()
local header = vgui.Create( "DLabel", p )
header:SetText( "Character Creation" )
header:SetFont( "q_header" )
header:SetTextColor( Color( 255, 255, 255, 255 ) )
header:SizeToContents()
header.w, header.h = header:GetSize()
header:SetPos( (ip.x + ip.w/2) - header.w/2, header.h/2 )
-- character model panel
local mdl = vgui.Create( "DModelPanel", p )
mdl:SetSize( 600 * resScale, 1000 * resScale )
mdl.w, mdl.h = mdl:GetSize()
mdl:SetPos( p.w/2 - mdl.w/2, p.h/2 - mdl.h/2 )
mdl.x, mdl.y = mdl:GetPos()
mdl.x, mdl.y = mdl:GetPos()
mdl:SetFOV( 55 )
function mdl:LayoutEntity( ent ) return end
local inputs = {
gender = "Male",
class = "Worker",
modelIndex = 1,
name = ""
}
local name = vgui.Create( "DTextEntry", p )
name:SetPlaceholderText( "Character Name" )
name:SetPlaceholderColor( Color( 100, 100, 100, 100 ) )
name:SetFont( "q_button2" )
name:SetTextColor( Color( 255, 255, 255, 255 ) )
name:SetSize( 300 * resScale, 40 * resScale )
name.w, name.h = name:GetSize()
name:SetPos( p.w/2 - name.w/2, p.h*0.85 - name.h/2 )
name.x, name.y = name:GetPos()
name.Paint = function( self )
theme.blurpanel( self )
self:DrawTextEntryText( Color( 255, 255, 255, 255 ), Color( 150, 150, 150, 255 ), Color( 100, 100, 100, 255 ) )
end
name.OnEnter = function()
checkNameString( name:GetText() )
end
gender = "Male",
class = "Worker",
modelIndex = 1,
name = ""
}
local name = vgui.Create( "DTextEntry", p )
name:SetPlaceholderText( "Character Name" )
name:SetPlaceholderColor( Color( 100, 100, 100, 100 ) )
name:SetFont( "q_button2" )
name:SetTextColor( Color( 255, 255, 255, 255 ) )
name:SetSize( 300 * resScale, 40 * resScale )
name.w, name.h = name:GetSize()
name:SetPos( p.w/2 - name.w/2, p.h*0.85 - name.h/2 )
name.x, name.y = name:GetPos()
name.Paint = function( self )
theme.blurpanel( self )
self:DrawTextEntryText( Color( 255, 255, 255, 255 ), Color( 150, 150, 150, 255 ), Color( 100, 100, 100, 255 ) )
end
name.OnEnter = function()
checkNameString( name:GetText() )
end
-- input panel contens --
local rheader = vgui.Create( "DLabel", ip )
rheader:SetText("Select Class")
rheader:SetFont( "q_button2" )
rheader:SetTextColor( Color( 255, 255, 255, 255 ) )
rheader:SizeToContents()
rheader.w, rheader.h = rheader:GetSize()
rheader:SetPos( ip.w/2 - rheader.w/2, rheader.h )
rheader.x, rheader.y = rheader:GetPos()
local rheader = vgui.Create( "DLabel", ip )
rheader:SetText("Select Class")
rheader:SetFont( "q_button2" )
rheader:SetTextColor( Color( 255, 255, 255, 255 ) )
rheader:SizeToContents()
rheader.w, rheader.h = rheader:GetSize()
rheader:SetPos( ip.w/2 - rheader.w/2, rheader.h )
rheader.x, rheader.y = rheader:GetPos()
local gbuttons = {}
local gbuttons = {}
gbuttons.female = vgui.Create( "DButton", ip )
local selectedGenderButton = gbuttons.female -- select itself
gbuttons.female = vgui.Create( "DButton", ip )
local selectedGenderButton = gbuttons.female -- select itself
gbuttons.female:SetText( "Female" )
gbuttons.female:SetTextColor( Color( 255, 255, 255, 255 ) )
gbuttons.female:SetFont( "q_button2" )
gbuttons.female.Paint = function( self, w, h )
theme.sharpbutton( self, Color( 0, 0, 0, 0 ) )
renderSelectedButton( self, selectedGenderButton == self )
end
gbuttons.female:SizeToContents()
theme.sharpbutton( self, Color( 0, 0, 0, 0 ) )
renderSelectedButton( self, selectedGenderButton == self )
end
gbuttons.female:SizeToContents()
gbuttons.female.w, gbuttons.female.h = gbuttons.female:GetSize()
gbuttons.female:SetPos( (ip.w - gbuttons.female.w) - padding - gbuttons.female.w/2, rheader.y + gbuttons.female.h + padding )
gbuttons.female.x, gbuttons.female.y = gbuttons.female:GetPos()
gbuttons.female.x, gbuttons.female.y = gbuttons.female:GetPos()
gbuttons.female.DoClick = function( self )
if( selectedGenderButton ~= self ) then
selectedGenderButton = self
inputs.gender = "Female"
surface.PlaySound( "UI/buttonclick.wav" )
end
if( selectedGenderButton ~= self ) then
selectedGenderButton = self
inputs.gender = "Female"
surface.PlaySound( "UI/buttonclick.wav" )
end
end
gbuttons.male = vgui.Create( "DButton", ip )
selectedGenderButton = gbuttons.male
selectedGenderButton = gbuttons.male
gbuttons.male:SetText( "Male" )
gbuttons.male:SetTextColor( Color( 0, 0, 0, 255 ) )
gbuttons.male:SetFont( "q_button2" )
@ -194,205 +194,205 @@ local pages = {
gbuttons.male:SetPos( padding + gbuttons.male.w/2, rheader.y + gbuttons.male.h + padding )
gbuttons.male.Paint = function( self, w, h )
theme.sharpbutton( self, Color( 0, 0, 0, 0 ) )
theme.sharpbutton( self, Color( 0, 0, 0, 0 ) )
renderSelectedButton( self, selectedGenderButton == self )
end
gbuttons.male.DoClick = function( self )
if( selectedGenderButton ~= self ) then
selectedGenderButton = self
inputs.gender = "Male"
surface.PlaySound( "UI/buttonclick.wav" )
end
end
--- Class buttons ---
local cscroll = vgui.Create( "DScrollPanel", ip )
cscroll:SetSize( ip.w, ip.h/5 )
cscroll.w, cscroll.h = cscroll:GetSize()
cscroll:SetPos( 0, ip.h/6 )
cscroll.x, cscroll.y = cscroll:GetPos()
cscroll:GetVBar():SetSize( 0, 0 )
local classButtons = {}
local classCount = 0
for id, class in pairs( Quantum.Classes ) do
classCount = classCount + 1 -- keep count
classButtons[classCount] = vgui.Create( "DButton", cscroll )
classButtons[classCount].class = id
classButtons[classCount]:SetText( class.Name )
classButtons[classCount]:SetFont( "q_button2" )
classButtons[classCount]:SetTextColor( Color( 255, 255, 255, 255 ) )
classButtons[classCount]:SizeToContents()
classButtons[classCount].w, classButtons[classCount].h = classButtons[classCount]:GetSize()
classButtons[classCount]:SetSize( ip.w - padding*2, classButtons[classCount].h )
classButtons[classCount].w, classButtons[classCount].h = classButtons[classCount]:GetSize()
classButtons[classCount]:SetPos( cscroll.w/2 - classButtons[classCount].w/2, (classCount-1) * ( padding + classButtons[classCount].h ) )
classButtons[classCount].Paint = function( self )
theme.sharpbutton( self, Color( 0, 0, 0, 0 ) )
renderSelectedButton( self, inputs.class == self.class )
end
classButtons[classCount].DoClick = function( self )
if( inputs.class ~= id ) then
inputs.class = id
surface.PlaySound( "UI/buttonclick.wav" )
end
end
end
--- Model selector ---
local pmodel = vgui.Create( "DButton", p ) -- previous model
pmodel:SetText( "< Prev. Model" )
pmodel:SetFont( "q_button_m" )
pmodel:SetTextColor( Color( 255, 255, 255, 255 ) )
pmodel:SizeToContents()
pmodel.w, pmodel.h = pmodel:GetSize()
pmodel:SetPos( (mdl.x - pmodel.w) + padding*10, (mdl.y + mdl.h/2) - pmodel.h/2 )
pmodel.Paint = function( self ) theme.sharpbutton( self, Color( 0, 0, 0, 100 ) ) end
pmodel.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" )
inputs.modelIndex = getNextIndex( inputs.modelIndex, false, 1, #getClassModels( inputs.class )[inputs.gender] )
end
local nmodel = vgui.Create( "DButton", p ) -- next model
nmodel:SetText( "Next Model >" )
nmodel:SetFont( "q_button_m" )
nmodel:SetTextColor( Color( 255, 255, 255, 255 ) )
nmodel:SetSize( pmodel.w, pmodel.h )
nmodel.w, nmodel.h = nmodel:GetSize()
nmodel:SetPos( (mdl.x + mdl.w) - padding*10, (mdl.y + mdl.h/2) - nmodel.h/2 )
nmodel.Paint = function( self ) theme.sharpbutton( self, Color( 0, 0, 0, 100 ) ) end
nmodel.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" )
inputs.modelIndex = getNextIndex( inputs.modelIndex, true, 1, #getClassModels( inputs.class )[inputs.gender] )
end
-- Class info --
local mscroll = vgui.Create( "DScrollPanel", ip )
mscroll:SetSize( ip.w, ip.h/1.6 )
mscroll.w, mscroll.h = mscroll:GetSize()
mscroll:SetPos( 0, ip.h - mscroll.h )
mscroll:GetVBar():SetSize( 0, 0 )
mscroll.Paint = function( self )
theme.borderpanel( self )
end
--- Model viewer
mdl:SetModel( Quantum.Models.Player.Citizen.Male[math.random(1, #Quantum.Models.Player.Citizen.Male)] ) -- set the char model
local minv, maxv = mdl.Entity:GetRenderBounds()
local ent = mdl.Entity
gbuttons.male.DoClick = function( self )
if( selectedGenderButton ~= self ) then
selectedGenderButton = self
inputs.gender = "Male"
surface.PlaySound( "UI/buttonclick.wav" )
end
end
--- Class buttons ---
local cscroll = vgui.Create( "DScrollPanel", ip )
cscroll:SetSize( ip.w, ip.h/5 )
cscroll.w, cscroll.h = cscroll:GetSize()
cscroll:SetPos( 0, ip.h/6 )
cscroll.x, cscroll.y = cscroll:GetPos()
cscroll:GetVBar():SetSize( 0, 0 )
local classButtons = {}
local classCount = 0
for id, class in pairs( Quantum.Classes ) do
classCount = classCount + 1 -- keep count
classButtons[classCount] = vgui.Create( "DButton", cscroll )
classButtons[classCount].class = id
classButtons[classCount]:SetText( class.Name )
classButtons[classCount]:SetFont( "q_button2" )
classButtons[classCount]:SetTextColor( Color( 255, 255, 255, 255 ) )
classButtons[classCount]:SizeToContents()
classButtons[classCount].w, classButtons[classCount].h = classButtons[classCount]:GetSize()
classButtons[classCount]:SetSize( ip.w - padding*2, classButtons[classCount].h )
classButtons[classCount].w, classButtons[classCount].h = classButtons[classCount]:GetSize()
classButtons[classCount]:SetPos( cscroll.w/2 - classButtons[classCount].w/2, (classCount-1) * ( padding + classButtons[classCount].h ) )
classButtons[classCount].Paint = function( self )
theme.sharpbutton( self, Color( 0, 0, 0, 0 ) )
renderSelectedButton( self, inputs.class == self.class )
end
classButtons[classCount].DoClick = function( self )
if( inputs.class ~= id ) then
inputs.class = id
surface.PlaySound( "UI/buttonclick.wav" )
end
end
end
--- Model selector ---
local pmodel = vgui.Create( "DButton", p ) -- previous model
pmodel:SetText( "< Prev. Model" )
pmodel:SetFont( "q_button_m" )
pmodel:SetTextColor( Color( 255, 255, 255, 255 ) )
pmodel:SizeToContents()
pmodel.w, pmodel.h = pmodel:GetSize()
pmodel:SetPos( (mdl.x - pmodel.w) + padding*10, (mdl.y + mdl.h/2) - pmodel.h/2 )
pmodel.Paint = function( self ) theme.sharpbutton( self, Color( 0, 0, 0, 100 ) ) end
pmodel.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" )
inputs.modelIndex = getNextIndex( inputs.modelIndex, false, 1, #getClassModels( inputs.class )[inputs.gender] )
end
local nmodel = vgui.Create( "DButton", p ) -- next model
nmodel:SetText( "Next Model >" )
nmodel:SetFont( "q_button_m" )
nmodel:SetTextColor( Color( 255, 255, 255, 255 ) )
nmodel:SetSize( pmodel.w, pmodel.h )
nmodel.w, nmodel.h = nmodel:GetSize()
nmodel:SetPos( (mdl.x + mdl.w) - padding*10, (mdl.y + mdl.h/2) - nmodel.h/2 )
nmodel.Paint = function( self ) theme.sharpbutton( self, Color( 0, 0, 0, 100 ) ) end
nmodel.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" )
inputs.modelIndex = getNextIndex( inputs.modelIndex, true, 1, #getClassModels( inputs.class )[inputs.gender] )
end
-- Class info --
local mscroll = vgui.Create( "DScrollPanel", ip )
mscroll:SetSize( ip.w, ip.h/1.6 )
mscroll.w, mscroll.h = mscroll:GetSize()
mscroll:SetPos( 0, ip.h - mscroll.h )
mscroll:GetVBar():SetSize( 0, 0 )
mscroll.Paint = function( self )
theme.borderpanel( self )
end
--- Model viewer
mdl:SetModel( Quantum.Models.Player.Citizen.Male[math.random(1, #Quantum.Models.Player.Citizen.Male)] ) -- set the char model
local minv, maxv = mdl.Entity:GetRenderBounds()
local ent = mdl.Entity
local eyepos = ent:GetBonePosition( ent:LookupBone( "ValveBiped.Bip01_Head1" ) )
eyepos:Add( Vector( 40, 0, -15 ) )
mdl:SetCamPos( eyepos - Vector( -10, 0, -2 ) )
mdl:SetLookAt( eyepos )
mdl.Think = function( self )
--getClassModels(inputs.class)
if( self:GetModel() ~= getMaxModel( getClassModels(inputs.class)[inputs.gender], inputs.modelIndex ) ) then
self:SetModel( getMaxModel( getClassModels(inputs.class)[inputs.gender], inputs.modelIndex ) )
end
end
-- create char button --
local cr = vgui.Create( "DButton", p )
cr:SetText( "Create Character" )
cr:SetFont( "q_button2" )
cr:SetTextColor( Color( 0, 0, 0, 255 ) )
cr:SizeToContents()
cr.w, cr.h = cr:GetSize()
cr:SetPos( name.x + name.w/2 - cr.w/2, name.y + cr.h + padding )
cr.Paint = function( self ) theme.sharpbutton( self ) end
cr.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" )
-- create char
inputs.name = checkNameString( name:GetText() )
snm.RunNetworkedFunc( "createChar", inputs )
end
return p, c
end
mdl.Think = function( self )
--getClassModels(inputs.class)
if( self:GetModel() ~= getMaxModel( getClassModels(inputs.class)[inputs.gender], inputs.modelIndex ) ) then
self:SetModel( getMaxModel( getClassModels(inputs.class)[inputs.gender], inputs.modelIndex ) )
end
end
-- create char button --
local cr = vgui.Create( "DButton", p )
cr:SetText( "Create Character" )
cr:SetFont( "q_button2" )
cr:SetTextColor( Color( 0, 0, 0, 255 ) )
cr:SizeToContents()
cr.w, cr.h = cr:GetSize()
cr:SetPos( name.x + name.w/2 - cr.w/2, name.y + cr.h + padding )
cr.Paint = function( self ) theme.sharpbutton( self ) end
cr.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" )
-- create char
inputs.name = checkNameString( name:GetText() )
snm.RunNetworkedFunc( "createChar", inputs )
end
return p, c
end
}
function menu.open( dt )
Quantum.Client.IsInMenu = true -- hide the hud
if( !f ) then
local f = vgui.Create( "DFrame" )
f:SetTitle( "" )
f:SetSize( sw, sh )
f.Paint = function( self, w, h )
surface.SetDrawColor( 0, 0, 0, 120 )
surface.DrawRect( 0, 0, w, h )
end
f:SetDraggable( false )
f:ShowCloseButton( false )
f:MakePopup()
function f:OnClose()
Quantum.Client.IsInMenu = false -- show the hud when closed
Quantum.Client.Cam.Stop()
end
local scene = {
["rp_truenorth_v1a_livin"] = {
[1] = {
fov = 70,
velocity = 10,
pos1 = Vector(9807.226563, -9093.957031, 5560.153809),
ang1 = Angle(5.702401, -42.888149, 0.000000)
}
}
}
Quantum.Client.Cam.Start( scene[game.GetMap()], true )
local args = {
CloseButtonText = "Quit",
CloseButtonFont = "q_text"
}
local p, c = page.New( f, args )
f.page = p
f.page:SetVisible( true )
local clist = vgui.Create( "DScrollPanel", p )
clist:SetSize( 380 * resScale, sh - padding*15 )
clist.w, clist.h = clist:GetSize()
clist:SetPos( (sw - clist.w) - padding*2, padding*6 )
clist.x, clist.y = clist:GetPos()
clist.Paint = function( self, w, h )
theme.blurpanel( self )
end
local sbar = clist:GetVBar()
sbar:SetSize( 0, 0 ) -- Remove the scroll bar
--- Close/quit button stuff ---
local cW, cH = c:GetSize()
c:SetPos( (clist.x + clist.w) - cW, clist.y + clist.h + cH )
c.Paint = function( self ) theme.button( self ) end
c.DoClick = function()
surface.PlaySound( "UI/buttonclick.wav" )
f:Close()
end
---
local banner = vgui.Create( "DImage", p )
banner:SetImage( Quantum.Client.ServerBannerPath )
banner:SizeToContents()
banner.w, banner.h = banner:GetSize()
banner:SetSize( (banner.w * resScale)/2.8, (banner.h * resScale)/2.8 )
banner:SetPos( padding, padding )
local header = vgui.Create( "DLabel", p )
header:SetText( "Characters" )
header:SetFont( "q_header" )
header:SizeToContents()
local headerW, headerH = header:GetSize()
header:SetPos( clist.x + ( clist.w/2 - headerW/2 ), (clist.y - headerH) + padding/2 )
header:SetTextColor( Color( 255, 255, 255, 255 ) )
header.Paint = function( self, w, h ) end
local chars = dt.cont -- set the char table
local cpanels = {}
local selectedChar
Quantum.Client.IsInMenu = true -- hide the hud
if( !f ) then
local f = vgui.Create( "DFrame" )
f:SetTitle( "" )
f:SetSize( sw, sh )
f.Paint = function( self, w, h )
surface.SetDrawColor( 0, 0, 0, 120 )
surface.DrawRect( 0, 0, w, h )
end
f:SetDraggable( false )
f:ShowCloseButton( false )
f:MakePopup()
function f:OnClose()
Quantum.Client.IsInMenu = false -- show the hud when closed
Quantum.Client.Cam.Stop()
end
local scene = {
["rp_truenorth_v1a_livin"] = {
[1] = {
fov = 70,
velocity = 10,
pos1 = Vector(9807.226563, -9093.957031, 5560.153809),
ang1 = Angle(5.702401, -42.888149, 0.000000)
}
}
}
Quantum.Client.Cam.Start( scene[game.GetMap()], true )
local args = {
CloseButtonText = "Quit",
CloseButtonFont = "q_text"
}
local p, c = page.New( f, args )
f.page = p
f.page:SetVisible( true )
local clist = vgui.Create( "DScrollPanel", p )
clist:SetSize( 380 * resScale, sh - padding*15 )
clist.w, clist.h = clist:GetSize()
clist:SetPos( (sw - clist.w) - padding*2, padding*6 )
clist.x, clist.y = clist:GetPos()
clist.Paint = function( self, w, h )
theme.blurpanel( self )
end
local sbar = clist:GetVBar()
sbar:SetSize( 0, 0 ) -- Remove the scroll bar
--- Close/quit button stuff ---
local cW, cH = c:GetSize()
c:SetPos( (clist.x + clist.w) - cW, clist.y + clist.h + cH )
c.Paint = function( self ) theme.button( self ) end
c.DoClick = function()
surface.PlaySound( "UI/buttonclick.wav" )
f:Close()
end
---
local banner = vgui.Create( "DImage", p )
banner:SetImage( Quantum.Client.ServerBannerPath )
banner:SizeToContents()
banner.w, banner.h = banner:GetSize()
banner:SetSize( (banner.w * resScale)/2.8, (banner.h * resScale)/2.8 )
banner:SetPos( padding, padding )
local header = vgui.Create( "DLabel", p )
header:SetText( "Characters" )
header:SetFont( "q_header" )
header:SizeToContents()
local headerW, headerH = header:GetSize()
header:SetPos( clist.x + ( clist.w/2 - headerW/2 ), (clist.y - headerH) + padding/2 )
header:SetTextColor( Color( 255, 255, 255, 255 ) )
header.Paint = function( self, w, h ) end
local chars = dt.cont -- set the char table
local cpanels = {}
local selectedChar
if( table.Count( chars ) >= 1 ) then
-- Char model
@ -421,66 +421,66 @@ function menu.open( dt )
end
local count = 0
for k, v in pairs( chars ) do
count = count + 1
cpanels[count] = vgui.Create( "DButton", clist )
cpanels[count].index = count
cpanels[count].char = v -- give the panel it's character
if( !selectedChar ) then selectedChar = cpanels[1] end -- select the first one
cpanels[count]:SetText( "" )
cpanels[count]:SetSize( clist.w - padding, 100 * resScale )
cpanels[count].w, cpanels[count].h = cpanels[count]:GetSize()
cpanels[count]:SetPos( padding/2, (padding)*count + (cpanels[count].h * (count-1)) )
cpanels[count].Paint = function( self, w, h )
surface.SetDrawColor( 0, 0, 0, 0 )
surface.DrawRect( 0, 0, w, h )
if( self == selectedChar ) then
surface.SetDrawColor( 252, 186, 3, 100 )
surface.DrawOutlinedRect( 0, 0, w, h )
end
end
cpanels[count].DoClick = function( self ) -- if you press the char, then select it
selectedChar = self
surface.PlaySound( "UI/buttonclick.wav" )
p.mdl:SetModel( self.char.model || errorMdl )
end
local txt = vgui.Create( "DLabel", cpanels[count] )
txt:SetText( v.name || "[ERROR] NAME=nil" )
txt:SetFont( "q_charNameText" )
txt:SetTextColor( Color( 200, 200, 200, 220 ) )
txt:SizeToContents()
local txtW, txtH = txt:GetSize()
txt:SetPos( padding, cpanels[count].h/4 - txtH/2 )
local txtX, txtY = txt:GetPos()
local lvlTxt
if( v.job.level >= 0 ) then
lvlTxt = "Level " .. v.job.level .. " "
else
lvlTxt = ""
end
local lvl = vgui.Create( "DLabel", cpanels[count] )
lvl:SetText( lvlTxt .. v.job.title )
lvl:SetFont( "q_text2" )
lvl:SetTextColor( Color( 180, 180, 180, 225 ) )
lvl:SizeToContents()
local lvlW, lvlH = lvl:GetSize()
lvl:SetPos( txtX, txtY + lvlH )
local lvlX, lvlY = lvl:GetPos()
local class = vgui.Create( "DLabel", cpanels[count] )
class:SetText( v.class )
class:SetFont( "q_text2" )
class:SetTextColor( Color( 252, 186, 3, 180 ) )
class:SizeToContents()
local classW, classH = class:GetSize()
class:SetPos( txtX, lvlY + classH )
end
local count = 0
for k, v in pairs( chars ) do
count = count + 1
cpanels[count] = vgui.Create( "DButton", clist )
cpanels[count].index = count
cpanels[count].char = v -- give the panel it's character
if( !selectedChar ) then selectedChar = cpanels[1] end -- select the first one
cpanels[count]:SetText( "" )
cpanels[count]:SetSize( clist.w - padding, 100 * resScale )
cpanels[count].w, cpanels[count].h = cpanels[count]:GetSize()
cpanels[count]:SetPos( padding/2, (padding)*count + (cpanels[count].h * (count-1)) )
cpanels[count].Paint = function( self, w, h )
surface.SetDrawColor( 0, 0, 0, 0 )
surface.DrawRect( 0, 0, w, h )
if( self == selectedChar ) then
surface.SetDrawColor( 252, 186, 3, 100 )
surface.DrawOutlinedRect( 0, 0, w, h )
end
end
cpanels[count].DoClick = function( self ) -- if you press the char, then select it
selectedChar = self
surface.PlaySound( "UI/buttonclick.wav" )
p.mdl:SetModel( self.char.model || errorMdl )
end
local txt = vgui.Create( "DLabel", cpanels[count] )
txt:SetText( v.name || "[ERROR] NAME=nil" )
txt:SetFont( "q_charNameText" )
txt:SetTextColor( Color( 200, 200, 200, 220 ) )
txt:SizeToContents()
local txtW, txtH = txt:GetSize()
txt:SetPos( padding, cpanels[count].h/4 - txtH/2 )
local txtX, txtY = txt:GetPos()
local lvlTxt
if( v.job.level >= 0 ) then
lvlTxt = "Level " .. v.job.level .. " "
else
lvlTxt = ""
end
local lvl = vgui.Create( "DLabel", cpanels[count] )
lvl:SetText( lvlTxt .. v.job.title )
lvl:SetFont( "q_text2" )
lvl:SetTextColor( Color( 180, 180, 180, 225 ) )
lvl:SizeToContents()
local lvlW, lvlH = lvl:GetSize()
lvl:SetPos( txtX, txtY + lvlH )
local lvlX, lvlY = lvl:GetPos()
local class = vgui.Create( "DLabel", cpanels[count] )
class:SetText( v.class )
class:SetFont( "q_text2" )
class:SetTextColor( Color( 252, 186, 3, 180 ) )
class:SizeToContents()
local classW, classH = class:GetSize()
class:SetPos( txtX, lvlY + classH )
end
if( selectedChar && p.mdl ~= nil ) then
p.mdl:SetModel( selectedChar.char.model ) -- set the char model
@ -491,26 +491,26 @@ 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")
cr:SetFont( "q_button" )
cr:SetTextColor( Color( 0, 0, 0, 255 ) )
cr:SizeToContents()
cr.w, cr.h = cr:GetSize()
cr:SetPos( clist.x + ( clist.w/2 - cr.w/2 ), clist.y + ( ( clist.h - cr.h ) - padding*2 ) )
cr.Paint = function( self )
theme.sharpbutton( self )
end
cr.DoClick = function()
surface.PlaySound( "UI/buttonclick.wav" )
p:SetVisible( false )
local crPage = pages.charCreate( f )
end
cr.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
end
if( table.Count( dt.cont ) < Quantum.CharacterLimit ) then
-- create char button
local cr = vgui.Create( "DButton", p )
cr:SetText("Create New Character")
cr:SetFont( "q_button" )
cr:SetTextColor( Color( 0, 0, 0, 255 ) )
cr:SizeToContents()
cr.w, cr.h = cr:GetSize()
cr:SetPos( clist.x + ( clist.w/2 - cr.w/2 ), clist.y + ( ( clist.h - cr.h ) - padding*2 ) )
cr.Paint = function( self )
theme.sharpbutton( self )
end
cr.DoClick = function()
surface.PlaySound( "UI/buttonclick.wav" )
p:SetVisible( false )
local crPage = pages.charCreate( f )
end
cr.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
end
if( selectedChar ) then
-- Delete char button
@ -531,25 +531,25 @@ function menu.open( dt )
dl.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
-- Enter world button --
p.enter = vgui.Create( "DButton", p )
p.enter:SetText( "Enter World" )
p.enter:SetFont( "q_button2" )
p.enter:SetTextColor( Color( 0, 0, 0, 255 ) )
p.enter:SizeToContents()
p.enter.w, p.enter.h = p.enter:GetSize()
p.enter:SetPos( p.w/2 - p.enter.w/2, p.h*0.925 - p.enter.h/2 )
p.enter.Paint = function( self ) theme.sharpbutton( self ) end
p.enter.DoClick = function()
surface.PlaySound( "UI/buttonclick.wav" )
-- enter world --
local dt = { index = selectedChar.index }
snm.RunNetworkedFunc( "enterWorldChar", dt ) -- FIX CRASH ISSUE ( 0xC00000FD )
f:Close() -- close the frame
end
p.enter.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
-- Enter world button --
p.enter = vgui.Create( "DButton", p )
p.enter:SetText( "Enter World" )
p.enter:SetFont( "q_button2" )
p.enter:SetTextColor( Color( 0, 0, 0, 255 ) )
p.enter:SizeToContents()
p.enter.w, p.enter.h = p.enter:GetSize()
p.enter:SetPos( p.w/2 - p.enter.w/2, p.h*0.925 - p.enter.h/2 )
p.enter.Paint = function( self ) theme.sharpbutton( self ) end
p.enter.DoClick = function()
surface.PlaySound( "UI/buttonclick.wav" )
-- enter world --
local dt = { index = selectedChar.index }
snm.RunNetworkedFunc( "enterWorldChar", dt ) -- FIX CRASH ISSUE ( 0xC00000FD )
f:Close() -- close the frame
end
p.enter.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
end
end
end
end
return menu

@ -11,133 +11,153 @@ local log = Quantum.Client.Menu.GetAPI( "dialogue" )
local theme = Quantum.Client.Menu.GetAPI( "theme" )
local scenes = { -- 5031.821777 3866.334961 120.090790;setang 0.898059 56.421352 0.000000
["rp_truenorth_v1a_livin"] = {
[1] = {
fov = 70,
velocity = 12,
pos1 = Vector(5062.544434, 3264.783447, 136.604355),
pos2 = Vector(5031.821777, 3866.334961, 120.090790),
ang1 = Angle(0.370070, 90.952415, 0.000000),
ang2 = Angle(0.898059, 56.421352, 0.000000)
},
[2] = {
fov = 80,
velocity = 16,
pos1 = Vector(6879, 4135, 72),
pos2 = Vector(8760, 2740, 86),
ang1 = Angle(0.686861, -43.159401, 0.000000),
ang2 = Angle(1, -104, 0)
},
[3] = {
fov = 70,
velocity = 12,
pos1 = Vector( 8917, 2194, 83 ),
pos2 = Vector( 8312, 2265, 83 ),
ang1 = Angle( 2, -123, 0 ),
ang2 = Angle( 3, -41, 0 )
},
[4] = {
fov = 70,
velocity = 12,
pos1 = Vector( 10860.154297, 3337.662109, 141.101013 ),
pos2 = Vector( 10881.356445, 5483.074219, 132.792114 ),
ang1 = Angle( 0.052806, 85.319626, 0.000000 ),
ang2 = Angle( -0.105593, 90.978638, 0.000000 )
},
[5] = {
fov = 60,
velocity = 12,
pos1 = Vector( 3114.608887, -13817.962891, 82.778885 ),
pos2 = Vector( 5247.718262, -14413.496094, 74.946350 ),
ang1 = Angle( 0.844603, -15.770578, 0.000000 ),
ang2 = Angle( 2.006202, 37.927032, 0.000000 )
},
[6] = {
fov = 60,
velocity = 12,
pos1 = Vector( 6830.229004, 9614.283203, 105.920792 ),
pos2 = Vector( 6675.346191, 9711.740234, 102.549484 ),
ang1 = Angle( 1.055771, 147.803604, 0.000000 ),
ang2 = Angle( 1.055771, 149.803604, 0.000000 )
}
}
["rp_truenorth_v1a_livin"] = {
[1] = {
fov = 70,
velocity = 12,
pos1 = Vector(5062.544434, 3264.783447, 136.604355),
pos2 = Vector(5031.821777, 3866.334961, 120.090790),
ang1 = Angle(0.370070, 90.952415, 0.000000),
ang2 = Angle(0.898059, 56.421352, 0.000000)
},
[2] = {
fov = 80,
velocity = 12,
pos1 = Vector(6879, 4135, 72),
pos2 = Vector(8760, 2740, 86),
ang1 = Angle(0.686861, -43.159401, 0.000000),
ang2 = Angle(1, -104, 0)
},
[3] = {
fov = 70,
velocity = 12,
pos1 = Vector( 8917, 2194, 83 ),
pos2 = Vector( 8312, 2265, 83 ),
ang1 = Angle( 2, -123, 0 ),
ang2 = Angle( 3, -41, 0 )
},
[4] = {
fov = 70,
velocity = 12,
pos1 = Vector( 10860.154297, 3337.662109, 141.101013 ),
pos2 = Vector( 10881.356445, 5483.074219, 132.792114 ),
ang1 = Angle( 0.052806, 85.319626, 0.000000 ),
ang2 = Angle( -0.105593, 90.978638, 0.000000 )
},
[5] = {
fov = 60,
velocity = 16,
pos1 = Vector( 6830.229004, 9614.283203, 105.920792 ),
pos2 = Vector( 6675.346191, 9711.740234, 102.549484 ),
ang1 = Angle( 1.055771, 147.803604, 0.000000 ),
ang2 = Angle( 1.055771, 149.803604, 0.000000 )
},
[6] = {
fov = 60,
velocity = 15,
pos1 = Vector( 3114.608887, -13817.962891, 82.778885 ),
pos2 = Vector( 5247.718262, -14413.496094, 74.946350 ),
ang1 = Angle( 0.844603, -15.770578, 0.000000 ),
ang2 = Angle( 2.006202, 37.927032, 0.000000 )
},
[7] = {
fov = 60,
velocity = 14,
pos1 = Vector( 4964.591797, 4514.272461, 213.532272 ),
pos2 = Vector( 5047.838379, 3216.407959, 128.219254 ),
ang1 = Angle( 8.131199, -77.082695, 0.000000 ),
ang2 = Angle( 0.422407, -89.520081, 0.000000 )
}
}
}
function intro.open( dt )
local chars = dt.cont
local resScale = Quantum.Client.ResolutionScale
local sw, sh = ScrW(), ScrH()
local padding = 10 * resScale
local padding_s = 4 * resScale
local chars = dt.cont
local resScale = Quantum.Client.ResolutionScale
local sw, sh = ScrW(), ScrH()
local padding = 10 * resScale
local padding_s = 4 * resScale
if( !f ) then
if( !f ) then
Quantum.Client.IsInMenu = true -- hide the hud
Quantum.Client.IsInMenu = true -- hide the hud
local f = vgui.Create( "DFrame" )
f:SetSize( sw, sh )
f:SetTitle( "" )
f:ShowCloseButton( false )
f.Paint = function( self, w, h )
surface.SetDrawColor( Color( 20, 20, 20, 255 ) )
local height = 90 * resScale
surface.DrawRect( 0, 0, w, 90 * resScale )
surface.DrawRect( 0, h - height, w, height )
end
f:SetDraggable( false )
f:MakePopup()
function f:OnClose()
Quantum.Client.IsInMenu = false
Quantum.Client.Cam.Stop() -- stop the cinematic
end
f.w, f.h = f:GetSize()
local f = vgui.Create( "DFrame" )
f:SetSize( sw, sh )
f:SetTitle( "" )
f:ShowCloseButton( false )
f.Paint = function( self, w, h )
surface.SetDrawColor( Color( 20, 20, 20, 255 ) )
local height = 90 * resScale
surface.DrawRect( 0, 0, w, 90 * resScale )
surface.DrawRect( 0, h - height, w, height )
end
f:SetDraggable( false )
f:MakePopup()
function f:OnClose()
Quantum.Client.IsInMenu = false
Quantum.Client.Cam.Stop() -- stop the cinematic
end
f.w, f.h = f:GetSize()
--- MUSIC ---
--surface.PlaySound( "music/HL1_song10.mp3" ) -- too short
--surface.PlaySound( "music/HL2_song23_SuitSong3.mp3" )
--LocalPlayer():EmitSound("Quantum_Music_TriangeAtDawn")
f.Think = function( self )
if( Quantum.Client.Cam.Temp.Finished == true ) then self:Close() end -- if the scene is finished then close the menu and exit the cinematic
end
local skip = vgui.Create( "DButton", f )
skip:SetText( "Skip Intro" )
skip:SetFont( "q_button_m" )
skip:SetTextColor( Color( 255, 255, 255, 255 ) )
skip:SizeToContents()
skip.Paint = function( self ) theme.skipbutton( self, Color( 0, 0, 0, 0 ) ) end
skip.w, skip.h = skip:GetSize()
skip:SetPos( f.w - skip.w - padding, f.h - skip.h - padding )
skip.DoClick = function( self )
f:Close()
end
skip.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
--- MUSIC ---
--surface.PlaySound( "music/HL1_song10.mp3" ) -- too short
--surface.PlaySound( "music/HL2_song23_SuitSong3.mp3" )
--LocalPlayer():EmitSound("Quantum_Music_TriangeAtDawn")
Quantum.Client.Cam.Start( scenes[game.GetMap()], false ) -- start the cinematic
local skip = vgui.Create( "DButton", f )
skip:SetText( "Skip Intro" )
skip:SetFont( "q_button_m" )
skip:SetTextColor( Color( 255, 255, 255, 255 ) )
skip:SizeToContents()
skip.Paint = function( self ) theme.skipbutton( self, Color( 0, 0, 0, 0 ) ) end
skip.w, skip.h = skip:GetSize()
skip:SetPos( f.w - skip.w - padding, f.h - skip.h - padding )
skip.DoClick = function( self )
f:Close()
end
skip.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
local logdata = {
[1] = {
title = "Welcome!",
text = "Welcome to the server! This server is running the Quantum framework which was developed by AlmTech.\n\nDuring this awesome cinematic you will be shown what you can do on the server. Starting with the basics."
},
[2] = {
title = "Classes & Professions",
text = "Professions are the core gameplay where they can unlock certian abilities to craft, cook and gather certain resources. You can learn a profession at any teacher NPC.\n\nYou can have the maximum of 2 professions and if you are skilled enough then some players might hire you."
},
[3] = {
title = "Classes & Professions",
text = "Professions are important where they could lead you to many opportunities.\nThe items produced by certain professions could be sold or traded to NPCs and other players. But keep in mind that everyone might not be as trustworthy as you would have thought."
},
[4] = {
title = "Classes & Professions",
text = "Character classes are also one of many key element to the core gameplay. Some character classes are better at certain things but worse at other things, but your class does not define your journey and you have the freedom to choose whatever you want to do."
},
[5] = {
title = "Different Professions",
text = "There are different kinds of professions. These professions range from gathering resources, crafting items and even combat. But choose wisely becuase " -- insert more text later
}
}
Quantum.Client.Cam.Start( scenes[game.GetMap()], false ) -- start the cinematic
local box = log.createinfobox( logdata, f )
end
local logdata = {
[1] = {
title = "Welcome!",
text = "Welcome to the server! This server is running the Quantum framework which was developed by AlmTech.\n\nDuring this awesome cinematic you will be shown what you can do on the server. Starting with the basics."
},
[2] = {
title = "Classes & Professions",
text = "Professions are the core gameplay where they can unlock certian abilities to craft, cook and gather certain resources. You can learn a profession at any teacher NPC.\n\nYou can have the maximum of 2 professions and if you are skilled enough then some players might hire you."
},
[3] = {
title = "Classes & Professions",
text = "Professions are important where they could lead you to many opportunities.\nThe items produced by certain professions could be sold or traded to NPCs and other players. But keep in mind that everyone might not be as trustworthy as you would have thought."
},
[4] = {
title = "Classes & Professions",
text = "Character classes are also one of many key element to the core gameplay. Some character classes are better at certain things but worse at other things, but your class does not define your journey and you have the freedom to choose whatever you want to do."
},
[5] = {
title = "Factions & Zones",
text = "As a citizen on the server you can join or create your own faction. Factions are considered as an organization where players can band together to achieve goals and dominate a certain area on the map. But be aware that there exists more than one faction."
},
[6] = {
title = "Factions & Zones",
text = "All factions can controll zones if they have enough resources. Some zones/areas of the map contain different resources than others, therefore they might be more valuable to the other factions.\nA zone can be taken over by any faction but there might be competition which might conclude in a war."
},
[7] = {
title = "Questions & Help",
text = "If you have any questions about the server just join our discord server and we will be more than happy to give you a answer. If you need help with something in-game then you might consider contacting a 'Server-Master' which are the moderators of the server. Good luck!"
}
}
local box = log.createinfobox( logdata, f )
end
end
return intro

@ -0,0 +1,77 @@
-- __ _ _______ _ __
-- / / /\ | | |__ __| | | \ \
-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \
-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > >
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
local main = {}
local theme = Quantum.Client.Menu.GetAPI( "theme" )
local scenes = {
["rp_truenorth_v1a_livin"] = {
[1] = {
[1] = {
fov = 60,
velocity = 1,
pos1 = Vector( 3473.962158, -5456.522949, 4205.845703 ),
ang1 = Angle( 6.283165, -108.298935, 0.000000 )
}
},
[2] = {
[1] = {
fov = 70,
velocity = 1,
pos1 = Vector( 10481.976562, -6193.810059, 5464.451172 ),
ang1 = Angle( 3.220725, 103.288849, 0.000000 )
}
},
[3] = {
[1] = {
fov = 85,
velocity = 1,
pos1 = Vector( 6285.742676, -14192.770508, 53.289391 ),
ang1 = Angle( -0.052740, 158.862747, 0.000000 )
}
},
[4] = {
[1] = {
fov = 85,
velocity = 1,
pos1 = Vector( -11803.785156, -13864.571289, -39.331917 ),
ang1 = Angle( 7.180876, 118.805817, 0.000000 )
}
}
}
}
function main.open(dt)
if( !f ) then
Quantum.Client.IsInMenu = true -- hide the hud
local resScale = Quantum.Client.ResolutionScale
local sw, sh = ScrW(), ScrH()
local padding = 10 * resScale
local padding_s = 4 * resScale
local f = vgui.Create( "DFrame" )
f:SetSize( sw, sh )
f:SetTitle( "" )
f:IsDraggable( false )
f:MakePopup()
f.Paint = function( self )
theme.renderblur( self, 2, 7 )
end
f.OnClose = function( self )
Quantum.Client.IsInMenu = false
Quantum.Client.Cam.Stop()
end
Quantum.Client.Cam.Start( scenes[ game.GetMap() ][math.random( 1, table.Count(scenes[ game.GetMap() ])) ], false )
end
end
return main

@ -5,53 +5,56 @@
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
Quantum.Client.Cam = {}
Quantum.Client.Cam = {}
function Quantum.Client.Cam.InvertAngle( ang ) return Angle( -ang.x, ang.y, -ang.z ) end -- Flip the camera 180* relative to target
function Quantum.Client.Cam.Stop()
hook.Remove( "CalcView", "Quantum_Cinematic" )
Quantum.Client.Cam.Temp.scene_index = nil -- remove the var becuase it is unneeded
Quantum.Debug( "Stopped cinematic." )
hook.Remove( "CalcView", "Quantum_Cinematic" )
Quantum.Client.Cam.Temp.scene_index = nil -- remove the var becuase it is unneeded
Quantum.Debug( "Stopped cinematic." )
end
function Quantum.Client.Cam.Start( scene, loop )
local frac = 0
local time -- speed of the camera ( how long till it reaches its finish point )
local fov
Quantum.Client.Cam.Temp = {}
Quantum.Client.Cam.Temp.scene_index = 1
local view = {} -- calcview vector data
hook.Remove( "CalcView", "Quantum_Cinematic" ) -- if a cinematic is already running; cancel it
hook.Add( "CalcView", "Quantum_Cinematic", function( ply, pos, ang, fov )
time = scene[Quantum.Client.Cam.Temp.scene_index].velocity || 5
fov = scene[Quantum.Client.Cam.Temp.scene_index].fov || 20
frac = math.Clamp( frac + FrameTime()/time, 0, 1 )
if( frac <= 0 ) then return end
scene[Quantum.Client.Cam.Temp.scene_index].pos2 = scene[Quantum.Client.Cam.Temp.scene_index].pos2 || scene[Quantum.Client.Cam.Temp.scene_index].pos1 -- if there is no finish pos then make it stay still at starting pos
scene[Quantum.Client.Cam.Temp.scene_index].ang2 = scene[Quantum.Client.Cam.Temp.scene_index].ang2 || scene[Quantum.Client.Cam.Temp.scene_index].ang1
view.origin = LerpVector( frac, scene[Quantum.Client.Cam.Temp.scene_index].pos1, scene[Quantum.Client.Cam.Temp.scene_index].pos2 )
view.angles = LerpAngle( frac, scene[Quantum.Client.Cam.Temp.scene_index].ang1, scene[Quantum.Client.Cam.Temp.scene_index].ang2 )
view.fov = fov
view.drawviewer = true
if( view.origin:IsEqualTol( scene[Quantum.Client.Cam.Temp.scene_index].pos2, 1 ) ) then
if( Quantum.Client.Cam.Temp.scene_index + 1 <= #scene ) then
frac = 0
Quantum.Client.Cam.Temp.scene_index = Quantum.Client.Cam.Temp.scene_index + 1
end
if( Quantum.Client.Cam.Temp.scene_index > #scene ) then -- if all scenes are finished, loop them if loop is enabled
Quantum.Client.Cam.Temp.scene_index = 1
end
-- otherwise it will just stop at the end.
end
return view
end)
local frac = 0
local time -- speed of the camera ( how long till it reaches its finish point )
local fov
Quantum.Client.Cam.Temp = {}
Quantum.Client.Cam.Temp.Finished = false
Quantum.Client.Cam.Temp.scene_index = 1
local view = {} -- calcview vector data
hook.Remove( "CalcView", "Quantum_Cinematic" ) -- if a cinematic is already running; cancel it
hook.Add( "CalcView", "Quantum_Cinematic", function( ply, pos, ang, fov )
time = scene[Quantum.Client.Cam.Temp.scene_index].velocity || 5
fov = scene[Quantum.Client.Cam.Temp.scene_index].fov || 20
frac = math.Clamp( frac + FrameTime()/time, 0, 1 )
if( frac <= 0 ) then return end
scene[Quantum.Client.Cam.Temp.scene_index].pos2 = scene[Quantum.Client.Cam.Temp.scene_index].pos2 || scene[Quantum.Client.Cam.Temp.scene_index].pos1 -- if there is no finish pos then make it stay still at starting pos
scene[Quantum.Client.Cam.Temp.scene_index].ang2 = scene[Quantum.Client.Cam.Temp.scene_index].ang2 || scene[Quantum.Client.Cam.Temp.scene_index].ang1
view.origin = LerpVector( frac, scene[Quantum.Client.Cam.Temp.scene_index].pos1, scene[Quantum.Client.Cam.Temp.scene_index].pos2 )
view.angles = LerpAngle( frac, scene[Quantum.Client.Cam.Temp.scene_index].ang1, scene[Quantum.Client.Cam.Temp.scene_index].ang2 )
view.fov = fov
view.drawviewer = true
if( view.origin:IsEqualTol( scene[Quantum.Client.Cam.Temp.scene_index].pos2, 1 ) ) then
if( Quantum.Client.Cam.Temp.scene_index + 1 <= #scene ) then
frac = 0
Quantum.Client.Cam.Temp.scene_index = Quantum.Client.Cam.Temp.scene_index + 1
else
Quantum.Client.Cam.Temp.Finished = true -- tell the menu that the scene is finished
end
if( Quantum.Client.Cam.Temp.scene_index > #scene ) then -- if all scenes are finished, loop them if loop is enabled
Quantum.Client.Cam.Temp.scene_index = 1
end
-- otherwise it will just stop at the end.
end
return view
end)
end

@ -9,102 +9,102 @@ Quantum.Server.Char = {}
Quantum.Server.Char.Players = {}
local function CreateCharTable( args )
return {
name = args.name || "UNKNOWN",
class = Quantum.Classes[args.class] || Quantum.Classes[1],
maxhealth = Quantum.Server.Settings.MaxHealth,
health = args.health || Quantum.Server.Settings.MaxHealth,
model = Quantum.Classes[args.class].Models[args.gender][args.modelIndex] || "models/player.mdl",
money = args.money || Quantum.Server.Settings.StarterMoney,
inventory = args.inventory || {}, -- create new inventory later
jobs = args.jobs || {
[1] = { title = "Unemployed", level = -1 },
},
skills = args.skills || {
crafting = 0,
cooking = 0,
combat = 0,
science = 0
},
training = args.training || {},
licenses = args.licenses || {},
titles = args.titles || {}
}
return {
name = args.name || "UNKNOWN",
class = Quantum.Classes[args.class] || Quantum.Classes[1],
maxhealth = Quantum.Server.Settings.MaxHealth,
health = args.health || Quantum.Server.Settings.MaxHealth,
model = Quantum.Classes[args.class].Models[args.gender][args.modelIndex] || "models/player.mdl",
money = args.money || Quantum.Server.Settings.StarterMoney,
inventory = args.inventory || {}, -- create new inventory later
jobs = args.jobs || {
[1] = { title = "Unemployed", level = -1 },
},
skills = args.skills || {
crafting = 0,
cooking = 0,
combat = 0,
science = 0
},
training = args.training || {},
licenses = args.licenses || {},
titles = args.titles || {}
}
end
function Quantum.Server.Char.Load( pl, index, tbl )
local id = pl:SteamID() .. ";" .. index
if( Quantum.Server.Char.Players[ id ] == nil ) then
Quantum.Server.Char.Players[ id ] = CreateCharTable( tbl ) -- create the character
Quantum.Server.Char.Players[ id ].inventory = tbl.inventory || Quantum.Server.Inventory.Create( Quantum.Server.Char.Players[ id ] ) -- give the character an inventory
local id = pl:SteamID() .. ";" .. index
if( Quantum.Server.Char.Players[ id ] == nil ) then
Quantum.Server.Char.Players[ id ] = CreateCharTable( tbl ) -- create the character
Quantum.Server.Char.Players[ id ].inventory = tbl.inventory || Quantum.Server.Inventory.Create( Quantum.Server.Char.Players[ id ] ) -- give the character an inventory
Quantum.Debug( "Created character (" .. id .. ")" )
return Quantum.Server.Char.Players[ id ]
else
Quantum.Error( "Tried to duplicate character! Index already used. (" .. id .. ")" )
end
Quantum.Debug( "Created character (" .. id .. ")" )
return Quantum.Server.Char.Players[ id ]
else
Quantum.Error( "Tried to duplicate character! Index already used. (" .. id .. ")" )
end
end
function Quantum.Server.Char.Remove( pl, index )
local id = pl:SteamID() .. ":" .. index
if( Quantum.Server.Char.Players[ id ] ~= nil ) then
Quantum.Server.Char.Players[ id ] = nil
Quantum.Debug( "Removed character (" .. id .. ")" )
end
local id = pl:SteamID() .. ":" .. index
if( Quantum.Server.Char.Players[ id ] ~= nil ) then
Quantum.Server.Char.Players[ id ] = nil
Quantum.Debug( "Removed character (" .. id .. ")" )
end
end
function Quantum.Server.Char.GetCurrentCharacter( pl )
if( pl.character == nil ) then Quantum.Error( tostring( pl ) .. " doesn't have a character! Unable to get current character table." ) end
return pl.character
if( pl.character == nil ) then Quantum.Error( tostring( pl ) .. " doesn't have a character! Unable to get current character table." ) end
return pl.character
end
local function setupCharacter( pl, char )
pl:Spawn()
pl:SetMaxHealth( char.maxhealth )
pl:SetHealth( char.health )
pl:SetModel( char.model )
pl:Spawn()
pl:SetMaxHealth( char.maxhealth )
pl:SetHealth( char.health )
pl:SetModel( char.model )
end
function Quantum.Server.Char.SetCurrentCharacter( pl, index )
local id = pl:SteamID() .. ";" .. index
if( Quantum.Server.Char.Players[ id ] ) then
pl.character = Quantum.Server.Char.Players[ id ]
pl.charindex = index
setupCharacter( pl, pl.character )
return pl.character
else
Quantum.Error( "Unable to set " .. tostring(pl) .. " character (" .. id .. "). Character not found!" )
return nil
end
local id = pl:SteamID() .. ";" .. index
if( Quantum.Server.Char.Players[ id ] ) then
pl.character = Quantum.Server.Char.Players[ id ]
pl.charindex = index
setupCharacter( pl, pl.character )
return pl.character
else
Quantum.Error( "Unable to set " .. tostring(pl) .. " character (" .. id .. "). Character not found!" )
return nil
end
end
function Quantum.Server.Char.GetPlayerChars( pl )
local chars = {}
local strtbl = {}
for id, char in pairs( Quantum.Server.Char.Players ) do
strtbl = string.Split( id, ";" )
if( strtbl[1] == pl:SteamID() ) then chars[id] = char end
end
return chars
local chars = {}
local strtbl = {}
for id, char in pairs( Quantum.Server.Char.Players ) do
strtbl = string.Split( id, ";" )
if( strtbl[1] == pl:SteamID() ) then chars[id] = char end
end
return chars
end
function Quantum.Server.Char.GetCharCount( pl )
return table.Count( Quantum.Server.Char.GetPlayerChars( pl ) ) || 0
return table.Count( Quantum.Server.Char.GetPlayerChars( pl ) ) || 0
end
local function getBasicCharInfo( char )
return {
name = char.name,
model = char.model,
class = char.class.Name,
job = char.jobs[1]
}
return {
name = char.name,
model = char.model,
class = char.class.Name,
job = char.jobs[1]
}
end
function Quantum.Server.Char.GetPlayerChars_cl( pl )
local chars = {}
for id, char in pairs( Quantum.Server.Char.GetPlayerChars( pl ) ) do
chars[id] = getBasicCharInfo( char )
end
return chars
local chars = {}
for id, char in pairs( Quantum.Server.Char.GetPlayerChars( pl ) ) do
chars[id] = getBasicCharInfo( char )
end
return chars
end

@ -8,35 +8,35 @@
Quantum.Server.Inventory = {}
function Quantum.Server.Inventory.Create( char )
char.inventory = {}
char.inventory = {}
for i = 1, Quantum.Server.Settings.Inventory.Width do
char.inventory[i] = {}
end
for i = 1, Quantum.Server.Settings.Inventory.Width do
char.inventory[i] = {}
end
for h, v in pairs( char.inventory ) do
for w = 1, Quantum.Server.Settings.Inventory.Height do
char.inventory[h][w] = 0
end
end
for h, v in pairs( char.inventory ) do
for w = 1, Quantum.Server.Settings.Inventory.Height do
char.inventory[h][w] = 0
end
end
return char.inventory
return char.inventory
end
local function isEquippable( item )
return item.equipable || false
return item.equipable || false
end
function Quantum.Server.Inventory.SetSlotItem( char, x, y, item, amount )
if( isEquippable( item ) ) then
amount = 1
char.inventory[x][y] = { item }
else
amount = amount || 1
char.inventory[x][y] = { item, amount }
end
Quantum.Debug( "Gave " .. char.name .. " " .. amount .. " [" .. item.name .. "]" )
return
if( isEquippable( item ) ) then
amount = 1
char.inventory[x][y] = { item }
else
amount = amount || 1
char.inventory[x][y] = { item, amount }
end
Quantum.Debug( "Gave " .. char.name .. " " .. amount .. " [" .. item.name .. "]" )
return
end
function Quantum.Server.Inventory.GetSlotItem( char, x, y ) return char.inventory[x][y] end

@ -110,7 +110,7 @@ local function runNetFunc( pl, func, args )
end
net.Receive( "quantum_menu_button_net", function( len, pl )
local funcid = net.ReadString()
local funcid = net.ReadString()
local args = net.ReadTable()
runNetFunc( pl, funcid, args )
end)

@ -7,15 +7,15 @@
local menus = {
character = function( pl )
Quantum.Net.OpenMenu( pl, "character", Quantum.Server.Char.GetPlayerChars( pl ) )
end
character = function( pl )
Quantum.Net.OpenMenu( pl, "character", Quantum.Server.Char.GetPlayerChars( pl ) )
end
}
function Quantum.Server.OpenMenu( pl, menu )
if( menus[menu] ) then
menus[menu]( pl )
else
Quantum.Error( "Tried to open a non-exsistent menu for " .. tostring(pl) .. "." )
end
if( menus[menu] ) then
menus[menu]( pl )
else
Quantum.Error( "Tried to open a non-exsistent menu for " .. tostring(pl) .. "." )
end
end

@ -9,15 +9,15 @@ Quantum.Item = {}
Quantum.Items = {}
function Quantum.Item.Create( id, args )
local item = {
name = args.name, -- items name
desc = args.desc, -- items description
icon = args.icon, -- items icon
stack = args.stack, -- items max stack size
soulbound = args.soulbound, -- if item could be dropped/traded to other players
rarity = args.rarity, -- rarity of the item
usefunction = args.usefunction, -- use function
consumefunction = args.consumefunction, --consume function
equipfunction = args.equipfunction -- equip function
}
local item = {
name = args.name, -- items name
desc = args.desc, -- items description
icon = args.icon, -- items icon
stack = args.stack, -- items max stack size
soulbound = args.soulbound, -- if item could be dropped/traded to other players
rarity = args.rarity, -- rarity of the item
usefunction = args.usefunction, -- use function
consumefunction = args.consumefunction, --consume function
equipfunction = args.equipfunction -- equip function
}
end

@ -9,17 +9,17 @@ local prefix
if CLIENT then prefix = "[Quantum] : " else prefix = "" end -- A little advertisement for the players
function Quantum.Debug( txt ) -- Very usefull for debugging
if( txt ) then
MsgC( Color( 200, 200, 200 ), prefix .. "[Debug] " .. txt .. "\n" )
else
MsgC( Color( 200, 200, 200 ), prefix .. "[Debug]\n" )
end
if( txt ) then
MsgC( Color( 200, 200, 200 ), prefix .. "[Debug] " .. txt .. "\n" )
else
MsgC( Color( 200, 200, 200 ), prefix .. "[Debug]\n" )
end
end
function Quantum.Error( txt )
if( txt ) then
MsgC( Color( 255, 10, 10 ), prefix .. "[ERROR] " .. txt .. "\n" )
else
return
end
if( txt ) then
MsgC( Color( 255, 10, 10 ), prefix .. "[ERROR] " .. txt .. "\n" )
else
return
end
end

@ -6,106 +6,106 @@
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
if SERVER then
AddCSLuaFile( "engine/sh_debug.lua" )
AddCSLuaFile( "settings/sh_settings.lua" )
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
AddCSLuaFile( "engine/sh_debug.lua" )
AddCSLuaFile( "settings/sh_settings.lua" )
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
-- Content --
local path = "gamemodes/" .. GM.FolderName .. "/gamemode/content/materials/quantum/server_banner.png"
resource.AddSingleFile( path )
-- Content --
local path = "gamemodes/" .. GM.FolderName .. "/gamemode/content/materials/quantum/server_banner.png"
resource.AddSingleFile( path )
include( "shared.lua" ) --
include( "shared.lua" ) --
Quantum.Server = {}
include( "settings/sv_settings.lua" ) -- include the settings
Quantum.Server = {}
include( "settings/sv_settings.lua" ) -- include the settings
local function loadCoreFiles()
local fol = GM.FolderName .. "/gamemode/engine/core/"
MsgC( "\n" )
Quantum.Debug( "Loading core files..." )
-- Shared files
local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" )
for _, file in pairs( shFiles ) do
local function loadCoreFiles()
local fol = GM.FolderName .. "/gamemode/engine/core/"
MsgC( "\n" )
Quantum.Debug( "Loading core files..." )
-- Shared files
local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" )
for _, file in pairs( shFiles ) do
AddCSLuaFile( fol .. file )
include( fol .. file )
Quantum.Debug( "(CORE) Loaded: " .. fol .. file )
end
-- CLient files
local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" )
for _, file in pairs( clFiles ) do
AddCSLuaFile( fol .. "client/" .. file )
Quantum.Debug( "(CORE) Loaded: " .. fol .. "client/" .. file )
end
-- Server files
local cFiles = file.Find( fol .. "/server/sv_*.lua", "LUA" )
for _, file in pairs( cFiles ) do
include( fol .. "server/" .. file )
Quantum.Debug( "(CORE) Loaded: " .. fol .. "server/" .. file )
end
end
local function loadLibFiles()
local fol = GM.FolderName .. "/gamemode/engine/lib/"
MsgC( "\n" )
Quantum.Debug( "Loading libraries..." )
-- Shared files
local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" )
for _, file in pairs( shFiles ) do
include( fol .. file )
Quantum.Debug( "(CORE) Loaded: " .. fol .. file )
end
-- CLient files
local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" )
for _, file in pairs( clFiles ) do
AddCSLuaFile( fol .. "client/" .. file )
Quantum.Debug( "(CORE) Loaded: " .. fol .. "client/" .. file )
end
-- Server files
local cFiles = file.Find( fol .. "/server/sv_*.lua", "LUA" )
for _, file in pairs( cFiles ) do
include( fol .. "server/" .. file )
Quantum.Debug( "(CORE) Loaded: " .. fol .. "server/" .. file )
end
end
local function loadLibFiles()
local fol = GM.FolderName .. "/gamemode/engine/lib/"
MsgC( "\n" )
Quantum.Debug( "Loading libraries..." )
-- Shared files
local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" )
for _, file in pairs( shFiles ) do
AddCSLuaFile( fol .. file )
include( fol .. file )
Quantum.Debug( "Added library: " .. fol .. file )
end
-- CLient files
local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" )
for _, file in pairs( clFiles ) do
AddCSLuaFile( fol .. "client/" .. file )
Quantum.Debug( "Added library: " .. fol .. "client/" .. file )
end
-- Server files
local cFiles = file.Find( fol .. "/server/sv_*.lua", "LUA" )
for _, file in pairs( cFiles ) do
include( fol .. "server/" .. file )
Quantum.Debug( "Added library: " .. fol .. "server/" .. file )
end
end
local function addAllDermaMenus()
local fol = GM.FolderName .. "/gamemode/engine/derma/"
MsgC( "\n" )
Quantum.Debug( "Loading menus...")
AddCSLuaFile( fol .. "cl_menu.lua" )
-- add all the menu libs
local libfol = fol .. "lib/"
local libFiles = file.Find( libfol .. "cl_*.lua", "LUA" )
for _, file in pairs( libFiles ) do
AddCSLuaFile( libfol .. file )
Quantum.Debug( "Added library: " .. libfol .. file )
end
-- add the menu's
local menufol = GM.FolderName .. "/gamemode/engine/derma/menus/"
local menuFiles = file.Find( menufol .. "menu_*.lua", "LUA" )
for _, file in pairs( menuFiles ) do
AddCSLuaFile( menufol .. file )
Quantum.Debug( "Added menu: " .. menufol .. file )
end
end
function Quantum.Server.Load()
-- Add all of the base files
loadCoreFiles()
loadLibFiles()
addAllDermaMenus()
end
Quantum.Server.Load()
include( fol .. file )
Quantum.Debug( "Added library: " .. fol .. file )
end
-- CLient files
local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" )
for _, file in pairs( clFiles ) do
AddCSLuaFile( fol .. "client/" .. file )
Quantum.Debug( "Added library: " .. fol .. "client/" .. file )
end
-- Server files
local cFiles = file.Find( fol .. "/server/sv_*.lua", "LUA" )
for _, file in pairs( cFiles ) do
include( fol .. "server/" .. file )
Quantum.Debug( "Added library: " .. fol .. "server/" .. file )
end
end
local function addAllDermaMenus()
local fol = GM.FolderName .. "/gamemode/engine/derma/"
MsgC( "\n" )
Quantum.Debug( "Loading menus...")
AddCSLuaFile( fol .. "cl_menu.lua" )
-- add all the menu libs
local libfol = fol .. "lib/"
local libFiles = file.Find( libfol .. "cl_*.lua", "LUA" )
for _, file in pairs( libFiles ) do
AddCSLuaFile( libfol .. file )
Quantum.Debug( "Added library: " .. libfol .. file )
end
-- add the menu's
local menufol = GM.FolderName .. "/gamemode/engine/derma/menus/"
local menuFiles = file.Find( menufol .. "menu_*.lua", "LUA" )
for _, file in pairs( menuFiles ) do
AddCSLuaFile( menufol .. file )
Quantum.Debug( "Added menu: " .. menufol .. file )
end
end
function Quantum.Server.Load()
-- Add all of the base files
loadCoreFiles()
loadLibFiles()
addAllDermaMenus()
end
Quantum.Server.Load()
end

@ -8,51 +8,51 @@
Quantum.CharacterLimit = 5
Quantum.Models = {
NPC = {},
Player = {
Citizen = {
Male = {
"models/player/Group01/male_01.mdl",
"models/player/Group01/male_02.mdl",
"models/player/Group01/male_03.mdl",
"models/player/Group01/male_04.mdl",
"models/player/Group01/male_05.mdl",
"models/player/Group01/male_06.mdl",
"models/player/Group01/male_07.mdl",
"models/player/Group01/male_08.mdl",
"models/player/Group01/male_09.mdl"
},
NPC = {},
Player = {
Citizen = {
Male = {
"models/player/Group01/male_01.mdl",
"models/player/Group01/male_02.mdl",
"models/player/Group01/male_03.mdl",
"models/player/Group01/male_04.mdl",
"models/player/Group01/male_05.mdl",
"models/player/Group01/male_06.mdl",
"models/player/Group01/male_07.mdl",
"models/player/Group01/male_08.mdl",
"models/player/Group01/male_09.mdl"
},
Female = {
"models/player/group01/female_01.mdl",
"models/player/group01/female_02.mdl",
"models/player/group01/female_03.mdl",
"models/player/group01/female_04.mdl",
"models/player/group01/female_05.mdl",
"models/player/group01/female_06.mdl"
}
},
Nobleman = {
Male = { "models/player/breen.mdl" },
Female = { "models/player/alyx.mdl" }
}
}
Female = {
"models/player/group01/female_01.mdl",
"models/player/group01/female_02.mdl",
"models/player/group01/female_03.mdl",
"models/player/group01/female_04.mdl",
"models/player/group01/female_05.mdl",
"models/player/group01/female_06.mdl"
}
},
Nobleman = {
Male = { "models/player/breen.mdl" },
Female = { "models/player/alyx.mdl" }
}
}
}
Quantum.Classes = {
Commoner = { -- id
Name = "Commoner",
Desc = "Someone who lives in a city.",
Models = Quantum.Models.Player.Citizen
},
Nobleman = {
Name = "Nobleman",
Desc = "A nobleman is someone who originates from a family of wealth and power and tend to look down upon those who are not 'fit' in their eyes. They often expects everyone to do their bidding without question.",
Models = Quantum.Models.Player.Nobleman -- change this to better models
},
Worker = {
Name = "Worker",
Desc = "A worker is someone who is in the working-class and come from a poor family but has learned the secret of life; how to work hard and earn what you want.",
Models = Quantum.Models.Player.Citizen -- change this to better models
}
Commoner = { -- id
Name = "Commoner",
Desc = "Someone who lives in a city.",
Models = Quantum.Models.Player.Citizen
},
Nobleman = {
Name = "Nobleman",
Desc = "A nobleman is someone who originates from a family of wealth and power and tend to look down upon those who are not 'fit' in their eyes. They often expects everyone to do their bidding without question.",
Models = Quantum.Models.Player.Nobleman -- change this to better models
},
Worker = {
Name = "Worker",
Desc = "A worker is someone who is in the working-class and come from a poor family but has learned the secret of life; how to work hard and earn what you want.",
Models = Quantum.Models.Player.Citizen -- change this to better models
}
}

@ -5,7 +5,7 @@
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
Quantum.Server.Settings = {}
Quantum.Server.Settings = {}
Quantum.Server.Settings.VoiceChatRange = 400
@ -14,8 +14,8 @@ Quantum.Server.Settings.MaxHealth = 100
Quantum.Server.Settings.StarterMoney = 0
Quantum.Server.Settings.Inventory = {
Height = 5,
Width = 5
Height = 5,
Width = 5
}
--- Features to be added ---
@ -25,53 +25,53 @@ Quantum.Server.Settings.MaxSkillLevel = 100
Quantum.Server.Settings.SpawnLocations = {
["rp_truenorth_v1a_livin"] = {
["Hospital"] = { pos = Vector( 13583, 13189, 128 ), ang = Angle( 1, 115, 0 ) },
["Lake"] = { pos = Vector( 10812, -8319, 5388 ), ang = Angle( 5, -40, 0 ) }
}
["rp_truenorth_v1a_livin"] = {
["Hospital"] = { pos = Vector( 13583, 13189, 128 ), ang = Angle( 1, 115, 0 ) },
["Lake"] = { pos = Vector( 10812, -8319, 5388 ), ang = Angle( 5, -40, 0 ) }
}
}
Quantum.Server.Settings.Licenses = {
Driving = { title = "Driving License", desc = "This permits you to operate and pilot any motorized vehicle in a public area.", cost = 1000 }
Driving = { title = "Driving License", desc = "This permits you to operate and pilot any motorized vehicle in a public area.", cost = 1000 }
}
Quantum.Server.Settings.Titles = {
dev = "Developer,"
dev = "Developer,"
}
Quantum.Server.Settings.DamageScale = { -- The scale of the damage for each hitgroup
[HITGROUP_HEAD] = 10,
[HITGROUP_CHEST] = 4,
[HITGROUP_STOMACH] = 2,
[HITGROUP_LEFTARM] = 1,
[HITGROUP_RIGHTARM] = 1,
[HITGROUP_LEFTLEG] = 1,
[HITGROUP_RIGHTLEG] = 1
[HITGROUP_HEAD] = 10,
[HITGROUP_CHEST] = 4,
[HITGROUP_STOMACH] = 2,
[HITGROUP_LEFTARM] = 1,
[HITGROUP_RIGHTARM] = 1,
[HITGROUP_LEFTLEG] = 1,
[HITGROUP_RIGHTLEG] = 1
}
Quantum.Server.Settings.PainSounds = {}
Quantum.Server.Settings.PainSounds.Male = {
"vo/npc/male01/pain01.wav",
"vo/npc/male01/pain02.wav",
"vo/npc/male01/pain03.wav",
"vo/npc/male01/pain04.wav",
"vo/npc/male01/pain05.wav",
"vo/npc/male01/pain06.wav",
"vo/npc/male01/pain07.wav",
"vo/npc/male01/pain08.wav",
"vo/npc/male01/pain09.wav"
"vo/npc/male01/pain01.wav",
"vo/npc/male01/pain02.wav",
"vo/npc/male01/pain03.wav",
"vo/npc/male01/pain04.wav",
"vo/npc/male01/pain05.wav",
"vo/npc/male01/pain06.wav",
"vo/npc/male01/pain07.wav",
"vo/npc/male01/pain08.wav",
"vo/npc/male01/pain09.wav"
}
Quantum.Server.Settings.DamageHurtSoundRepeatChance = 90 -- %
Quantum.Server.Settings.IdlePainSounds = {}
Quantum.Server.Settings.IdlePainSounds.Male = {
"vo/npc/male01/moan01.wav",
"vo/npc/male01/moan02.wav",
"vo/npc/male01/moan03.wav",
"vo/npc/male01/moan04.wav",
"vo/npc/male01/moan05.wav"
"vo/npc/male01/moan01.wav",
"vo/npc/male01/moan02.wav",
"vo/npc/male01/moan03.wav",
"vo/npc/male01/moan04.wav",
"vo/npc/male01/moan05.wav"
}

Loading…
Cancel
Save