Bug fix: Unable to chat in claimed areas.

This commit is contained in:
Droog71 2022-04-21 17:53:21 -04:00
parent ae5268316f
commit aca9fb42b4

View File

@ -111,6 +111,17 @@ public class AreaProtection : FortressCraftMod
File.WriteAllText(playersFilePath, playerData);
}
// Returns true when the player is trying to chat in a claimed area.
private bool ChatOverrideRequired()
{
bool b1 = UIManager.HudShown;
bool b2 = !UIManager.AllowInteracting;
bool b3 = !UIManager.mbEditingTextField;
bool b4 = UIManager.instance.mChatPanel.ShouldShow();
bool b5 = !UIManager.instance.WorkshopDetailPanel.activeSelf;
return b1 && b2 && b3 && b4 && b5;
}
// Called once per frame by unity engine.
public void Update()
{
@ -130,6 +141,14 @@ public class AreaProtection : FortressCraftMod
showGUI = !showGUI;
}
if (Input.GetKeyUp(KeyCode.Return))
{
if (ChatOverrideRequired())
{
UIManager.instance.mChatPanel.ShowUI();
}
}
UpdateClient();
}
}