public override bool UseItem(Player player) { //Enter should be called on exactly one side, which here is either the singleplayer player, or the server if (Main.netMode != NetmodeID.MultiplayerClient) { bool result = SubworldManager.Enter(SubworldManager.mySubworldID) ?? false; if (!result) { //If some issue occured, inform why (can't know exactly obviously, might need to check logs) string message; if (!SubworldManager.Loaded) { message = "SubworldLibrary Mod is required to be enabled for this item to work!"; } else { message = $"Unable to enter {SubworldManager.mySubworldID}!"; } if (Main.netMode == NetmodeID.Server) { NetMessage.BroadcastChatMessage(NetworkText.FromLiteral(message), Color.Orange); } else { Main.NewText(message, Color.Orange); } } return(result); } return(true); }
public override void EditSpawnPool(IDictionary <int, float> pool, NPCSpawnInfo spawnInfo) { //If any subworld from our mod is loaded, disable spawns if (SubworldManager.AnyActive(mod) ?? false) { pool.Clear(); } }
public override void PostUpdate() { //This hook also runs in the subworld if we choose to specify ExclusiveWorld for the "Register" if (!(SubworldManager.IsActive(SubworldManager.mySubworldID) ?? false)) { return; //No point executing the code below if we aren't in the subworld we want } if (!enteredWorld) { enteredWorld = true; string message = $"Hey, We successfully entered '{SubworldManager.mySubworldID}' and only the '{Name}' will update here!"; if (Main.netMode == NetmodeID.Server) { NetMessage.BroadcastChatMessage(NetworkText.FromLiteral(message), Color.Orange); } else { Main.NewText(message, Color.Orange); } } }
public override void Unload() { SubworldManager.Unload(); }
public override void PostSetupContent() { SubworldManager.Load(); }