mirror of
https://github.com/JonnyBro/beatrun.git
synced 2025-02-22 22:48:29 +05:00
Added auto hand switching/put away weapon feature (#235)
* Added auto hand switching/put away weapon feature * feat:Add toolmenu toggle for hand switching * fix:Toolmenu: Separate hand switch desc from toggle text * feat:Add English localization to toolmenu hand switch setting * Auto hand switching cleanup * small spelling fix * Bug fix and added switching for more hang animations * Added more scenarios(ladders, monkey bars and ziplines) * Bug fix and a tweak to wallrunning * Cleanup * Bug fix :/ --------- Co-authored-by: Globalsl <Globalsl> Co-authored-by: UnderSet <hunglam12700@gmail.com>
This commit is contained in:
parent
0adf75a12b
commit
13b1fcba71
3 changed files with 75 additions and 1 deletions
|
@ -155,6 +155,10 @@ beatrun.toolsmenu.gameplay.quickturngrounddesc=Toggles quickturning with seconda
|
|||
beatrun.toolsmenu.gameplay.quickturnhandsonly=Quickturn Hands Only
|
||||
beatrun.toolsmenu.gameplay.quickturnhandsonlydesc=Toggles quickturning with "Runner Hands" only
|
||||
|
||||
# This is written pretty awkwardly, please rewrite if necessary - UnderSet
|
||||
beatrun.toolsmenu.gameplay.autohandswitch=Automatic Hand Switching
|
||||
beatrun.toolsmenu.gameplay.autohandswitchdesc=Automatically switches to Beatrun's hands during certain movement scenarios.
|
||||
|
||||
beatrun.toolsmenu.gameplay.puristmode=Purist Mode
|
||||
beatrun.toolsmenu.gameplay.puristmodedesc=Purist mode is a clientside preference that severely weakens the ability to strafe while in the air, which is how Mirror's Edge games handle this.\nDisabled = No restrictions\nEnabled = Reduced move speed in the air
|
||||
|
||||
|
|
|
@ -1,4 +1,36 @@
|
|||
local OldAnims = CreateClientConVar("Beatrun_OldAnims", "0", true, false, "")
|
||||
local AutoHandSw = CreateClientConVar("Beatrun_AutoHandSwitching", "1", true, false)
|
||||
|
||||
local requires_arms = { -- animations that use arms for auto hand switching
|
||||
hang = true,
|
||||
hanghardstartvertical = true,
|
||||
hangheaveup = true,
|
||||
hangfoldedstart = true,
|
||||
hanghardstart2 = true,
|
||||
hangfoldedendhang = true,
|
||||
hangfoldedheaveup= true,
|
||||
hangstrafeleft = true,
|
||||
hangstraferight = true,
|
||||
hanghardstart = true,
|
||||
ladder = true,
|
||||
ladderclimbdownfast = true,
|
||||
ladderclimbhangstart = true,
|
||||
ladderclimbleft = true,
|
||||
ladderclimbright = true,
|
||||
ladderclimbuplefthand = true,
|
||||
ladderclimbuplefthandstill = true,
|
||||
ladderclimbuprighthand = true,
|
||||
ladderclimbuprighthandstill = true,
|
||||
ladderenterbottom = true,
|
||||
ladderenter = true,
|
||||
ladderenterhang = true,
|
||||
ladderexitarm1 = true,
|
||||
ladderexitarm2 = true,
|
||||
ladderexittoplefthand = true,
|
||||
ladderexittoprighthand = true,
|
||||
swingstraight = true,
|
||||
swingjumpoff = true
|
||||
}
|
||||
|
||||
local animtable = {
|
||||
lockang = false,
|
||||
|
@ -1504,8 +1536,43 @@ end)
|
|||
|
||||
local animtr, animtr_result = nil, nil
|
||||
local oldnewang = Angle()
|
||||
--auto hand switching variables
|
||||
local using_hands = false
|
||||
local weapon_before_hands
|
||||
|
||||
local function JumpThink()
|
||||
-- auto hand switching code
|
||||
local ply = LocalPlayer()
|
||||
if AutoHandSw:GetBool() and ply:Alive() then
|
||||
if ((ply:GetWallrun() == 1 or ply:GetMantle() > 0 or IsValid(ply:GetZipline()) or requires_arms[BodyAnimString]) and not using_hands) and not ply:UsingRH() then
|
||||
weapon_before_hands = (ply:GetActiveWeapon())
|
||||
input.SelectWeapon(ply:GetWeapon("runnerhands"))
|
||||
using_hands = true
|
||||
if ply:GetWallrun() == 1 then -- 1 = verticaL
|
||||
BodyLimitX = 25 -- fixes a bug where if u look behind u will vault over air
|
||||
BodyLimitY = 70
|
||||
BodyAnim:SetSequence("wallrunverticalstart")
|
||||
end
|
||||
|
||||
if ply:GetMantle() == 2 then
|
||||
BodyAnim:SetSequence("vaultover")
|
||||
elseif ply:GetMantle() == 3 then
|
||||
BodyAnim:SetSequence("vaultkong")
|
||||
end
|
||||
|
||||
if IsValid(ply:GetZipline()) then
|
||||
BodyAnim:SetSequence("zipline")
|
||||
end
|
||||
end
|
||||
if ply:GetWallrun() == 0 and not requires_arms[BodyAnimString] and ply:GetMantle() == 0 and using_hands and not IsValid(ply:GetZipline()) then
|
||||
if IsValid(weapon_before_hands) and ply:UsingRH() then
|
||||
input.SelectWeapon(weapon_before_hands)
|
||||
end
|
||||
|
||||
using_hands = false
|
||||
end
|
||||
end
|
||||
|
||||
if IsValid(BodyAnim) then
|
||||
if not animtr then
|
||||
animtr = {}
|
||||
|
@ -1826,4 +1893,4 @@ local function JumpThink()
|
|||
end
|
||||
end
|
||||
|
||||
hook.Add("Think", "JumpThink", JumpThink)
|
||||
hook.Add("Think", "JumpThink", JumpThink)
|
|
@ -246,6 +246,9 @@ hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function()
|
|||
panel:CheckBox("#beatrun.toolsmenu.gameplay.quickturnhandsonly", "Beatrun_QuickturnHandsOnly")
|
||||
panel:ControlHelp("#beatrun.toolsmenu.gameplay.quickturnhandsonlydesc")
|
||||
|
||||
panel:CheckBox("#beatrun.toolsmenu.gameplay.autohandswitch", "Beatrun_AutoHandSwitching")
|
||||
panel:ControlHelp("#beatrun.toolsmenu.gameplay.autohandswitchdesc")
|
||||
|
||||
panel:CheckBox("#beatrun.toolsmenu.gameplay.puristmode", "Beatrun_PuristMode")
|
||||
panel:ControlHelp(language.GetPhrase("beatrun.toolsmenu.gameplay.puristmodedesc"))
|
||||
|
||||
|
|
Loading…
Reference in a new issue