Skip to content

Commit

Permalink
Allow binding joystick keys, Adds a Reload button, Fixes taunt activa…
Browse files Browse the repository at this point in the history
…tion outside the game/lobby
  • Loading branch information
luponix committed Apr 18, 2023
1 parent 1e96929 commit d1fb94d
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 86 deletions.
9 changes: 8 additions & 1 deletion GameMod/ControlsExt.cs
Expand Up @@ -117,7 +117,14 @@ public enum CCInputExt
NUM,
NUM_CONFIGURABLE = 45,
// Start of new entries
TOGGLE_LOADOUT_PRIMARY = 60
TOGGLE_LOADOUT_PRIMARY = 60,
TAUNT_1 = 61,
TAUNT_2 = 62,
TAUNT_3 = 63,
TAUNT_4 = 64,
TAUNT_5 = 65,
TAUNT_6 = 66,

};

[HarmonyPatch(typeof(PlayerShip), "UpdateReadImmediateControls")]
Expand Down
8 changes: 4 additions & 4 deletions GameMod/ExtendedConfig.cs
Expand Up @@ -615,12 +615,12 @@ public static void MatchMControllerOrder()
&&(!controllers[i].name.Equals(Controls.m_controllers[i].name))
)
{
Debug.Log("Found a mismatch in the "+i+"th device: "+ controllers[i].name+" : "+ Controls.m_controllers[i].name);
//Debug.Log("Found a mismatch in the "+i+"th device: "+ controllers[i].name+" : "+ Controls.m_controllers[i].name);
// check if there is an exact match
int index = controllers.FindIndex((Controller c) => c.name == Controls.m_controllers[i].name && Controls.m_controllers[i].joystickID == c.id);
if(index != -1)
{
Debug.Log(" Found an exact match");
//Debug.Log(" Found an exact match");
Controller tmp = controllers[i];
controllers[i] = controllers[controllers.Count - 1];
controllers[controllers.Count - 1] = tmp;
Expand All @@ -632,13 +632,13 @@ public static void MatchMControllerOrder()
Debug.Log("\nSection_Joystickcurve.controllers Order");
for (int i = 0; i < controllers.Count; i++)
{
Debug.Log(""+controllers[i].name+":"+controllers[i].id);
Debug.Log(" "+controllers[i].name+":"+controllers[i].id);
}

Debug.Log("\nControls.m_controllers Order");
for (int i = 0; i < Controls.m_controllers.Count; i++)
{
Debug.Log("" + Controls.m_controllers[i].name + ":" + Controls.m_controllers[i].joystickID);
Debug.Log(" " + Controls.m_controllers[i].name + ":" + Controls.m_controllers[i].joystickID);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions GameMod/MPAudioTaunts.cs
Expand Up @@ -132,7 +132,6 @@ static void Postfix()
if (String.IsNullOrEmpty(LocalAudioTauntDirectory))
{
LocalAudioTauntDirectory = Path.Combine(Application.persistentDataPath, "AudioTaunts");

if (!Directory.Exists(LocalAudioTauntDirectory))
{
Debug.Log("Did not find a directory for local audiotaunts, creating one at: " + LocalAudioTauntDirectory);
Expand Down Expand Up @@ -668,16 +667,17 @@ public static void Postfix()
MPAudioTaunts_Client_RegisterHandlers.queued_uploads.Remove(MPAudioTaunts_Client_RegisterHandlers.queued_uploads[0]);
}

//uConsole.Log("Menustate: "+ MenuManager.m_menu_state.ToString());

// Checks for Keyinput on this client for triggering the playing of an audio taunt
if (AServer.server_supports_audiotaunts & !PlayerShip.m_typing_in_chat)
if (AServer.server_supports_audiotaunts & !PlayerShip.m_typing_in_chat & (GameplayManager.IsMultiplayerActive | MenuManager.m_menu_state == MenuState.MP_PRE_MATCH_MENU))
{
if (remaining_cooldown > 0f)
remaining_cooldown -= Time.unscaledDeltaTime;

for (int i = 0; i < 6; i++)
{
if (remaining_cooldown <= 0f && keybinds[i] > 0 && Input.GetKeyDown((KeyCode)keybinds[i]) && local_taunts[i].audioclip != null)
if (remaining_cooldown <= 0f && keybinds[i] > 0 && (Input.GetKeyDown((KeyCode)keybinds[i]) && local_taunts[i].audioclip != null || Controls.JustPressed((CCInput)(61+i))))
{
remaining_cooldown = DEFAULT_TAUNT_COOLDOWN;
PlayAudioTauntFromAudioclip(local_taunts[i].audioclip, GameManager.m_local_player.m_mp_name, local_taunts[i].hash);
Expand Down

0 comments on commit d1fb94d

Please sign in to comment.