From cdac6dad7d163736ead307041e15857123e07951 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 18 Jun 2017 18:01:15 -0400 Subject: enable C# 7 tuples --- src/StardewModdingAPI.Installer/InteractiveInstaller.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/StardewModdingAPI.Installer') diff --git a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs index efad0a3e..78d3d10e 100644 --- a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs +++ b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs @@ -82,6 +82,7 @@ namespace StardewModdingApi.Installer yield return GetInstallPath("StardewModdingAPI.config.json"); yield return GetInstallPath("StardewModdingAPI.data.json"); yield return GetInstallPath("StardewModdingAPI.AssemblyRewriters.dll"); + yield return GetInstallPath("System.ValueTuple.dll"); yield return GetInstallPath("steam_appid.txt"); // Linux/Mac only -- cgit From e66ee50cae9773d4ebaed0ab7e649aef9602cc94 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 19 Jun 2017 20:41:48 -0400 Subject: add manual install steps to readme (removing from main guide) --- src/StardewModdingAPI.Installer/readme.txt | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'src/StardewModdingAPI.Installer') diff --git a/src/StardewModdingAPI.Installer/readme.txt b/src/StardewModdingAPI.Installer/readme.txt index cf6090c4..5f548398 100644 --- a/src/StardewModdingAPI.Installer/readme.txt +++ b/src/StardewModdingAPI.Installer/readme.txt @@ -13,7 +13,27 @@ SMAPI lets you run Stardew Valley with mods. Don't forget to download mods separately. -Need help? See: - - Install guide: http://canimod.com/for-players/install-smapi - - Troubleshooting: http://canimod.com/for-players/faqs#troubleshooting - - Ask for help: https://discord.gg/kH55QXP + +Install guide +-------------------------------- +See http://stardewvalleywiki.com/Modding:Installing_SMAPI. + + +Need help? +-------------------------------- +- FAQs: http://stardewvalleywiki.com/Modding:Player_FAQs +- Ask for help: https://discord.gg/kH55QXP + + +Manual install +-------------------------------- +THIS IS NOT RECOMMENDED FOR MOST PLAYERS. See instructions above instead. +If you really want to install SMAPI manually, here's how. + +1. Download the latest version of SMAPI: https://github.com/Pathoschild/SMAPI/releases. +2. Unzip the .zip file somewhere (not in your game folder). +3. Copy the files from the "internal/Windows" folder (on Windows) or "internal/Mono" folder (on + Linux/Mac) into your game folder. The `StardewModdingAPI.exe` file should be right next to the + game's executable. +4. If you use Steam, see the install guide above to enable achievements and overlay. Otherwise, + just run StardewModdingAPI.exe in your game folder to play with mods. -- cgit From 5ad74396fc882d73327fac0d718adf3a2d731efa Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 3 Jul 2017 15:23:54 -0400 Subject: correct manual install steps --- src/StardewModdingAPI.Installer/readme.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/StardewModdingAPI.Installer') diff --git a/src/StardewModdingAPI.Installer/readme.txt b/src/StardewModdingAPI.Installer/readme.txt index 5f548398..09c751b0 100644 --- a/src/StardewModdingAPI.Installer/readme.txt +++ b/src/StardewModdingAPI.Installer/readme.txt @@ -35,5 +35,10 @@ If you really want to install SMAPI manually, here's how. 3. Copy the files from the "internal/Windows" folder (on Windows) or "internal/Mono" folder (on Linux/Mac) into your game folder. The `StardewModdingAPI.exe` file should be right next to the game's executable. -4. If you use Steam, see the install guide above to enable achievements and overlay. Otherwise, - just run StardewModdingAPI.exe in your game folder to play with mods. +4. + - Windows only: if you use Steam, see the install guide above to enable achievements and + overlay. Otherwise, just run StardewModdingAPI.exe in your game folder to play with mods. + + - Linux/Mac only: rename the "StardewValley" file (no extension) to "StardewValley-original", and + "StardewModdingAPI" (no extension) to "StardewValley". Now just launch the game as usual to + play with mods. \ No newline at end of file -- cgit From baf2c6328265866bc8c381338c12d6d173fbf50c Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 5 Jul 2017 15:43:50 -0400 Subject: add method to suppress button input from game (#317) --- src/StardewModdingAPI.Installer/readme.txt | 2 +- src/StardewModdingAPI/Events/EventArgsInput.cs | 88 ++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) (limited to 'src/StardewModdingAPI.Installer') diff --git a/src/StardewModdingAPI.Installer/readme.txt b/src/StardewModdingAPI.Installer/readme.txt index 09c751b0..eb27ac52 100644 --- a/src/StardewModdingAPI.Installer/readme.txt +++ b/src/StardewModdingAPI.Installer/readme.txt @@ -41,4 +41,4 @@ If you really want to install SMAPI manually, here's how. - Linux/Mac only: rename the "StardewValley" file (no extension) to "StardewValley-original", and "StardewModdingAPI" (no extension) to "StardewValley". Now just launch the game as usual to - play with mods. \ No newline at end of file + play with mods. diff --git a/src/StardewModdingAPI/Events/EventArgsInput.cs b/src/StardewModdingAPI/Events/EventArgsInput.cs index 1d5e6fde..e5eb7372 100644 --- a/src/StardewModdingAPI/Events/EventArgsInput.cs +++ b/src/StardewModdingAPI/Events/EventArgsInput.cs @@ -1,6 +1,10 @@ #if SMAPI_2_0 using System; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; using StardewModdingAPI.Utilities; +using StardewValley; namespace StardewModdingAPI.Events { @@ -33,6 +37,90 @@ namespace StardewModdingAPI.Events this.Cursor = cursor; this.IsClick = isClick; } + + /// Prevent the game from handling the vurrent button press. This doesn't prevent other mods from receiving the event. + public void SuppressButton() + { + this.SuppressButton(this.Button); + } + + /// Prevent the game from handling a button press. This doesn't prevent other mods from receiving the event. + /// The button to suppress. + public void SuppressButton(SButton button) + { + // keyboard + if (this.Button.TryGetKeyboard(out Keys key)) + Game1.oldKBState = new KeyboardState(Game1.oldKBState.GetPressedKeys().Except(new[] { key }).ToArray()); + + // controller + else if (this.Button.TryGetController(out Buttons controllerButton)) + { + var newState = GamePad.GetState(PlayerIndex.One); + var thumbsticks = Game1.oldPadState.ThumbSticks; + var triggers = Game1.oldPadState.Triggers; + var buttons = Game1.oldPadState.Buttons; + var dpad = Game1.oldPadState.DPad; + + switch (controllerButton) + { + // d-pad + case Buttons.DPadDown: + dpad = new GamePadDPad(dpad.Up, newState.DPad.Down, dpad.Left, dpad.Right); + break; + case Buttons.DPadLeft: + dpad = new GamePadDPad(dpad.Up, dpad.Down, newState.DPad.Left, dpad.Right); + break; + case Buttons.DPadRight: + dpad = new GamePadDPad(dpad.Up, dpad.Down, dpad.Left, newState.DPad.Right); + break; + case Buttons.DPadUp: + dpad = new GamePadDPad(newState.DPad.Up, dpad.Down, dpad.Left, dpad.Right); + break; + + // trigger + case Buttons.LeftTrigger: + triggers = new GamePadTriggers(newState.Triggers.Left, triggers.Right); + break; + case Buttons.RightTrigger: + triggers = new GamePadTriggers(triggers.Left, newState.Triggers.Right); + break; + + // thumbstick + case Buttons.LeftThumbstickDown: + case Buttons.LeftThumbstickLeft: + case Buttons.LeftThumbstickRight: + case Buttons.LeftThumbstickUp: + thumbsticks = new GamePadThumbSticks(newState.ThumbSticks.Left, thumbsticks.Right); + break; + case Buttons.RightThumbstickDown: + case Buttons.RightThumbstickLeft: + case Buttons.RightThumbstickRight: + case Buttons.RightThumbstickUp: + thumbsticks = new GamePadThumbSticks(newState.ThumbSticks.Right, thumbsticks.Left); + break; + + // buttons + default: + var mask = + (buttons.A == ButtonState.Pressed ? Buttons.A : 0) + | (buttons.B == ButtonState.Pressed ? Buttons.B : 0) + | (buttons.Back == ButtonState.Pressed ? Buttons.Back : 0) + | (buttons.BigButton == ButtonState.Pressed ? Buttons.BigButton : 0) + | (buttons.LeftShoulder == ButtonState.Pressed ? Buttons.LeftShoulder : 0) + | (buttons.LeftStick == ButtonState.Pressed ? Buttons.LeftStick : 0) + | (buttons.RightShoulder == ButtonState.Pressed ? Buttons.RightShoulder : 0) + | (buttons.RightStick == ButtonState.Pressed ? Buttons.RightStick : 0) + | (buttons.Start == ButtonState.Pressed ? Buttons.Start : 0) + | (buttons.X == ButtonState.Pressed ? Buttons.X : 0) + | (buttons.Y == ButtonState.Pressed ? Buttons.Y : 0); + mask = mask ^ controllerButton; + buttons = new GamePadButtons(mask); + break; + } + + Game1.oldPadState = new GamePadState(thumbsticks, triggers, buttons, dpad); + } + } } } #endif -- cgit