public override void ModifyScreenPosition() { if (Subworld.AnyActive(mod)) { if (Main.screenPosition.Y >= 11864f) // Ignore the magic numbers :peepohappy: { Main.screenPosition = new Vector2(Main.screenPosition.X, 11864f); } } }
public override void PostUpdateEverything() { _anySubworldActive = Subworld.AnyActive(this); if (_anySubworldActive && !_anySubworldActiveLastTick) { INTERNAL_SubworldTileFraming(); } _anySubworldActiveLastTick = _anySubworldActive; }
public override bool UseItem(Player player) { if (!Subworld.AnyActive <Macrocosm>()) { Subworld.Enter <Moon>(); } else { Subworld.Exit(); } return(true); }
public static int GetCurrentWorldID()//Main way to get the current world ID, -1 is ship, zero is earth/other mod's subworld { if (Subworld.AnyActive <PlanetMod>()) { if (!Subworld.IsActive <ShipSubworld>()) { return(SelectedPlanet); } else { return(-1);//ship ID } } return(0);//earth (or another mod's subworld) }
public override void MidUpdateTimeWorld() { if (Subworld.AnyActive <Multiverse>() && GetInstance <Config>().WorldsRegistry[Util.KeyByValue(SubworldManager.WorldsEnter, SLWorld.currentSubworld.Current)].type == WorldType.NormalWorld) //lotta stuff copied from vanilla { Main.UpdateSundial(); Main.time += Main.dayRate; Terraria.GameContent.Events.BirthdayParty.UpdateTime(); Terraria.GameContent.Events.DD2Event.UpdateTime(); if (Main.time > 54000 && Main.dayTime) //replace main.daytime with speed adjust (add/mult) { Main.time = 0; Main.dayTime = !Main.dayTime; } else if (Main.time > 32400 && !Main.dayTime) { if (Main.fastForwardTime) { Main.fastForwardTime = false; Main.UpdateSundial(); } Main.checkXMas(); Main.checkHalloween(); Main.AnglerQuestSwap(); Terraria.GameContent.Events.BirthdayParty.CheckMorning(); Main.time = 0; Main.dayTime = !Main.dayTime; if (Main.sundialCooldown > 0) { Main.sundialCooldown--; } Main.moonPhase++; if (Main.moonPhase >= 8) { Main.moonPhase = 0; } } } }
//public override void ModifySunLightColor(ref Color tileColor, ref Color backgroundColor) //{ // //int worldID = GetCurrentWorldID(); // //if (worldID == -1)//ship // //{ // // backgroundColor = Color.Black; // //} // //else if (planetArray[worldID].blackSky)//else, if subworld has blacksky set to true // //{ // // backgroundColor = Color.Black; // //}; //} public override void MidUpdateTimeWorld() { if (Subworld.AnyActive <PlanetMod>()) //lotta stuff copied from vanilla { Main.UpdateSundial(); Main.time += Main.dayRate; Terraria.GameContent.Events.BirthdayParty.UpdateTime(); Terraria.GameContent.Events.DD2Event.UpdateTime(); if (Main.time > 54000 && Main.dayTime) //replace main.daytime with speed adjust (add/mult) { Main.time = 0; Main.dayTime = !Main.dayTime; } else if (Main.time > 32400 && !Main.dayTime) { if (Main.fastForwardTime) { Main.fastForwardTime = false; Main.UpdateSundial(); } Main.checkXMas(); Main.checkHalloween(); Main.AnglerQuestSwap(); Terraria.GameContent.Events.BirthdayParty.CheckMorning(); Main.time = 0; Main.dayTime = !Main.dayTime; if (Main.sundialCooldown > 0) { Main.sundialCooldown--; } Main.moonPhase++; if (Main.moonPhase >= 8) { Main.moonPhase = 0; } } UpdateTime_SpawnTownNPCs(); //not 100% sure if this is the right place } if (IsTeleporting) { if (TeleportTimer >= TeleportTimerMax - 1) { //planetWorld.IsTeleporting = false; //these are now set in Init() in modworld //TeleportTimer = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { TeleportCorrectWorld(true); //teleports after animation ends } } else { TeleportTimer++; } } //this is gonna desync, but I dont think it will be an issue, maybe only run on single or multi client int tileEntityType = ModContent.TileEntityType <Tiles.PlasmaEntity>(); foreach (var item in TileEntity.ByID) { if (item.Value.type == tileEntityType) { var currentEntity = item.Value as Tiles.PlasmaEntity; Point16 curEntPos = currentEntity.EntityPosition(); if (Main.tile[curEntPos.X, curEntPos.Y].frameX == 0) { currentEntity.PlasmaInstance.UpdatePlasma(); } } } SelectedPlanet = (ushort)PlanetID.Moon; //debug }