0.15.21.0

This commit is contained in:
Markus Isberg
2021-12-16 01:05:43 +09:00
parent 617d9ede88
commit 7d43cb1e91
74 changed files with 487 additions and 541 deletions
@@ -30,10 +30,9 @@ namespace Barotrauma
public static SubmarineVote SubVote;
private void StartSubmarineVote(IReadMessage inc, VoteType voteType, Client sender)
private void StartSubmarineVote(SubmarineInfo subInfo, VoteType voteType, Client sender)
{
string subName = inc.ReadString();
SubVote.Sub = SubmarineInfo.SavedSubmarines.FirstOrDefault(s => s.Name == subName);
SubVote.Sub = subInfo;
SubVote.DeliveryFee = voteType == VoteType.SwitchSub ? GameMain.GameSession.Map.DistanceToClosestLocationWithOutpost(GameMain.GameSession.Map.CurrentLocation, out Location endLocation) : 0;
SubVote.VoteType = voteType;
SubVote.State = VoteState.Started;
@@ -130,7 +129,12 @@ namespace Barotrauma
bool startVote = inc.ReadBoolean();
if (startVote)
{
StartSubmarineVote(inc, voteType, sender);
string subName = inc.ReadString();
SubmarineInfo subInfo = SubmarineInfo.SavedSubmarines.FirstOrDefault(s => s.Name == subName);
if (GameMain.GameSession?.Campaign is MultiPlayerCampaign campaign && campaign.CanPurchaseSub(subInfo))
{
StartSubmarineVote(subInfo, voteType, sender);
}
}
else
{