Skip to content

Commit c8cf6b1

Browse files
committed
v0.3.3, Telemetry config, fix potential issues with last element in vanilla arrays
1 parent ade3ffb commit c8cf6b1

File tree

9 files changed

+19
-10
lines changed

9 files changed

+19
-10
lines changed

HEROsMod.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,11 @@ public static void LoadAddServices()
459459

460460
ServiceController.AddService(new Login());
461461

462-
ServiceController.AddService(new PSAService());
463-
ServiceController.AddService(new StatsService());
462+
if (ModContent.GetInstance<HEROsModServerConfig>().Telemetry)
463+
{
464+
ServiceController.AddService(new PSAService());
465+
ServiceController.AddService(new StatsService());
466+
}
464467

465468
//ServiceController.AddService(new HardmodeEnemyToggler(multiplayerOption.Hotbar));
466469
//ServiceController.AddService(new ZoomToolsService());

HEROsModNetwork/GeneralMessages.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ private static void ProcessSpawnNPCRequest(ref BinaryReader reader, int playerNu
11731173

11741174
if (newNPC.townNPC || global::HEROsMod.HEROsModServices.NPCStats.boundNPC.Contains(npcType))
11751175
{
1176-
for (int i = 0; i < Main.npc.Length; i++)
1176+
for (int i = 0; i < Main.maxNPCs; i++)
11771177
{
11781178
NPC npc = Main.npc[i];
11791179
if (npc.type == newNPC.type)

HEROsModNetwork/Network.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ public static Region GetRegionByID(int id)
10031003

10041004
public static void ClearGroundItems()
10051005
{
1006-
for (int i = 0; i < Main.item.Length; i++)
1006+
for (int i = 0; i < Main.maxItems; i++)
10071007
{
10081008
if (Main.item[i].active)
10091009
{
@@ -1016,7 +1016,7 @@ public static void ClearGroundItems()
10161016
public static void SpawnNPC(int type, Vector2 position)
10171017
{
10181018
bool npcFound = false;
1019-
for (int i = 0; i < Main.npc.Length; i++)
1019+
for (int i = 0; i < Main.maxNPCs; i++)
10201020
{
10211021
NPC n = Main.npc[i];
10221022
if (n.type == type)

HEROsModServerConfig.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ class HEROsModServerConfig : ModConfig
2525
[DefaultValue(false)]
2626
public bool FreezeNonLoggedIn { get; set; }
2727

28+
[Label("Telemetry")]
29+
[Tooltip("Disable this to disable update notifications and other telemetry.")]
30+
[DefaultValue(true)]
31+
[ReloadRequired]
32+
public bool Telemetry { get; set; }
33+
2834
public override bool AcceptClientChanges(ModConfig pendingConfig, int whoAmI, ref string message)
2935
{
3036
if (Network.Players[whoAmI].Group.IsAdmin)

HEROsModServices/EnemyToggler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static void ToggleNPCs()
4747

4848
public static void ClearNPCs()
4949
{
50-
for (int i = 0; i < Main.npc.Length; i++)
50+
for (int i = 0; i < Main.maxNPCs; i++)
5151
{
5252
if (Main.npc[i] != null && !Main.npc[i].townNPC)
5353
{

HEROsModServices/ItemClearer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ private void _hotbarIcon_onLeftClick(object sender, EventArgs e)
2222
//ClearItems
2323
if (ModUtils.NetworkMode == NetworkMode.None)
2424
{
25-
for (int i = 0; i < Main.item.Length; i++)
25+
for (int i = 0; i < Main.maxItems; i++)
2626
{
2727
Main.item[i].active = false;
2828
}

HEROsModServices/MobSpawner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ public virtual void Spawn(int playerIndex)
787787
Player player = Main.player[playerIndex];
788788
if (IsTownNPC || boundNPC.Contains(Type))
789789
{
790-
for (int i = 0; i < Main.npc.Length; i++)
790+
for (int i = 0; i < Main.maxNPCs; i++)
791791
{
792792
NPC npc = Main.npc[i];
793793
if (npc.type == NetID)

HEROsModVideo/Services/MobHUD/MobInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal class MobInfo
1313

1414
public static void Update()
1515
{
16-
for (int i = 0; i < Main.npc.Length; i++)
16+
for (int i = 0; i < Main.maxNPCs; i++)
1717
{
1818
NPC npc = Main.npc[i];
1919
if (npc.active && NPCOnScreen(npc))

build.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
author = HERO, jopojelly, Matt Thompson, Panini
2-
version = 0.3.2
2+
version = 0.3.3
33
versionScheme = ?.?.Fix.Quickfix
44
displayName = HERO's Mod
55
homepage = http://forums.terraria.org/index.php?threads/heros-mod-creative-mode-server-management-and-over-25-tools-1-3-1-1-compatible.44650/

0 commit comments

Comments
 (0)