d38c50c...f202506

commit f20250657eda223fddacf812a477727b1a2b507b
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Mar 20 16:50:39 2019 +0200

    Ending a campaign round by talking to watchman doesn't require any special permissions. Closes #1313
This commit is contained in:
Joonas Rikkonen
2019-03-20 16:51:22 +02:00
parent a8309b5766
commit e8025cc66e
3 changed files with 36 additions and 9 deletions
@@ -72,6 +72,27 @@ namespace Barotrauma
});
}
public bool AllowedToEndRound(Character interactor)
{
if (interactor == null || Level.Loaded?.StartOutpost == null || Level.Loaded?.EndOutpost == null)
{
return false;
}
if (interactor.Submarine == Level.Loaded.StartOutpost &&
interactor.CanInteractWith(startWatchman))
{
return true;
}
if (interactor.Submarine == Level.Loaded.EndOutpost &&
interactor.CanInteractWith(endWatchman))
{
return true;
}
return false;
}
protected override void WatchmanInteract(Character watchman, Character interactor)
{
if ((watchman.Submarine == Level.Loaded.StartOutpost && !Submarine.MainSub.AtStartPosition) ||
@@ -85,8 +106,7 @@ namespace Barotrauma
if (GameMain.Server != null)
{
var client = GameMain.Server.ConnectedClients.Find(c => c.Character == interactor);
hasPermissions = client != null &&
(client.HasPermission(ClientPermissions.ManageRound) || client.HasPermission(ClientPermissions.ManageCampaign));
hasPermissions = client != null;
CreateDialog(new List<Character> { watchman }, hasPermissions ? "WatchmanInteract" : "WatchmanInteractNotAllowed", 1.0f);
}
}