From c616d1caded8e24352176bec11f79bc1df9405d2 Mon Sep 17 00:00:00 2001 From: Arthri <41360489+Arthri@users.noreply.github.com> Date: Thu, 22 Jul 2021 10:39:19 +0800 Subject: [PATCH] Add comment describing biome torch correction code --- TShockAPI/Bouncer.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 197490b1..cb3229ff 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -315,8 +315,17 @@ namespace TShockAPI var tplayer = args.Player.TPlayer; if (createTile == TileID.Torches && placeStyle == TorchID.Torch && tplayer.unlockedBiomeTorches) { - // BiomeTorchPlaceStyle checks if the player has biome torches activated - // but biome torches activation isn't broadcasted when it's toggled + // The torch is a default torch, so biome torches apply to it + // The player has also used Torch God's Favor, they can use biome torches + + // The server isn't notified when the player turns on biome torches. + // So on the client it can be on, while on the server it's off. + // BiomeTorchPlaceStyle returns placeStyle as-is if biome torches is off. + // Because of the uncertainty, we: + // 1. Ensure that UsingBiomeTorches is on, so we can get the correct + // value from BiomeTorchPlaceStyle. + // 2. Check if the torch is either 0 or the biome torch since we aren't + // sure if the player has biome torches on var usingBiomeTorches = tplayer.UsingBiomeTorches; if (!usingBiomeTorches) {