Upload from upload_mods.ps1
This commit is contained in:
42
Harmony/Harmony_TileEntitySign.cs
Normal file
42
Harmony/Harmony_TileEntitySign.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
using Platform;
|
||||
|
||||
namespace Harmony.TileEntitySignPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(TileEntitySign))]
|
||||
[HarmonyPatch("SetText")]
|
||||
[HarmonyPatch(new[] { typeof(string), typeof(bool), typeof(PlatformUserIdentifierAbs) })]
|
||||
public class SetTextPatch
|
||||
{
|
||||
public static bool Prefix(TileEntitySign __instance, string _text, bool _syncData, PlatformUserIdentifierAbs _signingPlayer)
|
||||
{
|
||||
if (_signingPlayer == null)
|
||||
{
|
||||
_signingPlayer = PlatformManager.MultiPlatform.User.PlatformUserId;
|
||||
}
|
||||
|
||||
// Check for null as Vanilla code generates an error if still null
|
||||
if (_signingPlayer != null && GameManager.Instance.persistentPlayers != null)
|
||||
{
|
||||
if (GameManager.Instance.persistentPlayers.GetPlayerData(_signingPlayer) == null)
|
||||
{
|
||||
_signingPlayer = (PlatformUserIdentifierAbs)null;
|
||||
_text = "";
|
||||
}
|
||||
if (_text == __instance.signText.Text)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
__instance.signText.Update(_text, _signingPlayer);
|
||||
GeneratedTextManager.GetDisplayText(__instance.signText, new Action<string>(__instance.RefreshTextMesh), true, true, GeneratedTextManager.TextFilteringMode.FilterWithSafeString, GeneratedTextManager.BbCodeSupportMode.NotSupported);
|
||||
if (!_syncData)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
__instance.setModified();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user