Unstable 1.8.4.0

This commit is contained in:
Markus Isberg
2025-03-12 12:56:27 +00:00
parent a4c3e868e4
commit a4a3427e4e
627 changed files with 29860 additions and 10018 deletions
@@ -1,4 +1,5 @@
using Barotrauma.Networking;
using Barotrauma.Extensions;
using Barotrauma.Networking;
using System;
using System.Linq;
@@ -26,8 +27,11 @@ namespace Barotrauma
public void ServerRead(IReadMessage inc, Client sender)
{
const float IgnoreTime = 3f;
UInt16 actionId = inc.ReadUInt16();
byte selectedOption = inc.ReadByte();
bool isIgnore = selectedOption == byte.MaxValue;
foreach (Event ev in activeEvents)
{
@@ -40,24 +44,38 @@ namespace Barotrauma
if (!convAction.TargetClients.Contains(sender))
{
#if DEBUG || UNSTABLE
DebugConsole.ThrowError($"Client \"{sender.Name}\" tried to respond to a ConversationAction that was not targeted to them ({convAction.Text}).");
if (!isIgnore)
{
DebugConsole.ThrowError($"Client \"{sender.Name}\" tried to respond to a ConversationAction that was not targeted to them ({convAction.Text}).");
}
#endif
convAction.IgnoreClient(sender, IgnoreTime);
continue;
}
if (convAction.SelectedOption > -1)
{
//someone else already chose an option for this conversation: interrupt for this client
DebugConsole.Log($"Client replied to {ev.Prefab.Identifier}, but option already selected for conversation, interrupt for the client");
convAction.ServerWrite(convAction.Speaker, sender, interrupt: true);
}
else
{
if (selectedOption == byte.MaxValue)
if (isIgnore)
{
convAction.IgnoreClient(sender, 3f);
DebugConsole.NewMessage($"Client ignored ConversationAction (event {ev.Prefab.Identifier}).");
convAction.IgnoreClient(sender, IgnoreTime);
//no more target clients (the only/last target ignored the conversation action)
// -> reset the action so it can appear when some client becomes available
if (convAction.TargetClients.None())
{
DebugConsole.NewMessage($"No target clients for event {ev.Prefab.Identifier}, retrying in " + (IgnoreTime + 1.0f));
convAction.RetriggerAfter(IgnoreTime + 1.0f);
}
}
else
{
DebugConsole.NewMessage($"Client selected option {selectedOption} for ConversationAction in event {ev.Prefab.Identifier}.");
convAction.SelectedOption = selectedOption;
if (convAction.Options.Any() && !convAction.GetEndingOptions().Contains(selectedOption))
{