public override void Entry(IModHelper helper) { _helper = helper; _monitor = Monitor; //testing(); harmonyFix(); FormatManager.Instance.RegisterMapFormat(new NewTiledTmxFormat()); SaveHandler.BeforeRebuilding += (a, b) => CustomObjectData.collection.useAll(k => k.Value.sdvId = k.Value.getNewSDVId()); registerConsoleCommands(); CustomTVMod.load(); PyLua.init(); SaveHandler.setUpEventHandlers(); }
public override void Entry(IModHelper helper) { _helper = helper; _monitor = Monitor; //testing(); //messageTest() harmonyFix(); FormatManager.Instance.RegisterMapFormat(new NewTiledTmxFormat()); SaveHandler.BeforeRebuilding += (a, b) => CustomObjectData.collection.useAll(k => k.Value.sdvId = k.Value.getNewSDVId()); initializeResponders(); startResponder(); registerConsoleCommands(); CustomTVMod.load(); PyLua.init(); SaveHandler.setUpEventHandlers(); ContentSync.ContentSyncHandler.initialize(); PlayerEvents.Warped += (s, e) => e.NewLocation?.Map.enableMoreMapLayers(); }
public override void Entry(IModHelper helper) { _helper = helper; _monitor = Monitor; harmonyFix(); FormatManager.Instance.RegisterMapFormat(new NewTiledTmxFormat()); SaveHandler.BeforeRebuilding += (a, b) => CustomObjectData.collection.useAll(k => k.Value.sdvId = k.Value.getNewSDVId()); initializeResponders(); startResponder(); registerConsoleCommands(); CustomTVMod.load(); PyLua.init(); registerTileActions(); SaveHandler.setUpEventHandlers(); CustomObjectData.CODSyncer.start(); ContentSync.ContentSyncHandler.initialize(); this.Helper.Events.Player.Warped += Player_Warped; this.Helper.Events.GameLoop.DayStarted += OnDayStarted; this.Helper.Events.Multiplayer.PeerContextReceived += (s, e) => { if (Game1.IsMasterGame && Game1.IsServer && CustomObjectData.collection.Values.Count > 0) { List <CODSync> list = new List <CODSync>(); foreach (CustomObjectData data in CustomObjectData.collection.Values) { list.Add(new CODSync(data.id, data.sdvId)); } PyNet.sendDataToFarmer(CustomObjectData.CODSyncerName, new CODSyncMessage(list), e.Peer.PlayerID, SerializationType.JSON); } }; Helper.Events.Multiplayer.ModMessageReceived += PyNet.Multiplayer_ModMessageReceived; }
public override void Entry(IModHelper helper) { _instance = this; PostSerializer.Add(ModManifest, Rebuilder); PreSerializer.Add(ModManifest, Replacer); harmonyFix(); FormatManager.Instance.RegisterMapFormat(new TMXTile.TMXFormat(Game1.tileSize / Game1.pixelZoom, Game1.tileSize / Game1.pixelZoom, Game1.pixelZoom, Game1.pixelZoom)); initializeResponders(); startResponder(); registerConsoleCommands(); CustomTVMod.load(); PyLua.init(); registerTileActions(); registerEventPreconditions(); SaveHandler.setUpEventHandlers(); CustomObjectData.CODSyncer.start(); ContentSync.ContentSyncHandler.initialize(); helper.Events.GameLoop.DayStarted += (s, e) => { if (ReInjectCustomObjects) { ReInjectCustomObjects = false; CustomObjectData.injector.Invalidate(); CustomObjectData.injectorBig.Invalidate(); } }; this.Helper.Events.Player.Warped += Player_Warped; this.Helper.Events.GameLoop.DayStarted += OnDayStarted; this.Helper.Events.Multiplayer.PeerContextReceived += (s, e) => { if (Game1.IsMasterGame && Game1.IsServer) { if (CustomObjectData.collection.Values.Count > 0) { List <CODSync> list = new List <CODSync>(); foreach (CustomObjectData data in CustomObjectData.collection.Values) { list.Add(new CODSync(data.id, data.sdvId)); } PyNet.sendDataToFarmer(CustomObjectData.CODSyncerName, new CODSyncMessage(list), e.Peer.PlayerID, SerializationType.JSON); } PyNet.sendDataToFarmer("PyTK.ModSavdDataReceiver", saveData, e.Peer.PlayerID, SerializationType.JSON); } }; Helper.Events.Display.RenderingHud += (s, e) => { if (Game1.displayHUD && Context.IsWorldReady) { PyTK.PlatoUI.UIHelper.DrawHud(e.SpriteBatch, true); } }; Helper.Events.Display.RenderedHud += (s, e) => { if (Game1.displayHUD && Context.IsWorldReady) { PyTK.PlatoUI.UIHelper.DrawHud(e.SpriteBatch, false); } }; Helper.Events.Input.ButtonPressed += (s, e) => { if (Game1.displayHUD && Context.IsWorldReady) { if (e.Button == SButton.MouseLeft || e.Button == SButton.MouseRight) { PlatoUI.UIHelper.BaseHud.PerformClick(e.Cursor.ScreenPixels.toPoint(), e.Button == SButton.MouseRight, false, false); } } }; Helper.Events.Display.WindowResized += (s, e) => { PlatoUI.UIElement.Viewportbase.UpdateBounds(); PlatoUI.UIHelper.BaseHud.UpdateBounds(); }; Helper.Events.Multiplayer.ModMessageReceived += PyNet.Multiplayer_ModMessageReceived; helper.Events.GameLoop.Saving += (s, e) => { if (Game1.IsMasterGame) { try { helper.Data.WriteSaveData <PyTKSaveData>("PyTK.ModSaveData", saveData); } catch { } } }; helper.Events.GameLoop.ReturnedToTitle += (s, e) => { saveData = new PyTKSaveData(); }; helper.Events.GameLoop.SaveLoaded += (s, e) => { if (Game1.IsMasterGame) { try { saveData = helper.Data.ReadSaveData <PyTKSaveData>("PyTK.ModSaveData"); } catch { } if (saveData == null) { saveData = new PyTKSaveData(); } } }; helper.Events.GameLoop.OneSecondUpdateTicked += (s, e) => { if (Context.IsWorldReady && Game1.currentLocation is GameLocation location && location.Map is Map map) { PyUtils.checkDrawConditions(map); } }; helper.Events.GameLoop.GameLaunched += (s, e) => { if (!Helper.ModRegistry.IsLoaded("spacechase0.GenericModConfigMenu")) { return; } try { registerCPTokens(); } catch { } }; helper.Events.GameLoop.DayStarted += (s, e) => UpdateLuaTokens = true; }
public override void Entry(IModHelper helper) { _instance = this; if (xTile.Format.FormatManager.Instance.GetMapFormatByExtension("tmx") is TMXFormat tmxf) { tmxf.DrawImageLayer = PyMaps.drawImageLayer; } Game1.mapDisplayDevice = new PyDisplayDevice(Game1.content, Game1.graphics.GraphicsDevice); helper.Events.Display.RenderingWorld += (s, e) => { if (Game1.currentLocation is GameLocation location && location.Map is Map map && map.GetBackgroundColor() is TMXColor tmxColor) { Game1.graphics.GraphicsDevice.Clear(tmxColor.toColor()); } }; PostSerializer.Add(ModManifest, Rebuilder); PreSerializer.Add(ModManifest, Replacer); harmonyFix(); initializeResponders(); startResponder(); registerConsoleCommands(); CustomTVMod.load(); PyLua.init(); registerTileActions(); registerEventPreconditions(); SaveHandler.setUpEventHandlers(); CustomObjectData.CODSyncer.start(); ContentSync.ContentSyncHandler.initialize(); helper.Events.GameLoop.DayStarted += (s, e) => { if (ReInjectCustomObjects) { ReInjectCustomObjects = false; CustomObjectData.injector?.Invalidate(); CustomObjectData.injectorBig?.Invalidate(); } }; this.Helper.Events.Player.Warped += Player_Warped; this.Helper.Events.GameLoop.DayStarted += OnDayStarted; this.Helper.Events.Multiplayer.PeerContextReceived += (s, e) => { if (Game1.IsMasterGame && Game1.IsServer) { if (CustomObjectData.collection.Values.Count > 0) { List <CODSync> list = new List <CODSync>(); foreach (CustomObjectData data in CustomObjectData.collection.Values) { list.Add(new CODSync(data.id, data.sdvId)); } PyNet.sendDataToFarmer(CustomObjectData.CODSyncerName, new CODSyncMessage(list), e.Peer.PlayerID, SerializationType.JSON); } PyNet.sendDataToFarmer("PyTK.ModSavdDataReceiver", saveData, e.Peer.PlayerID, SerializationType.JSON); } }; Helper.Events.Display.RenderingHud += (s, e) => { if (Game1.displayHUD && Context.IsWorldReady) { PyTK.PlatoUI.UIHelper.DrawHud(e.SpriteBatch, true); } }; Helper.Events.Display.RenderedHud += (s, e) => { if (Game1.displayHUD && Context.IsWorldReady) { PyTK.PlatoUI.UIHelper.DrawHud(e.SpriteBatch, false); } }; Helper.Events.Input.ButtonPressed += (s, e) => { if (Game1.displayHUD && Context.IsWorldReady) { if (e.Button == SButton.MouseLeft || e.Button == SButton.MouseRight) { PlatoUI.UIHelper.BaseHud.PerformClick(e.Cursor.ScreenPixels.toPoint(), e.Button == SButton.MouseRight, false, false); } } }; Helper.Events.Display.WindowResized += (s, e) => { PlatoUI.UIElement.Viewportbase.UpdateBounds(); PlatoUI.UIHelper.BaseHud.UpdateBounds(); }; Helper.Events.Multiplayer.ModMessageReceived += PyNet.Multiplayer_ModMessageReceived; helper.Events.GameLoop.Saving += (s, e) => { if (Game1.IsMasterGame) { try { helper.Data.WriteSaveData <PyTKSaveData>("PyTK.ModSaveData", saveData); } catch { } } }; helper.Events.GameLoop.ReturnedToTitle += (s, e) => { saveData = new PyTKSaveData(); }; helper.Events.GameLoop.SaveLoaded += (s, e) => { CustomTVMod.reloadStrings(); if (Game1.IsMasterGame) { try { saveData = helper.Data.ReadSaveData <PyTKSaveData>("PyTK.ModSaveData"); } catch { } if (saveData == null) { saveData = new PyTKSaveData(); } } }; helper.Events.GameLoop.OneSecondUpdateTicked += (s, e) => { if (Context.IsWorldReady && Game1.currentLocation is GameLocation location && location.Map is Map map) { PyUtils.checkDrawConditions(map); } }; helper.Events.GameLoop.DayStarted += (s, e) => { if (Game1.currentLocation is GameLocation loc) { UpdateLuaTokens = true; } }; helper.Events.GameLoop.UpdateTicked += (s, e) => AnimatedTexture2D.ticked = e.Ticks; }
public override void Entry(IModHelper helper) { _helper = helper; _monitor = Monitor; harmonyFix(); // Monitor.Log("Harmony Patching failed", LogLevel.Error); FormatManager.Instance.RegisterMapFormat(new NewTiledTmxFormat()); SaveHandler.BeforeRebuilding += (a, b) => CustomObjectData.collection.useAll(k => k.Value.sdvId = k.Value.getNewSDVId()); initializeResponders(); startResponder(); registerConsoleCommands(); CustomTVMod.load(); PyLua.init(); registerTileActions(); registerEventPreconditions(); SaveHandler.setUpEventHandlers(); CustomObjectData.CODSyncer.start(); ContentSync.ContentSyncHandler.initialize(); this.Helper.Events.Player.Warped += Player_Warped; this.Helper.Events.GameLoop.DayStarted += OnDayStarted; this.Helper.Events.Multiplayer.PeerContextReceived += (s, e) => { if (Game1.IsMasterGame && Game1.IsServer) { if (CustomObjectData.collection.Values.Count > 0) { List <CODSync> list = new List <CODSync>(); foreach (CustomObjectData data in CustomObjectData.collection.Values) { list.Add(new CODSync(data.id, data.sdvId)); } PyNet.sendDataToFarmer(CustomObjectData.CODSyncerName, new CODSyncMessage(list), e.Peer.PlayerID, SerializationType.JSON); } PyNet.sendDataToFarmer("PyTK.ModSavdDataReceiver", saveData, e.Peer.PlayerID, SerializationType.JSON); } }; Helper.Events.Display.RenderingHud += (s, e) => { if (Game1.displayHUD && Context.IsWorldReady) { PyTK.PlatoUI.UIHelper.DrawHud(e.SpriteBatch, true); } }; Helper.Events.Display.RenderedHud += (s, e) => { if (Game1.displayHUD && Context.IsWorldReady) { PyTK.PlatoUI.UIHelper.DrawHud(e.SpriteBatch, false); } }; Helper.Events.Input.ButtonPressed += (s, e) => { if (Game1.displayHUD && Context.IsWorldReady) { if (e.Button == SButton.MouseLeft || e.Button == SButton.MouseRight) { PlatoUI.UIHelper.BaseHud.PerformClick(e.Cursor.ScreenPixels.toPoint(), e.Button == SButton.MouseRight, false, false); } } }; Helper.Events.Display.WindowResized += (s, e) => { PlatoUI.UIElement.Viewportbase.UpdateBounds(); PlatoUI.UIHelper.BaseHud.UpdateBounds(); }; Helper.Events.Multiplayer.ModMessageReceived += PyNet.Multiplayer_ModMessageReceived; helper.Events.GameLoop.Saving += (s, e) => { if (Game1.IsMasterGame) { try { helper.Data.WriteSaveData <PyTKSaveData>("PyTK.ModSaveData", saveData); } catch { } } }; helper.Events.GameLoop.ReturnedToTitle += (s, e) => { saveData = new PyTKSaveData(); }; helper.Events.GameLoop.SaveLoaded += (s, e) => { if (Game1.IsMasterGame) { try { saveData = helper.Data.ReadSaveData <PyTKSaveData>("PyTK.ModSaveData"); } catch { } if (saveData == null) { saveData = new PyTKSaveData(); } } }; helper.Events.GameLoop.OneSecondUpdateTicked += (s, e) => { if (Context.IsWorldReady && Game1.currentLocation is GameLocation location && location.Map is Map map) { PyUtils.checkDrawConditions(map); } }; }