Began work on weapon holstering

master
AlmTech Software 5 years ago
parent ad6ce4a6ee
commit edad87b41f
  1. 64
      gamemode/engine/core/client/cl_holster.lua
  2. 4
      gamemode/settings/sh_settings.lua

@ -1 +1,63 @@
-- -- __ _ _______ _ __
-- / / /\ | | |__ __| | | \ \
-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \
-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > >
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
Quantum.Client.Holster = {}
local holsterBind = Quantum.Bind.HolsterMain
local holsterTime = Quantum.HolsterTime
local client
local function getItemFromInv( pos )
return Quantum.Client.Inventory[pos]
end
local function getCurEquippedWeapon()
local item = getItemFromInv(Quantum.Client.Equipped[ Quantum.EquipSlots.Weapon ])
local itemTbl = Quantum.Item.Get( item[1] )
if( itemTbl != nil ) then
return itemTbl.equipgive
end
end
function Quantum.Client.Holster.SwitchHolster()
client = LocalPlayer()
if( client:GetActiveWeapon():GetClass() != "quantum_hands" ) then
local curWep= getCurEquippedWeapon()
if( curWep != nil && curWep != "quantum_hands" ) then
local wepEnt = client:GetWeapon( curWep )
client:SelectWeapon( client:GetWeapon( curWep ) )
else
client:SelectWeapon( client:GetWeapon( "quantum_hands" ) )
end
end
end
local startTime
function Quantum.Client.Holster.CheckBind()
if( Quantum.Client.Equipped != nil ) then
if( input.IsKeyDown( holsterBind ) ) then
if( startTime == nil ) then startTime = CurTime() end
if( CurTime() - startTime >= holsterTime ) then
Quantum.Client.Holster.SwitchHolster()
startTime = nil
end
else
startTime = nil
end
end
end
hook.Add( "Think", "Quantum_Client_Holster_Hook", function()
-- if( !Quantum.Client.IsInMenu ) then
-- Quantum.Client.Holster.CheckBind()
-- end
end)

@ -21,6 +21,8 @@ Quantum.Inventory = {
Quantum.InventoryOpenDelay = 0.35 Quantum.InventoryOpenDelay = 0.35
Quantum.ItemPickupTime = 0.5 -- seconds Quantum.ItemPickupTime = 0.5 -- seconds
Quantum.HolsterTime = 1 -- seconds
Quantum.Money = { Quantum.Money = {
Prefix = "$", Prefix = "$",
Surfix = "" Surfix = ""
@ -28,7 +30,7 @@ Quantum.Money = {
Quantum.Bind = { Quantum.Bind = {
OpenInventory = KEY_TAB, OpenInventory = KEY_TAB,
HolsterWeapon = "" HolsterMain = KEY_F
} }
Quantum.Models = { Quantum.Models = {

Loading…
Cancel
Save