-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathInputManager.cs
More file actions
56 lines (55 loc) · 2.11 KB
/
InputManager.cs
File metadata and controls
56 lines (55 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using Terraria.GameInput;
using Terraria;
using Terraria.ModLoader;
using Fargowiltas.Common.Configs;
namespace Fargowiltas
{
public class InputManager : ModPlayer
{
public int latestXDirPressed = 0;
public int latestXDirReleased = 0;
private bool LeftLastPressed = false;
private bool RightLastPressed = false;
int lastSetBonusTimer = 0;
public override void ProcessTriggers(TriggersSet triggersSet)
{
int setbonusDir = Main.ReversedUpDownArmorSetBonuses ? 1 : 0;
if (Fargowiltas.SetBonusKey.JustPressed)
{
Main.LocalPlayer.KeyDoubleTap(setbonusDir);
}
if (Fargowiltas.SetBonusKey.Current)
{
if (Main.LocalPlayer.holdDownCardinalTimer[setbonusDir] != lastSetBonusTimer + 1)//don't double dip when holding normal set bonus key
{
Main.LocalPlayer.holdDownCardinalTimer[setbonusDir]++;
}
Main.LocalPlayer.KeyHoldDown(setbonusDir, Main.LocalPlayer.holdDownCardinalTimer[setbonusDir]);
lastSetBonusTimer = Main.LocalPlayer.holdDownCardinalTimer[setbonusDir];
}
else
{
if (FargoClientConfig.Instance.DoubleTapSetBonusDisabled)
Main.LocalPlayer.doubleTapCardinalTimer[0] = Main.LocalPlayer.doubleTapCardinalTimer[1] = 0;
}
if (Main.LocalPlayer.controlLeft && !LeftLastPressed)
{
latestXDirPressed = -1;
}
if (Main.LocalPlayer.controlRight && !RightLastPressed)
{
latestXDirPressed = 1;
}
if (!Main.LocalPlayer.controlLeft && !Main.LocalPlayer.releaseLeft)
{
latestXDirReleased = -1;
}
if (!Main.LocalPlayer.controlRight && !Main.LocalPlayer.releaseRight)
{
latestXDirReleased = 1;
}
LeftLastPressed = Main.LocalPlayer.controlLeft;
RightLastPressed = Main.LocalPlayer.controlRight;
}
}
}