This commit is contained in:
2026-06-04 12:42:00 +07:00
parent 5526341041
commit f70082a350
14 changed files with 697 additions and 447 deletions

View File

@@ -1,4 +1,4 @@
using UnityEngine;
using UnityEngine;
namespace Invector
{
@@ -16,7 +16,6 @@ namespace Invector
public bool lockInventoryInputOnLock;
[vReadOnly]
public bool isLocked;
public GenericInput hideAndDrawWeaponsInput = new GenericInput("H", "LB", "LB");
[vEditorToolbar("Melee")]
[Header("Draw Immediate Conditions")]
@@ -29,7 +28,6 @@ namespace Invector
public bool weaponsHided;
[vReadOnly(false)]
public bool previouslyWeaponsHided;
protected float currentTimer;
protected bool forceHide;
@@ -48,7 +46,7 @@ namespace Invector
protected virtual void ControlWeapons()
{
if (isLocked || melee.cc == null || melee.cc.customAction)
if (isLocked || melee == null || melee.cc == null || melee.cc.customAction)
return;
HandleInput();
@@ -196,9 +194,10 @@ namespace Invector
protected virtual void HandleInput()
{
if (hideAndDrawWeaponsInput.GetButtonDown() && !IsEquipping)
if (melee != null && melee.inputReader != null && melee.inputReader.ConsumeSwitchSide() && !IsEquipping)
{
// Note: I'm using SwitchSide action as a placeholder or you can map a dedicated "Hide/Draw" action.
// Assuming SwitchSide is suitable for now as it's Tab/Middle Click.
if (CanHideRightWeapon() || CanHideLeftWeapon())
{
HideWeapons();
@@ -221,11 +220,11 @@ namespace Invector
protected virtual bool DrawWeaponsImmediateConditions()
{
if (!melee || melee.cc.customAction || !melee.meleeManager || (melee.meleeManager.CurrentAttackWeapon == null && melee.meleeManager.CurrentDefenseWeapon == null))
if (!melee || melee.inputReader == null || melee.cc.customAction || !melee.meleeManager || (melee.meleeManager.CurrentAttackWeapon == null && melee.meleeManager.CurrentDefenseWeapon == null))
return false;
else
{
return melee.weakAttackInput.GetButton() && meleeWeakAttack || melee.strongAttackInput.GetButton() && meleeStrongAttack || melee.blockInput.GetButton() && meleeBlock;
return (melee.inputReader.IsAttackHeld && meleeWeakAttack) || (melee.inputReader.ConsumeStrongAttack() && meleeStrongAttack) || (melee.inputReader.IsBlockHeld && meleeBlock);
}
}
@@ -353,5 +352,4 @@ namespace Invector
StartCoroutine(holderManager.UnequipRoutine(equipment.referenceItem.disableDelayTime, immediate, onStart, onFinish));
}
}
}
}