diff --git a/gamemode/engine/core/client/cl_hud.lua b/gamemode/engine/core/client/cl_hud.lua index 0a6dcda..1864c94 100644 --- a/gamemode/engine/core/client/cl_hud.lua +++ b/gamemode/engine/core/client/cl_hud.lua @@ -8,7 +8,7 @@ local enabledHUDs = { ["CHudChat"] = true, ["CHudGMod"] = true, - ["CHudWeaponSelection"] = true + ["CHudWeaponSelection"] = false } hook.Add( "HUDShouldDraw", "Quantum_RemoveDefualtHUD", function( hudid ) diff --git a/gamemode/engine/core/server/sv_player_damage.lua b/gamemode/engine/core/server/sv_player_damage.lua index b8cd60d..42bcce7 100644 --- a/gamemode/engine/core/server/sv_player_damage.lua +++ b/gamemode/engine/core/server/sv_player_damage.lua @@ -27,31 +27,48 @@ end function GM:PlayerDeathSound() return true end +local function getModelGender( char ) + return char.gender +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 ) ] ) + + local chargender = getModelGender( Quantum.Server.Char.GetCurrentCharacter( pl ) ) + local soundlist + + if( chargender == "Male" ) then + soundlist = { + pain = Quantum.Server.Settings.PainSounds.Male, + idlepain = Quantum.Server.Settings.IdlePainSounds.Male + } + elseif( chargender == "Female" ) then + soundlist = { + pain = Quantum.Server.Settings.PainSounds.Female, + idlepain = Quantum.Server.Settings.IdlePainSounds.Female + } + end + + pl:EmitSound( soundlist.pain[ math.random( 1, #soundlist.pain ) ] ) - 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:SteamID64())) ) then timer.Remove( "Quantum_PlayerHurtSounds_" .. tostring( pl:SteamID64() ) ) end -- if it already exists remove it + timer.Create( "Quantum_PlayerHurtSounds_" .. tostring( pl:SteamID64() ), 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 ) ] ) + pl:EmitSound( soundlist.idlepain[ math.random( 1, #soundlist.idlepain ) ] ) end end) timer.Simple( 60, function() - timer.Remove( "Quantum_PlayerHurtSounds_" .. tostring( pl ) ) -- remove the timer for the player + timer.Remove( "Quantum_PlayerHurtSounds_" .. tostring( pl:SteamID64() ) ) -- remove the timer for the player 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:SteamID64()) ) ) then timer.Remove( "Quantum_PlayerHurtSounds_" .. tostring( pl:SteamID64() )) end end) \ No newline at end of file diff --git a/gamemode/engine/core/server/sv_player_init.lua b/gamemode/engine/core/server/sv_player_init.lua index 8742a8f..e30c65d 100644 --- a/gamemode/engine/core/server/sv_player_init.lua +++ b/gamemode/engine/core/server/sv_player_init.lua @@ -9,7 +9,7 @@ Quantum.Server.Player = {} local ply = FindMetaTable( "Player" ) -function GM:PlayerSelectSpawn( pl ) +function GM:PlayerSelectSpawn( ply ) return -- return nothing because we dont wont the player to spawn anywhere end @@ -20,6 +20,12 @@ function GM:PlayerInitialSpawn( ply ) end local function setUpPlayer( ply ) + local plchar = Quantum.Server.Char.GetCurrentCharacter( ply ) + + if( plchar != nil ) then + ply:SetModel( plchar.model ) + end + if( ply:GetModel() ~= nil ) then ply:SetupHands() else @@ -40,6 +46,8 @@ local function setUpPlayer( ply ) ply:Give( "quantum_hands" ) ply:SetActiveWeapon( "quantum_hands" ) + ply:SetFOV( 80 ) + Quantum.Debug( tostring( ply ) .. charnametxt ) end diff --git a/gamemode/engine/derma/menus/menu_charinfo.lua b/gamemode/engine/derma/menus/menu_charinfo.lua index 2c82343..3dc9dae 100644 --- a/gamemode/engine/derma/menus/menu_charinfo.lua +++ b/gamemode/engine/derma/menus/menu_charinfo.lua @@ -234,6 +234,32 @@ function menu.open( dt ) ent:SetEyeTarget( eyepos + Vector( 40, -5, 2 ) ) function char:LayoutEntity( Entity ) return end + ---- Inventory panel ---- + + local inv = vgui.Create( "DPanel", f ) -- section for all of the item panels + inv:SetSize( f.w - char.w, f.h - bar.h ) + inv.w, inv.h = inv:GetSize() + inv:SetPos( char.w, bar.h ) + inv.Paint = function( self, w, h ) + surface.SetDrawColor( 0, 0, 0, 0 ) + surface.DrawRect( 0, 0, w, h ) + end + + local maxW, maxH = Quantum.Inventory.Width, Quantum.Inventory.Height + + local itempanels = {} + + local count = 0 + local xbasepos, ybasepos = 0, 0 + local xintervall, yintervall = itemWidth + padding/2, itemHeight + padding/2 + local xpos, ypos = 0, 0 + local rows = 0 + + local itemframe = vgui.Create( "DPanel", inv ) -- container for all of the item panels + itemframe:SetSize( inv:GetSize() ) + itemframe:SetPos( 0, 0 ) + itemframe.Paint = function( self, w, h ) end + ---- EQUIP INFO---- f.markedItemPanel = {} f.equippanels = {} -- so we can access it later @@ -270,32 +296,6 @@ function menu.open( dt ) f.equippanels[Quantum.EquipSlots.Weapon] = createEquipSlotPanel( Quantum.EquipSlots.Weapon, slotXpos + equipSlot_PanelWidth + equipSlotSpacing/2, (equipSlotYpos + equipSlot_PanelHeight) / 2, slotScale, f ) -- create the panel f.equippanels[Quantum.EquipSlots.Weapon].SetItem( getItemInSlot(equipped[ Quantum.EquipSlots.Weapon ]) ) -- give its current item - ---- Inventory panel ---- - - local inv = vgui.Create( "DPanel", f ) -- section for all of the item panels - inv:SetSize( f.w - char.w, f.h - bar.h ) - inv.w, inv.h = inv:GetSize() - inv:SetPos( char.w, bar.h ) - inv.Paint = function( self, w, h ) - surface.SetDrawColor( 0, 0, 0, 0 ) - surface.DrawRect( 0, 0, w, h ) - end - - local maxW, maxH = Quantum.Inventory.Width, Quantum.Inventory.Height - - local itempanels = {} - - local count = 0 - local xbasepos, ybasepos = 0, 0 - local xintervall, yintervall = itemWidth + padding/2, itemHeight + padding/2 - local xpos, ypos = 0, 0 - local rows = 0 - - local itemframe = vgui.Create( "DPanel", inv ) -- container for all of the item panels - itemframe:SetSize( inv:GetSize() ) - itemframe:SetPos( 0, 0 ) - itemframe.Paint = function( self, w, h ) end - for ii=1, maxW * maxH, 1 do -- create all of the item panels if( ii != 1 ) then count = count + 1 end diff --git a/gamemode/engine/lib/server/sv_character.lua b/gamemode/engine/lib/server/sv_character.lua index f6a4ad4..9545c0f 100644 --- a/gamemode/engine/lib/server/sv_character.lua +++ b/gamemode/engine/lib/server/sv_character.lua @@ -24,6 +24,7 @@ local function CreateCharTable( args ) maxhealth = Quantum.Server.Settings.MaxHealth, health = args.health || Quantum.Server.Settings.MaxHealth, model = setMdl || "models/player.mdl", + gender = args.gender || "Male", money = args.money || Quantum.Server.Settings.StarterMoney, inventory = args.inventory || {}, -- create new inventory later jobs = args.jobs || { diff --git a/gamemode/engine/lib/server/sv_inventory.lua b/gamemode/engine/lib/server/sv_inventory.lua index 4baca0a..fdb3582 100644 --- a/gamemode/engine/lib/server/sv_inventory.lua +++ b/gamemode/engine/lib/server/sv_inventory.lua @@ -27,6 +27,7 @@ end local function setupWeaponItem( pl, itemTbl, dontSelect ) if( itemTbl.equipgive != nil ) then + pl:StripAmmo() pl:Give( itemTbl.equipgive, false ) if( !dontSelect ) then pl:SelectWeapon( itemTbl.equipgive ) end end @@ -51,8 +52,10 @@ local function setupWeaponOnRespawn( pl, char ) end hook.Add( "PlayerSpawn", "Quantum_Inventory_Equip_GiveWeapon", function( ply ) - setupWeaponOnRespawn( ply ) - ply:SelectWeapon( "quantum_hands" ) + if( ply.isloaded ) then + setupWeaponOnRespawn( ply ) + ply:SelectWeapon( "quantum_hands" ) + end end) function Quantum.Server.Inventory.UnEquipItem( pl, equipslot, char ) diff --git a/gamemode/engine/lib/server/sv_networking.lua b/gamemode/engine/lib/server/sv_networking.lua index 40f5937..6cf3993 100644 --- a/gamemode/engine/lib/server/sv_networking.lua +++ b/gamemode/engine/lib/server/sv_networking.lua @@ -146,13 +146,16 @@ function Quantum.Net.Inventory.Update( pl ) Quantum.Debug( "Updating " .. tostring(pl) .. " character." ) local charTbl = Quantum.Server.Char.GetCurrentCharacter( pl ) - local char = { money = charTbl.money, model = charTbl.model, name = charTbl.name } - net.Start( "quantum_char_update" ) - net.WriteTable( Quantum.Server.Char.GetInventory( charTbl ) ) - net.WriteTable( char ) - net.WriteTable( charTbl.equipped ) - net.Send( pl ) + if( charTbl != nil ) then + local char = { money = charTbl.money, model = charTbl.model, name = charTbl.name } + + net.Start( "quantum_char_update" ) + net.WriteTable( Quantum.Server.Char.GetInventory( charTbl ) ) + net.WriteTable( char ) + net.WriteTable( charTbl.equipped ) + net.Send( pl ) + end end local intcodeFunctions = { diff --git a/gamemode/engine/vars/cl_vars.lua b/gamemode/engine/vars/cl_vars.lua index 14a7d77..39248be 100644 --- a/gamemode/engine/vars/cl_vars.lua +++ b/gamemode/engine/vars/cl_vars.lua @@ -13,5 +13,5 @@ Quantum.EquipSlotsNames = { [Quantum.EquipSlots.Chest] = "Chest", [Quantum.EquipSlots.Legs] = "Legs", [Quantum.EquipSlots.Boots] = "Boots", - [Quantum.EquipSlots.Weapon] = "Weapon", + [Quantum.EquipSlots.Weapon] = "Main hand", } \ No newline at end of file diff --git a/gamemode/engine/vars/sh_vars.lua b/gamemode/engine/vars/sh_vars.lua index 42df895..a0b8ddc 100644 --- a/gamemode/engine/vars/sh_vars.lua +++ b/gamemode/engine/vars/sh_vars.lua @@ -18,7 +18,7 @@ Quantum.Rarity = { Rare = { txt = "Rare", color = Color( 48, 163, 230, 40 ) }, Epic = { txt = "Epic", color = Color( 220, 90, 90, 40 ) }, Legendary = { txt = "Legendary", color = Color( 235, 125, 52, 40 ) }, - Weapon = { txt = "Illegal", color = Color( 220, 90, 90, 40 ) } + Weapon = { txt = "Weapon", color = Color( 220, 90, 90, 40 ) } } Quantum.EquipSlots = { diff --git a/gamemode/settings/sv_settings.lua b/gamemode/settings/sv_settings.lua index 0a5604c..c5fc142 100644 --- a/gamemode/settings/sv_settings.lua +++ b/gamemode/settings/sv_settings.lua @@ -73,6 +73,18 @@ Quantum.Server.Settings.PainSounds.Male = { "vo/npc/male01/pain09.wav" } +Quantum.Server.Settings.PainSounds.Female = { + "vo/npc/female01/pain01.wav", + "vo/npc/female01/pain02.wav", + "vo/npc/female01/pain03.wav", + "vo/npc/female01/pain04.wav", + "vo/npc/female01/pain05.wav", + "vo/npc/female01/pain06.wav", + "vo/npc/female01/pain07.wav", + "vo/npc/female01/pain08.wav", + "vo/npc/female01/pain09.wav" +} + Quantum.Server.Settings.DamageHurtSoundRepeatChance = 90 -- % Quantum.Server.Settings.IdlePainSounds = {} @@ -84,6 +96,14 @@ Quantum.Server.Settings.IdlePainSounds.Male = { "vo/npc/male01/moan05.wav" } +Quantum.Server.Settings.IdlePainSounds.Female = { + "vo/npc/female01/moan01.wav", + "vo/npc/female01/moan02.wav", + "vo/npc/female01/moan03.wav", + "vo/npc/female01/moan04.wav", + "vo/npc/female01/moan05.wav" +} + --- Features to be added --- Quantum.Server.Settings.MaxJobLevel = 250 Quantum.Server.Settings.MaxJobSlots = 2 diff --git a/plugins/plugin_addweaponsasitems.lua b/plugins/plugin_addweaponsasitems.lua index 244d90f..ae048be 100644 --- a/plugins/plugin_addweaponsasitems.lua +++ b/plugins/plugin_addweaponsasitems.lua @@ -27,7 +27,7 @@ local function createItemName( entclass ) local str = string.Replace( entclass, "_", " " ) for i, ns in pairs( plugin.types ) do - str = string.Replace( str, ns, "" ) + str = string.gsub( str, ns, "" ) end return string.upper( str ) @@ -56,8 +56,10 @@ end function plugin.CreateItems( weps ) for _, wepID in pairs( weps ) do local swepTbl = weapons.Get( wepID ) - Quantum.Debug( "Added " .. wepID .. " as an item!" ) - local wepName = createItemName( wepID ) + local wepName = swepTbl.PrintName + if( wepName == "Scripted Weapon" || wepName == wepID ) then + wepName = createItemName( wepID ) + end Quantum.Item.Create( wepID, { name = wepName, desc = "A firearm." || swepTbl.Purpose,