Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DoUpdateInWorld()

void Terraria.Main.DoUpdateInWorld ( Stopwatch sw)
inlineprivate

Definition at line 16531 of file Main.cs.

16532 {
16534 tileSolid[379] = false;
16535 int num = 0;
16536 int num2 = 0;
16537 sittingManager.ClearPlayerAnchors();
16538 sleepingManager.ClearPlayerAnchors();
16539 for (int i = 0; i < 255; i++)
16540 {
16541 if (!player[i].active)
16542 {
16543 continue;
16544 }
16545 try
16546 {
16547 player[i].Update(i);
16548 if (player[i].active)
16549 {
16550 num++;
16551 if (player[i].sleeping.FullyFallenAsleep)
16552 {
16553 num2++;
16554 }
16555 }
16556 }
16557 catch
16558 {
16559 if (!ignoreErrors)
16560 {
16561 throw;
16562 }
16563 }
16564 }
16565 CurrentFrameFlags.ActivePlayersCount = num;
16566 CurrentFrameFlags.SleepingPlayersCount = num2;
16567 if (netMode != 2)
16568 {
16569 int num3 = myPlayer;
16570 if (player[num3].creativeGodMode)
16571 {
16572 player[num3].statLife = player[num3].statLifeMax2;
16573 player[num3].statMana = player[num3].statManaMax2;
16574 player[num3].breath = player[num3].breathMax;
16575 }
16576 }
16578 NPC.RevengeManager.Update();
16579 if (netMode != 1)
16580 {
16581 if (remixWorld)
16582 {
16583 NPC.SetRemixHax();
16584 }
16585 try
16586 {
16587 NPC.SpawnNPC();
16588 }
16589 catch
16590 {
16591 }
16592 if (remixWorld)
16593 {
16594 NPC.ResetRemixHax();
16595 }
16596 }
16597 if (netMode != 1)
16598 {
16600 }
16601 for (int j = 0; j < 255; j++)
16602 {
16603 player[j].nearbyActiveNPCs = 0f;
16604 player[j].townNPCs = 0f;
16605 }
16607 sittingManager.ClearNPCAnchors();
16608 sleepingManager.ClearNPCAnchors();
16609 NPC.taxCollector = false;
16610 NPC.ClearFoundActiveNPCs();
16611 NPC.UpdateFoundActiveNPCs();
16613 if (netMode != 1)
16614 {
16615 BestiaryTracker.Sights.ScanWorldForFinds();
16616 }
16617 bool anyActiveBossNPC = false;
16618 if (NPC.offSetDelayTime > 0)
16619 {
16620 NPC.offSetDelayTime--;
16621 }
16622 if (remixWorld && NPC.empressRageMode && !NPC.AnyNPCs(636))
16623 {
16624 NPC.empressRageMode = false;
16625 }
16627 {
16628 for (int k = 0; k < 200; k++)
16629 {
16630 NPC nPC = npc[k];
16631 if (nPC.active && nPC.townNPC && nPC.type != 37 && nPC.type != 453 && nPC.type != 368)
16632 {
16633 nPC.StrikeNPCNoInteraction(9999, 10f, -nPC.direction);
16634 if (netMode == 2)
16635 {
16636 NetMessage.SendData(28, -1, -1, null, k, 9999f, 10f, -nPC.direction);
16637 }
16638 }
16639 }
16640 NPC.unlockedPartyGirlSpawn = false;
16641 NPC.unlockedPrincessSpawn = false;
16642 NPC.unlockedSlimeRainbowSpawn = false;
16643 NPC.unlockedSlimeGreenSpawn = false;
16644 afterPartyOfDoom = false;
16645 }
16646 if (NPC.brainOfGravity >= 0 && NPC.brainOfGravity < 200 && (!npc[NPC.brainOfGravity].active || npc[NPC.brainOfGravity].type != 266))
16647 {
16648 NPC.brainOfGravity = -1;
16649 }
16650 for (int l = 0; l < 200; l++)
16651 {
16652 if (ignoreErrors)
16653 {
16654 try
16655 {
16656 npc[l].UpdateNPC(l);
16657 if (npc[l].active && (npc[l].boss || NPCID.Sets.DangerThatPreventsOtherDangers[npc[l].type]))
16658 {
16659 anyActiveBossNPC = true;
16660 }
16661 }
16662 catch (Exception)
16663 {
16664 npc[l] = new NPC();
16665 }
16666 }
16667 else
16668 {
16669 npc[l].UpdateNPC(l);
16670 }
16671 }
16672 CurrentFrameFlags.AnyActiveBossNPC = anyActiveBossNPC;
16673 for (int m = 0; m < 600; m++)
16674 {
16675 if (ignoreErrors)
16676 {
16677 try
16678 {
16679 gore[m].Update();
16680 }
16681 catch
16682 {
16683 gore[m] = new Gore();
16684 }
16685 }
16686 else
16687 {
16688 gore[m].Update();
16689 }
16690 }
16692 CurrentFrameFlags.HadAnActiveInteractibleProjectile = false;
16694 for (int n = 0; n < 1000; n++)
16695 {
16697 if (ignoreErrors)
16698 {
16699 try
16700 {
16701 projectile[n].Update(n);
16702 }
16703 catch
16704 {
16705 projectile[n] = new Projectile();
16706 }
16707 }
16708 else
16709 {
16710 projectile[n].Update(n);
16711 }
16712 }
16716 Item.numberOfNewItems = 0;
16717 for (int num4 = 0; num4 < 400; num4++)
16718 {
16719 if (ignoreErrors)
16720 {
16721 try
16722 {
16723 item[num4].UpdateItem(num4);
16724 }
16725 catch
16726 {
16727 item[num4] = new Item();
16728 }
16729 }
16730 else
16731 {
16732 item[num4].UpdateItem(num4);
16733 }
16734 }
16735 if (ignoreErrors)
16736 {
16737 try
16738 {
16739 Dust.UpdateDust();
16740 }
16741 catch
16742 {
16743 for (int num5 = 0; num5 < 6000; num5++)
16744 {
16745 dust[num5] = new Dust();
16746 dust[num5].dustIndex = num5;
16747 }
16748 }
16749 }
16750 else
16751 {
16752 Dust.UpdateDust();
16753 }
16754 if (netMode != 2)
16755 {
16756 CombatText.UpdateCombatText();
16757 PopupText.UpdateItemText();
16758 }
16759 if (ignoreErrors)
16760 {
16761 try
16762 {
16763 UpdateTime();
16764 }
16765 catch
16766 {
16767 checkForSpawns = 0;
16768 }
16769 }
16770 else
16771 {
16772 UpdateTime();
16773 }
16774 tileSolid[379] = true;
16775 if (gameMenu && netMode != 2)
16776 {
16777 return;
16778 }
16779 if (netMode != 1)
16780 {
16781 if (ignoreErrors)
16782 {
16783 try
16784 {
16785 WorldGen.UpdateWorld();
16787 }
16788 catch
16789 {
16790 }
16791 }
16792 else
16793 {
16794 WorldGen.UpdateWorld();
16796 }
16797 }
16798 if (ignoreErrors)
16799 {
16800 try
16801 {
16802 if (netMode == 2)
16803 {
16804 UpdateServer();
16805 }
16806 if (netMode == 1)
16807 {
16808 UpdateClient();
16809 }
16810 }
16811 catch
16812 {
16813 _ = netMode;
16814 _ = 2;
16815 }
16816 }
16817 else
16818 {
16819 if (netMode == 2)
16820 {
16821 UpdateServer();
16822 }
16823 if (netMode == 1)
16824 {
16825 UpdateClient();
16826 }
16827 }
16828 chatMonitor.Update();
16829 upTimer = (float)sw.Elapsed.TotalMilliseconds;
16830 if (upTimerMaxDelay > 0f)
16831 {
16832 upTimerMaxDelay -= 1f;
16833 }
16834 else
16835 {
16836 upTimerMax = 0f;
16837 }
16838 if (upTimer > upTimerMax)
16839 {
16841 upTimerMaxDelay = 400f;
16842 }
16843 Chest.UpdateChestFrames();
16847 if (cameraLerp > 0f)
16848 {
16851 {
16852 cameraLerp += (float)((cameraLerpTimer - cameraLerpTimeToggle) / 3 + 1) * 0.001f;
16853 }
16854 if (cameraLerp > 1f)
16855 {
16856 cameraLerp = 1f;
16857 }
16858 }
16859 }
static bool[] DangerThatPreventsOtherDangers
Definition NPCID.cs:4246
static int cameraLerpTimeToggle
Definition Main.cs:459
static int checkForSpawns
Definition Main.cs:1316
static int cameraLerpTimer
Definition Main.cs:457
static void UpdateClient()
Definition Main.cs:61321
static void UpdateTime()
Definition Main.cs:61580
static float cameraLerp
Definition Main.cs:455
void PostUpdateAllProjectiles()
Definition Main.cs:16352
static float upTimer
Definition Main.cs:584
static AnchoredEntitiesCollection sleepingManager
Definition Main.cs:2257
static Item[] item
Definition Main.cs:1681
TileDrawing TilesRenderer
Definition Main.cs:2403
static int myPlayer
Definition Main.cs:1801
static int netMode
Definition Main.cs:2095
static Gore[] gore
Definition Main.cs:1687
static void UpdateInvasion()
Definition Main.cs:61128
static float upTimerMax
Definition Main.cs:586
void UpdateParticleSystems()
Definition Main.cs:3593
static uint _gameUpdateCount
Definition Main.cs:944
static IChatMonitor chatMonitor
Definition Main.cs:2339
static bool[] tileSolid
Definition Main.cs:1471
static BestiaryUnlocksTracker BestiaryTracker
Definition Main.cs:1868
AmbientWindSystem _ambientWindSys
Definition Main.cs:2407
static Projectile[] projectile
Definition Main.cs:1691
static bool ignoreErrors
Definition Main.cs:742
void PreUpdateAllProjectiles()
Definition Main.cs:16346
static NPC[] npc
Definition Main.cs:1685
static bool afterPartyOfDoom
Definition Main.cs:1020
WallDrawing WallsRenderer
Definition Main.cs:2405
static int ProjectileUpdateLoopIndex
Definition Main.cs:2341
static float upTimerMaxDelay
Definition Main.cs:588
static void UpdateServer()
Definition Main.cs:61360
static bool gameMenu
Definition Main.cs:1926
static AnchoredEntitiesCollection sittingManager
Definition Main.cs:2255
static Player[] player
Definition Main.cs:1803
static void CheckBossIndexes()
Definition Main.cs:16861
static bool remixWorld
Definition Main.cs:349
static Dust[] dust
Definition Main.cs:1677

References Terraria.Main._ambientWindSys, Terraria.Main._gameUpdateCount, Terraria.Main.afterPartyOfDoom, Terraria.NPC.AnyNPCs(), Terraria.Main.BestiaryTracker, Terraria.NPC.brainOfGravity, Terraria.Main.cameraLerp, Terraria.Main.cameraLerpTimer, Terraria.Main.cameraLerpTimeToggle, Terraria.Main.chatMonitor, Terraria.Main.CheckBossIndexes(), Terraria.Main.checkForSpawns, Terraria.NPC.ClearFoundActiveNPCs(), Terraria.ID.NPCID.Sets.DangerThatPreventsOtherDangers, Terraria.Main.dust, Terraria.NPC.empressRageMode, Terraria.Main.gameMenu, Terraria.Main.gore, System.Text.RegularExpressions.i, Terraria.Main.ignoreErrors, Terraria.Main.item, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Enums.NPC, Terraria.Main.npc, Terraria.NPC.offSetDelayTime, Terraria.GameContent.Events.BirthdayParty.PartyIsUp, Terraria.Main.player, Terraria.Main.PostUpdateAllProjectiles(), Terraria.Main.PreUpdateAllProjectiles(), Terraria.Main.projectile, Terraria.Main.ProjectileUpdateLoopIndex, Terraria.Main.remixWorld, Terraria.NPC.ResetRemixHax(), Terraria.NPC.RevengeManager, Terraria.NetMessage.SendData(), Terraria.GameInput.LockOnHelper.SetDOWN(), Terraria.NPC.SetRemixHax(), Terraria.GameInput.LockOnHelper.SetUP(), Terraria.Main.sittingManager, Terraria.Main.sleepingManager, Terraria.NPC.SpawnNPC(), Terraria.Main.tileSolid, Terraria.Main.TilesRenderer, Terraria.GameContent.Drawing.TileDrawing.Update(), Terraria.GameContent.Drawing.WallDrawing.Update(), Terraria.GameContent.AmbientWindSystem.Update(), Terraria.GameContent.FixExploitManEaters.Update(), Terraria.GameContent.PressurePlateHelper.Update(), Terraria.Chest.UpdateChestFrames(), Terraria.Main.UpdateClient(), Terraria.CombatText.UpdateCombatText(), Terraria.Dust.UpdateDust(), Terraria.NPC.UpdateFoundActiveNPCs(), Terraria.Main.UpdateInvasion(), Terraria.PopupText.UpdateItemText(), Terraria.Main.UpdateParticleSystems(), Terraria.Main.UpdateServer(), Terraria.Main.UpdateTime(), Terraria.WorldGen.UpdateWorld(), Terraria.Main.upTimer, Terraria.Main.upTimerMax, Terraria.Main.upTimerMaxDelay, and Terraria.Main.WallsRenderer.

Referenced by Terraria.Main.DoUpdate().