Beispiel #1
0
        /// <summary>The mod entry point, called after the mod is first loaded.</summary>
        /// <param name="helper">Provides simplified APIs for writing mods.</param>
        public override void Entry(IModHelper helper)
        {
            Logger.Init(this.Monitor);
            MultiplayerHelper.Init(this.Helper.Multiplayer);
            SaveGameHelper.Init(this.Helper.Data);
            ConfigHelper.Init(this.Helper);

            SaveGameHelper.AddResetCommand(helper);

            helper.Events.Display.MenuChanged += (object sender, MenuChangedEventArgs e) =>
                                                 EventHandler.OnMenuChanged(ref this.isInDialog, e);

            helper.Events.Multiplayer.ModMessageReceived += (object sender, ModMessageReceivedEventArgs e) =>
                                                            EventHandler.OnModMessageReceived(e);

            helper.Events.Multiplayer.PeerConnected += (object sender, PeerConnectedEventArgs e) =>
                                                       EventHandler.OnPeerConnected(e);

            helper.Events.Player.InventoryChanged += (object sender, InventoryChangedEventArgs e) =>
                                                     EventHandler.OnInventoryChanged(this.OnItemRemoved, e);

            helper.Events.Player.Warped += (object sender, WarpedEventArgs e) =>
                                           EventHandler.OnWarped();

            helper.Events.GameLoop.DayEnding += (object sender, DayEndingEventArgs e) =>
                                                EventHandler.OnDayEnding();

            helper.Events.GameLoop.ReturnedToTitle += (object sender, ReturnedToTitleEventArgs e) =>
                                                      EventHandler.OnReturnedToTitle();

            helper.Events.GameLoop.Saving += (object sender, SavingEventArgs e) =>
                                             EventHandler.OnSaving();

            helper.Events.GameLoop.SaveLoaded += (object sender, SaveLoadedEventArgs e) =>
                                                 EventHandler.OnSaveLoaded();

            helper.Events.World.NpcListChanged += (object sender, NpcListChangedEventArgs e) =>
                                                  EventHandler.OnNpcListChanged(e);
        }
 /// <summary>Send the save state to all peers.</summary>
 public static void SyncWithPeers()
 {
     MultiplayerHelper.SendMessage(SaveState, Key);
 }
Beispiel #3
0
 /// <summary>Send the configuration to all peers.</summary>
 public static void SyncWithPeers()
 {
     MultiplayerHelper.SendMessage(Config, Key);
 }