//////////////// internal void PostFiltersLoad() { LoadHooks.AddWorldLoadOnceHook(() => { if (Main.netMode == NetmodeID.Server) { return; } var myworld = ModContent.GetInstance <NihilismWorld>(); if (myworld.Logic.DataAccess.IsActive()) { return; } string msg; if (Main.netMode == NetmodeID.SinglePlayer) { msg = "Enter the /nih-on command to activate Nihilism restrictions for the current world. Enter /help for a list of other commands."; } else { msg = "Enter nih-on in the server's command console to activate Nihilism restrictions for the current world. Enter help for a list of other commands."; } if (ModLoader.GetMod("Messages") != null) { WorldLogic.MessageAboutModUsage(msg); } }); }
private void PostLoadGameMode() { CustomLoadHooks.TriggerHook( LicensesMod.GameModeLoadValidator, LicensesMod.MyValidatorKey ); LoadHooks.AddWorldUnloadEachHook( () => { CustomLoadHooks.ClearHook( LicensesMod.GameModeLoadValidator, LicensesMod.MyValidatorKey ); LoadHooks.AddWorldLoadOnceHook( () => { CustomLoadHooks.TriggerHook( LicensesMod.GameModeLoadValidator, LicensesMod.MyValidatorKey ); // Whee! } ); } ); }
private void Initialize(Item item) { if (this.AwaitsInitialization || this.IsInitialized || !ElementsItem.CanHaveElements(item)) { return; } this.AwaitsInitialization = true; LoadHooks.AddWorldLoadOnceHook(() => { this.AwaitsInitialization = false; this.IsInitialized = true; if (ElementsAPI.PreItemInitialize(item)) { this.AutoInitializeElement(item); } }); }
private void OnClientConnect() { LoadHooks.AddWorldLoadOnceHook(() => { WorldDataProtocol.QuickRequest(); }); }