-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModEntry.cs
37 lines (33 loc) · 1.15 KB
/
ModEntry.cs
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
using System.Linq;
using CabinStacker.Harmony;
using CabinStacker.Helper;
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
namespace CabinStacker
{
public class ModEntry : Mod
{
public override void Entry(IModHelper helper)
{
HarmonyPatcher.Initialize(Monitor, helper, ModManifest.UniqueID);
helper.Events.GameLoop.UpdateTicked += OnUpdate;
helper.Events.GameLoop.SaveLoaded += OnSaveLoaded;
}
private static void OnSaveLoaded(object sender, SaveLoadedEventArgs e)
{
//Those values aren't loaded from the save for some reason
foreach (var cabin in Game1.getFarm().buildings.Where(o => o.tileX.Value > 1000)) {
cabin.humanDoor.Value = new Point(-1007, -4);
}
}
private static void OnUpdate(object sender, UpdateTickedEventArgs e)
{
// ignore if player hasn't loaded a save yet
if (!Context.IsWorldReady)
return;
CabinHelper.MoveCabinsForWarpingEvent();
}
}
}