public static void Player_Warped(object sender, WarpedEventArgs e) { if (!Config.EnableMod) { return; } ModActions.DeactivateMod(); MapActions.UpdateCurrentMap(false); }
public static void PasteCurrentTile() { if (!Utility.isOnScreen(Game1.currentCursorTile * Game1.tileSize, Game1.tileSize)) { return; } string mapName = Game1.player.currentLocation.mapPath.Value.Replace("Maps\\", ""); MapActions.SaveMapTile(mapName, Game1.currentCursorTile, new TileLayers(ModEntry.currentTileDict)); ModEntry.cleanMaps.Remove(mapName); MapActions.UpdateCurrentMap(false); ModEntry.pastedTileLoc = Game1.currentCursorTile; Game1.playSound(ModEntry.Config.PasteSound); ModEntry.SMonitor.Log($"Pasted tile to {Game1.currentCursorTile}"); }
public static void Input_ButtonPressed(object sender, ButtonPressedEventArgs e) { if (!Config.EnableMod || !Context.IsPlayerFree) { ModActions.DeactivateMod(); return; } if (e.Button == Config.ToggleButton) { Helper.Input.Suppress(e.Button); ModEntry.modActive = !ModEntry.modActive; ModEntry.copiedTileLoc = new Vector2(-1, -1); ModEntry.currentTileDict.Clear(); Monitor.Log($"Toggled mod: {ModEntry.modActive}"); if (ModEntry.modActive) { ModActions.ShowMessage(string.Format(Helper.Translation.Get("mod-active"), Config.ToggleButton)); } else { ModActions.ShowMessage(string.Format(Helper.Translation.Get("mod-inactive"), Config.ToggleButton)); } } else if (ModEntry.modActive && e.Button == Config.CopyButton) { Helper.Input.Suppress(e.Button); TileActions.CopyCurrentTile(); } else if (ModEntry.modActive && ModEntry.copiedTileLoc.X > -1 && e.Button == Config.PasteButton && ModEntry.pastedTileLoc != Game1.currentCursorTile) { Helper.Input.Suppress(e.Button); TileActions.PasteCurrentTile(); } else if (ModEntry.modActive && e.Button == Config.RevertButton && MapActions.MapHasTile(Game1.currentCursorTile)) { Helper.Input.Suppress(e.Button); TileActions.RevertCurrentTile(); } else if (ModEntry.modActive && e.Button == SButton.Escape) { Helper.Input.Suppress(e.Button); if (ModEntry.copiedTileLoc.X > -1) { ModEntry.copiedTileLoc = new Vector2(-1, -1); ModEntry.pastedTileLoc = new Vector2(-1, -1); ModEntry.currentLayer = 0; ModEntry.currentTileDict.Clear(); } else { ModActions.DeactivateMod(); } } else if (ModEntry.modActive && e.Button == Config.RefreshButton) { Helper.Input.Suppress(e.Button); ModEntry.cleanMaps.Clear(); MapActions.GetMapCollectionData(); MapActions.UpdateCurrentMap(true); } else if (ModEntry.modActive && e.Button == Config.ScrollUpButton) { Helper.Input.Suppress(e.Button); ModActions.SwitchTile(true); } else if (ModEntry.modActive && e.Button == Config.ScrollDownButton) { Helper.Input.Suppress(e.Button); ModActions.SwitchTile(false); } }
public static void RevertCurrentTile() { ModEntry.pastedTileLoc = new Vector2(-1, -1); MapActions.SaveMapTile(Game1.player.currentLocation.mapPath.Value.Replace("Maps\\", ""), Game1.currentCursorTile, null); MapActions.UpdateCurrentMap(true); }