fix melee custom bind

This commit is contained in:
edshot99 2024-12-26 22:10:05 -06:00
parent 3518bf7e4b
commit 8a254b9ae8
2 changed files with 14 additions and 3 deletions

View File

@ -12,6 +12,8 @@ ArcCW.KEY_TOGGLEUBGL = "arccw_toggle_ubgl"
ArcCW.KEY_TOGGLEATT = "arccw_toggle_att"
ArcCW.KEY_MELEE = "arccw_melee"
ArcCW.IN_MELEE = false
ArcCW.BindToEffect = {
[ArcCW.KEY_FIREMODE] = "firemode",
[ArcCW.KEY_ZOOMIN] = "zoomin",
@ -146,7 +148,9 @@ local function ArcCW_PlayerBindPress(ply, bind, pressed)
end
if bind == "melee" and wep:GetState() != ArcCW.STATE_SIGHTS then
wep:Bash()
ArcCW.IN_MELEE = true
timer.Simple(0, function() ArcCW.IN_MELEE = false end)
block = true
end
if block then return true end
@ -195,4 +199,11 @@ end
-- end
-- return false
-- end
-- end
hook.Add("StartCommand", "ArcCW_StartCommand_Melee", function(ply, ucmd)
if ArcCW.IN_MELEE then
ucmd:AddKey(IN_BULLRUSH)
ucmd:AddKey(IN_ATTACK)
end
end)

View File

@ -50,7 +50,7 @@ function SWEP:CanPrimaryAttack()
if self:GetHeatLocked() then return end
-- Attempting a bash
if self:GetState() != ArcCW.STATE_SIGHTS and owner:KeyDown(IN_USE) or self.PrimaryBash then self:Bash() return end
if self:GetState() != ArcCW.STATE_SIGHTS and (owner:KeyDown(IN_USE) or owner:KeyDown(IN_BULLRUSH)) or self.PrimaryBash then self:Bash() return end
-- Throwing weapon
if self.Throwing then self:PreThrow() return end