Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git
This commit is contained in:
@@ -685,6 +685,7 @@ namespace Barotrauma
|
|||||||
causeOfDeathAffliction = AfflictionPrefab.Prefabs[afflictionName];
|
causeOfDeathAffliction = AfflictionPrefab.Prefabs[afflictionName];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bool containsAfflictionData = msg.ReadBoolean();
|
||||||
if (!IsDead)
|
if (!IsDead)
|
||||||
{
|
{
|
||||||
if (causeOfDeathType == CauseOfDeathType.Pressure || causeOfDeathAffliction == AfflictionPrefab.Pressure)
|
if (causeOfDeathType == CauseOfDeathType.Pressure || causeOfDeathAffliction == AfflictionPrefab.Pressure)
|
||||||
@@ -695,6 +696,11 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Kill(causeOfDeathType, causeOfDeathAffliction?.Instantiate(1.0f), true);
|
Kill(causeOfDeathType, causeOfDeathAffliction?.Instantiate(1.0f), true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (containsAfflictionData)
|
||||||
|
{
|
||||||
|
CharacterHealth.ClientRead(msg);
|
||||||
|
CharacterHealth.ForceUpdateVisuals();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -2011,7 +2011,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
partial void UpdateSkinTint()
|
partial void UpdateSkinTint()
|
||||||
{
|
{
|
||||||
if (!Character.IsVisible) { return; }
|
|
||||||
FaceTint = DefaultFaceTint;
|
FaceTint = DefaultFaceTint;
|
||||||
BodyTint = Color.TransparentBlack;
|
BodyTint = Color.TransparentBlack;
|
||||||
|
|
||||||
@@ -2029,7 +2028,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
partial void UpdateLimbAfflictionOverlays()
|
partial void UpdateLimbAfflictionOverlays()
|
||||||
{
|
{
|
||||||
if (!Character.IsVisible) { return; }
|
|
||||||
foreach (Limb limb in Character.AnimController.Limbs)
|
foreach (Limb limb in Character.AnimController.Limbs)
|
||||||
{
|
{
|
||||||
if (limb.HealthIndex < 0 || limb.HealthIndex >= limbHealths.Count) { continue; }
|
if (limb.HealthIndex < 0 || limb.HealthIndex >= limbHealths.Count) { continue; }
|
||||||
|
|||||||
@@ -1750,9 +1750,9 @@ namespace Barotrauma
|
|||||||
addIfMissing($"missionfailure.{missionId}".ToIdentifier(), language);
|
addIfMissing($"missionfailure.{missionId}".ToIdentifier(), language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i<missionPrefab.Messages.Length; i++)
|
for (int i = 0; i < missionPrefab.Messages.Length; i++)
|
||||||
{
|
{
|
||||||
if (missionPrefab.Messages[i].IsNullOrWhiteSpace())
|
if (missionPrefab.Messages[i].IsNullOrWhiteSpace() || (missionPrefab.Messages[i] as FallbackLString)?.GetLastFallback() is FallbackLString { PrimaryIsLoaded: false })
|
||||||
{
|
{
|
||||||
addIfMissing($"MissionMessage{i}.{missionId}".ToIdentifier(), language);
|
addIfMissing($"MissionMessage{i}.{missionId}".ToIdentifier(), language);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ namespace Barotrauma
|
|||||||
CreateUI();
|
CreateUI();
|
||||||
UpdateLocationView(campaignUI.Campaign.Map.CurrentLocation, true);
|
UpdateLocationView(campaignUI.Campaign.Map.CurrentLocation, true);
|
||||||
|
|
||||||
campaignUI.Campaign.Map.OnLocationChanged += (prevLocation, newLocation) => UpdateLocationView(newLocation, true, prevLocation);
|
campaignUI.Campaign.Map.OnLocationChanged.RegisterOverwriteExisting(
|
||||||
|
"CrewManagement.UpdateLocationView".ToIdentifier(),
|
||||||
|
(locationChangeInfo) => UpdateLocationView(locationChangeInfo.NewLocation, true, locationChangeInfo.PrevLocation));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshPermissions()
|
public void RefreshPermissions()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Barotrauma
|
|||||||
private RectTransform currentHighestParent;
|
private RectTransform currentHighestParent;
|
||||||
private List<RectTransform> parentHierarchy = new List<RectTransform>();
|
private List<RectTransform> parentHierarchy = new List<RectTransform>();
|
||||||
|
|
||||||
private bool selectMultiple;
|
private readonly bool selectMultiple;
|
||||||
|
|
||||||
public bool Dropped { get; set; }
|
public bool Dropped { get; set; }
|
||||||
|
|
||||||
@@ -129,18 +129,20 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<object> selectedDataMultiple = new List<object>();
|
private readonly List<object> selectedDataMultiple = new List<object>();
|
||||||
public IEnumerable<object> SelectedDataMultiple
|
public IEnumerable<object> SelectedDataMultiple
|
||||||
{
|
{
|
||||||
get { return selectedDataMultiple; }
|
get { return selectedDataMultiple; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<int> selectedIndexMultiple = new List<int>();
|
private readonly List<int> selectedIndexMultiple = new List<int>();
|
||||||
public IEnumerable<int> SelectedIndexMultiple
|
public IEnumerable<int> SelectedIndexMultiple
|
||||||
{
|
{
|
||||||
get { return selectedIndexMultiple; }
|
get { return selectedIndexMultiple; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool MustSelectAtLeastOne;
|
||||||
|
|
||||||
public LocalizedString Text
|
public LocalizedString Text
|
||||||
{
|
{
|
||||||
get { return button.Text; }
|
get { return button.Text; }
|
||||||
@@ -269,6 +271,12 @@ namespace Barotrauma
|
|||||||
ToolTip = toolTip,
|
ToolTip = toolTip,
|
||||||
OnSelected = (GUITickBox tb) =>
|
OnSelected = (GUITickBox tb) =>
|
||||||
{
|
{
|
||||||
|
if (MustSelectAtLeastOne && selectedIndexMultiple.Count <= 1 && !tb.Selected)
|
||||||
|
{
|
||||||
|
tb.Selected = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
List<LocalizedString> texts = new List<LocalizedString>();
|
List<LocalizedString> texts = new List<LocalizedString>();
|
||||||
selectedDataMultiple.Clear();
|
selectedDataMultiple.Clear();
|
||||||
selectedIndexMultiple.Clear();
|
selectedIndexMultiple.Clear();
|
||||||
|
|||||||
@@ -188,21 +188,23 @@ namespace Barotrauma
|
|||||||
this.parentComponent = parentComponent;
|
this.parentComponent = parentComponent;
|
||||||
UpdatePermissions();
|
UpdatePermissions();
|
||||||
CreateUI();
|
CreateUI();
|
||||||
campaignUI.Campaign.Map.OnLocationChanged += UpdateLocation;
|
Identifier refreshStoreId = new Identifier("RefreshStore");
|
||||||
if (CurrentLocation?.Reputation != null)
|
campaignUI.Campaign.Map.OnLocationChanged.RegisterOverwriteExisting(
|
||||||
{
|
refreshStoreId,
|
||||||
CurrentLocation.Reputation.OnReputationValueChanged += () => { needsRefresh = true; };
|
(locationChangeInfo) => UpdateLocation(locationChangeInfo.PrevLocation, locationChangeInfo.NewLocation));
|
||||||
}
|
|
||||||
campaignUI.Campaign.CargoManager.OnItemsInBuyCrateChanged += () => { needsBuyingRefresh = true; };
|
CurrentLocation?.Reputation?.OnReputationValueChanged.RegisterOverwriteExisting(refreshStoreId, _ => needsRefresh = true);
|
||||||
campaignUI.Campaign.CargoManager.OnPurchasedItemsChanged += () => { needsRefresh = true; };
|
CargoManager cargoManager = campaignUI.Campaign.CargoManager;
|
||||||
campaignUI.Campaign.CargoManager.OnItemsInSellCrateChanged += () => { needsSellingRefresh = true; };
|
cargoManager.OnItemsInBuyCrateChanged.RegisterOverwriteExisting(refreshStoreId, _ => needsBuyingRefresh = true);
|
||||||
campaignUI.Campaign.CargoManager.OnSoldItemsChanged += () =>
|
cargoManager.OnPurchasedItemsChanged.RegisterOverwriteExisting(refreshStoreId, _ => needsRefresh = true);
|
||||||
|
cargoManager.OnItemsInSellCrateChanged.RegisterOverwriteExisting(refreshStoreId, _ => needsSellingRefresh = true);
|
||||||
|
cargoManager.OnSoldItemsChanged.RegisterOverwriteExisting(refreshStoreId, _ =>
|
||||||
{
|
{
|
||||||
needsItemsToSellRefresh = true;
|
needsItemsToSellRefresh = true;
|
||||||
needsItemsToSellFromSubRefresh = true;
|
needsItemsToSellFromSubRefresh = true;
|
||||||
needsRefresh = true;
|
needsRefresh = true;
|
||||||
};
|
});
|
||||||
campaignUI.Campaign.CargoManager.OnItemsInSellFromSubCrateChanged += () => { needsSellingFromSubRefresh = true; };
|
cargoManager.OnItemsInSellFromSubCrateChanged.RegisterOverwriteExisting(refreshStoreId, _ => needsSellingFromSubRefresh = true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectStore(Identifier identifier)
|
public void SelectStore(Identifier identifier)
|
||||||
@@ -713,7 +715,7 @@ namespace Barotrauma
|
|||||||
if (prevLocation == newLocation) { return; }
|
if (prevLocation == newLocation) { return; }
|
||||||
if (prevLocation?.Reputation != null)
|
if (prevLocation?.Reputation != null)
|
||||||
{
|
{
|
||||||
prevLocation.Reputation.OnReputationValueChanged -= SetNeedsRefresh;
|
prevLocation.Reputation.OnReputationValueChanged.Dispose();
|
||||||
}
|
}
|
||||||
if (ItemPrefab.Prefabs.Any(p => p.CanBeBoughtFrom(newLocation)))
|
if (ItemPrefab.Prefabs.Any(p => p.CanBeBoughtFrom(newLocation)))
|
||||||
{
|
{
|
||||||
@@ -722,7 +724,7 @@ namespace Barotrauma
|
|||||||
ChangeStoreTab(StoreTab.Buy);
|
ChangeStoreTab(StoreTab.Buy);
|
||||||
if (newLocation?.Reputation != null)
|
if (newLocation?.Reputation != null)
|
||||||
{
|
{
|
||||||
newLocation.Reputation.OnReputationValueChanged += SetNeedsRefresh;
|
CurrentLocation.Reputation.OnReputationValueChanged.RegisterOverwriteExisting("RefreshStore".ToIdentifier(), _ => { SetNeedsRefresh(); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using Microsoft.Xna.Framework;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using System.Globalization;
|
|
||||||
using PlayerBalanceElement = Barotrauma.CampaignUI.PlayerBalanceElement;
|
using PlayerBalanceElement = Barotrauma.CampaignUI.PlayerBalanceElement;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
@@ -30,12 +29,12 @@ namespace Barotrauma
|
|||||||
private int selectionIndicatorThickness;
|
private int selectionIndicatorThickness;
|
||||||
private GUIImage listBackground;
|
private GUIImage listBackground;
|
||||||
private GUITickBox transferItemsTickBox;
|
private GUITickBox transferItemsTickBox;
|
||||||
private GUITextBlock itemTransferReminderBlock;
|
private GUITextBlock itemTransferInfoBlock;
|
||||||
|
|
||||||
private readonly List<SubmarineInfo> subsToShow;
|
private readonly List<SubmarineInfo> subsToShow;
|
||||||
private readonly SubmarineDisplayContent[] submarineDisplays = new SubmarineDisplayContent[submarinesPerPage];
|
private readonly SubmarineDisplayContent[] submarineDisplays = new SubmarineDisplayContent[submarinesPerPage];
|
||||||
private SubmarineInfo selectedSubmarine = null;
|
private SubmarineInfo selectedSubmarine = null;
|
||||||
private LocalizedString purchaseAndSwitchText, purchaseOnlyText, deliveryText, currentSubText, switchText, missingPreviewText, currencyName;
|
private LocalizedString purchaseAndSwitchText, purchaseOnlyText, deliveryText, selectedSubText, switchText, missingPreviewText, currencyName;
|
||||||
private readonly RectTransform parent;
|
private readonly RectTransform parent;
|
||||||
private readonly Action closeAction;
|
private readonly Action closeAction;
|
||||||
private Sprite pageIndicator;
|
private Sprite pageIndicator;
|
||||||
@@ -107,7 +106,7 @@ namespace Barotrauma
|
|||||||
private void Initialize()
|
private void Initialize()
|
||||||
{
|
{
|
||||||
initialized = true;
|
initialized = true;
|
||||||
currentSubText = TextManager.Get("currentsub");
|
selectedSubText = TextManager.Get("selectedsub");
|
||||||
deliveryText = TextManager.Get("requestdeliverybutton");
|
deliveryText = TextManager.Get("requestdeliverybutton");
|
||||||
switchText = TextManager.Get("switchtosubmarinebutton");
|
switchText = TextManager.Get("switchtosubmarinebutton");
|
||||||
purchaseAndSwitchText = TextManager.Get("purchaseandswitch");
|
purchaseAndSwitchText = TextManager.Get("purchaseandswitch");
|
||||||
@@ -203,7 +202,7 @@ namespace Barotrauma
|
|||||||
OnSelected = (tb) => transferItemsOnSwitch = tb.Selected
|
OnSelected = (tb) => transferItemsOnSwitch = tb.Selected
|
||||||
};
|
};
|
||||||
transferItemsTickBox.RectTransform.Resize(new Point(Math.Min((int)transferItemsTickBox.ContentWidth, transferInfoFrame.Rect.Width), transferItemsTickBox.Rect.Height));
|
transferItemsTickBox.RectTransform.Resize(new Point(Math.Min((int)transferItemsTickBox.ContentWidth, transferInfoFrame.Rect.Width), transferItemsTickBox.Rect.Height));
|
||||||
itemTransferReminderBlock = new GUITextBlock(new RectTransform(Vector2.One, transferInfoFrame.RectTransform, Anchor.CenterRight), null)
|
itemTransferInfoBlock = new GUITextBlock(new RectTransform(Vector2.One, transferInfoFrame.RectTransform, Anchor.CenterRight), null, wrap: true)
|
||||||
{
|
{
|
||||||
TextAlignment = Alignment.CenterRight,
|
TextAlignment = Alignment.CenterRight,
|
||||||
Visible = false
|
Visible = false
|
||||||
@@ -412,7 +411,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
submarineDisplays[i].submarineFee.Text = currentSubText;
|
submarineDisplays[i].submarineFee.Text = selectedSubText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,7 +473,10 @@ namespace Barotrauma
|
|||||||
subsToShow.Sort((x, y) => x.SubmarineClass.CompareTo(y.SubmarineClass));
|
subsToShow.Sort((x, y) => x.SubmarineClass.CompareTo(y.SubmarineClass));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transferService) SetConfirmButtonState(selectedSubmarine != null && selectedSubmarine.Name != CurrentOrPendingSubmarine().Name);
|
if (transferService)
|
||||||
|
{
|
||||||
|
SetConfirmButtonState(selectedSubmarine != null && selectedSubmarine.Name != CurrentOrPendingSubmarine().Name);
|
||||||
|
}
|
||||||
|
|
||||||
subsToShow.Sort((x, y) => x.SubmarineClass.CompareTo(y.SubmarineClass));
|
subsToShow.Sort((x, y) => x.SubmarineClass.CompareTo(y.SubmarineClass));
|
||||||
pageCount = Math.Max(1, (int)Math.Ceiling(subsToShow.Count / (float)submarinesPerPage));
|
pageCount = Math.Max(1, (int)Math.Ceiling(subsToShow.Count / (float)submarinesPerPage));
|
||||||
@@ -607,35 +609,36 @@ namespace Barotrauma
|
|||||||
UpdateItemTransferInfoFrame();
|
UpdateItemTransferInfoFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool IsSelectedSubCurrentSub => Submarine.MainSub?.Info?.Name == selectedSubmarine?.Name;
|
||||||
|
|
||||||
private void UpdateItemTransferInfoFrame()
|
private void UpdateItemTransferInfoFrame()
|
||||||
{
|
{
|
||||||
if (selectedSubmarine != null)
|
if (selectedSubmarine != null)
|
||||||
{
|
{
|
||||||
var pendingSub = GameMain.GameSession?.Campaign?.PendingSubmarineSwitch;
|
if (IsSelectedSubCurrentSub)
|
||||||
if (Submarine.MainSub?.Info?.Name == selectedSubmarine.Name && pendingSub == null)
|
|
||||||
{
|
{
|
||||||
|
TransferItemsOnSwitch = false;
|
||||||
transferItemsTickBox.Visible = false;
|
transferItemsTickBox.Visible = false;
|
||||||
itemTransferReminderBlock.Visible = false;
|
itemTransferInfoBlock.Visible = confirmButton.Enabled;
|
||||||
|
itemTransferInfoBlock.Text = TextManager.Get("switchingbacktocurrentsub");
|
||||||
}
|
}
|
||||||
else if (pendingSub?.Name == selectedSubmarine.Name)
|
else if (GameMain.GameSession?.Campaign?.PendingSubmarineSwitch?.Name == selectedSubmarine.Name)
|
||||||
{
|
{
|
||||||
transferItemsTickBox.Visible = false;
|
transferItemsTickBox.Visible = false;
|
||||||
itemTransferReminderBlock.Text = GameMain.GameSession.Campaign.TransferItemsOnSubSwitch ?
|
itemTransferInfoBlock.Visible = true;
|
||||||
TextManager.Get("itemtransferenabledreminder") :
|
itemTransferInfoBlock.Text = GameMain.GameSession.Campaign.TransferItemsOnSubSwitch ? TextManager.Get("itemtransferenabledreminder") : TextManager.Get("itemtransferdisabledreminder");
|
||||||
TextManager.Get("itemtransferdisabledreminder");
|
|
||||||
itemTransferReminderBlock.Visible = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
transferItemsTickBox.Selected = TransferItemsOnSwitch;
|
transferItemsTickBox.Selected = TransferItemsOnSwitch;
|
||||||
transferItemsTickBox.Visible = true;
|
transferItemsTickBox.Visible = true;
|
||||||
itemTransferReminderBlock.Visible = false;
|
itemTransferInfoBlock.Visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
transferItemsTickBox.Visible = false;
|
transferItemsTickBox.Visible = false;
|
||||||
itemTransferReminderBlock.Visible = false;
|
itemTransferInfoBlock.Visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -710,6 +713,45 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
msgBox.Buttons[0].OnClicked = (applyButton, obj) =>
|
msgBox.Buttons[0].OnClicked = (applyButton, obj) =>
|
||||||
|
{
|
||||||
|
if (!TransferItemsOnSwitch && !IsSelectedSubCurrentSub)
|
||||||
|
{
|
||||||
|
if (selectedSubmarine.NoItems)
|
||||||
|
{
|
||||||
|
return ShowConfirmationPopup(TextManager.Get("noitemsheader"), TextManager.Get("noitemswarning"));
|
||||||
|
}
|
||||||
|
if (!GameMain.GameSession.IsSubmarineOwned(selectedSubmarine) && !selectedSubmarine.IsManuallyOutfitted)
|
||||||
|
{
|
||||||
|
var (header, body) = GetItemTransferWarningText();
|
||||||
|
return ShowConfirmationPopup(header, body);
|
||||||
|
}
|
||||||
|
if (selectedSubmarine.LowFuel)
|
||||||
|
{
|
||||||
|
return ShowConfirmationPopup(TextManager.Get("lowfuelheader"), TextManager.Get("lowfuelwarning"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Confirm();
|
||||||
|
};
|
||||||
|
msgBox.Buttons[0].OnClicked += msgBox.Close;
|
||||||
|
msgBox.Buttons[1].OnClicked = msgBox.Close;
|
||||||
|
|
||||||
|
bool ShowConfirmationPopup(LocalizedString header, LocalizedString textBody)
|
||||||
|
{
|
||||||
|
msgBox.Close();
|
||||||
|
var extraConfirmationBox = new GUIMessageBox(header, textBody, new LocalizedString[2] { TextManager.Get("ok"), TextManager.Get("cancel") });
|
||||||
|
extraConfirmationBox.Buttons[0].OnClicked = (b, o) => Confirm();
|
||||||
|
extraConfirmationBox.Buttons[1].OnClicked = (b, o) =>
|
||||||
|
{
|
||||||
|
selectedSubmarine = CurrentOrPendingSubmarine();
|
||||||
|
RefreshSubmarineDisplay(true);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
extraConfirmationBox.Buttons[0].OnClicked += extraConfirmationBox.Close;
|
||||||
|
extraConfirmationBox.Buttons[1].OnClicked += extraConfirmationBox.Close;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Confirm()
|
||||||
{
|
{
|
||||||
if (GameMain.Client == null)
|
if (GameMain.Client == null)
|
||||||
{
|
{
|
||||||
@@ -721,9 +763,14 @@ namespace Barotrauma
|
|||||||
GameMain.Client.InitiateSubmarineChange(selectedSubmarine, TransferItemsOnSwitch, Networking.VoteType.SwitchSub);
|
GameMain.Client.InitiateSubmarineChange(selectedSubmarine, TransferItemsOnSwitch, Networking.VoteType.SwitchSub);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
}
|
||||||
msgBox.Buttons[0].OnClicked += msgBox.Close;
|
}
|
||||||
msgBox.Buttons[1].OnClicked = msgBox.Close;
|
|
||||||
|
private (LocalizedString header, LocalizedString body) GetItemTransferWarningText()
|
||||||
|
{
|
||||||
|
var header = TextManager.Get("itemtransferheader").Fallback("lowfuelheader");
|
||||||
|
var body = TextManager.Get("itemtransferwarning").Fallback("lowfuelwarning");
|
||||||
|
return (header, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowBuyPrompt(bool purchaseOnly)
|
private void ShowBuyPrompt(bool purchaseOnly)
|
||||||
@@ -737,7 +784,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
GUIMessageBox msgBox;
|
GUIMessageBox msgBox;
|
||||||
|
|
||||||
if (!purchaseOnly)
|
if (!purchaseOnly)
|
||||||
{
|
{
|
||||||
var text = TextManager.GetWithVariables("purchaseandswitchsubmarinetext",
|
var text = TextManager.GetWithVariables("purchaseandswitchsubmarinetext",
|
||||||
@@ -749,6 +795,39 @@ namespace Barotrauma
|
|||||||
msgBox = new GUIMessageBox(TextManager.Get("purchaseandswitchsubmarineheader"), text, messageBoxOptions);
|
msgBox = new GUIMessageBox(TextManager.Get("purchaseandswitchsubmarineheader"), text, messageBoxOptions);
|
||||||
|
|
||||||
msgBox.Buttons[0].OnClicked = (applyButton, obj) =>
|
msgBox.Buttons[0].OnClicked = (applyButton, obj) =>
|
||||||
|
{
|
||||||
|
if (!TransferItemsOnSwitch && !IsSelectedSubCurrentSub)
|
||||||
|
{
|
||||||
|
if (selectedSubmarine.NoItems)
|
||||||
|
{
|
||||||
|
ShowConfirmationPopup(TextManager.Get("noitemsheader"), TextManager.Get("noitemswarning"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!GameMain.GameSession.IsSubmarineOwned(selectedSubmarine) && !selectedSubmarine.IsManuallyOutfitted)
|
||||||
|
{
|
||||||
|
var (header, body) = GetItemTransferWarningText();
|
||||||
|
ShowConfirmationPopup(header, body);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (selectedSubmarine.LowFuel)
|
||||||
|
{
|
||||||
|
ShowConfirmationPopup(TextManager.Get("lowfuelheader"), TextManager.Get("lowfuelwarning"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Confirm();
|
||||||
|
};
|
||||||
|
|
||||||
|
void ShowConfirmationPopup(LocalizedString header, LocalizedString textBody)
|
||||||
|
{
|
||||||
|
msgBox.Close();
|
||||||
|
var extraConfirmationBox = new GUIMessageBox(header, textBody, new LocalizedString[2] { TextManager.Get("ok"), TextManager.Get("cancel") });
|
||||||
|
extraConfirmationBox.Buttons[0].OnClicked = (b, o) => Confirm();
|
||||||
|
extraConfirmationBox.Buttons[0].OnClicked += extraConfirmationBox.Close;
|
||||||
|
extraConfirmationBox.Buttons[1].OnClicked += extraConfirmationBox.Close;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Confirm()
|
||||||
{
|
{
|
||||||
if (GameMain.Client == null)
|
if (GameMain.Client == null)
|
||||||
{
|
{
|
||||||
@@ -761,7 +840,7 @@ namespace Barotrauma
|
|||||||
GameMain.Client.InitiateSubmarineChange(selectedSubmarine, TransferItemsOnSwitch, Networking.VoteType.PurchaseAndSwitchSub);
|
GameMain.Client.InitiateSubmarineChange(selectedSubmarine, TransferItemsOnSwitch, Networking.VoteType.PurchaseAndSwitchSub);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -792,7 +871,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private LocalizedString GetItemTransferText()
|
private LocalizedString GetItemTransferText()
|
||||||
{
|
{
|
||||||
return "\n\n" + TextManager.Get(TransferItemsOnSwitch ? "itemswillbetransferred" : "itemswontbetransferred");
|
if (Submarine.MainSub?.Info?.Name == selectedSubmarine.Name)
|
||||||
|
{
|
||||||
|
return $"\n\n{TextManager.Get("switchingbacktocurrentsub")}";
|
||||||
|
}
|
||||||
|
var s = "\n\n" + TextManager.Get(TransferItemsOnSwitch ? "itemswillbetransferred" : "itemswontbetransferred");
|
||||||
|
s += $" {TextManager.Get("toggleitemtransferprompt")}";
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1885,6 +1885,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
IgnoreLayoutGroups = true
|
IgnoreLayoutGroups = true
|
||||||
};
|
};
|
||||||
|
newCharacterBox.TextBlock.AutoScaleHorizontal = true;
|
||||||
|
|
||||||
newCharacterBox.OnClicked = (button, o) =>
|
newCharacterBox.OnClicked = (button, o) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -107,10 +107,11 @@ namespace Barotrauma
|
|||||||
CreateUI(upgradeFrame);
|
CreateUI(upgradeFrame);
|
||||||
|
|
||||||
if (Campaign == null) { return; }
|
if (Campaign == null) { return; }
|
||||||
Campaign.UpgradeManager.OnUpgradesChanged += RequestRefresh;
|
Identifier eventId = new Identifier(nameof(UpgradeStore));
|
||||||
Campaign.CargoManager.OnPurchasedItemsChanged += RequestRefresh;
|
Campaign.UpgradeManager.OnUpgradesChanged?.RegisterOverwriteExisting(eventId, _ => RequestRefresh());
|
||||||
Campaign.CargoManager.OnSoldItemsChanged += RequestRefresh;
|
Campaign.CargoManager.OnPurchasedItemsChanged.RegisterOverwriteExisting(eventId, _ => RequestRefresh());
|
||||||
Campaign.OnMoneyChanged.RegisterOverwriteExisting(nameof(UpgradeStore).ToIdentifier(), e => { RequestRefresh(); } );
|
Campaign.CargoManager.OnSoldItemsChanged.RegisterOverwriteExisting(eventId, _ => RequestRefresh());
|
||||||
|
Campaign.OnMoneyChanged.RegisterOverwriteExisting(eventId, _ => RequestRefresh());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RequestRefresh()
|
public void RequestRefresh()
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
ItemsInBuyCrate.Add(entry.Key, entry.Value);
|
ItemsInBuyCrate.Add(entry.Key, entry.Value);
|
||||||
}
|
}
|
||||||
OnItemsInBuyCrateChanged?.Invoke();
|
OnItemsInBuyCrateChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetItemsInSubSellCrate(Dictionary<Identifier, List<PurchasedItem>> items)
|
public void SetItemsInSubSellCrate(Dictionary<Identifier, List<PurchasedItem>> items)
|
||||||
@@ -62,7 +62,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
ItemsInSellFromSubCrate.Add(entry.Key, entry.Value);
|
ItemsInSellFromSubCrate.Add(entry.Key, entry.Value);
|
||||||
}
|
}
|
||||||
OnItemsInSellFromSubCrateChanged?.Invoke();
|
OnItemsInSellFromSubCrateChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSoldItems(Dictionary<Identifier, List<SoldItem>> items)
|
public void SetSoldItems(Dictionary<Identifier, List<SoldItem>> items)
|
||||||
@@ -97,7 +97,7 @@ namespace Barotrauma
|
|||||||
soldEntityMatch.Status = SoldEntity.SellStatus.Confirmed;
|
soldEntityMatch.Status = SoldEntity.SellStatus.Confirmed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OnSoldItemsChanged?.Invoke();
|
OnSoldItemsChanged?.Invoke(this);
|
||||||
|
|
||||||
static bool Match(SoldItem soldItem, SoldEntity soldEntity, bool matchId)
|
static bool Match(SoldItem soldItem, SoldEntity soldEntity, bool matchId)
|
||||||
{
|
{
|
||||||
@@ -122,7 +122,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
GetSellCrateItems(storeIdentifier, create: true).Add(new PurchasedItem(itemPrefab, changeInQuantity));
|
GetSellCrateItems(storeIdentifier, create: true).Add(new PurchasedItem(itemPrefab, changeInQuantity));
|
||||||
}
|
}
|
||||||
OnItemsInSellCrateChanged?.Invoke();
|
OnItemsInSellCrateChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SellItems(Identifier storeIdentifier, List<PurchasedItem> itemsToSell, Store.StoreTab sellingMode)
|
public void SellItems(Identifier storeIdentifier, List<PurchasedItem> itemsToSell, Store.StoreTab sellingMode)
|
||||||
@@ -199,7 +199,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OnSoldItemsChanged?.Invoke();
|
OnSoldItemsChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearSoldItemsProjSpecific()
|
public void ClearSoldItemsProjSpecific()
|
||||||
|
|||||||
@@ -326,6 +326,48 @@ namespace Barotrauma
|
|||||||
ReadyCheckButton?.AddToGUIUpdateList();
|
ReadyCheckButton?.AddToGUIUpdateList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void TryEndRoundWithFuelCheck(Action onConfirm, Action onReturnToMapScreen)
|
||||||
|
{
|
||||||
|
Submarine.MainSub.CheckFuel();
|
||||||
|
SubmarineInfo nextSub = PendingSubmarineSwitch ?? Submarine.MainSub.Info;
|
||||||
|
bool lowFuel = nextSub.Name == Submarine.MainSub.Info.Name ? Submarine.MainSub.Info.LowFuel : nextSub.LowFuel;
|
||||||
|
if (Level.IsLoadedFriendlyOutpost && lowFuel && CargoManager.PurchasedItems.None(i => i.Value.Any(pi => pi.ItemPrefab.Tags.Contains("reactorfuel"))))
|
||||||
|
{
|
||||||
|
var extraConfirmationBox =
|
||||||
|
new GUIMessageBox(TextManager.Get("lowfuelheader"),
|
||||||
|
TextManager.Get("lowfuelwarning"),
|
||||||
|
new LocalizedString[2] { TextManager.Get("ok"), TextManager.Get("cancel") });
|
||||||
|
extraConfirmationBox.Buttons[0].OnClicked = (b, o) => { Confirm(); return true; };
|
||||||
|
extraConfirmationBox.Buttons[0].OnClicked += extraConfirmationBox.Close;
|
||||||
|
extraConfirmationBox.Buttons[1].OnClicked = extraConfirmationBox.Close;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Confirm();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Confirm()
|
||||||
|
{
|
||||||
|
var availableTransition = GetAvailableTransition(out _, out _);
|
||||||
|
if (Character.Controlled != null &&
|
||||||
|
availableTransition == TransitionType.ReturnToPreviousLocation &&
|
||||||
|
Character.Controlled?.Submarine == Level.Loaded?.StartOutpost)
|
||||||
|
{
|
||||||
|
onConfirm();
|
||||||
|
}
|
||||||
|
else if (Character.Controlled != null &&
|
||||||
|
availableTransition == TransitionType.ProgressToNextLocation &&
|
||||||
|
Character.Controlled?.Submarine == Level.Loaded?.EndOutpost)
|
||||||
|
{
|
||||||
|
onConfirm();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
onReturnToMapScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
base.Update(deltaTime);
|
base.Update(deltaTime);
|
||||||
|
|||||||
+12
-21
@@ -137,25 +137,14 @@ namespace Barotrauma
|
|||||||
},
|
},
|
||||||
OnClicked = (btn, userdata) =>
|
OnClicked = (btn, userdata) =>
|
||||||
{
|
{
|
||||||
var availableTransition = GetAvailableTransition(out _, out _);
|
TryEndRoundWithFuelCheck(
|
||||||
if (Character.Controlled != null &&
|
onConfirm: () => GameMain.Client.RequestStartRound(),
|
||||||
availableTransition == TransitionType.ReturnToPreviousLocation &&
|
onReturnToMapScreen: () =>
|
||||||
Character.Controlled?.Submarine == Level.Loaded?.StartOutpost)
|
{
|
||||||
{
|
ShowCampaignUI = true;
|
||||||
GameMain.Client.RequestStartRound();
|
if (CampaignUI == null) { InitCampaignUI(); }
|
||||||
}
|
CampaignUI.SelectTab(InteractionType.Map);
|
||||||
else if (Character.Controlled != null &&
|
});
|
||||||
availableTransition == TransitionType.ProgressToNextLocation &&
|
|
||||||
Character.Controlled?.Submarine == Level.Loaded?.EndOutpost)
|
|
||||||
{
|
|
||||||
GameMain.Client.RequestStartRound();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ShowCampaignUI = true;
|
|
||||||
if (CampaignUI == null) { InitCampaignUI(); }
|
|
||||||
CampaignUI.SelectTab(InteractionType.Map);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -704,13 +693,15 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (ShouldApply(NetFlags.SubList, id, requireUpToDateSave: false))
|
if (ShouldApply(NetFlags.SubList, id, requireUpToDateSave: false))
|
||||||
{
|
{
|
||||||
GameMain.GameSession.OwnedSubmarines.Clear();
|
|
||||||
foreach (int ownedSubIndex in ownedSubIndices)
|
foreach (int ownedSubIndex in ownedSubIndices)
|
||||||
{
|
{
|
||||||
SubmarineInfo sub = GameMain.Client.ServerSubmarines[ownedSubIndex];
|
SubmarineInfo sub = GameMain.Client.ServerSubmarines[ownedSubIndex];
|
||||||
if (GameMain.NetLobbyScreen.CheckIfCampaignSubMatches(sub, NetLobbyScreen.SubmarineDeliveryData.Owned))
|
if (GameMain.NetLobbyScreen.CheckIfCampaignSubMatches(sub, NetLobbyScreen.SubmarineDeliveryData.Owned))
|
||||||
{
|
{
|
||||||
GameMain.GameSession.OwnedSubmarines.Add(sub);
|
if (GameMain.GameSession.OwnedSubmarines.None(s => s.Name == sub.Name))
|
||||||
|
{
|
||||||
|
GameMain.GameSession.OwnedSubmarines.Add(sub);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-18
@@ -184,24 +184,9 @@ namespace Barotrauma
|
|||||||
},
|
},
|
||||||
OnClicked = (btn, userdata) =>
|
OnClicked = (btn, userdata) =>
|
||||||
{
|
{
|
||||||
var availableTransition = GetAvailableTransition(out _, out _);
|
TryEndRoundWithFuelCheck(
|
||||||
if (Character.Controlled != null &&
|
onConfirm: () => TryEndRound(),
|
||||||
availableTransition == TransitionType.ReturnToPreviousLocation &&
|
onReturnToMapScreen: () => { ShowCampaignUI = true; CampaignUI.SelectTab(InteractionType.Map); });
|
||||||
Character.Controlled?.Submarine == Level.Loaded?.StartOutpost)
|
|
||||||
{
|
|
||||||
TryEndRound();
|
|
||||||
}
|
|
||||||
else if (Character.Controlled != null &&
|
|
||||||
availableTransition == TransitionType.ProgressToNextLocation &&
|
|
||||||
Character.Controlled?.Submarine == Level.Loaded?.EndOutpost)
|
|
||||||
{
|
|
||||||
TryEndRound();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ShowCampaignUI = true;
|
|
||||||
CampaignUI.SelectTab(InteractionType.Map);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -89,7 +89,8 @@ namespace Barotrauma.Items.Components
|
|||||||
if (Light?.LightSprite != null && item.Prefab.CanSpriteFlipX && item.body == null)
|
if (Light?.LightSprite != null && item.Prefab.CanSpriteFlipX && item.body == null)
|
||||||
{
|
{
|
||||||
Light.LightSpriteEffect = Light.LightSpriteEffect == SpriteEffects.None ?
|
Light.LightSpriteEffect = Light.LightSpriteEffect == SpriteEffects.None ?
|
||||||
SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||||
|
SetLightSourceTransformProjSpecific();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -938,7 +938,7 @@ namespace Barotrauma.Items.Components
|
|||||||
DrawMarker(spriteBatch,
|
DrawMarker(spriteBatch,
|
||||||
Level.Loaded.StartLocation.Name,
|
Level.Loaded.StartLocation.Name,
|
||||||
(Level.Loaded.StartOutpost != null ? "outpost" : "location").ToIdentifier(),
|
(Level.Loaded.StartOutpost != null ? "outpost" : "location").ToIdentifier(),
|
||||||
Level.Loaded.StartLocation.Name,
|
"startlocation",
|
||||||
Level.Loaded.StartExitPosition, transducerCenter,
|
Level.Loaded.StartExitPosition, transducerCenter,
|
||||||
displayScale, center, DisplayRadius);
|
displayScale, center, DisplayRadius);
|
||||||
}
|
}
|
||||||
@@ -948,7 +948,7 @@ namespace Barotrauma.Items.Components
|
|||||||
DrawMarker(spriteBatch,
|
DrawMarker(spriteBatch,
|
||||||
Level.Loaded.EndLocation.Name,
|
Level.Loaded.EndLocation.Name,
|
||||||
(Level.Loaded.EndOutpost != null ? "outpost" : "location").ToIdentifier(),
|
(Level.Loaded.EndOutpost != null ? "outpost" : "location").ToIdentifier(),
|
||||||
Level.Loaded.EndLocation.Name,
|
"endlocation",
|
||||||
Level.Loaded.EndExitPosition, transducerCenter,
|
Level.Loaded.EndExitPosition, transducerCenter,
|
||||||
displayScale, center, DisplayRadius);
|
displayScale, center, DisplayRadius);
|
||||||
}
|
}
|
||||||
@@ -985,7 +985,8 @@ namespace Barotrauma.Items.Components
|
|||||||
missionIndex++;
|
missionIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AllowUsingMineralScanner && useMineralScanner && CurrentMode == Mode.Active && MineralClusters != null)
|
if (AllowUsingMineralScanner && useMineralScanner && CurrentMode == Mode.Active && MineralClusters != null &&
|
||||||
|
(item.CurrentHull == null || !DetectSubmarineWalls))
|
||||||
{
|
{
|
||||||
foreach (var c in MineralClusters)
|
foreach (var c in MineralClusters)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
using Barotrauma.Networking;
|
using Barotrauma.Networking;
|
||||||
using Barotrauma.Particles;
|
using Barotrauma.Particles;
|
||||||
using FarseerPhysics;
|
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace Barotrauma.Items.Components
|
namespace Barotrauma.Items.Components
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,22 +10,18 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
int roundedValue = (int)Math.Round((1 - damageModifier.DamageMultiplier * damageModifier.ProbabilityMultiplier) * 100);
|
int roundedValue = (int)Math.Round((1 - damageModifier.DamageMultiplier * damageModifier.ProbabilityMultiplier) * 100);
|
||||||
if (roundedValue == 0) { return; }
|
if (roundedValue == 0) { return; }
|
||||||
string colorStr = XMLExtensions.ColorToString(GUIStyle.Green);
|
string colorStr = XMLExtensions.ToStringHex(GUIStyle.Green);
|
||||||
|
|
||||||
LocalizedString afflictionName =
|
LocalizedString afflictionName =
|
||||||
AfflictionPrefab.List.FirstOrDefault(ap => ap.Identifier == afflictionIdentifier)?.Name ??
|
AfflictionPrefab.List.FirstOrDefault(ap => ap.Identifier == afflictionIdentifier)?.Name ??
|
||||||
TextManager.Get($"afflictiontype.{afflictionIdentifier}").Fallback(afflictionIdentifier.Value);
|
TextManager.Get($"afflictiontype.{afflictionIdentifier}").Fallback(afflictionIdentifier.Value);
|
||||||
|
|
||||||
description += $"\n ‖color:{colorStr}‖{roundedValue.ToString("-0;+#")}%‖color:end‖ {afflictionName}";
|
if (!description.IsNullOrWhiteSpace()) { description += '\n'; }
|
||||||
|
description += $" ‖color:{colorStr}‖{roundedValue.ToString("-0;+#")}%‖color:end‖ {afflictionName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddTooltipInfo(ref LocalizedString name, ref LocalizedString description)
|
public override void AddTooltipInfo(ref LocalizedString name, ref LocalizedString description)
|
||||||
{
|
{
|
||||||
if (damageModifiers.Any(d => !MathUtils.NearlyEqual(d.DamageMultiplier, 1f) || !MathUtils.NearlyEqual(d.ProbabilityMultiplier, 1f)) || SkillModifiers.Any())
|
|
||||||
{
|
|
||||||
description += "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (damageModifiers.Any())
|
if (damageModifiers.Any())
|
||||||
{
|
{
|
||||||
foreach (DamageModifier damageModifier in damageModifiers)
|
foreach (DamageModifier damageModifier in damageModifiers)
|
||||||
@@ -49,10 +45,11 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
foreach (var skillModifier in SkillModifiers)
|
foreach (var skillModifier in SkillModifiers)
|
||||||
{
|
{
|
||||||
string colorStr = XMLExtensions.ColorToString(GUIStyle.Green);
|
string colorStr = XMLExtensions.ToStringHex(GUIStyle.Green);
|
||||||
int roundedValue = (int)Math.Round(skillModifier.Value);
|
int roundedValue = (int)Math.Round(skillModifier.Value);
|
||||||
if (roundedValue == 0) { continue; }
|
if (roundedValue == 0) { continue; }
|
||||||
description += $"\n ‖color:{colorStr}‖{roundedValue.ToString("+0;-#")}‖color:end‖ {TextManager.Get($"SkillName.{skillModifier.Key}").Fallback(skillModifier.Key.Value)}";
|
if (!description.IsNullOrWhiteSpace()) { description += '\n'; }
|
||||||
|
description += $" ‖color:{colorStr}‖{roundedValue.ToString("+0;-#")}‖color:end‖ {TextManager.Get($"SkillName.{skillModifier.Key}").Fallback(skillModifier.Key.Value)}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -292,7 +292,9 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
description = TextManager.GetWithVariables("IDCardNameJob", ("[name]", idName, FormatCapitals.No), ("[job]", idJob, FormatCapitals.Yes));
|
description = TextManager.GetWithVariables("IDCardNameJob",
|
||||||
|
("[name]", idName, FormatCapitals.No),
|
||||||
|
("[job]", TextManager.Get("jobname." + idJob).Fallback(idJob), FormatCapitals.Yes));
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(item.Description))
|
if (!string.IsNullOrEmpty(item.Description))
|
||||||
{
|
{
|
||||||
@@ -1582,7 +1584,7 @@ namespace Barotrauma
|
|||||||
DrawItemStateIndicator(spriteBatch, inventory, indicatorSprite, emptyIndicatorSprite, conditionIndicatorArea, item.Condition / item.MaxCondition);
|
DrawItemStateIndicator(spriteBatch, inventory, indicatorSprite, emptyIndicatorSprite, conditionIndicatorArea, item.Condition / item.MaxCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemContainer != null && itemContainer.ShowContainedStateIndicator)
|
if (itemContainer != null && itemContainer.ShowContainedStateIndicator && itemContainer.Capacity > 0)
|
||||||
{
|
{
|
||||||
float containedState = 0.0f;
|
float containedState = 0.0f;
|
||||||
if (itemContainer.ShowConditionInContainedStateIndicator)
|
if (itemContainer.ShowConditionInContainedStateIndicator)
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ namespace Barotrauma.MapCreatures.Behavior
|
|||||||
{
|
{
|
||||||
foreach (BallastFloraBranch branch in Branches)
|
foreach (BallastFloraBranch branch in Branches)
|
||||||
{
|
{
|
||||||
|
if (branch.IsRoot && isDead) { continue; }
|
||||||
|
|
||||||
if (branch.AccumulatedDamage > 0)
|
if (branch.AccumulatedDamage > 0)
|
||||||
{
|
{
|
||||||
CreateDamageParticle(branch, branch.AccumulatedDamage);
|
CreateDamageParticle(branch, branch.AccumulatedDamage);
|
||||||
@@ -101,8 +103,7 @@ namespace Barotrauma.MapCreatures.Behavior
|
|||||||
GUI.AddMessage($"{(int)branch.AccumulatedDamage}", GUIStyle.Red, pos, Vector2.UnitY * 10.0f, 3f, playSound: false, subId: Parent?.Submarine?.ID ?? -1);
|
GUI.AddMessage($"{(int)branch.AccumulatedDamage}", GUIStyle.Red, pos, Vector2.UnitY * 10.0f, 3f, playSound: false, subId: Parent?.Submarine?.ID ?? -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Character.Controlled != null && Character.Controlled.CurrentHull == branch.CurrentHull &&
|
if (Character.Controlled != null && Character.Controlled.CurrentHull == branch.CurrentHull && branch.IsRoot &&
|
||||||
branch.IsRoot &&
|
|
||||||
(branch.AccumulatedDamage > 0.0f || branch.AccumulatedDamage < -0.1f))
|
(branch.AccumulatedDamage > 0.0f || branch.AccumulatedDamage < -0.1f))
|
||||||
{
|
{
|
||||||
Character.Controlled.UpdateHUDProgressBar(this,
|
Character.Controlled.UpdateHUDProgressBar(this,
|
||||||
|
|||||||
@@ -149,51 +149,18 @@ namespace Barotrauma
|
|||||||
pos.X += Math.Sign(flowForce.X);
|
pos.X += Math.Sign(flowForce.X);
|
||||||
pos.Y = MathHelper.Clamp(Rand.Range(higherSurface, lowerSurface), rect.Y - rect.Height, rect.Y);
|
pos.Y = MathHelper.Clamp(Rand.Range(higherSurface, lowerSurface), rect.Y - rect.Height, rect.Y);
|
||||||
}
|
}
|
||||||
else
|
if (flowTargetHull != null)
|
||||||
{
|
{
|
||||||
pos.Y += Math.Sign(flowForce.Y) * rect.Height / 2.0f;
|
pos.X = MathHelper.Clamp(pos.X, flowTargetHull.Rect.X + 1, flowTargetHull.Rect.Right - 1);
|
||||||
|
pos.Y = MathHelper.Clamp(pos.Y, flowTargetHull.Rect.Y - flowTargetHull.Rect.Height + 1, flowTargetHull.Rect.Y - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//spawn less particles when there's already a large number of them
|
//spawn less particles when there's already a large number of them
|
||||||
float particleAmountMultiplier = 1.0f - GameMain.ParticleManager.ParticleCount / (float)GameMain.ParticleManager.MaxParticles;
|
float particleAmountMultiplier = 1.0f - GameMain.ParticleManager.ParticleCount / (float)GameMain.ParticleManager.MaxParticles;
|
||||||
particleAmountMultiplier *= particleAmountMultiplier;
|
particleAmountMultiplier *= particleAmountMultiplier;
|
||||||
|
|
||||||
//light dripping
|
|
||||||
if (open < 0.2f && LerpedFlowForce.LengthSquared() > 100.0f)
|
|
||||||
{
|
|
||||||
particleTimer += deltaTime;
|
|
||||||
float particlesPerSec = open * 100.0f * particleAmountMultiplier;
|
|
||||||
float emitInterval = 1.0f / particlesPerSec;
|
|
||||||
while (particleTimer > emitInterval)
|
|
||||||
{
|
|
||||||
Vector2 velocity = flowForce;
|
|
||||||
if (!IsHorizontal)
|
|
||||||
{
|
|
||||||
velocity.X = Rand.Range(-500.0f, 500.0f) * open;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
velocity.X *= Rand.Range(1.0f, 3.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flowTargetHull.WaterVolume < flowTargetHull.Volume)
|
|
||||||
{
|
|
||||||
GameMain.ParticleManager.CreateParticle(
|
|
||||||
Rand.Range(0.0f, open) < 0.05f ? "waterdrop" : "watersplash",
|
|
||||||
(Submarine == null ? pos : pos + Submarine.Position),
|
|
||||||
velocity, 0, flowTargetHull);
|
|
||||||
}
|
|
||||||
|
|
||||||
GameMain.ParticleManager.CreateParticle(
|
|
||||||
"bubbles",
|
|
||||||
(Submarine == null ? pos : pos + Submarine.Position),
|
|
||||||
velocity, 0, flowTargetHull);
|
|
||||||
|
|
||||||
particleTimer -= emitInterval;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//heavy flow -> strong waterfall type of particles
|
//heavy flow -> strong waterfall type of particles
|
||||||
else if (LerpedFlowForce.LengthSquared() > 20000.0f)
|
if (LerpedFlowForce.LengthSquared() > 20000.0f)
|
||||||
{
|
{
|
||||||
particleTimer += deltaTime;
|
particleTimer += deltaTime;
|
||||||
if (IsHorizontal)
|
if (IsHorizontal)
|
||||||
@@ -218,6 +185,10 @@ namespace Barotrauma
|
|||||||
if (particle.CurrentHull == null) { GameMain.ParticleManager.RemoveParticle(particle); }
|
if (particle.CurrentHull == null) { GameMain.ParticleManager.RemoveParticle(particle); }
|
||||||
particle.Size *= Math.Min(Math.Abs(flowForce.X / 500.0f), 5.0f);
|
particle.Size *= Math.Min(Math.Abs(flowForce.X / 500.0f), 5.0f);
|
||||||
}
|
}
|
||||||
|
if (GapSize() <= Structure.WallSectionSize || !IsRoomToRoom)
|
||||||
|
{
|
||||||
|
CreateWaterSpatter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math.Abs(flowForce.X) > 300.0f && flowTargetHull.WaterVolume > flowTargetHull.Volume * 0.1f)
|
if (Math.Abs(flowForce.X) > 300.0f && flowTargetHull.WaterVolume > flowTargetHull.Volume * 0.1f)
|
||||||
@@ -245,7 +216,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (Math.Sign(flowTargetHull.Rect.Y - rect.Y) != Math.Sign(lerpedFlowForce.Y)) { return; }
|
if (Math.Sign(flowTargetHull.Rect.Y - rect.Y) != Math.Sign(lerpedFlowForce.Y)) { return; }
|
||||||
|
|
||||||
float particlesPerSec = Math.Max(open * rect.Width * 0.3f * particleAmountMultiplier, 20.0f);
|
float particlesPerSec = Math.Max(open * rect.Width * particleAmountMultiplier, 10.0f);
|
||||||
float emitInterval = 1.0f / particlesPerSec;
|
float emitInterval = 1.0f / particlesPerSec;
|
||||||
while (particleTimer > emitInterval)
|
while (particleTimer > emitInterval)
|
||||||
{
|
{
|
||||||
@@ -263,7 +234,11 @@ namespace Barotrauma
|
|||||||
if (splash != null)
|
if (splash != null)
|
||||||
{
|
{
|
||||||
if (splash.CurrentHull == null) { GameMain.ParticleManager.RemoveParticle(splash); }
|
if (splash.CurrentHull == null) { GameMain.ParticleManager.RemoveParticle(splash); }
|
||||||
splash.Size *= MathHelper.Clamp(rect.Width / 50.0f, 1.5f, 4.0f);
|
splash.Size *= MathHelper.Clamp(rect.Width / 50.0f, 1.5f, 4.0f);
|
||||||
|
}
|
||||||
|
if (GapSize() <= Structure.WallSectionSize || !IsRoomToRoom)
|
||||||
|
{
|
||||||
|
CreateWaterSpatter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Math.Abs(flowForce.Y) > 190.0f && Rand.Range(0.0f, 1.0f) < 0.3f && flowTargetHull.WaterVolume > flowTargetHull.Volume * 0.1f)
|
if (Math.Abs(flowForce.Y) > 190.0f && Rand.Range(0.0f, 1.0f) < 0.3f && flowTargetHull.WaterVolume > flowTargetHull.Volume * 0.1f)
|
||||||
@@ -277,10 +252,77 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//light dripping
|
||||||
|
else if (LerpedFlowForce.LengthSquared() > 100.0f &&
|
||||||
|
/*no dripping from large gaps between rooms (looks bad)*/
|
||||||
|
((GapSize() <= Structure.WallSectionSize) || !IsRoomToRoom))
|
||||||
|
{
|
||||||
|
particleTimer += deltaTime;
|
||||||
|
float particlesPerSec = open * 10.0f * particleAmountMultiplier;
|
||||||
|
float emitInterval = 1.0f / particlesPerSec;
|
||||||
|
while (particleTimer > emitInterval)
|
||||||
|
{
|
||||||
|
Vector2 velocity = flowForce;
|
||||||
|
if (!IsHorizontal)
|
||||||
|
{
|
||||||
|
velocity.X = Rand.Range(-100.0f, 100.0f) * open;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
velocity.X *= Rand.Range(1.0f, 3.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flowTargetHull.WaterVolume < flowTargetHull.Volume)
|
||||||
|
{
|
||||||
|
GameMain.ParticleManager.CreateParticle(
|
||||||
|
Rand.Range(0.0f, open) < 0.05f ? "waterdrop" : "watersplash",
|
||||||
|
Submarine == null ? pos : pos + Submarine.Position,
|
||||||
|
velocity, 0, flowTargetHull);
|
||||||
|
CreateWaterSpatter();
|
||||||
|
}
|
||||||
|
|
||||||
|
GameMain.ParticleManager.CreateParticle(
|
||||||
|
"bubbles",
|
||||||
|
(Submarine == null ? pos : pos + Submarine.Position),
|
||||||
|
velocity, 0, flowTargetHull);
|
||||||
|
|
||||||
|
particleTimer -= emitInterval;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
particleTimer = 0.0f;
|
particleTimer = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreateWaterSpatter()
|
||||||
|
{
|
||||||
|
Vector2 spatterPos = pos;
|
||||||
|
float rotation;
|
||||||
|
if (IsHorizontal)
|
||||||
|
{
|
||||||
|
rotation = LerpedFlowForce.X > 0 ? 0 : MathHelper.Pi;
|
||||||
|
spatterPos.Y = rect.Y - rect.Height / 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rotation = LerpedFlowForce.Y > 0 ? -MathHelper.PiOver2 : MathHelper.PiOver2;
|
||||||
|
spatterPos.X = rect.Center.X;
|
||||||
|
}
|
||||||
|
var spatter = GameMain.ParticleManager.CreateParticle(
|
||||||
|
"waterspatter",
|
||||||
|
Submarine == null ? spatterPos : spatterPos + Submarine.Position,
|
||||||
|
Vector2.Zero, rotation, flowTargetHull);
|
||||||
|
if (spatter != null)
|
||||||
|
{
|
||||||
|
if (spatter.CurrentHull == null) { GameMain.ParticleManager.RemoveParticle(spatter); }
|
||||||
|
spatter.Size *= MathHelper.Clamp(LerpedFlowForce.Length() / 200.0f, 0.5f, 1.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float GapSize()
|
||||||
|
{
|
||||||
|
return IsHorizontal ? rect.Height : rect.Width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
|
|
||||||
//remove some lights with a light volume if there's too many of them
|
//remove some lights with a light volume if there's too many of them
|
||||||
if (activeLightsWithLightVolume.Count > GameSettings.CurrentConfig.Graphics.VisibleLightLimit)
|
if (activeLightsWithLightVolume.Count > GameSettings.CurrentConfig.Graphics.VisibleLightLimit && Screen.Selected is { IsEditor: false })
|
||||||
{
|
{
|
||||||
for (int i = GameSettings.CurrentConfig.Graphics.VisibleLightLimit; i < activeLightsWithLightVolume.Count; i++)
|
for (int i = GameSettings.CurrentConfig.Graphics.VisibleLightLimit; i < activeLightsWithLightVolume.Count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Barotrauma.Lights
|
|||||||
[Serialize(0f, IsPropertySaveable.Yes), Editable(MinValueFloat = -360, MaxValueFloat = 360, ValueStep = 1, DecimalCount = 0)]
|
[Serialize(0f, IsPropertySaveable.Yes), Editable(MinValueFloat = -360, MaxValueFloat = 360, ValueStep = 1, DecimalCount = 0)]
|
||||||
public float Rotation { get; set; }
|
public float Rotation { get; set; }
|
||||||
|
|
||||||
public Vector2 GetOffset() => Vector2.Transform(Offset, Matrix.CreateRotationZ(Rotation));
|
public Vector2 GetOffset() => Vector2.Transform(Offset, Matrix.CreateRotationZ(MathHelper.ToRadians(Rotation)));
|
||||||
|
|
||||||
private float flicker;
|
private float flicker;
|
||||||
[Editable, Serialize(0.0f, IsPropertySaveable.No, description: "How heavily the light flickers. 0 = no flickering, 1 = the light will alternate between completely dark and full brightness.")]
|
[Editable, Serialize(0.0f, IsPropertySaveable.No, description: "How heavily the light flickers. 0 = no flickering, 1 = the light will alternate between completely dark and full brightness.")]
|
||||||
|
|||||||
@@ -110,7 +110,9 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
noiseOverlay ??= new Sprite("Content/UI/noise.png", Vector2.Zero);
|
noiseOverlay ??= new Sprite("Content/UI/noise.png", Vector2.Zero);
|
||||||
|
|
||||||
OnLocationChanged = LocationChanged;
|
OnLocationChanged.RegisterOverwriteExisting(
|
||||||
|
"Map.InitProjSpecific".ToIdentifier(),
|
||||||
|
(locationChangeInfo) => LocationChanged(locationChangeInfo.PrevLocation, locationChangeInfo.NewLocation));
|
||||||
|
|
||||||
borders = new Rectangle(
|
borders = new Rectangle(
|
||||||
(int)Locations.Min(l => l.MapPosition.X),
|
(int)Locations.Min(l => l.MapPosition.X),
|
||||||
@@ -447,7 +449,7 @@ namespace Barotrauma
|
|||||||
Level.Loaded.DebugSetEndLocation(null);
|
Level.Loaded.DebugSetEndLocation(null);
|
||||||
|
|
||||||
CurrentLocation.Discover();
|
CurrentLocation.Discover();
|
||||||
OnLocationChanged?.Invoke(prevLocation, CurrentLocation);
|
OnLocationChanged?.Invoke(new LocationChangeInfo(prevLocation, CurrentLocation));
|
||||||
SelectLocation(-1);
|
SelectLocation(-1);
|
||||||
if (GameMain.Client == null)
|
if (GameMain.Client == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -88,6 +88,11 @@ namespace Barotrauma
|
|||||||
prevCullTime = 0;
|
prevCullTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ForceRemoveFromVisibleEntities(MapEntity entity)
|
||||||
|
{
|
||||||
|
visibleEntities?.Remove(entity);
|
||||||
|
}
|
||||||
|
|
||||||
public static void Draw(SpriteBatch spriteBatch, bool editing = false)
|
public static void Draw(SpriteBatch spriteBatch, bool editing = false)
|
||||||
{
|
{
|
||||||
var entitiesToRender = !editing && visibleEntities != null ? visibleEntities : MapEntity.mapEntityList;
|
var entitiesToRender = !editing && visibleEntities != null ? visibleEntities : MapEntity.mapEntityList;
|
||||||
|
|||||||
@@ -1847,8 +1847,11 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
GameMain.GameScreen.Select();
|
GameMain.GameScreen.Select();
|
||||||
|
|
||||||
// TODO: Re-enable the server message once it's been edited and translated
|
string message = "ServerMessage.HowToCommunicate" +
|
||||||
//AddChatMessage($"ServerMessage.HowToCommunicate~[chatbutton]={GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.Chat)}~[radiobutton]={GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.RadioChat)}", ChatMessageType.Server);
|
$"~[chatbutton]={GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.ActiveChat)}" +
|
||||||
|
$"~[pttbutton]={GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.Voice)}" +
|
||||||
|
$"~[switchbutton]={GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.ToggleChatMode)}";
|
||||||
|
AddChatMessage(message, ChatMessageType.Server);
|
||||||
|
|
||||||
yield return CoroutineStatus.Success;
|
yield return CoroutineStatus.Success;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ namespace Barotrauma
|
|||||||
case VoteType.SwitchSub:
|
case VoteType.SwitchSub:
|
||||||
string subName1 = inc.ReadString();
|
string subName1 = inc.ReadString();
|
||||||
bool transferItems = inc.ReadBoolean();
|
bool transferItems = inc.ReadBoolean();
|
||||||
SubmarineInfo info = GameMain.Client.ServerSubmarines.FirstOrDefault(s => s.Name == subName1);
|
SubmarineInfo info = GameMain.GameSession.OwnedSubmarines.FirstOrDefault(s => s.Name == subName1) ?? GameMain.Client.ServerSubmarines.FirstOrDefault(s => s.Name == subName1);
|
||||||
if (info == null)
|
if (info == null)
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Failed to find a matching submarine, vote aborted");
|
DebugConsole.ThrowError("Failed to find a matching submarine, vote aborted");
|
||||||
@@ -303,7 +303,7 @@ namespace Barotrauma
|
|||||||
case VoteType.PurchaseAndSwitchSub:
|
case VoteType.PurchaseAndSwitchSub:
|
||||||
case VoteType.SwitchSub:
|
case VoteType.SwitchSub:
|
||||||
string subName2 = inc.ReadString();
|
string subName2 = inc.ReadString();
|
||||||
var submarineInfo = GameMain.Client.ServerSubmarines.FirstOrDefault(s => s.Name == subName2);
|
var submarineInfo = GameMain.GameSession.OwnedSubmarines.FirstOrDefault(s => s.Name == subName2) ?? GameMain.Client.ServerSubmarines.FirstOrDefault(s => s.Name == subName2);
|
||||||
bool transferItems = inc.ReadBoolean();
|
bool transferItems = inc.ReadBoolean();
|
||||||
int deliveryFee = inc.ReadInt16();
|
int deliveryFee = inc.ReadInt16();
|
||||||
if (submarineInfo == null)
|
if (submarineInfo == null)
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
GUILayoutGroup inputContainer = CreateSettingBase(parent, description, tooltip, horizontalSize: 0.55f, verticalSize: verticalSize);
|
GUILayoutGroup inputContainer = CreateSettingBase(parent, description, tooltip, horizontalSize: 0.55f, verticalSize: verticalSize);
|
||||||
|
|
||||||
GUIButton minusButton = new GUIButton(new RectTransform(Vector2.One, inputContainer.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIMinusButton", textAlignment: Alignment.Center) { UserData = -1 };
|
GUIButton minusButton = new GUIButton(new RectTransform(Vector2.One, inputContainer.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIButtonToggleLeft", textAlignment: Alignment.Center) { UserData = -1 };
|
||||||
GUIFrame inputFrame = new GUIFrame(new RectTransform(Vector2.One, inputContainer.RectTransform), style: null);
|
GUIFrame inputFrame = new GUIFrame(new RectTransform(Vector2.One, inputContainer.RectTransform), style: null);
|
||||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(Vector2.One, inputFrame.RectTransform, Anchor.Center), NumberType.Int, textAlignment: Alignment.Center, style: "GUITextBox", hidePlusMinusButtons: true)
|
GUINumberInput numberInput = new GUINumberInput(new RectTransform(Vector2.One, inputFrame.RectTransform, Anchor.Center), NumberType.Int, textAlignment: Alignment.Center, style: "GUITextBox", hidePlusMinusButtons: true)
|
||||||
{
|
{
|
||||||
@@ -290,7 +290,7 @@ namespace Barotrauma
|
|||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
|
|
||||||
GUIButton plusButton = new GUIButton(new RectTransform(Vector2.One, inputContainer.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIPlusButton", textAlignment: Alignment.Center) { UserData = 1 };
|
GUIButton plusButton = new GUIButton(new RectTransform(Vector2.One, inputContainer.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIButtonToggleRight", textAlignment: Alignment.Center) { UserData = 1 };
|
||||||
|
|
||||||
minusButton.OnClicked = plusButton.OnClicked = ChangeValue;
|
minusButton.OnClicked = plusButton.OnClicked = ChangeValue;
|
||||||
|
|
||||||
|
|||||||
-7
@@ -235,13 +235,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var disclaimerBtn = new GUIButton(new RectTransform(new Vector2(1.0f, 0.8f), rightColumn.RectTransform, Anchor.TopRight) { AbsoluteOffset = new Point(5) }, style: "GUINotificationButton")
|
|
||||||
{
|
|
||||||
IgnoreLayoutGroups = true,
|
|
||||||
OnClicked = (btn, userdata) => { GameMain.Instance.ShowCampaignDisclaimer(); return true; }
|
|
||||||
};
|
|
||||||
disclaimerBtn.RectTransform.MaxSize = new Point((int)(30 * GUI.Scale));
|
|
||||||
|
|
||||||
columnContainer.Recalculate();
|
columnContainer.Recalculate();
|
||||||
leftColumn.Recalculate();
|
leftColumn.Recalculate();
|
||||||
rightColumn.Recalculate();
|
rightColumn.Recalculate();
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
CreateUI(container);
|
CreateUI(container);
|
||||||
|
|
||||||
campaign.Map.OnLocationSelected += SelectLocation;
|
campaign.Map.OnLocationSelected = SelectLocation;
|
||||||
campaign.Map.OnMissionsSelected += (connection, missions) =>
|
campaign.Map.OnMissionsSelected = (connection, missions) =>
|
||||||
{
|
{
|
||||||
if (missionList?.Content != null)
|
if (missionList?.Content != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -608,12 +608,6 @@ namespace Barotrauma
|
|||||||
ShowTutorialSkipWarning(Tab.NewGame);
|
ShowTutorialSkipWarning(Tab.NewGame);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!GameSettings.CurrentConfig.CampaignDisclaimerShown)
|
|
||||||
{
|
|
||||||
selectedTab = Tab.Empty;
|
|
||||||
GameMain.Instance.ShowCampaignDisclaimer(() => { SelectTab(null, Tab.NewGame); });
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
campaignSetupUI.RandomizeCrew();
|
campaignSetupUI.RandomizeCrew();
|
||||||
campaignSetupUI.SetPage(0);
|
campaignSetupUI.SetPage(0);
|
||||||
campaignSetupUI.CreateDefaultSaveName();
|
campaignSetupUI.CreateDefaultSaveName();
|
||||||
@@ -633,12 +627,6 @@ namespace Barotrauma
|
|||||||
ShowTutorialSkipWarning(Tab.JoinServer);
|
ShowTutorialSkipWarning(Tab.JoinServer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!GameSettings.CurrentConfig.CampaignDisclaimerShown)
|
|
||||||
{
|
|
||||||
selectedTab = Tab.Empty;
|
|
||||||
GameMain.Instance.ShowCampaignDisclaimer(() => { SelectTab(null, Tab.JoinServer); });
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
GameMain.ServerListScreen.Select();
|
GameMain.ServerListScreen.Select();
|
||||||
break;
|
break;
|
||||||
case Tab.HostServer:
|
case Tab.HostServer:
|
||||||
@@ -648,13 +636,6 @@ namespace Barotrauma
|
|||||||
ShowTutorialSkipWarning(tab);
|
ShowTutorialSkipWarning(tab);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!GameSettings.CurrentConfig.CampaignDisclaimerShown)
|
|
||||||
{
|
|
||||||
selectedTab = Tab.Empty;
|
|
||||||
GameMain.Instance.ShowCampaignDisclaimer(() => { SelectTab(null, Tab.HostServer); });
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
serverExecutableDropdown.ListBox.Content.Children.ToArray()
|
serverExecutableDropdown.ListBox.Content.Children.ToArray()
|
||||||
.Where(c => c.UserData is ServerExecutableFile f && !ContentPackageManager.EnabledPackages.All.Contains(f.ContentPackage))
|
.Where(c => c.UserData is ServerExecutableFile f && !ContentPackageManager.EnabledPackages.All.Contains(f.ContentPackage))
|
||||||
.ForEach(serverExecutableDropdown.ListBox.RemoveChild);
|
.ForEach(serverExecutableDropdown.ListBox.RemoveChild);
|
||||||
@@ -685,12 +666,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Tab.Tutorials:
|
case Tab.Tutorials:
|
||||||
if (!GameSettings.CurrentConfig.CampaignDisclaimerShown)
|
|
||||||
{
|
|
||||||
selectedTab = Tab.Empty;
|
|
||||||
GameMain.Instance.ShowCampaignDisclaimer(() => { SelectTab(null, Tab.Tutorials); });
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
UpdateTutorialList();
|
UpdateTutorialList();
|
||||||
break;
|
break;
|
||||||
case Tab.CharacterEditor:
|
case Tab.CharacterEditor:
|
||||||
|
|||||||
@@ -921,7 +921,7 @@ namespace Barotrauma
|
|||||||
toggleEntityMenuButton = new GUIButton(new RectTransform(new Vector2(0.15f, 0.08f), EntityMenu.RectTransform, Anchor.TopCenter, Pivot.BottomCenter) { MinSize = new Point(0, 15) },
|
toggleEntityMenuButton = new GUIButton(new RectTransform(new Vector2(0.15f, 0.08f), EntityMenu.RectTransform, Anchor.TopCenter, Pivot.BottomCenter) { MinSize = new Point(0, 15) },
|
||||||
style: "UIToggleButtonVertical")
|
style: "UIToggleButtonVertical")
|
||||||
{
|
{
|
||||||
ToolTip = RichString.Rich(TextManager.Get("EntityMenuToggleTooltip") + "‖color:125,125,125‖\nQ‖color:end‖"),
|
ToolTip = RichString.Rich($"{TextManager.Get("EntityMenuToggleTooltip")}\n‖color:125,125,125‖{GameSettings.CurrentConfig.KeyMap.Bindings[InputType.ToggleInventory].Name}‖color:end‖"),
|
||||||
OnClicked = (btn, userdata) =>
|
OnClicked = (btn, userdata) =>
|
||||||
{
|
{
|
||||||
entityMenuOpen = !entityMenuOpen;
|
entityMenuOpen = !entityMenuOpen;
|
||||||
@@ -1822,7 +1822,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (Submarine.GetLightCount() > MaxLights)
|
if (Submarine.GetLightCount() > MaxLights)
|
||||||
{
|
{
|
||||||
new GUIMessageBox(TextManager.Get("error"), TextManager.GetWithVariable("subeditor.lightcounterror", "[max]", MaxShadowCastingLights.ToString()));
|
new GUIMessageBox(TextManager.Get("error"), TextManager.GetWithVariable("subeditor.lightcounterror", "[max]", MaxLights.ToString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2530,6 +2530,27 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var outFittingArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.25f), subSettingsContainer.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft)
|
||||||
|
{
|
||||||
|
Stretch = true,
|
||||||
|
AbsoluteSpacing = 5
|
||||||
|
};
|
||||||
|
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), outFittingArea.RectTransform),
|
||||||
|
TextManager.Get("ManuallyOutfitted"), textAlignment: Alignment.CenterLeft, wrap: true, font: GUIStyle.SmallFont)
|
||||||
|
{
|
||||||
|
ToolTip = TextManager.Get("manuallyoutfittedtooltip")
|
||||||
|
};
|
||||||
|
new GUITickBox(new RectTransform((0.4f, 1.0f), outFittingArea.RectTransform), "")
|
||||||
|
{
|
||||||
|
ToolTip = TextManager.Get("manuallyoutfittedtooltip"),
|
||||||
|
Selected = MainSub.Info.IsManuallyOutfitted,
|
||||||
|
OnSelected = box =>
|
||||||
|
{
|
||||||
|
MainSub.Info.IsManuallyOutfitted = box.Selected;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (MainSub != null)
|
if (MainSub != null)
|
||||||
{
|
{
|
||||||
int min = MainSub.Info.RecommendedCrewSizeMin;
|
int min = MainSub.Info.RecommendedCrewSizeMin;
|
||||||
@@ -2832,7 +2853,7 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
|
|
||||||
var saveButton = new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), buttonArea.RectTransform, Anchor.BottomRight),
|
var saveButton = new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), buttonArea.RectTransform, Anchor.BottomRight),
|
||||||
TextManager.Get("SaveSubButton"))
|
TextManager.Get("SaveSubButton").Fallback(TextManager.Get("save")))
|
||||||
{
|
{
|
||||||
OnClicked = (button, o) => SaveSub(packageToSaveInList.SelectedData as ContentPackage)
|
OnClicked = (button, o) => SaveSub(packageToSaveInList.SelectedData as ContentPackage)
|
||||||
};
|
};
|
||||||
@@ -3510,8 +3531,11 @@ namespace Barotrauma
|
|||||||
modProject.RemoveFile(modProject.Files.First(f => ContentPath.FromRaw(subPackage, f.Path) == sub.FilePath));
|
modProject.RemoveFile(modProject.Files.First(f => ContentPath.FromRaw(subPackage, f.Path) == sub.FilePath));
|
||||||
modProject.Save(subPackage.Path);
|
modProject.Save(subPackage.Path);
|
||||||
ReloadModifiedPackage(subPackage);
|
ReloadModifiedPackage(subPackage);
|
||||||
}
|
if (MainSub?.Info != null && MainSub.Info.FilePath == sub.FilePath)
|
||||||
|
{
|
||||||
|
MainSub.Info.FilePath = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
sub.Dispose();
|
sub.Dispose();
|
||||||
CreateLoadScreen();
|
CreateLoadScreen();
|
||||||
}
|
}
|
||||||
@@ -5044,8 +5068,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
hullVolumeFrame.Visible = MapEntity.SelectedList.Any(s => s is Hull);
|
hullVolumeFrame.Visible = MapEntity.SelectedList.Any(s => s is Hull);
|
||||||
hullVolumeFrame.RectTransform.AbsoluteOffset = new Point(Math.Max(showEntitiesPanel.Rect.Right, previouslyUsedPanel.Rect.Right), 0);
|
hullVolumeFrame.RectTransform.AbsoluteOffset = new Point(Math.Max(showEntitiesPanel.Rect.Right, previouslyUsedPanel.Rect.Right), 0);
|
||||||
saveAssemblyFrame.Visible = MapEntity.SelectedList.Count > 0;
|
saveAssemblyFrame.Visible = MapEntity.SelectedList.Count > 0 && !WiringMode;
|
||||||
snapToGridFrame.Visible = MapEntity.SelectedList.Count > 0;
|
snapToGridFrame.Visible = MapEntity.SelectedList.Count > 0 && !WiringMode;
|
||||||
|
|
||||||
var offset = cam.WorldView.Top - cam.ScreenToWorld(new Vector2(0, GameMain.GraphicsHeight - EntityMenu.Rect.Top)).Y;
|
var offset = cam.WorldView.Top - cam.ScreenToWorld(new Vector2(0, GameMain.GraphicsHeight - EntityMenu.Rect.Top)).Y;
|
||||||
|
|
||||||
@@ -5171,7 +5195,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlayerInput.KeyHit(Keys.Q) && mode == Mode.Default)
|
if (GameSettings.CurrentConfig.KeyMap.Bindings[InputType.ToggleInventory].IsHit() && mode == Mode.Default)
|
||||||
{
|
{
|
||||||
toggleEntityMenuButton.OnClicked?.Invoke(toggleEntityMenuButton, toggleEntityMenuButton.UserData);
|
toggleEntityMenuButton.OnClicked?.Invoke(toggleEntityMenuButton, toggleEntityMenuButton.UserData);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Barotrauma.Items.Components;
|
using Barotrauma.Items.Components;
|
||||||
using Barotrauma.Extensions;
|
using Barotrauma.Extensions;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -629,16 +630,18 @@ namespace Barotrauma
|
|||||||
|
|
||||||
bool isFlagsAttribute = value.GetType().IsDefined(typeof(FlagsAttribute), false);
|
bool isFlagsAttribute = value.GetType().IsDefined(typeof(FlagsAttribute), false);
|
||||||
|
|
||||||
|
bool hasNoneOption = false;
|
||||||
foreach (object enumValue in Enum.GetValues(value.GetType()))
|
foreach (object enumValue in Enum.GetValues(value.GetType()))
|
||||||
{
|
{
|
||||||
if (isFlagsAttribute && !MathHelper.IsPowerOfTwo((int)enumValue)) { continue; }
|
if (isFlagsAttribute && !MathHelper.IsPowerOfTwo((int)enumValue)) { continue; }
|
||||||
|
hasNoneOption |= (int)enumValue == 0;
|
||||||
enumDropDown.AddItem(enumValue.ToString(), enumValue);
|
enumDropDown.AddItem(enumValue.ToString(), enumValue);
|
||||||
if (((int)enumValue != 0 || (int)value == 0) && ((Enum)value).HasFlag((Enum)enumValue))
|
if (((int)enumValue != 0 || (int)value == 0) && ((Enum)value).HasFlag((Enum)enumValue))
|
||||||
{
|
{
|
||||||
enumDropDown.SelectItem(enumValue);
|
enumDropDown.SelectItem(enumValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
enumDropDown.MustSelectAtLeastOne = !hasNoneOption;
|
||||||
enumDropDown.OnSelected += (selected, val) =>
|
enumDropDown.OnSelected += (selected, val) =>
|
||||||
{
|
{
|
||||||
if (SetPropertyValue(property, entity, string.Join(", ", enumDropDown.SelectedDataMultiple.Select(d => d.ToString()))))
|
if (SetPropertyValue(property, entity, string.Join(", ", enumDropDown.SelectedDataMultiple.Select(d => d.ToString()))))
|
||||||
@@ -1435,14 +1438,31 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ItemComponent _ when entity is Item item:
|
case ItemComponent parentComponent when entity is Item otherItem:
|
||||||
foreach (var component in item.Components)
|
if (otherItem == parentComponent.Item) { continue; }
|
||||||
|
int componentIndex = parentComponent.Item.Components.FindAll(c => c.GetType() == parentComponent.GetType()).IndexOf(parentComponent);
|
||||||
|
//find the component of the same type and same index from the other item
|
||||||
|
var otherComponents = otherItem.Components.FindAll(c => c.GetType() == parentComponent.GetType());
|
||||||
|
if (componentIndex >= 0 && componentIndex < otherComponents.Count)
|
||||||
{
|
{
|
||||||
if (component.GetType() == parentObject.GetType() && component != parentObject)
|
var component = otherComponents[componentIndex];
|
||||||
|
Debug.Assert(component.GetType() == parentObject.GetType());
|
||||||
|
SafeAdd(component, property);
|
||||||
|
if (value is string stringValue && Enum.TryParse(property.PropertyType, stringValue, out var enumValue))
|
||||||
{
|
{
|
||||||
SafeAdd(component, property);
|
property.PropertyInfo.SetValue(component, enumValue);
|
||||||
property.PropertyInfo.SetValue(component, value);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
property.PropertyInfo.SetValue(component, value);
|
||||||
|
}
|
||||||
|
catch (ArgumentException e)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError($"Failed to set the value of the property \"{property.Name}\" to {value?.ToString() ?? "null"}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ namespace Barotrauma
|
|||||||
Instance = new SettingsMenu(mainParent);
|
Instance = new SettingsMenu(mainParent);
|
||||||
return Instance;
|
return Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SettingsMenu(RectTransform mainParent)
|
private SettingsMenu(RectTransform mainParent, GameSettings.Config setConfig = default)
|
||||||
{
|
{
|
||||||
unsavedConfig = GameSettings.CurrentConfig;
|
unsavedConfig = GameSettings.CurrentConfig;
|
||||||
|
|
||||||
@@ -462,8 +462,9 @@ namespace Barotrauma
|
|||||||
Slider(voiceChat, (0, 500), 26, (v) => $"{Round(v)} ms", unsavedConfig.Audio.VoiceChatCutoffPrevention, (v) => unsavedConfig.Audio.VoiceChatCutoffPrevention = Round(v), TextManager.Get("CutoffPreventionTooltip"));
|
Slider(voiceChat, (0, 500), 26, (v) => $"{Round(v)} ms", unsavedConfig.Audio.VoiceChatCutoffPrevention, (v) => unsavedConfig.Audio.VoiceChatCutoffPrevention = Round(v), TextManager.Get("CutoffPreventionTooltip"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly Dictionary<GUIButton, Func<LocalizedString>> inputButtonValueNameGetters = new Dictionary<GUIButton, Func<LocalizedString>>();
|
||||||
private bool inputBoxSelectedThisFrame = false;
|
private bool inputBoxSelectedThisFrame = false;
|
||||||
|
|
||||||
private void CreateControlsTab()
|
private void CreateControlsTab()
|
||||||
{
|
{
|
||||||
GUIFrame content = CreateNewContentFrame(Tab.Controls);
|
GUIFrame content = CreateNewContentFrame(Tab.Controls);
|
||||||
@@ -487,7 +488,7 @@ namespace Barotrauma
|
|||||||
GUILayoutGroup createInputRowLayout()
|
GUILayoutGroup createInputRowLayout()
|
||||||
=> new GUILayoutGroup(new RectTransform((1.0f, 0.1f), keyMapList.Content.RectTransform), isHorizontal: true);
|
=> new GUILayoutGroup(new RectTransform((1.0f, 0.1f), keyMapList.Content.RectTransform), isHorizontal: true);
|
||||||
|
|
||||||
HashSet<GUIButton> inputButtons = new HashSet<GUIButton>();
|
inputButtonValueNameGetters.Clear();
|
||||||
Action<KeyOrMouse>? currentSetter = null;
|
Action<KeyOrMouse>? currentSetter = null;
|
||||||
void addInputToRow(GUILayoutGroup currRow, LocalizedString labelText, Func<LocalizedString> valueNameGetter, Action<KeyOrMouse> valueSetter, bool isLegacyBind = false)
|
void addInputToRow(GUILayoutGroup currRow, LocalizedString labelText, Func<LocalizedString> valueNameGetter, Action<KeyOrMouse> valueSetter, bool isLegacyBind = false)
|
||||||
{
|
{
|
||||||
@@ -505,7 +506,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
OnClicked = (btn, obj) =>
|
OnClicked = (btn, obj) =>
|
||||||
{
|
{
|
||||||
inputButtons.ForEach(b =>
|
inputButtonValueNameGetters.Keys.ForEach(b =>
|
||||||
{
|
{
|
||||||
if (b != btn) { b.Selected = false; }
|
if (b != btn) { b.Selected = false; }
|
||||||
});
|
});
|
||||||
@@ -530,7 +531,7 @@ namespace Barotrauma
|
|||||||
inputBox.Color = Color.Lerp(inputBox.Color, inputBox.DisabledColor, 0.5f);
|
inputBox.Color = Color.Lerp(inputBox.Color, inputBox.DisabledColor, 0.5f);
|
||||||
inputBox.TextColor = Color.Lerp(inputBox.TextColor, label.DisabledTextColor, 0.5f);
|
inputBox.TextColor = Color.Lerp(inputBox.TextColor, label.DisabledTextColor, 0.5f);
|
||||||
}
|
}
|
||||||
inputButtons.Add(inputBox);
|
inputButtonValueNameGetters.Add(inputBox, valueNameGetter);
|
||||||
}
|
}
|
||||||
|
|
||||||
var inputListener = new GUICustomComponent(new RectTransform(Vector2.Zero, layout.RectTransform), onUpdate: (deltaTime, component) =>
|
var inputListener = new GUICustomComponent(new RectTransform(Vector2.Zero, layout.RectTransform), onUpdate: (deltaTime, component) =>
|
||||||
@@ -546,7 +547,7 @@ namespace Barotrauma
|
|||||||
void clearSetter()
|
void clearSetter()
|
||||||
{
|
{
|
||||||
currentSetter = null;
|
currentSetter = null;
|
||||||
inputButtons.ForEach(b => b.Selected = false);
|
inputButtonValueNameGetters.Keys.ForEach(b => b.Selected = false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void callSetter(KeyOrMouse v)
|
void callSetter(KeyOrMouse v)
|
||||||
@@ -649,11 +650,14 @@ namespace Barotrauma
|
|||||||
TextManager.Get("Reset"), style: "GUIButtonSmall")
|
TextManager.Get("Reset"), style: "GUIButtonSmall")
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("SetDefaultBindingsTooltip"),
|
ToolTip = TextManager.Get("SetDefaultBindingsTooltip"),
|
||||||
OnClicked = (btn, userdata) =>
|
OnClicked = (_, userdata) =>
|
||||||
{
|
{
|
||||||
unsavedConfig.InventoryKeyMap = GameSettings.Config.InventoryKeyMapping.GetDefault();
|
unsavedConfig.InventoryKeyMap = GameSettings.Config.InventoryKeyMapping.GetDefault();
|
||||||
unsavedConfig.KeyMap = GameSettings.Config.KeyMapping.GetDefault();
|
unsavedConfig.KeyMap = GameSettings.Config.KeyMapping.GetDefault();
|
||||||
Create(mainFrame.Parent.RectTransform);
|
foreach (var btn in inputButtonValueNameGetters.Keys)
|
||||||
|
{
|
||||||
|
btn.Text = inputButtonValueNameGetters[btn]();
|
||||||
|
}
|
||||||
Instance?.SelectTab(Tab.Controls);
|
Instance?.SelectTab(Tab.Controls);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -761,7 +765,7 @@ namespace Barotrauma
|
|||||||
private void CreateBottomButtons()
|
private void CreateBottomButtons()
|
||||||
{
|
{
|
||||||
GUIButton cancelButton =
|
GUIButton cancelButton =
|
||||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), bottom.RectTransform), text: "Cancel")
|
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), bottom.RectTransform), text: TextManager.Get("Cancel"))
|
||||||
{
|
{
|
||||||
OnClicked = (btn, obj) =>
|
OnClicked = (btn, obj) =>
|
||||||
{
|
{
|
||||||
@@ -770,7 +774,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
GUIButton applyButton =
|
GUIButton applyButton =
|
||||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), bottom.RectTransform), text: "Apply")
|
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), bottom.RectTransform), text: TextManager.Get("applysettingsbutton"))
|
||||||
{
|
{
|
||||||
OnClicked = (btn, obj) =>
|
OnClicked = (btn, obj) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -253,12 +253,12 @@ namespace Barotrauma
|
|||||||
if (flipHorizontal)
|
if (flipHorizontal)
|
||||||
{
|
{
|
||||||
float diff = targetSize.X % (sourceRect.Width * scale.X);
|
float diff = targetSize.X % (sourceRect.Width * scale.X);
|
||||||
flippedDrawOffset.X = (int)MathF.Round((sourceRect.Width * scale.X - diff) / scale.X);
|
flippedDrawOffset.X = (int)((sourceRect.Width * scale.X - diff) / scale.X);
|
||||||
}
|
}
|
||||||
if (flipVertical)
|
if (flipVertical)
|
||||||
{
|
{
|
||||||
float diff = targetSize.Y % (sourceRect.Height * scale.Y);
|
float diff = targetSize.Y % (sourceRect.Height * scale.Y);
|
||||||
flippedDrawOffset.Y = (int)MathF.Round((sourceRect.Height * scale.Y - diff) / scale.Y);
|
flippedDrawOffset.Y = (int)((sourceRect.Height * scale.Y - diff) / scale.Y);
|
||||||
}
|
}
|
||||||
drawOffset += flippedDrawOffset;
|
drawOffset += flippedDrawOffset;
|
||||||
|
|
||||||
|
|||||||
@@ -360,8 +360,8 @@ namespace Barotrauma.Steam
|
|||||||
|
|
||||||
if (rules == null) { return; }
|
if (rules == null) { return; }
|
||||||
|
|
||||||
if (rules.ContainsKey("message")) serverInfo.ServerMessage = rules["message"];
|
if (rules.ContainsKey("message")) { serverInfo.ServerMessage = rules["message"]; }
|
||||||
if (rules.ContainsKey("version")) serverInfo.GameVersion = rules["version"];
|
if (rules.ContainsKey("version")) { serverInfo.GameVersion = rules["version"]; }
|
||||||
|
|
||||||
if (rules.ContainsKey("playercount"))
|
if (rules.ContainsKey("playercount"))
|
||||||
{
|
{
|
||||||
@@ -371,8 +371,8 @@ namespace Barotrauma.Steam
|
|||||||
serverInfo.ContentPackageNames.Clear();
|
serverInfo.ContentPackageNames.Clear();
|
||||||
serverInfo.ContentPackageHashes.Clear();
|
serverInfo.ContentPackageHashes.Clear();
|
||||||
serverInfo.ContentPackageWorkshopIds.Clear();
|
serverInfo.ContentPackageWorkshopIds.Clear();
|
||||||
if (rules.ContainsKey("contentpackage")) serverInfo.ContentPackageNames.AddRange(rules["contentpackage"].Split(','));
|
if (rules.ContainsKey("contentpackage")) { serverInfo.ContentPackageNames.AddRange(rules["contentpackage"].Split(',')); }
|
||||||
if (rules.ContainsKey("contentpackagehash")) serverInfo.ContentPackageHashes.AddRange(rules["contentpackagehash"].Split(','));
|
if (rules.ContainsKey("contentpackagehash")) { serverInfo.ContentPackageHashes.AddRange(rules["contentpackagehash"].Split(',')); }
|
||||||
if (rules.ContainsKey("contentpackageid"))
|
if (rules.ContainsKey("contentpackageid"))
|
||||||
{
|
{
|
||||||
serverInfo.ContentPackageWorkshopIds.AddRange(ParseWorkshopIds(rules["contentpackageid"]));
|
serverInfo.ContentPackageWorkshopIds.AddRange(ParseWorkshopIds(rules["contentpackageid"]));
|
||||||
@@ -383,24 +383,26 @@ namespace Barotrauma.Steam
|
|||||||
serverInfo.ContentPackageWorkshopIds.AddRange(WorkshopUrlsToIds(workshopUrls));
|
serverInfo.ContentPackageWorkshopIds.AddRange(WorkshopUrlsToIds(workshopUrls));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rules.ContainsKey("usingwhitelist")) serverInfo.UsingWhiteList = rules["usingwhitelist"] == "True";
|
if (rules.ContainsKey("usingwhitelist")) { serverInfo.UsingWhiteList = rules["usingwhitelist"] == "True"; }
|
||||||
if (rules.ContainsKey("modeselectionmode"))
|
if (rules.ContainsKey("modeselectionmode"))
|
||||||
{
|
{
|
||||||
if (Enum.TryParse(rules["modeselectionmode"], out SelectionMode selectionMode)) serverInfo.ModeSelectionMode = selectionMode;
|
if (Enum.TryParse(rules["modeselectionmode"], out SelectionMode selectionMode)) { serverInfo.ModeSelectionMode = selectionMode; }
|
||||||
}
|
}
|
||||||
if (rules.ContainsKey("subselectionmode"))
|
if (rules.ContainsKey("subselectionmode"))
|
||||||
{
|
{
|
||||||
if (Enum.TryParse(rules["subselectionmode"], out SelectionMode selectionMode)) serverInfo.SubSelectionMode = selectionMode;
|
if (Enum.TryParse(rules["subselectionmode"], out SelectionMode selectionMode)) { serverInfo.SubSelectionMode = selectionMode; }
|
||||||
}
|
}
|
||||||
if (rules.ContainsKey("allowspectating")) serverInfo.AllowSpectating = rules["allowspectating"] == "True";
|
if (rules.ContainsKey("allowspectating")) { serverInfo.AllowSpectating = rules["allowspectating"] == "True"; }
|
||||||
if (rules.ContainsKey("allowrespawn")) serverInfo.AllowRespawn = rules["allowrespawn"] == "True";
|
if (rules.ContainsKey("allowrespawn")) { serverInfo.AllowRespawn = rules["allowrespawn"] == "True"; }
|
||||||
if (rules.ContainsKey("voicechatenabled")) serverInfo.VoipEnabled = rules["voicechatenabled"] == "True";
|
if (rules.ContainsKey("voicechatenabled")) { serverInfo.VoipEnabled = rules["voicechatenabled"] == "True"; }
|
||||||
|
if (rules.ContainsKey("friendlyfireenabled")) { serverInfo.AllowRespawn = rules["friendlyfireenabled"] == "True"; }
|
||||||
|
if (rules.ContainsKey("karmaenabled")) { serverInfo.VoipEnabled = rules["karmaenabled"] == "True"; }
|
||||||
if (rules.ContainsKey("traitors"))
|
if (rules.ContainsKey("traitors"))
|
||||||
{
|
{
|
||||||
if (Enum.TryParse(rules["traitors"], out YesNoMaybe traitorsEnabled)) serverInfo.TraitorsEnabled = traitorsEnabled;
|
if (Enum.TryParse(rules["traitors"], out YesNoMaybe traitorsEnabled)) { serverInfo.TraitorsEnabled = traitorsEnabled; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rules.ContainsKey("gamestarted")) serverInfo.GameStarted = rules["gamestarted"] == "True";
|
if (rules.ContainsKey("gamestarted")) { serverInfo.GameStarted = rules["gamestarted"] == "True"; }
|
||||||
if (rules.ContainsKey("gamemode"))
|
if (rules.ContainsKey("gamemode"))
|
||||||
{
|
{
|
||||||
serverInfo.GameMode = rules["gamemode"].ToIdentifier();
|
serverInfo.GameMode = rules["gamemode"].ToIdentifier();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma</Product>
|
<Product>Barotrauma</Product>
|
||||||
<Version>0.18.12.0</Version>
|
<Version>0.18.15.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>Barotrauma</AssemblyName>
|
<AssemblyName>Barotrauma</AssemblyName>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma</Product>
|
<Product>Barotrauma</Product>
|
||||||
<Version>0.18.12.0</Version>
|
<Version>0.18.15.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>Barotrauma</AssemblyName>
|
<AssemblyName>Barotrauma</AssemblyName>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma</Product>
|
<Product>Barotrauma</Product>
|
||||||
<Version>0.18.12.0</Version>
|
<Version>0.18.15.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>Barotrauma</AssemblyName>
|
<AssemblyName>Barotrauma</AssemblyName>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma Dedicated Server</Product>
|
<Product>Barotrauma Dedicated Server</Product>
|
||||||
<Version>0.18.12.0</Version>
|
<Version>0.18.15.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>DedicatedServer</AssemblyName>
|
<AssemblyName>DedicatedServer</AssemblyName>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma Dedicated Server</Product>
|
<Product>Barotrauma Dedicated Server</Product>
|
||||||
<Version>0.18.12.0</Version>
|
<Version>0.18.15.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>DedicatedServer</AssemblyName>
|
<AssemblyName>DedicatedServer</AssemblyName>
|
||||||
|
|||||||
@@ -566,8 +566,10 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<int> severedJointIndices = new List<int>();
|
private readonly List<int> severedJointIndices = new List<int>();
|
||||||
private void WriteStatus(IWriteMessage msg)
|
|
||||||
|
/// <param name="forceAfflictionData">Normally full affliction data is not written for dead characters, this can be used to force them to be written</param>
|
||||||
|
private void WriteStatus(IWriteMessage msg, bool forceAfflictionData = false)
|
||||||
{
|
{
|
||||||
msg.Write(IsDead);
|
msg.Write(IsDead);
|
||||||
if (IsDead)
|
if (IsDead)
|
||||||
@@ -577,6 +579,11 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
msg.Write(CauseOfDeath.Affliction.Identifier);
|
msg.Write(CauseOfDeath.Affliction.Identifier);
|
||||||
}
|
}
|
||||||
|
msg.Write(forceAfflictionData);
|
||||||
|
if (forceAfflictionData)
|
||||||
|
{
|
||||||
|
CharacterHealth.ServerWrite(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -693,7 +700,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (msg.LengthBytes - initialMsgLength >= 255 && restrictMessageSize)
|
if (msg.LengthBytes - initialMsgLength >= 255 && restrictMessageSize)
|
||||||
{
|
{
|
||||||
string errorMsg = $"Error when writing character spawn data: data exceeded 255 bytes (info: {infoLength}, orders: {ordersLength}, total: {msg.LengthBytes - initialMsgLength})";
|
string errorMsg = $"Error when writing character spawn data for \"{Name}\": data exceeded 255 bytes (info: {infoLength}, orders: {ordersLength}, total: {msg.LengthBytes - initialMsgLength})";
|
||||||
DebugConsole.ThrowError(errorMsg);
|
DebugConsole.ThrowError(errorMsg);
|
||||||
GameAnalyticsManager.AddErrorEventOnce("Character.WriteSpawnData:TooMuchData", GameAnalyticsManager.ErrorSeverity.Error, errorMsg);
|
GameAnalyticsManager.AddErrorEventOnce("Character.WriteSpawnData:TooMuchData", GameAnalyticsManager.ErrorSeverity.Error, errorMsg);
|
||||||
}
|
}
|
||||||
@@ -705,13 +712,13 @@ namespace Barotrauma
|
|||||||
int msgLengthBeforeStatus = msg.LengthBytes - initialMsgLength;
|
int msgLengthBeforeStatus = msg.LengthBytes - initialMsgLength;
|
||||||
|
|
||||||
var tempBuffer = new ReadWriteMessage();
|
var tempBuffer = new ReadWriteMessage();
|
||||||
WriteStatus(tempBuffer);
|
WriteStatus(tempBuffer, forceAfflictionData: true);
|
||||||
if (msgLengthBeforeStatus + tempBuffer.LengthBytes >= 255 && restrictMessageSize && GameMain.LuaCs.Networking.RestrictMessageSize)
|
if (msgLengthBeforeStatus + tempBuffer.LengthBytes >= 255 && restrictMessageSize && GameMain.LuaCs.Networking.RestrictMessageSize)
|
||||||
{
|
{
|
||||||
msg.Write(false);
|
msg.Write(false);
|
||||||
if (msgLengthBeforeStatus < 255)
|
if (msgLengthBeforeStatus < 255)
|
||||||
{
|
{
|
||||||
string errorMsg = $"Error when writing character spawn data: status data caused the length of the message to exceed 255 bytes ({msgLengthBeforeStatus} + {tempBuffer.LengthBytes})";
|
string errorMsg = $"Error when writing character spawn data for \"{Name}\": status data caused the length of the message to exceed 255 bytes ({msgLengthBeforeStatus} + {tempBuffer.LengthBytes})";
|
||||||
DebugConsole.ThrowError(errorMsg);
|
DebugConsole.ThrowError(errorMsg);
|
||||||
GameAnalyticsManager.AddErrorEventOnce("Character.WriteSpawnData:TooMuchDataForStatus", GameAnalyticsManager.ErrorSeverity.Error, errorMsg);
|
GameAnalyticsManager.AddErrorEventOnce("Character.WriteSpawnData:TooMuchDataForStatus", GameAnalyticsManager.ErrorSeverity.Error, errorMsg);
|
||||||
}
|
}
|
||||||
@@ -719,7 +726,7 @@ namespace Barotrauma
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Write(true);
|
msg.Write(true);
|
||||||
WriteStatus(msg);
|
WriteStatus(msg, forceAfflictionData: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1462,6 +1462,11 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (GameMain.NetLobbyScreen.SelectedMode == GameModePreset.MultiPlayerCampaign)
|
||||||
|
{
|
||||||
|
MultiPlayerCampaign.StartCampaignSetup();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!GameMain.Server.StartGame()) { NewMessage("Failed to start a new round", Color.Yellow); }
|
if (!GameMain.Server.StartGame()) { NewMessage("Failed to start a new round", Color.Yellow); }
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace Barotrauma
|
|||||||
campaign.GetWallet(client).Give(itemValue);
|
campaign.GetWallet(client).Give(itemValue);
|
||||||
GameAnalyticsManager.AddMoneyGainedEvent(itemValue, GameAnalyticsManager.MoneySource.Store, item.ItemPrefab.Identifier.Value);
|
GameAnalyticsManager.AddMoneyGainedEvent(itemValue, GameAnalyticsManager.MoneySource.Store, item.ItemPrefab.Identifier.Value);
|
||||||
}
|
}
|
||||||
OnSoldItemsChanged?.Invoke();
|
OnSoldItemsChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearSoldItemsProjSpecific()
|
public void ClearSoldItemsProjSpecific()
|
||||||
|
|||||||
+11
-8
@@ -393,14 +393,17 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
partial void InitProjSpecific()
|
partial void InitProjSpecific()
|
||||||
{
|
{
|
||||||
CargoManager.OnItemsInBuyCrateChanged += () => { IncrementLastUpdateIdForFlag(NetFlags.ItemsInBuyCrate); };
|
Identifier eventId = nameof(MultiPlayerCampaign).ToIdentifier();
|
||||||
CargoManager.OnPurchasedItemsChanged += () => { IncrementLastUpdateIdForFlag(NetFlags.PurchasedItems); };
|
CargoManager.OnItemsInBuyCrateChanged.RegisterOverwriteExisting(eventId, _ => IncrementLastUpdateIdForFlag(NetFlags.ItemsInBuyCrate));
|
||||||
CargoManager.OnSoldItemsChanged += () => { IncrementLastUpdateIdForFlag(NetFlags.SoldItems); };
|
CargoManager.OnPurchasedItemsChanged.RegisterOverwriteExisting(eventId, _ => IncrementLastUpdateIdForFlag(NetFlags.PurchasedItems));
|
||||||
UpgradeManager.OnUpgradesChanged += () => { IncrementLastUpdateIdForFlag(NetFlags.UpgradeManager); };
|
CargoManager.OnSoldItemsChanged.RegisterOverwriteExisting(eventId, _ => IncrementLastUpdateIdForFlag(NetFlags.SoldItems));
|
||||||
Map.OnLocationSelected += (loc, connection) => { IncrementLastUpdateIdForFlag(NetFlags.MapAndMissions); };
|
UpgradeManager.OnUpgradesChanged.RegisterOverwriteExisting(eventId, _ => IncrementLastUpdateIdForFlag(NetFlags.UpgradeManager));
|
||||||
Map.OnMissionsSelected += (loc, mission) => { IncrementLastUpdateIdForFlag(NetFlags.MapAndMissions); };
|
|
||||||
Reputation.OnAnyReputationValueChanged += () => { IncrementLastUpdateIdForFlag(NetFlags.Reputation); };
|
Reputation.OnAnyReputationValueChanged.RegisterOverwriteExisting(eventId, _ => IncrementLastUpdateIdForFlag(NetFlags.Reputation));
|
||||||
|
|
||||||
|
Map.OnLocationSelected = (loc, connection) => IncrementLastUpdateIdForFlag(NetFlags.MapAndMissions);
|
||||||
|
Map.OnMissionsSelected = (loc, mission) => IncrementLastUpdateIdForFlag(NetFlags.MapAndMissions);
|
||||||
|
|
||||||
//increment save ID so clients know they're lacking the most up-to-date save file
|
//increment save ID so clients know they're lacking the most up-to-date save file
|
||||||
LastSaveID++;
|
LastSaveID++;
|
||||||
|
|||||||
@@ -1611,10 +1611,11 @@ namespace Barotrauma.Networking
|
|||||||
outmsg.Write((UInt16)subList.Count);
|
outmsg.Write((UInt16)subList.Count);
|
||||||
for (int i = 0; i < subList.Count; i++)
|
for (int i = 0; i < subList.Count; i++)
|
||||||
{
|
{
|
||||||
outmsg.Write(subList[i].Name);
|
var sub = subList[i];
|
||||||
outmsg.Write(subList[i].MD5Hash.ToString());
|
outmsg.Write(sub.Name);
|
||||||
outmsg.Write((byte)subList[i].SubmarineClass);
|
outmsg.Write(sub.MD5Hash.ToString());
|
||||||
outmsg.Write(subList[i].RequiredContentPackagesInstalled);
|
outmsg.Write((byte)sub.SubmarineClass);
|
||||||
|
outmsg.Write(sub.RequiredContentPackagesInstalled);
|
||||||
}
|
}
|
||||||
|
|
||||||
outmsg.Write(GameStarted);
|
outmsg.Write(GameStarted);
|
||||||
@@ -2052,12 +2053,15 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
GameModePreset selectedMode = Voting.HighestVoted<GameModePreset>(VoteType.Mode, connectedClients);
|
GameModePreset selectedMode = Voting.HighestVoted<GameModePreset>(VoteType.Mode, connectedClients);
|
||||||
if (selectedMode == null) { selectedMode = GameMain.NetLobbyScreen.SelectedMode; }
|
if (selectedMode == null) { selectedMode = GameMain.NetLobbyScreen.SelectedMode; }
|
||||||
|
|
||||||
if (selectedMode == null)
|
if (selectedMode == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (selectedMode == GameModePreset.MultiPlayerCampaign && !(GameMain.GameSession?.GameMode is CampaignMode))
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("StartGame failed. Cannot start a multiplayer campaign via StartGame - use MultiPlayerCampaign.StartNewCampaign or MultiPlayerCampaign.LoadCampaign instead.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
initiatedStartGame = true;
|
initiatedStartGame = true;
|
||||||
startGameCoroutine = CoroutineManager.StartCoroutine(InitiateStartGame(selectedSub, selectedShuttle, selectedMode), "InitiateStartGame");
|
startGameCoroutine = CoroutineManager.StartCoroutine(InitiateStartGame(selectedSub, selectedShuttle, selectedMode), "InitiateStartGame");
|
||||||
|
|
||||||
@@ -2144,11 +2148,17 @@ namespace Barotrauma.Networking
|
|||||||
yield return CoroutineStatus.Failure;
|
yield return CoroutineStatus.Failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool initialSuppliesSpawned = false;
|
||||||
//don't instantiate a new gamesession if we're playing a campaign
|
//don't instantiate a new gamesession if we're playing a campaign
|
||||||
if (campaign == null || GameMain.GameSession == null)
|
if (campaign == null || GameMain.GameSession == null)
|
||||||
{
|
{
|
||||||
GameMain.GameSession = new GameSession(selectedSub, "", selectedMode, settings, GameMain.NetLobbyScreen.LevelSeed, missionType: GameMain.NetLobbyScreen.MissionType);
|
GameMain.GameSession = new GameSession(selectedSub, "", selectedMode, settings, GameMain.NetLobbyScreen.LevelSeed, missionType: GameMain.NetLobbyScreen.MissionType);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
initialSuppliesSpawned = GameMain.GameSession.SubmarineInfo is { InitialSuppliesSpawned: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
List<Client> playingClients = new List<Client>(connectedClients);
|
List<Client> playingClients = new List<Client>(connectedClients);
|
||||||
if (serverSettings.AllowSpectating)
|
if (serverSettings.AllowSpectating)
|
||||||
@@ -2433,17 +2443,18 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
campaign?.CargoManager.InitPurchasedIDCards();
|
campaign?.CargoManager.InitPurchasedIDCards();
|
||||||
|
|
||||||
foreach (Submarine sub in Submarine.MainSubs)
|
if (campaign == null || !initialSuppliesSpawned)
|
||||||
{
|
{
|
||||||
if (sub == null) { continue; }
|
foreach (Submarine sub in Submarine.MainSubs)
|
||||||
|
|
||||||
List<PurchasedItem> spawnList = new List<PurchasedItem>();
|
|
||||||
foreach (KeyValuePair<ItemPrefab, int> kvp in serverSettings.ExtraCargo)
|
|
||||||
{
|
{
|
||||||
spawnList.Add(new PurchasedItem(kvp.Key, kvp.Value, buyer: null));
|
if (sub == null) { continue; }
|
||||||
|
List<PurchasedItem> spawnList = new List<PurchasedItem>();
|
||||||
|
foreach (KeyValuePair<ItemPrefab, int> kvp in serverSettings.ExtraCargo)
|
||||||
|
{
|
||||||
|
spawnList.Add(new PurchasedItem(kvp.Key, kvp.Value, buyer: null));
|
||||||
|
}
|
||||||
|
CargoManager.CreateItems(spawnList, sub, cargoManager: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
CargoManager.CreateItems(spawnList, sub, cargoManager: null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TraitorManager = null;
|
TraitorManager = null;
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ namespace Barotrauma
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
string subName = inc.ReadString();
|
string subName = inc.ReadString();
|
||||||
SubmarineInfo subInfo = SubmarineInfo.SavedSubmarines.FirstOrDefault(s => s.Name == subName);
|
SubmarineInfo subInfo = GameMain.GameSession.OwnedSubmarines.FirstOrDefault(s => s.Name == subName) ?? SubmarineInfo.SavedSubmarines.FirstOrDefault(s => s.Name == subName);
|
||||||
bool transferItems = inc.ReadBoolean();
|
bool transferItems = inc.ReadBoolean();
|
||||||
if (!ShouldRejectVote(sender, voteType))
|
if (!ShouldRejectVote(sender, voteType))
|
||||||
{
|
{
|
||||||
@@ -389,8 +389,9 @@ namespace Barotrauma
|
|||||||
case VoteType.PurchaseSub:
|
case VoteType.PurchaseSub:
|
||||||
case VoteType.PurchaseAndSwitchSub:
|
case VoteType.PurchaseAndSwitchSub:
|
||||||
case VoteType.SwitchSub:
|
case VoteType.SwitchSub:
|
||||||
msg.Write((ActiveVote as SubmarineVote).Sub.Name);
|
SubmarineVote vote = ActiveVote as SubmarineVote;
|
||||||
msg.Write((ActiveVote as SubmarineVote).TransferItems);
|
msg.Write(vote.Sub.Name);
|
||||||
|
msg.Write(vote.TransferItems);
|
||||||
break;
|
break;
|
||||||
case VoteType.TransferMoney:
|
case VoteType.TransferMoney:
|
||||||
var transferVote = (ActiveVote as TransferVote);
|
var transferVote = (ActiveVote as TransferVote);
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ namespace Barotrauma.Steam
|
|||||||
Steamworks.SteamServer.SetKey("allowspectating", server.ServerSettings.AllowSpectating.ToString());
|
Steamworks.SteamServer.SetKey("allowspectating", server.ServerSettings.AllowSpectating.ToString());
|
||||||
Steamworks.SteamServer.SetKey("allowrespawn", server.ServerSettings.AllowRespawn.ToString());
|
Steamworks.SteamServer.SetKey("allowrespawn", server.ServerSettings.AllowRespawn.ToString());
|
||||||
Steamworks.SteamServer.SetKey("traitors", server.ServerSettings.TraitorsEnabled.ToString());
|
Steamworks.SteamServer.SetKey("traitors", server.ServerSettings.TraitorsEnabled.ToString());
|
||||||
|
Steamworks.SteamServer.SetKey("friendlyfireenabled", server.ServerSettings.AllowFriendlyFire.ToString());
|
||||||
|
Steamworks.SteamServer.SetKey("karmaenabled", server.ServerSettings.KarmaEnabled.ToString());
|
||||||
Steamworks.SteamServer.SetKey("gamestarted", server.GameStarted.ToString());
|
Steamworks.SteamServer.SetKey("gamestarted", server.GameStarted.ToString());
|
||||||
Steamworks.SteamServer.SetKey("gamemode", server.ServerSettings.GameModeIdentifier.Value);
|
Steamworks.SteamServer.SetKey("gamemode", server.ServerSettings.GameModeIdentifier.Value);
|
||||||
Steamworks.SteamServer.SetKey("playstyle", server.ServerSettings.PlayStyle.ToString());
|
Steamworks.SteamServer.SetKey("playstyle", server.ServerSettings.PlayStyle.ToString());
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma Dedicated Server</Product>
|
<Product>Barotrauma Dedicated Server</Product>
|
||||||
<Version>0.18.12.0</Version>
|
<Version>0.18.15.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>DedicatedServer</AssemblyName>
|
<AssemblyName>DedicatedServer</AssemblyName>
|
||||||
|
|||||||
@@ -308,6 +308,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (targetSlot < 0) { return false; }
|
||||||
return targetInventory.TryPutItem(item, targetSlot, allowSwapping, allowCombine: false, Character);
|
return targetInventory.TryPutItem(item, targetSlot, allowSwapping, allowCombine: false, Character);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1297,6 +1297,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
AIObjectiveCombat.CombatMode DetermineCombatMode(Character c, float cumulativeDamage = 0, bool isWitnessing = false)
|
AIObjectiveCombat.CombatMode DetermineCombatMode(Character c, float cumulativeDamage = 0, bool isWitnessing = false)
|
||||||
{
|
{
|
||||||
|
if (!(c.AIController is HumanAIController humanAI)) { return AIObjectiveCombat.CombatMode.None; }
|
||||||
if (!IsFriendly(attacker))
|
if (!IsFriendly(attacker))
|
||||||
{
|
{
|
||||||
if (c.Submarine == null)
|
if (c.Submarine == null)
|
||||||
@@ -1306,12 +1307,15 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
if (!c.Submarine.GetConnectedSubs().Contains(attacker.Submarine))
|
if (!c.Submarine.GetConnectedSubs().Contains(attacker.Submarine))
|
||||||
{
|
{
|
||||||
// Attacked from an unconnected submarine.
|
// Attacked from an unconnected submarine (pirate/pvp)
|
||||||
return c.SelectedConstruction?.GetComponent<Turret>() != null ? AIObjectiveCombat.CombatMode.None : AIObjectiveCombat.CombatMode.Retreat;
|
return
|
||||||
|
humanAI.ObjectiveManager.CurrentOrder is AIObjectiveOperateItem operateOrder && operateOrder.GetTarget() is Controller ?
|
||||||
|
AIObjectiveCombat.CombatMode.None : AIObjectiveCombat.CombatMode.Retreat;
|
||||||
}
|
}
|
||||||
return c.AIController is HumanAIController humanAI &&
|
return
|
||||||
(humanAI.ObjectiveManager.IsCurrentOrder<AIObjectiveFightIntruders>() || humanAI.ObjectiveManager.Objectives.Any(o => o is AIObjectiveFightIntruders))
|
humanAI.ObjectiveManager.IsCurrentOrder<AIObjectiveFightIntruders>() ||
|
||||||
? AIObjectiveCombat.CombatMode.Offensive : AIObjectiveCombat.CombatMode.Defensive;
|
humanAI.ObjectiveManager.Objectives.Any(o => o is AIObjectiveFightIntruders) ?
|
||||||
|
AIObjectiveCombat.CombatMode.Offensive : AIObjectiveCombat.CombatMode.Defensive;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1362,7 +1366,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (c.AIController is HumanAIController humanAI && humanAI.ObjectiveManager.GetActiveObjective<AIObjectiveCombat>()?.Enemy == attacker)
|
if (humanAI.ObjectiveManager.GetActiveObjective<AIObjectiveCombat>()?.Enemy == attacker)
|
||||||
{
|
{
|
||||||
// Already targeting the attacker -> treat as a more serious threat.
|
// Already targeting the attacker -> treat as a more serious threat.
|
||||||
cumulativeDamage *= 2;
|
cumulativeDamage *= 2;
|
||||||
|
|||||||
@@ -1527,9 +1527,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (skillIdentifier != null)
|
if (skillIdentifier != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Inventory.Capacity; i++)
|
foreach (Item item in Inventory.AllItems)
|
||||||
{
|
{
|
||||||
if (Inventory.SlotTypes[i] != InvSlotType.Any && Inventory.GetItemAt(i)?.GetComponent<Wearable>() is Wearable wearable)
|
if (item?.GetComponent<Wearable>() is Wearable wearable &&
|
||||||
|
!Inventory.IsInLimbSlot(item, InvSlotType.Any))
|
||||||
{
|
{
|
||||||
if (wearable.SkillModifiers.TryGetValue(skillIdentifier, out float skillValue))
|
if (wearable.SkillModifiers.TryGetValue(skillIdentifier, out float skillValue))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1639,8 +1639,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private void RefreshHeadSprites()
|
private void RefreshHeadSprites()
|
||||||
{
|
{
|
||||||
HeadSprite = null;
|
_headSprite = null;
|
||||||
AttachmentSprites = null;
|
LoadHeadSprite();
|
||||||
|
#if CLIENT
|
||||||
|
CalculateHeadPosition(_headSprite);
|
||||||
|
#endif
|
||||||
|
attachmentSprites?.Clear();
|
||||||
|
LoadAttachmentSprites();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This could maybe be a LookUp instead?
|
// This could maybe be a LookUp instead?
|
||||||
|
|||||||
@@ -825,8 +825,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (!Character.GodMode)
|
if (!Character.GodMode)
|
||||||
{
|
{
|
||||||
UpdateLimbAfflictionOverlays();
|
#if CLIENT
|
||||||
UpdateSkinTint();
|
if (Character.IsVisible)
|
||||||
|
{
|
||||||
|
UpdateLimbAfflictionOverlays();
|
||||||
|
UpdateSkinTint();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
CalculateVitality();
|
CalculateVitality();
|
||||||
|
|
||||||
if (Vitality <= MinVitality)
|
if (Vitality <= MinVitality)
|
||||||
@@ -836,6 +841,12 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ForceUpdateVisuals()
|
||||||
|
{
|
||||||
|
UpdateLimbAfflictionOverlays();
|
||||||
|
UpdateSkinTint();
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateDamageReductions(float deltaTime)
|
private void UpdateDamageReductions(float deltaTime)
|
||||||
{
|
{
|
||||||
float healthRegen = Character.Params.Health.ConstantHealthRegeneration;
|
float healthRegen = Character.Params.Health.ConstantHealthRegeneration;
|
||||||
|
|||||||
+2
-2
@@ -14,7 +14,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
public abstract class ContentPackage
|
public abstract class ContentPackage
|
||||||
{
|
{
|
||||||
public static readonly Version MinimumHashCompatibleVersion = new Version(0, 18, 3, 0);
|
public static readonly Version MinimumHashCompatibleVersion = new Version(0, 18, 13, 0);
|
||||||
|
|
||||||
public const string LocalModsDir = "LocalMods";
|
public const string LocalModsDir = "LocalMods";
|
||||||
public static readonly string WorkshopModsDir = Barotrauma.IO.Path.Combine(
|
public static readonly string WorkshopModsDir = Barotrauma.IO.Path.Combine(
|
||||||
@@ -180,7 +180,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (!condition)
|
if (!condition)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException($"Failed to load \"{Name ?? Path}\": {errorMsg}");
|
throw new InvalidOperationException($"Failed to load \"{Name}\" at {Path}: {errorMsg}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace Barotrauma
|
|||||||
var subs = sub.GetConnectedSubs().Where(s => s.TeamID == sub.TeamID);
|
var subs = sub.GetConnectedSubs().Where(s => s.TeamID == sub.TeamID);
|
||||||
CreateAndPlace(subs);
|
CreateAndPlace(subs);
|
||||||
subs.ForEach(s => s.Info.InitialSuppliesSpawned = true);
|
subs.ForEach(s => s.Info.InitialSuppliesSpawned = true);
|
||||||
|
sub.CheckFuel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,12 +147,12 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private Location Location => campaign?.Map?.CurrentLocation;
|
private Location Location => campaign?.Map?.CurrentLocation;
|
||||||
|
|
||||||
public Action OnItemsInBuyCrateChanged;
|
public readonly NamedEvent<CargoManager> OnItemsInBuyCrateChanged = new NamedEvent<CargoManager>();
|
||||||
public Action OnItemsInSellCrateChanged;
|
public readonly NamedEvent<CargoManager> OnItemsInSellCrateChanged = new NamedEvent<CargoManager>();
|
||||||
public Action OnItemsInSellFromSubCrateChanged;
|
public readonly NamedEvent<CargoManager> OnItemsInSellFromSubCrateChanged = new NamedEvent<CargoManager>();
|
||||||
public Action OnPurchasedItemsChanged;
|
public readonly NamedEvent<CargoManager> OnPurchasedItemsChanged = new NamedEvent<CargoManager>();
|
||||||
public Action OnSoldItemsChanged;
|
public readonly NamedEvent<CargoManager> OnSoldItemsChanged = new NamedEvent<CargoManager>();
|
||||||
|
|
||||||
public CargoManager(CampaignMode campaign)
|
public CargoManager(CampaignMode campaign)
|
||||||
{
|
{
|
||||||
this.campaign = campaign;
|
this.campaign = campaign;
|
||||||
@@ -215,19 +215,19 @@ namespace Barotrauma
|
|||||||
public void ClearItemsInBuyCrate()
|
public void ClearItemsInBuyCrate()
|
||||||
{
|
{
|
||||||
ItemsInBuyCrate.Clear();
|
ItemsInBuyCrate.Clear();
|
||||||
OnItemsInBuyCrateChanged?.Invoke();
|
OnItemsInBuyCrateChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearItemsInSellCrate()
|
public void ClearItemsInSellCrate()
|
||||||
{
|
{
|
||||||
ItemsInSellCrate.Clear();
|
ItemsInSellCrate.Clear();
|
||||||
OnItemsInSellCrateChanged?.Invoke();
|
OnItemsInSellCrateChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearItemsInSellFromSubCrate()
|
public void ClearItemsInSellFromSubCrate()
|
||||||
{
|
{
|
||||||
ItemsInSellFromSubCrate.Clear();
|
ItemsInSellFromSubCrate.Clear();
|
||||||
OnItemsInSellFromSubCrateChanged?.Invoke();
|
OnItemsInSellFromSubCrateChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPurchasedItems(Dictionary<Identifier, List<PurchasedItem>> purchasedItems)
|
public void SetPurchasedItems(Dictionary<Identifier, List<PurchasedItem>> purchasedItems)
|
||||||
@@ -238,7 +238,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
PurchasedItems.Add(entry.Key, entry.Value);
|
PurchasedItems.Add(entry.Key, entry.Value);
|
||||||
}
|
}
|
||||||
OnPurchasedItemsChanged?.Invoke();
|
OnPurchasedItemsChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ModifyItemQuantityInBuyCrate(Identifier storeIdentifier, ItemPrefab itemPrefab, int changeInQuantity, Client client = null)
|
public void ModifyItemQuantityInBuyCrate(Identifier storeIdentifier, ItemPrefab itemPrefab, int changeInQuantity, Client client = null)
|
||||||
@@ -255,7 +255,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
GetBuyCrateItems(storeIdentifier, create: true).Add(new PurchasedItem(itemPrefab, changeInQuantity, client));
|
GetBuyCrateItems(storeIdentifier, create: true).Add(new PurchasedItem(itemPrefab, changeInQuantity, client));
|
||||||
}
|
}
|
||||||
OnItemsInBuyCrateChanged?.Invoke();
|
OnItemsInBuyCrateChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ModifyItemQuantityInSubSellCrate(Identifier storeIdentifier, ItemPrefab itemPrefab, int changeInQuantity, Client client = null)
|
public void ModifyItemQuantityInSubSellCrate(Identifier storeIdentifier, ItemPrefab itemPrefab, int changeInQuantity, Client client = null)
|
||||||
@@ -272,7 +272,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
GetSubCrateItems(storeIdentifier, create: true).Add(new PurchasedItem(itemPrefab, changeInQuantity, client));
|
GetSubCrateItems(storeIdentifier, create: true).Add(new PurchasedItem(itemPrefab, changeInQuantity, client));
|
||||||
}
|
}
|
||||||
OnItemsInSellFromSubCrateChanged?.Invoke();
|
OnItemsInSellFromSubCrateChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SERVER
|
#if SERVER
|
||||||
@@ -331,7 +331,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OnPurchasedItemsChanged?.Invoke();
|
OnPurchasedItemsChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<ItemPrefab, int> GetBuyValuesAtCurrentLocation(Identifier storeIdentifier, IEnumerable<ItemPrefab> items)
|
public Dictionary<ItemPrefab, int> GetBuyValuesAtCurrentLocation(Identifier storeIdentifier, IEnumerable<ItemPrefab> items)
|
||||||
@@ -378,7 +378,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
CreateItems(items, Submarine.MainSub, this);
|
CreateItems(items, Submarine.MainSub, this);
|
||||||
PurchasedItems.Clear();
|
PurchasedItems.Clear();
|
||||||
OnPurchasedItemsChanged?.Invoke();
|
OnPurchasedItemsChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<ItemPrefab, int> UndeterminedSoldEntities { get; } = new Dictionary<ItemPrefab, int>();
|
private Dictionary<ItemPrefab, int> UndeterminedSoldEntities { get; } = new Dictionary<ItemPrefab, int>();
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ namespace Barotrauma
|
|||||||
float prevValue = Value;
|
float prevValue = Value;
|
||||||
|
|
||||||
Metadata.SetValue(metaDataIdentifier, Math.Clamp(value, MinReputation, MaxReputation));
|
Metadata.SetValue(metaDataIdentifier, Math.Clamp(value, MinReputation, MaxReputation));
|
||||||
OnReputationValueChanged?.Invoke();
|
OnReputationValueChanged?.Invoke(this);
|
||||||
OnAnyReputationValueChanged?.Invoke();
|
OnAnyReputationValueChanged?.Invoke(this);
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
int increase = (int)Value - (int)prevValue;
|
int increase = (int)Value - (int)prevValue;
|
||||||
if (increase != 0 && Character.Controlled != null)
|
if (increase != 0 && Character.Controlled != null)
|
||||||
@@ -73,8 +73,8 @@ namespace Barotrauma
|
|||||||
Value += reputationChange;
|
Value += reputationChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action OnReputationValueChanged;
|
public readonly NamedEvent<Reputation> OnReputationValueChanged = new NamedEvent<Reputation>();
|
||||||
public static Action OnAnyReputationValueChanged;
|
public static readonly NamedEvent<Reputation> OnAnyReputationValueChanged = new NamedEvent<Reputation>();
|
||||||
|
|
||||||
public readonly Faction Faction;
|
public readonly Faction Faction;
|
||||||
public readonly Location Location;
|
public readonly Location Location;
|
||||||
|
|||||||
@@ -1005,7 +1005,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubmarineInfo SwitchSubs()
|
public void SwitchSubs()
|
||||||
{
|
{
|
||||||
if (TransferItemsOnSubSwitch)
|
if (TransferItemsOnSubSwitch)
|
||||||
{
|
{
|
||||||
@@ -1013,7 +1013,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
RefreshOwnedSubmarines();
|
RefreshOwnedSubmarines();
|
||||||
PendingSubmarineSwitch = null;
|
PendingSubmarineSwitch = null;
|
||||||
return GameMain.GameSession.SubmarineInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1035,13 +1034,16 @@ namespace Barotrauma
|
|||||||
foreach (Item item in Item.ItemList)
|
foreach (Item item in Item.ItemList)
|
||||||
{
|
{
|
||||||
if (item.Removed) { continue; }
|
if (item.Removed) { continue; }
|
||||||
if (item.NonInteractable) { continue; }
|
if (item.NonInteractable || item.NonPlayerTeamInteractable) { continue; }
|
||||||
if (item.HiddenInGame) { continue; }
|
if (item.HiddenInGame) { continue; }
|
||||||
if (!connectedSubs.Contains(item.Submarine)) { continue; }
|
if (!connectedSubs.Contains(item.Submarine)) { continue; }
|
||||||
if (item.Prefab.DontTransferBetweenSubs) { continue; }
|
if (item.Prefab.DontTransferBetweenSubs) { continue; }
|
||||||
if (item.GetRootInventoryOwner() is Character) { continue; }
|
var rootOwner = item.GetRootInventoryOwner();
|
||||||
if (item.GetComponent<Holdable>() == null && item.GetComponent<Wearable>() == null && item.GetComponent<Projectile>() == null) { continue; }
|
if (rootOwner is Character) { continue; }
|
||||||
if (item.Components.Any(c => c is Holdable h && h.Attached)) { continue; }
|
if (rootOwner is Item ownerItem && (ownerItem.NonInteractable || item.NonPlayerTeamInteractable || ownerItem.HiddenInGame)) { continue; }
|
||||||
|
if (item.GetComponent<Door>() != null) { continue; }
|
||||||
|
if (item.Components.None(c => c is Pickable)) { continue; }
|
||||||
|
if (item.Components.Any(c => c is Pickable p && p.IsAttached)) { continue; }
|
||||||
if (item.Components.Any(c => c is Wire w && w.Connections.Any(c => c != null))) { continue; }
|
if (item.Components.Any(c => c is Wire w && w.Connections.Any(c => c != null))) { continue; }
|
||||||
itemsToTransfer.Add((item, item.Container));
|
itemsToTransfer.Add((item, item.Container));
|
||||||
item.Submarine = null;
|
item.Submarine = null;
|
||||||
@@ -1054,6 +1056,7 @@ namespace Barotrauma
|
|||||||
item.Drop(null, createNetworkEvent: false, setTransform: false);
|
item.Drop(null, createNetworkEvent: false, setTransform: false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
currentSub.Info.NoItems = true;
|
||||||
}
|
}
|
||||||
// Serialize the current sub
|
// Serialize the current sub
|
||||||
GameMain.GameSession.SubmarineInfo = new SubmarineInfo(currentSub);
|
GameMain.GameSession.SubmarineInfo = new SubmarineInfo(currentSub);
|
||||||
@@ -1064,7 +1067,7 @@ namespace Barotrauma
|
|||||||
var connectedSubs = newSub.GetConnectedSubs().Where(s => s.Info.Type == SubmarineType.Player).ToHashSet();
|
var connectedSubs = newSub.GetConnectedSubs().Where(s => s.Info.Type == SubmarineType.Player).ToHashSet();
|
||||||
// Move the transferred items
|
// Move the transferred items
|
||||||
List<ItemContainer> availableContainers = Item.ItemList
|
List<ItemContainer> availableContainers = Item.ItemList
|
||||||
.Where(it => connectedSubs.Contains(it.Submarine) && it.HasTag("crate") && !it.NonInteractable && !it.HiddenInGame && !it.Removed)
|
.Where(it => connectedSubs.Contains(it.Submarine) && it.HasTag("crate") && !it.NonInteractable && !it.NonPlayerTeamInteractable && !it.HiddenInGame && !it.Removed)
|
||||||
.Select(it => it.GetComponent<ItemContainer>())
|
.Select(it => it.GetComponent<ItemContainer>())
|
||||||
.Where(c => c != null)
|
.Where(c => c != null)
|
||||||
.ToList();
|
.ToList();
|
||||||
@@ -1122,6 +1125,7 @@ namespace Barotrauma
|
|||||||
DebugConsole.Log(msg);
|
DebugConsole.Log(msg);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
newSub.Info.NoItems = false;
|
||||||
// Serialize the new sub
|
// Serialize the new sub
|
||||||
PendingSubmarineSwitch = new SubmarineInfo(newSub);
|
PendingSubmarineSwitch = new SubmarineInfo(newSub);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ namespace Barotrauma
|
|||||||
private CampaignMetadata Metadata => Campaign.CampaignMetadata;
|
private CampaignMetadata Metadata => Campaign.CampaignMetadata;
|
||||||
private readonly CampaignMode Campaign;
|
private readonly CampaignMode Campaign;
|
||||||
|
|
||||||
public event Action? OnUpgradesChanged;
|
public readonly NamedEvent<UpgradeManager> OnUpgradesChanged = new NamedEvent<UpgradeManager>();
|
||||||
|
|
||||||
public UpgradeManager(CampaignMode campaign)
|
public UpgradeManager(CampaignMode campaign)
|
||||||
{
|
{
|
||||||
@@ -248,7 +248,7 @@ namespace Barotrauma
|
|||||||
// tell the server that this item is yet to be paid for server side
|
// tell the server that this item is yet to be paid for server side
|
||||||
PurchasedUpgrades.Add(new PurchasedUpgrade(prefab, category));
|
PurchasedUpgrades.Add(new PurchasedUpgrade(prefab, category));
|
||||||
#endif
|
#endif
|
||||||
OnUpgradesChanged?.Invoke();
|
OnUpgradesChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -349,7 +349,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OnUpgradesChanged?.Invoke();
|
OnUpgradesChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -418,7 +418,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
OnUpgradesChanged?.Invoke();
|
OnUpgradesChanged?.Invoke(this);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -802,7 +802,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
PendingUpgrades.Clear();
|
PendingUpgrades.Clear();
|
||||||
PendingUpgrades.AddRange(upgrades);
|
PendingUpgrades.AddRange(upgrades);
|
||||||
OnUpgradesChanged?.Invoke();
|
OnUpgradesChanged?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DebugLog(string msg, Color? color = null)
|
public static void DebugLog(string msg, Color? color = null)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ namespace Barotrauma
|
|||||||
Deselect,
|
Deselect,
|
||||||
Shoot,
|
Shoot,
|
||||||
Command,
|
Command,
|
||||||
|
ToggleInventory,
|
||||||
TakeOneFromInventorySlot,
|
TakeOneFromInventorySlot,
|
||||||
TakeHalfFromInventorySlot,
|
TakeHalfFromInventorySlot,
|
||||||
NextFireMode,
|
NextFireMode,
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ namespace Barotrauma.Items.Components
|
|||||||
while (impactQueue.Count > 0)
|
while (impactQueue.Count > 0)
|
||||||
{
|
{
|
||||||
var impact = impactQueue.Dequeue();
|
var impact = impactQueue.Dequeue();
|
||||||
HandleImpact(impact.Body);
|
HandleImpact(impact);
|
||||||
}
|
}
|
||||||
//in case handling the impact does something to the picker
|
//in case handling the impact does something to the picker
|
||||||
if (picker == null) { return; }
|
if (picker == null) { return; }
|
||||||
@@ -342,7 +342,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
hitTargets.Add(targetCharacter);
|
hitTargets.Add(targetCharacter);
|
||||||
}
|
}
|
||||||
else if (f2.Body.UserData is Structure targetStructure)
|
else if ((f2.Body.UserData as Structure ?? f2.UserData as Structure) is Structure targetStructure)
|
||||||
{
|
{
|
||||||
if (AllowHitMultiple)
|
if (AllowHitMultiple)
|
||||||
{
|
{
|
||||||
@@ -380,8 +380,9 @@ namespace Barotrauma.Items.Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleImpact(Body target)
|
private void HandleImpact(Fixture targetFixture)
|
||||||
{
|
{
|
||||||
|
var target = targetFixture.Body;
|
||||||
if (User == null || User.Removed || target == null)
|
if (User == null || User.Removed || target == null)
|
||||||
{
|
{
|
||||||
RestoreCollision();
|
RestoreCollision();
|
||||||
@@ -411,7 +412,7 @@ namespace Barotrauma.Items.Components
|
|||||||
targetCharacter.LastDamageSource = item;
|
targetCharacter.LastDamageSource = item;
|
||||||
Attack.DoDamage(User, targetCharacter, item.WorldPosition, 1.0f);
|
Attack.DoDamage(User, targetCharacter, item.WorldPosition, 1.0f);
|
||||||
}
|
}
|
||||||
else if (target.UserData is Structure targetStructure)
|
else if ((target.UserData as Structure ?? targetFixture.UserData as Structure) is Structure targetStructure)
|
||||||
{
|
{
|
||||||
if (targetStructure.Removed) { return; }
|
if (targetStructure.Removed) { return; }
|
||||||
Attack.DoDamage(User, targetStructure, item.WorldPosition, 1.0f);
|
Attack.DoDamage(User, targetStructure, item.WorldPosition, 1.0f);
|
||||||
|
|||||||
@@ -193,6 +193,9 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
private Vector2 prevContainedItemPositions;
|
private Vector2 prevContainedItemPositions;
|
||||||
|
|
||||||
|
private float autoInjectCooldown = 1.0f;
|
||||||
|
const float AutoInjectInterval = 1.0f;
|
||||||
|
|
||||||
|
|
||||||
public bool ShouldBeContained(string[] identifiersOrTags, out bool isRestrictionsDefined)
|
public bool ShouldBeContained(string[] identifiersOrTags, out bool isRestrictionsDefined)
|
||||||
{
|
{
|
||||||
@@ -412,7 +415,15 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
if (AutoInject)
|
if (AutoInject)
|
||||||
{
|
{
|
||||||
if (ownerInventory?.Owner is Character ownerCharacter &&
|
//normally autoinjection should delete the (medical) item, so it only gets applied once
|
||||||
|
//but in multiplayer clients aren't allowed to remove items themselves, so they may be able to trigger this dozens of times
|
||||||
|
//before the server notifies them of the item being removed, leading to a sharp lag spike.
|
||||||
|
//this can also happen with mods, if there's a way to autoinject something that doesn't get removed On Use.
|
||||||
|
//so let's ensure the item is only applied once per second at most.
|
||||||
|
|
||||||
|
autoInjectCooldown -= deltaTime;
|
||||||
|
if (autoInjectCooldown <= 0.0f &&
|
||||||
|
ownerInventory?.Owner is Character ownerCharacter &&
|
||||||
ownerCharacter.HealthPercentage / 100f <= AutoInjectThreshold &&
|
ownerCharacter.HealthPercentage / 100f <= AutoInjectThreshold &&
|
||||||
ownerCharacter.HasEquippedItem(item))
|
ownerCharacter.HasEquippedItem(item))
|
||||||
{
|
{
|
||||||
@@ -420,6 +431,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
item.ApplyStatusEffects(ActionType.OnUse, 1.0f, ownerCharacter);
|
item.ApplyStatusEffects(ActionType.OnUse, 1.0f, ownerCharacter);
|
||||||
item.GetComponent<GeneticMaterial>()?.Equip(ownerCharacter);
|
item.GetComponent<GeneticMaterial>()?.Equip(ownerCharacter);
|
||||||
|
autoInjectCooldown = AutoInjectInterval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -338,9 +338,7 @@ namespace Barotrauma.Items.Components
|
|||||||
if (user == null) { return; }
|
if (user == null) { return; }
|
||||||
if (GameMain.GameSession?.GameMode is MultiPlayerCampaign mpCampaign)
|
if (GameMain.GameSession?.GameMode is MultiPlayerCampaign mpCampaign)
|
||||||
{
|
{
|
||||||
#if CLIENT
|
#if SERVER
|
||||||
mpCampaign.TryPurchase(null, fabricatedItem.RequiredMoney);
|
|
||||||
#elif SERVER
|
|
||||||
if (GetUsingClient() is { } client)
|
if (GetUsingClient() is { } client)
|
||||||
{
|
{
|
||||||
mpCampaign.TryPurchase(client, fabricatedItem.RequiredMoney);
|
mpCampaign.TryPurchase(client, fabricatedItem.RequiredMoney);
|
||||||
|
|||||||
@@ -142,9 +142,8 @@ namespace Barotrauma.Items.Components
|
|||||||
//less effective when in a bad condition
|
//less effective when in a bad condition
|
||||||
currFlow *= MathHelper.Lerp(0.5f, 1.0f, item.Condition / item.MaxCondition);
|
currFlow *= MathHelper.Lerp(0.5f, 1.0f, item.Condition / item.MaxCondition);
|
||||||
|
|
||||||
item.CurrentHull.WaterVolume += currFlow * deltaTime * Timing.FixedUpdateRate;
|
item.CurrentHull.WaterVolume += currFlow * deltaTime * Timing.FixedUpdateRate;
|
||||||
if (item.CurrentHull.WaterVolume > item.CurrentHull.Volume) { item.CurrentHull.Pressure += 30.0f * deltaTime; }
|
if (item.CurrentHull.WaterVolume > item.CurrentHull.Volume) { item.CurrentHull.Pressure += 30.0f * deltaTime; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InfectBallast(Identifier identifier, bool allowMultiplePerShip = false)
|
public void InfectBallast(Identifier identifier, bool allowMultiplePerShip = false)
|
||||||
|
|||||||
@@ -742,7 +742,7 @@ namespace Barotrauma.Items.Components
|
|||||||
limb.body?.ApplyLinearImpulse(item.body.LinearVelocity * item.body.Mass * 0.1f, item.SimPosition);
|
limb.body?.ApplyLinearImpulse(item.body.LinearVelocity * item.body.Mass * 0.1f, item.SimPosition);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!FriendlyFire && User != null && limb.character.IsFriendly(User))
|
if (!FriendlyFire && User != null && limb.character.IsFriendly(User) && HumanAIController.IsOnFriendlyTeam(limb.character, User))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -789,6 +789,11 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
private bool ShouldIgnoreSubmarineCollision(ref Fixture target, Contact contact)
|
private bool ShouldIgnoreSubmarineCollision(ref Fixture target, Contact contact)
|
||||||
{
|
{
|
||||||
|
//not in the projectile category: the projectile has not been launched (e.g. just dropped from an inventory)
|
||||||
|
if (item.body.CollisionCategories != Physics.CollisionProjectile)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (target.Body.UserData is Submarine sub)
|
if (target.Body.UserData is Submarine sub)
|
||||||
{
|
{
|
||||||
Vector2 dir = item.body.LinearVelocity.LengthSquared() < 0.001f ?
|
Vector2 dir = item.body.LinearVelocity.LengthSquared() < 0.001f ?
|
||||||
|
|||||||
@@ -238,6 +238,12 @@ namespace Barotrauma.Items.Components
|
|||||||
base.OnItemLoaded();
|
base.OnItemLoaded();
|
||||||
SetLightSourceState(IsActive, lightBrightness);
|
SetLightSourceState(IsActive, lightBrightness);
|
||||||
turret = item.GetComponent<Turret>();
|
turret = item.GetComponent<Turret>();
|
||||||
|
#if CLIENT
|
||||||
|
if (Screen.Selected.IsEditor)
|
||||||
|
{
|
||||||
|
OnMapLoaded();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnMapLoaded()
|
public override void OnMapLoaded()
|
||||||
|
|||||||
+14
-10
@@ -1,12 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace Barotrauma.Items.Components
|
namespace Barotrauma.Items.Components
|
||||||
{
|
{
|
||||||
class RegExFindComponent : ItemComponent
|
class RegExFindComponent : ItemComponent
|
||||||
{
|
{
|
||||||
private static readonly TimeSpan timeout = TimeSpan.FromSeconds(Timing.Step);
|
private static readonly TimeSpan timeout = TimeSpan.FromMilliseconds(1);
|
||||||
|
|
||||||
private string expression;
|
private string expression;
|
||||||
|
|
||||||
@@ -63,10 +62,9 @@ namespace Barotrauma.Items.Components
|
|||||||
get { return expression; }
|
get { return expression; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (expression == value) return;
|
if (expression == value) { return; }
|
||||||
expression = value;
|
expression = value;
|
||||||
previousReceivedSignal = "";
|
previousReceivedSignal = "";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
regex = new Regex(
|
regex = new Regex(
|
||||||
@@ -74,11 +72,12 @@ namespace Barotrauma.Items.Components
|
|||||||
options: RegexOptions.None,
|
options: RegexOptions.None,
|
||||||
matchTimeout: timeout);
|
matchTimeout: timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//reactivate the component, in case some faulty/malicious expression caused it to time out and deactivate itself
|
||||||
|
IsActive = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,11 +104,16 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
item.SendSignal(
|
if (e is RegexMatchTimeoutException)
|
||||||
e is RegexMatchTimeoutException
|
{
|
||||||
? "TIMEOUT"
|
item.SendSignal("TIMEOUT", "signal_out");
|
||||||
: "ERROR",
|
//deactivate the component if the expression caused it to time out
|
||||||
"signal_out");
|
IsActive = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item.SendSignal("ERROR", "signal_out");
|
||||||
|
}
|
||||||
previousResult = false;
|
previousResult = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -878,6 +878,7 @@ namespace Barotrauma
|
|||||||
//and check if the collision should be ignored in the OnCollision callback, but
|
//and check if the collision should be ignored in the OnCollision callback, but
|
||||||
//that'd make the hit detection more expensive because every item would be included)
|
//that'd make the hit detection more expensive because every item would be included)
|
||||||
collisionCategory = Physics.CollisionCharacter;
|
collisionCategory = Physics.CollisionCharacter;
|
||||||
|
collidesWith |= Physics.CollisionProjectile;
|
||||||
}
|
}
|
||||||
if (collisionCategoryStr != null)
|
if (collisionCategoryStr != null)
|
||||||
{
|
{
|
||||||
@@ -1268,8 +1269,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
Vector2 displayPos = ConvertUnits.ToDisplayUnits(simPosition);
|
Vector2 displayPos = ConvertUnits.ToDisplayUnits(simPosition);
|
||||||
|
|
||||||
rect.X = (int)(displayPos.X - rect.Width / 2.0f);
|
rect.X = (int)MathF.Round(displayPos.X - rect.Width / 2.0f);
|
||||||
rect.Y = (int)(displayPos.Y + rect.Height / 2.0f);
|
rect.Y = (int)MathF.Round(displayPos.Y + rect.Height / 2.0f);
|
||||||
|
|
||||||
if (findNewHull) { FindHull(); }
|
if (findNewHull) { FindHull(); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -308,6 +308,8 @@ namespace Barotrauma.MapCreatures.Behavior
|
|||||||
private BallastFloraBranch? root;
|
private BallastFloraBranch? root;
|
||||||
private readonly List<Body> bodies = new List<Body>();
|
private readonly List<Body> bodies = new List<Body>();
|
||||||
|
|
||||||
|
private bool isDead;
|
||||||
|
|
||||||
public readonly BallastFloraStateMachine StateMachine;
|
public readonly BallastFloraStateMachine StateMachine;
|
||||||
|
|
||||||
public int GrowthWarps;
|
public int GrowthWarps;
|
||||||
@@ -403,13 +405,14 @@ namespace Barotrauma.MapCreatures.Behavior
|
|||||||
new XAttribute("health", branch.Health.ToString("G", CultureInfo.InvariantCulture)),
|
new XAttribute("health", branch.Health.ToString("G", CultureInfo.InvariantCulture)),
|
||||||
new XAttribute("maxhealth", branch.MaxHealth.ToString("G", CultureInfo.InvariantCulture)),
|
new XAttribute("maxhealth", branch.MaxHealth.ToString("G", CultureInfo.InvariantCulture)),
|
||||||
new XAttribute("sides", (int)branch.Sides),
|
new XAttribute("sides", (int)branch.Sides),
|
||||||
new XAttribute("blockedsides", (int)branch.BlockedSides));
|
new XAttribute("blockedsides", (int)branch.BlockedSides),
|
||||||
|
new XAttribute("tile", (int)branch.Type));
|
||||||
|
|
||||||
if (branch.ClaimedItem != null)
|
if (branch.ClaimedItem != null)
|
||||||
{
|
{
|
||||||
be.Add(new XAttribute("claimed", (int)(branch.ClaimedItem?.ID ?? -1)));
|
be.Add(new XAttribute("claimed", (int)(branch.ClaimedItem?.ID ?? -1)));
|
||||||
}
|
}
|
||||||
if (branch.ParentBranch != null)
|
if (branch.ParentBranch != null && !branch.ParentBranch.Removed)
|
||||||
{
|
{
|
||||||
be.Add(new XAttribute("parentbranch", (int)(branch.ParentBranch?.ID ?? -1)));
|
be.Add(new XAttribute("parentbranch", (int)(branch.ParentBranch?.ID ?? -1)));
|
||||||
}
|
}
|
||||||
@@ -495,14 +498,15 @@ namespace Barotrauma.MapCreatures.Behavior
|
|||||||
int blockedSides = getInt("blockedsides");
|
int blockedSides = getInt("blockedsides");
|
||||||
int claimedId = branchElement.GetAttributeInt("claimed", -1);
|
int claimedId = branchElement.GetAttributeInt("claimed", -1);
|
||||||
int parentBranchId = branchElement.GetAttributeInt("parentbranch", -1);
|
int parentBranchId = branchElement.GetAttributeInt("parentbranch", -1);
|
||||||
|
VineTileType type = (VineTileType)branchElement.GetAttributeInt("tile", 0);
|
||||||
|
|
||||||
BallastFloraBranch newBranch = new BallastFloraBranch(this, null, pos, VineTileType.CrossJunction, FoliageConfig.Deserialize(flowerConfig), FoliageConfig.Deserialize(leafconfig))
|
BallastFloraBranch newBranch = new BallastFloraBranch(this, null, pos, type, FoliageConfig.Deserialize(flowerConfig), FoliageConfig.Deserialize(leafconfig))
|
||||||
{
|
{
|
||||||
ID = id,
|
ID = id,
|
||||||
Health = health,
|
Health = health,
|
||||||
MaxHealth = maxhealth,
|
MaxHealth = maxhealth,
|
||||||
Sides = (TileSide) sides,
|
Sides = (TileSide)sides,
|
||||||
BlockedSides = (TileSide) blockedSides,
|
BlockedSides = (TileSide)blockedSides,
|
||||||
IsRoot = isRoot,
|
IsRoot = isRoot,
|
||||||
IsRootGrowth = isRootGrowth
|
IsRootGrowth = isRootGrowth
|
||||||
};
|
};
|
||||||
@@ -683,7 +687,6 @@ namespace Barotrauma.MapCreatures.Behavior
|
|||||||
if (branch.ClaimedItem != null)
|
if (branch.ClaimedItem != null)
|
||||||
{
|
{
|
||||||
RemoveClaim(branch.ClaimedItem);
|
RemoveClaim(branch.ClaimedItem);
|
||||||
branch.ClaimedItem = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
branch.RemoveTimer -= deltaTime;
|
branch.RemoveTimer -= deltaTime;
|
||||||
@@ -1196,6 +1199,14 @@ namespace Barotrauma.MapCreatures.Behavior
|
|||||||
ClaimedTargets.Remove(item);
|
ClaimedTargets.Remove(item);
|
||||||
item.Infector = null;
|
item.Infector = null;
|
||||||
|
|
||||||
|
foreach (var branch in Branches)
|
||||||
|
{
|
||||||
|
if (branch.ClaimedItem == item)
|
||||||
|
{
|
||||||
|
branch.ClaimedItem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ClaimedJunctionBoxes.ForEachMod(jb =>
|
ClaimedJunctionBoxes.ForEachMod(jb =>
|
||||||
{
|
{
|
||||||
if (jb.Item == item)
|
if (jb.Item == item)
|
||||||
@@ -1221,15 +1232,21 @@ namespace Barotrauma.MapCreatures.Behavior
|
|||||||
|
|
||||||
public void Kill()
|
public void Kill()
|
||||||
{
|
{
|
||||||
|
isDead = true;
|
||||||
|
|
||||||
foreach (var branch in Branches)
|
foreach (var branch in Branches)
|
||||||
{
|
{
|
||||||
branch.DisconnectedFromRoot = true;
|
branch.DisconnectedFromRoot = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Item target in ClaimedTargets)
|
foreach (Item target in ClaimedTargets.ToList())
|
||||||
{
|
{
|
||||||
|
RemoveClaim(target);
|
||||||
target.Infector = null;
|
target.Infector = null;
|
||||||
}
|
}
|
||||||
|
Debug.Assert(ClaimedTargets.Count == 0);
|
||||||
|
Debug.Assert(ClaimedJunctionBoxes.Count == 0);
|
||||||
|
Debug.Assert(ClaimedBatteries.Count == 0);
|
||||||
|
|
||||||
StateMachine?.State?.Exit();
|
StateMachine?.State?.Exit();
|
||||||
#if SERVER
|
#if SERVER
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ namespace Barotrauma
|
|||||||
startPath = new Tunnel(
|
startPath = new Tunnel(
|
||||||
TunnelType.SidePath,
|
TunnelType.SidePath,
|
||||||
new List<Point>() { startExitPosition, startPosition },
|
new List<Point>() { startExitPosition, startPosition },
|
||||||
minWidth / 2, parentTunnel: mainPath);
|
minWidth, parentTunnel: mainPath);
|
||||||
Tunnels.Add(startPath);
|
Tunnels.Add(startPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -561,7 +561,7 @@ namespace Barotrauma
|
|||||||
endPath = new Tunnel(
|
endPath = new Tunnel(
|
||||||
TunnelType.SidePath,
|
TunnelType.SidePath,
|
||||||
new List<Point>() { endPosition, endExitPosition },
|
new List<Point>() { endPosition, endExitPosition },
|
||||||
minWidth / 2, parentTunnel: mainPath);
|
minWidth, parentTunnel: mainPath);
|
||||||
Tunnels.Add(endPath);
|
Tunnels.Add(endPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -576,14 +576,14 @@ namespace Barotrauma
|
|||||||
endHole = new Tunnel(
|
endHole = new Tunnel(
|
||||||
TunnelType.SidePath,
|
TunnelType.SidePath,
|
||||||
new List<Point>() { startPosition, startExitPosition, new Point(0, Size.Y) },
|
new List<Point>() { startPosition, startExitPosition, new Point(0, Size.Y) },
|
||||||
minWidth / 2, parentTunnel: mainPath);
|
minWidth, parentTunnel: mainPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
endHole = new Tunnel(
|
endHole = new Tunnel(
|
||||||
TunnelType.SidePath,
|
TunnelType.SidePath,
|
||||||
new List<Point>() { endPosition, endExitPosition, Size },
|
new List<Point>() { endPosition, endExitPosition, Size },
|
||||||
minWidth / 2, parentTunnel: mainPath);
|
minWidth, parentTunnel: mainPath);
|
||||||
}
|
}
|
||||||
Tunnels.Add(endHole);
|
Tunnels.Add(endHole);
|
||||||
}
|
}
|
||||||
@@ -601,7 +601,7 @@ namespace Barotrauma
|
|||||||
abyssTunnel = new Tunnel(
|
abyssTunnel = new Tunnel(
|
||||||
TunnelType.SidePath,
|
TunnelType.SidePath,
|
||||||
new List<Point>() { lowestPoint, new Point(lowestPoint.X, 0) },
|
new List<Point>() { lowestPoint, new Point(lowestPoint.X, 0) },
|
||||||
minWidth / 2, parentTunnel: mainPath);
|
minWidth, parentTunnel: mainPath);
|
||||||
Tunnels.Add(abyssTunnel);
|
Tunnels.Add(abyssTunnel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4266,6 +4266,7 @@ namespace Barotrauma
|
|||||||
corpse.TeamID = CharacterTeamType.None;
|
corpse.TeamID = CharacterTeamType.None;
|
||||||
corpse.EnableDespawn = false;
|
corpse.EnableDespawn = false;
|
||||||
selectedPrefab.GiveItems(corpse, wreck);
|
selectedPrefab.GiveItems(corpse, wreck);
|
||||||
|
corpse.Kill(CauseOfDeathType.Unknown, causeOfDeathAffliction: null, log: false);
|
||||||
corpse.CharacterHealth.ApplyAffliction(corpse.AnimController.MainLimb, AfflictionPrefab.OxygenLow.Instantiate(200));
|
corpse.CharacterHealth.ApplyAffliction(corpse.AnimController.MainLimb, AfflictionPrefab.OxygenLow.Instantiate(200));
|
||||||
bool applyBurns = Rand.Value() < 0.1f;
|
bool applyBurns = Rand.Value() < 0.1f;
|
||||||
bool applyDamage = Rand.Value() < 0.3f;
|
bool applyDamage = Rand.Value() < 0.3f;
|
||||||
@@ -4294,7 +4295,7 @@ namespace Barotrauma
|
|||||||
return strength;
|
return strength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
corpse.Kill(CauseOfDeathType.Unknown, causeOfDeathAffliction: null, log: false);
|
corpse.CharacterHealth.ForceUpdateVisuals();
|
||||||
corpse.GiveIdCardTags(sp);
|
corpse.GiveIdCardTags(sp);
|
||||||
|
|
||||||
bool isServerOrSingleplayer = GameMain.IsSingleplayer || GameMain.NetworkMember is { IsServer: true };
|
bool isServerOrSingleplayer = GameMain.IsSingleplayer || GameMain.NetworkMember is { IsServer: true };
|
||||||
|
|||||||
@@ -182,8 +182,8 @@ namespace Barotrauma
|
|||||||
float scale = element.GetAttributeFloat("scale", prefab.Scale);
|
float scale = element.GetAttributeFloat("scale", prefab.Scale);
|
||||||
|
|
||||||
var rect = element.GetAttributeVector4("rect", Vector4.Zero);
|
var rect = element.GetAttributeVector4("rect", Vector4.Zero);
|
||||||
rect.Z *= scale / prefab.Scale;
|
if (!prefab.ResizeHorizontal) { rect.Z *= scale / prefab.Scale; }
|
||||||
rect.W *= scale / prefab.Scale;
|
if (!prefab.ResizeVertical) { rect.W *= scale / prefab.Scale; }
|
||||||
|
|
||||||
points.Add(new Vector2(rect.X, rect.Y));
|
points.Add(new Vector2(rect.X, rect.Y));
|
||||||
points.Add(new Vector2(rect.X + rect.Z, rect.Y));
|
points.Add(new Vector2(rect.X + rect.Z, rect.Y));
|
||||||
@@ -203,7 +203,7 @@ namespace Barotrauma
|
|||||||
if (Screen.Selected == GameMain.SubEditorScreen)
|
if (Screen.Selected == GameMain.SubEditorScreen)
|
||||||
{
|
{
|
||||||
linkedSub = CreateDummy(submarine, element, pos, id);
|
linkedSub = CreateDummy(submarine, element, pos, id);
|
||||||
linkedSub.saveElement = element;
|
linkedSub.saveElement = new XElement(element);
|
||||||
linkedSub.purchasedLostShuttles = false;
|
linkedSub.purchasedLostShuttles = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -212,8 +212,10 @@ namespace Barotrauma
|
|||||||
LevelData levelData = GameMain.GameSession?.Campaign?.NextLevel ?? GameMain.GameSession?.LevelData;
|
LevelData levelData = GameMain.GameSession?.Campaign?.NextLevel ?? GameMain.GameSession?.LevelData;
|
||||||
linkedSub = new LinkedSubmarine(submarine, id)
|
linkedSub = new LinkedSubmarine(submarine, id)
|
||||||
{
|
{
|
||||||
purchasedLostShuttles = GameMain.GameSession?.GameMode is CampaignMode campaign && campaign.PurchasedLostShuttles,
|
purchasedLostShuttles =
|
||||||
saveElement = element
|
(GameMain.GameSession?.GameMode is CampaignMode campaign && campaign.PurchasedLostShuttles) ||
|
||||||
|
element.GetAttributeBool("purchasedlostshuttle", false),
|
||||||
|
saveElement = new XElement(element)
|
||||||
};
|
};
|
||||||
|
|
||||||
bool levelMatches = string.IsNullOrWhiteSpace(levelSeed) || levelData == null || levelData.Seed == levelSeed;
|
bool levelMatches = string.IsNullOrWhiteSpace(levelSeed) || levelData == null || levelData.Seed == levelSeed;
|
||||||
@@ -282,6 +284,8 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveElement.Attribute("purchasedlostshuttle")?.Remove();
|
||||||
|
|
||||||
IdRemap parentRemap = new IdRemap(Submarine.Info.SubmarineElement, Submarine.IdOffset);
|
IdRemap parentRemap = new IdRemap(Submarine.Info.SubmarineElement, Submarine.IdOffset);
|
||||||
sub = Submarine.Load(info, false, parentRemap);
|
sub = Submarine.Load(info, false, parentRemap);
|
||||||
sub.Info.SubmarineClass = Submarine.Info.SubmarineClass;
|
sub.Info.SubmarineClass = Submarine.Info.SubmarineClass;
|
||||||
@@ -442,14 +446,22 @@ namespace Barotrauma
|
|||||||
saveElement.Attribute("previewimage").Remove();
|
saveElement.Attribute("previewimage").Remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saveElement.Attribute("pos") != null) { saveElement.Attribute("pos").Remove(); }
|
if (GameMain.GameSession?.GameMode is CampaignMode campaign && campaign.PurchasedLostShuttles)
|
||||||
saveElement.Add(new XAttribute("pos", XMLExtensions.Vector2ToString(Position - Submarine.HiddenSubPosition)));
|
|
||||||
|
|
||||||
var linkedPort = linkedTo.FirstOrDefault(lt => (lt is Item) && ((Item)lt).GetComponent<DockingPort>() != null);
|
|
||||||
if (linkedPort != null)
|
|
||||||
{
|
{
|
||||||
saveElement.Attribute("linkedto")?.Remove();
|
saveElement.SetAttributeValue("purchasedlostshuttle", true);
|
||||||
saveElement.Add(new XAttribute("linkedto", linkedPort.ID));
|
}
|
||||||
|
|
||||||
|
saveElement.SetAttributeValue("pos", XMLExtensions.Vector2ToString(Position - Submarine.HiddenSubPosition));
|
||||||
|
|
||||||
|
if (linkedTo.Any() || linkedToID.Any())
|
||||||
|
{
|
||||||
|
var linkedPort =
|
||||||
|
linkedTo.FirstOrDefault(lt => (lt is Item item) && item.GetComponent<DockingPort>() != null) ??
|
||||||
|
FindEntityByID(linkedToID.First()) as MapEntity;
|
||||||
|
if (linkedPort != null)
|
||||||
|
{
|
||||||
|
saveElement.SetAttributeValue("linkedto", linkedPort.ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -458,10 +470,8 @@ namespace Barotrauma
|
|||||||
sub.SaveToXElement(saveElement);
|
sub.SaveToXElement(saveElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
saveElement.Attribute("originallinkedto")?.Remove();
|
saveElement.SetAttributeValue("originallinkedto", originalLinkedPort != null ? originalLinkedPort.Item.ID : originalLinkedToID);
|
||||||
saveElement.Add(new XAttribute("originallinkedto", originalLinkedPort != null ? originalLinkedPort.Item.ID : originalLinkedToID));
|
saveElement.SetAttributeValue("originalmyport", originalMyPortID);
|
||||||
saveElement.Attribute("originalmyport")?.Remove();
|
|
||||||
saveElement.Add(new XAttribute("originalmyport", originalMyPortID));
|
|
||||||
|
|
||||||
if (sub != null)
|
if (sub != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -113,15 +113,23 @@ namespace Barotrauma
|
|||||||
string teamStr = element.GetAttributeString("outpostteam", "FriendlyNPC");
|
string teamStr = element.GetAttributeString("outpostteam", "FriendlyNPC");
|
||||||
Enum.TryParse(teamStr, out OutpostTeam);
|
Enum.TryParse(teamStr, out OutpostTeam);
|
||||||
|
|
||||||
ContentPath nameFile = element.GetAttributeContentPath("namefile") ?? ContentPath.FromRaw(null, "Content/Map/locationNames.txt");
|
string[] rawNamePaths = element.GetAttributeStringArray("namefile", new string[] { "Content/Map/locationNames.txt" });
|
||||||
try
|
names = new List<string>();
|
||||||
|
foreach (string rawPath in rawNamePaths)
|
||||||
{
|
{
|
||||||
names = File.ReadAllLines(nameFile.Value).ToList();
|
try
|
||||||
|
{
|
||||||
|
var path = ContentPath.FromRaw(element.ContentPackage, rawPath.Trim());
|
||||||
|
names.AddRange(File.ReadAllLines(path.Value).ToList());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError($"Failed to read name file \"rawPath\" for location type \"{Identifier}\"!", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
if (!names.Any())
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Failed to read name file for location type \"" + Identifier + "\"!", e);
|
names.Add("ERROR: No names found");
|
||||||
names = new List<string>() { "Name file not found" };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string[] commonnessPerZoneStrs = element.GetAttributeStringArray("commonnessperzone", Array.Empty<string>());
|
string[] commonnessPerZoneStrs = element.GetAttributeStringArray("commonnessperzone", Array.Empty<string>());
|
||||||
|
|||||||
@@ -20,11 +20,24 @@ namespace Barotrauma
|
|||||||
public int Height { get; private set; }
|
public int Height { get; private set; }
|
||||||
|
|
||||||
public Action<Location, LocationConnection> OnLocationSelected;
|
public Action<Location, LocationConnection> OnLocationSelected;
|
||||||
|
public Action<LocationConnection, IEnumerable<Mission>> OnMissionsSelected;
|
||||||
|
|
||||||
|
public readonly struct LocationChangeInfo
|
||||||
|
{
|
||||||
|
public readonly Location PrevLocation;
|
||||||
|
public readonly Location NewLocation;
|
||||||
|
|
||||||
|
public LocationChangeInfo(Location prevLocation, Location newLocation)
|
||||||
|
{
|
||||||
|
PrevLocation = prevLocation;
|
||||||
|
NewLocation = newLocation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// From -> To
|
/// From -> To
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action<Location, Location> OnLocationChanged;
|
public readonly NamedEvent<LocationChangeInfo> OnLocationChanged = new NamedEvent<LocationChangeInfo>();
|
||||||
public Action<LocationConnection, IEnumerable<Mission>> OnMissionsSelected;
|
|
||||||
|
|
||||||
public Location EndLocation { get; private set; }
|
public Location EndLocation { get; private set; }
|
||||||
|
|
||||||
@@ -766,7 +779,7 @@ namespace Barotrauma
|
|||||||
SelectedLocation = null;
|
SelectedLocation = null;
|
||||||
|
|
||||||
CurrentLocation.CreateStores();
|
CurrentLocation.CreateStores();
|
||||||
OnLocationChanged?.Invoke(prevLocation, CurrentLocation);
|
OnLocationChanged?.Invoke(new LocationChangeInfo(prevLocation, CurrentLocation));
|
||||||
|
|
||||||
if (GameMain.GameSession is { Campaign: { CampaignMetadata: { } metadata } })
|
if (GameMain.GameSession is { Campaign: { CampaignMetadata: { } metadata } })
|
||||||
{
|
{
|
||||||
@@ -803,7 +816,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
connection.Passed = true;
|
connection.Passed = true;
|
||||||
}
|
}
|
||||||
OnLocationChanged?.Invoke(prevLocation, CurrentLocation);
|
OnLocationChanged?.Invoke(new LocationChangeInfo(prevLocation, CurrentLocation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -542,6 +542,7 @@ namespace Barotrauma
|
|||||||
mapEntityList.Remove(this);
|
mapEntityList.Remove(this);
|
||||||
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
|
Submarine.ForceRemoveFromVisibleEntities(this);
|
||||||
if (SelectedList.Contains(this))
|
if (SelectedList.Contains(this))
|
||||||
{
|
{
|
||||||
SelectedList = SelectedList.Where(e => e != this).ToHashSet();
|
SelectedList = SelectedList.Where(e => e != this).ToHashSet();
|
||||||
|
|||||||
@@ -52,7 +52,9 @@ namespace Barotrauma
|
|||||||
get { return MainSubs[0]; }
|
get { return MainSubs[0]; }
|
||||||
set { MainSubs[0] = value; }
|
set { MainSubs[0] = value; }
|
||||||
}
|
}
|
||||||
private static List<Submarine> loaded = new List<Submarine>();
|
private static readonly List<Submarine> loaded = new List<Submarine>();
|
||||||
|
|
||||||
|
private readonly Identifier upgradeEventIdentifier;
|
||||||
|
|
||||||
private static List<MapEntity> visibleEntities;
|
private static List<MapEntity> visibleEntities;
|
||||||
public static IEnumerable<MapEntity> VisibleEntities
|
public static IEnumerable<MapEntity> VisibleEntities
|
||||||
@@ -1301,6 +1303,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public Submarine(SubmarineInfo info, bool showWarningMessages = true, Func<Submarine, List<MapEntity>> loadEntities = null, IdRemap linkedRemap = null) : base(null, Entity.NullEntityID)
|
public Submarine(SubmarineInfo info, bool showWarningMessages = true, Func<Submarine, List<MapEntity>> loadEntities = null, IdRemap linkedRemap = null) : base(null, Entity.NullEntityID)
|
||||||
{
|
{
|
||||||
|
upgradeEventIdentifier = new Identifier($"Submarine{ID}");
|
||||||
Loading = true;
|
Loading = true;
|
||||||
GameMain.World.Enabled = false;
|
GameMain.World.Enabled = false;
|
||||||
try
|
try
|
||||||
@@ -1462,10 +1465,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameMain.GameSession?.Campaign?.UpgradeManager != null)
|
GameMain.GameSession?.Campaign?.UpgradeManager?.OnUpgradesChanged.Register(upgradeEventIdentifier, _ => ResetCrushDepth());
|
||||||
{
|
|
||||||
GameMain.GameSession.Campaign.UpgradeManager.OnUpgradesChanged += ResetCrushDepth;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
GameMain.LightManager.OnMapLoaded();
|
GameMain.LightManager.OnMapLoaded();
|
||||||
@@ -1527,6 +1527,13 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CheckFuel()
|
||||||
|
{
|
||||||
|
float fuel = GetItems(true).Where(i => i.HasTag("reactorfuel")).Sum(i => i.Condition);
|
||||||
|
Info.LowFuel = fuel < 200;
|
||||||
|
return !Info.LowFuel;
|
||||||
|
}
|
||||||
|
|
||||||
public void SaveToXElement(XElement element)
|
public void SaveToXElement(XElement element)
|
||||||
{
|
{
|
||||||
element.Add(new XAttribute("name", Info.Name));
|
element.Add(new XAttribute("name", Info.Name));
|
||||||
@@ -1534,7 +1541,10 @@ namespace Barotrauma
|
|||||||
element.Add(new XAttribute("checkval", Rand.Int(int.MaxValue)));
|
element.Add(new XAttribute("checkval", Rand.Int(int.MaxValue)));
|
||||||
element.Add(new XAttribute("price", Info.Price));
|
element.Add(new XAttribute("price", Info.Price));
|
||||||
element.Add(new XAttribute("initialsuppliesspawned", Info.InitialSuppliesSpawned));
|
element.Add(new XAttribute("initialsuppliesspawned", Info.InitialSuppliesSpawned));
|
||||||
|
element.Add(new XAttribute("noitems", Info.NoItems));
|
||||||
|
element.Add(new XAttribute("lowfuel", !CheckFuel()));
|
||||||
element.Add(new XAttribute("type", Info.Type.ToString()));
|
element.Add(new XAttribute("type", Info.Type.ToString()));
|
||||||
|
element.Add(new XAttribute("ismanuallyoutfitted", Info.IsManuallyOutfitted));
|
||||||
if (Info.IsPlayer && !Info.HasTag(SubmarineTag.Shuttle))
|
if (Info.IsPlayer && !Info.HasTag(SubmarineTag.Shuttle))
|
||||||
{
|
{
|
||||||
element.Add(new XAttribute("class", Info.SubmarineClass.ToString()));
|
element.Add(new XAttribute("class", Info.SubmarineClass.ToString()));
|
||||||
@@ -1623,7 +1633,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
e.Save(element);
|
e.Save(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info.CheckSubsLeftBehind(element);
|
Info.CheckSubsLeftBehind(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1727,10 +1736,7 @@ namespace Barotrauma
|
|||||||
outdoorNodes?.Clear();
|
outdoorNodes?.Clear();
|
||||||
outdoorNodes = null;
|
outdoorNodes = null;
|
||||||
|
|
||||||
if (GameMain.GameSession?.Campaign?.UpgradeManager != null)
|
GameMain.GameSession?.Campaign?.UpgradeManager?.OnUpgradesChanged?.TryDeregister(upgradeEventIdentifier);
|
||||||
{
|
|
||||||
GameMain.GameSession.Campaign.UpgradeManager.OnUpgradesChanged -= ResetCrushDepth;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entityGrid != null)
|
if (entityGrid != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -598,7 +598,12 @@ namespace Barotrauma
|
|||||||
if (newHull != null)
|
if (newHull != null)
|
||||||
{
|
{
|
||||||
CoroutineManager.Invoke(() =>
|
CoroutineManager.Invoke(() =>
|
||||||
character.AnimController.FindHull(newHull.WorldPosition, setSubmarine: true));
|
{
|
||||||
|
if (character != null && !character.Removed)
|
||||||
|
{
|
||||||
|
character.AnimController.FindHull(newHull.WorldPosition, setSubmarine: true);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -86,6 +86,21 @@ namespace Barotrauma
|
|||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool NoItems
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Note: Refreshed for loaded submarines when they are saved, when they are loaded, and on round end. If you need to refresh it, please use Submarine.CheckFuel() method!
|
||||||
|
/// </summary>
|
||||||
|
public bool LowFuel
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
public Version GameVersion
|
public Version GameVersion
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
@@ -94,6 +109,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public SubmarineType Type { get; set; }
|
public SubmarineType Type { get; set; }
|
||||||
|
|
||||||
|
public bool IsManuallyOutfitted { get; set; }
|
||||||
|
|
||||||
public SubmarineClass SubmarineClass;
|
public SubmarineClass SubmarineClass;
|
||||||
|
|
||||||
public OutpostModuleInfo OutpostModuleInfo { get; set; }
|
public OutpostModuleInfo OutpostModuleInfo { get; set; }
|
||||||
@@ -272,6 +289,8 @@ namespace Barotrauma
|
|||||||
Description = original.Description;
|
Description = original.Description;
|
||||||
Price = original.Price;
|
Price = original.Price;
|
||||||
InitialSuppliesSpawned = original.InitialSuppliesSpawned;
|
InitialSuppliesSpawned = original.InitialSuppliesSpawned;
|
||||||
|
NoItems = original.NoItems;
|
||||||
|
LowFuel = original.LowFuel;
|
||||||
GameVersion = original.GameVersion;
|
GameVersion = original.GameVersion;
|
||||||
Type = original.Type;
|
Type = original.Type;
|
||||||
SubmarineClass = original.SubmarineClass;
|
SubmarineClass = original.SubmarineClass;
|
||||||
@@ -286,6 +305,7 @@ namespace Barotrauma
|
|||||||
RecommendedCrewExperience = original.RecommendedCrewExperience;
|
RecommendedCrewExperience = original.RecommendedCrewExperience;
|
||||||
RecommendedCrewSizeMin = original.RecommendedCrewSizeMin;
|
RecommendedCrewSizeMin = original.RecommendedCrewSizeMin;
|
||||||
RecommendedCrewSizeMax = original.RecommendedCrewSizeMax;
|
RecommendedCrewSizeMax = original.RecommendedCrewSizeMax;
|
||||||
|
IsManuallyOutfitted = original.IsManuallyOutfitted;
|
||||||
Tags = original.Tags;
|
Tags = original.Tags;
|
||||||
if (original.OutpostModuleInfo != null)
|
if (original.OutpostModuleInfo != null)
|
||||||
{
|
{
|
||||||
@@ -335,6 +355,9 @@ namespace Barotrauma
|
|||||||
Price = SubmarineElement.GetAttributeInt("price", 1000);
|
Price = SubmarineElement.GetAttributeInt("price", 1000);
|
||||||
|
|
||||||
InitialSuppliesSpawned = SubmarineElement.GetAttributeBool("initialsuppliesspawned", false);
|
InitialSuppliesSpawned = SubmarineElement.GetAttributeBool("initialsuppliesspawned", false);
|
||||||
|
NoItems = SubmarineElement.GetAttributeBool("noitems", false);
|
||||||
|
LowFuel = SubmarineElement.GetAttributeBool("lowfuel", false);
|
||||||
|
IsManuallyOutfitted = SubmarineElement.GetAttributeBool("ismanuallyoutfitted", false);
|
||||||
|
|
||||||
GameVersion = new Version(SubmarineElement.GetAttributeString("gameversion", "0.0.0.0"));
|
GameVersion = new Version(SubmarineElement.GetAttributeString("gameversion", "0.0.0.0"));
|
||||||
if (Enum.TryParse(SubmarineElement.GetAttributeString("tags", ""), out SubmarineTag tags))
|
if (Enum.TryParse(SubmarineElement.GetAttributeString("tags", ""), out SubmarineTag tags))
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ namespace Barotrauma.Networking
|
|||||||
if (hull.Submarine != RespawnShuttle) { continue; }
|
if (hull.Submarine != RespawnShuttle) { continue; }
|
||||||
hull.OxygenPercentage = 100.0f;
|
hull.OxygenPercentage = 100.0f;
|
||||||
hull.WaterVolume = 0.0f;
|
hull.WaterVolume = 0.0f;
|
||||||
hull.BallastFlora?.Kill();
|
hull.BallastFlora?.Remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<Character, Vector2> characterPositions = new Dictionary<Character, Vector2>();
|
Dictionary<Character, Vector2> characterPositions = new Dictionary<Character, Vector2>();
|
||||||
|
|||||||
@@ -1,17 +1,12 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Barotrauma.Extensions;
|
||||||
|
using Barotrauma.IO;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Globalization;
|
|
||||||
using Barotrauma.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Xml;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
using Barotrauma.Extensions;
|
|
||||||
|
|
||||||
namespace Barotrauma.Networking
|
namespace Barotrauma.Networking
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -405,6 +405,8 @@ namespace Barotrauma
|
|||||||
FarseerBody.Restitution = limbParams.Restitution;
|
FarseerBody.Restitution = limbParams.Restitution;
|
||||||
FarseerBody.AngularDamping = limbParams.AngularDamping;
|
FarseerBody.AngularDamping = limbParams.AngularDamping;
|
||||||
FarseerBody.UserData = this;
|
FarseerBody.UserData = this;
|
||||||
|
_collisionCategories = collisionCategory;
|
||||||
|
_collidesWith = collidesWith;
|
||||||
SetTransformIgnoreContacts(position, 0.0f);
|
SetTransformIgnoreContacts(position, 0.0f);
|
||||||
LastSentPosition = position;
|
LastSentPosition = position;
|
||||||
list.Add(this);
|
list.Add(this);
|
||||||
@@ -418,6 +420,8 @@ namespace Barotrauma
|
|||||||
density = Math.Max(forceDensity ?? element.GetAttributeFloat("density", 10.0f), MinDensity);
|
density = Math.Max(forceDensity ?? element.GetAttributeFloat("density", 10.0f), MinDensity);
|
||||||
Enum.TryParse(element.GetAttributeString("bodytype", "Dynamic"), out BodyType bodyType);
|
Enum.TryParse(element.GetAttributeString("bodytype", "Dynamic"), out BodyType bodyType);
|
||||||
CreateBody(width, height, radius, density, bodyType, collisionCategory, collidesWith, findNewContacts);
|
CreateBody(width, height, radius, density, bodyType, collisionCategory, collidesWith, findNewContacts);
|
||||||
|
_collisionCategories = collisionCategory;
|
||||||
|
_collidesWith = collidesWith;
|
||||||
FarseerBody.Friction = element.GetAttributeFloat("friction", 0.5f);
|
FarseerBody.Friction = element.GetAttributeFloat("friction", 0.5f);
|
||||||
FarseerBody.Restitution = element.GetAttributeFloat("restitution", 0.05f);
|
FarseerBody.Restitution = element.GetAttributeFloat("restitution", 0.05f);
|
||||||
FarseerBody.UserData = this;
|
FarseerBody.UserData = this;
|
||||||
@@ -456,6 +460,8 @@ namespace Barotrauma
|
|||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
|
_collisionCategories = collisionCategory;
|
||||||
|
_collidesWith = collidesWith;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ namespace Barotrauma
|
|||||||
EnableMouseLook = true,
|
EnableMouseLook = true,
|
||||||
ChatOpen = true,
|
ChatOpen = true,
|
||||||
CrewMenuOpen = true,
|
CrewMenuOpen = true,
|
||||||
CampaignDisclaimerShown = false,
|
|
||||||
EditorDisclaimerShown = false,
|
EditorDisclaimerShown = false,
|
||||||
ShowOffensiveServerPrompt = true,
|
ShowOffensiveServerPrompt = true,
|
||||||
TutorialSkipWarning = true,
|
TutorialSkipWarning = true,
|
||||||
@@ -127,7 +126,6 @@ namespace Barotrauma
|
|||||||
public bool EnableMouseLook;
|
public bool EnableMouseLook;
|
||||||
public bool ChatOpen;
|
public bool ChatOpen;
|
||||||
public bool CrewMenuOpen;
|
public bool CrewMenuOpen;
|
||||||
public bool CampaignDisclaimerShown;
|
|
||||||
public bool EditorDisclaimerShown;
|
public bool EditorDisclaimerShown;
|
||||||
public bool ShowOffensiveServerPrompt;
|
public bool ShowOffensiveServerPrompt;
|
||||||
public bool TutorialSkipWarning;
|
public bool TutorialSkipWarning;
|
||||||
@@ -304,6 +302,7 @@ namespace Barotrauma
|
|||||||
{ InputType.Down, Keys.S },
|
{ InputType.Down, Keys.S },
|
||||||
{ InputType.Left, Keys.A },
|
{ InputType.Left, Keys.A },
|
||||||
{ InputType.Right, Keys.D },
|
{ InputType.Right, Keys.D },
|
||||||
|
{ InputType.ToggleInventory, Keys.Q },
|
||||||
|
|
||||||
{ InputType.SelectNextCharacter, Keys.Z },
|
{ InputType.SelectNextCharacter, Keys.Z },
|
||||||
{ InputType.SelectPreviousCharacter, Keys.X },
|
{ InputType.SelectPreviousCharacter, Keys.X },
|
||||||
|
|||||||
@@ -324,7 +324,10 @@ namespace Barotrauma.Steam
|
|||||||
|
|
||||||
using (var copyIndicator = new CopyIndicator(copyIndicatorPath))
|
using (var copyIndicator = new CopyIndicator(copyIndicatorPath))
|
||||||
{
|
{
|
||||||
await CopyDirectory(itemDirectory, modPathDirName ?? modName, itemDirectory, installDir, ShouldCorrectPaths.Yes);
|
await CopyDirectory(itemDirectory, modPathDirName ?? modName, itemDirectory, installDir,
|
||||||
|
gameVersion < new Version(0, 18, 3, 0)
|
||||||
|
? ShouldCorrectPaths.Yes
|
||||||
|
: ShouldCorrectPaths.No);
|
||||||
|
|
||||||
string fileListDestPath = Path.Combine(installDir, ContentPackage.FileListFileName);
|
string fileListDestPath = Path.Combine(installDir, ContentPackage.FileListFileName);
|
||||||
XDocument fileListDest = XMLExtensions.TryLoadXml(fileListDestPath);
|
XDocument fileListDest = XMLExtensions.TryLoadXml(fileListDestPath);
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ namespace Barotrauma
|
|||||||
private readonly LocalizedString primary;
|
private readonly LocalizedString primary;
|
||||||
private readonly LocalizedString fallback;
|
private readonly LocalizedString fallback;
|
||||||
|
|
||||||
private bool primaryIsLoaded = false;
|
public bool PrimaryIsLoaded { get; private set; }
|
||||||
|
|
||||||
public FallbackLString(LocalizedString primary, LocalizedString fallback)
|
public FallbackLString(LocalizedString primary, LocalizedString fallback)
|
||||||
{
|
{
|
||||||
if (primary is FallbackLString {primary: { } innerPrimary, fallback: { } innerFallback})
|
if (primary is FallbackLString { primary: { } innerPrimary, fallback: { } innerFallback })
|
||||||
{
|
{
|
||||||
this.primary = innerPrimary;
|
this.primary = innerPrimary;
|
||||||
this.fallback = innerFallback.Fallback(fallback);
|
this.fallback = innerFallback.Fallback(fallback);
|
||||||
@@ -27,18 +27,27 @@ namespace Barotrauma
|
|||||||
return base.MustRetrieveValue()
|
return base.MustRetrieveValue()
|
||||||
|| MustRetrieveValue(primary)
|
|| MustRetrieveValue(primary)
|
||||||
|| MustRetrieveValue(fallback)
|
|| MustRetrieveValue(fallback)
|
||||||
|| primaryIsLoaded != primary.Loaded;
|
|| PrimaryIsLoaded != primary.Loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Loaded => primary.Loaded || fallback.Loaded;
|
public override bool Loaded => primary.Loaded || fallback.Loaded;
|
||||||
public override void RetrieveValue()
|
public override void RetrieveValue()
|
||||||
{
|
{
|
||||||
cachedValue = primary.Value;
|
cachedValue = primary.Value;
|
||||||
primaryIsLoaded = primary.Loaded;
|
PrimaryIsLoaded = primary.Loaded;
|
||||||
if (!primary.Loaded)
|
if (!primary.Loaded)
|
||||||
{
|
{
|
||||||
cachedValue = fallback.Value;
|
cachedValue = fallback.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LocalizedString GetLastFallback()
|
||||||
|
{
|
||||||
|
if (fallback is FallbackLString innerFallback)
|
||||||
|
{
|
||||||
|
return innerFallback.GetLastFallback();
|
||||||
|
}
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,58 @@
|
|||||||
|
---------------------------------------------------------------------------------------------------------
|
||||||
|
v0.18.15.0
|
||||||
|
---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- Show a warning when trying to switch to a submarine that's low on fuel or to a submarine that has no manually placed items to prevent softlocking the campaign if you switch to a sub that has no fuel. Whether a submarine is considered to have manually placed items can be set when saving it in the submarine editor (the checkbox "manually outfitted" in the saving dialog).
|
||||||
|
- Also show the low fuel warning when leaving an outpost without enough fuel.
|
||||||
|
- Handheld sonars can't detect minerals from inside the sub.
|
||||||
|
- Changed the plus and minus button in the campaign settings into arrows. The button on the right increases difficulty, which in the case of the starting balance and supplies means reducing them, making the plus and minus buttons misleading.
|
||||||
|
- Reduced costs of handheld weapon ammunition significantly.
|
||||||
|
- Slightly reduced effectiveness of harpoons and revolver round to compensate for the cheaper ammo.
|
||||||
|
- Changed recipes for Handcannon, Assault Rifle and Auto-Shotgun. Weapon crafting is more expensive, to compensate for cheaper ammo.
|
||||||
|
- Adjusted numerous other recipes and price costs of materials. Previously little used materials (like tin) are now used more.
|
||||||
|
- Partially reintroduced the "toggle inventory" keybind, now called "toggle entity list". Even though toggling the in-game inventory is no longer possible, the keybind can be used to change the hotkey for toggling the sub editor's entity list.
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- Fixed shuttles getting misplaced when switching and transferring items to a new sub with shuttles.
|
||||||
|
- Fixed inability to damage items (such as monster eggs) with melee weapons or handheld weapons.
|
||||||
|
- Fixed "failed to parse the string 'COLOR.GUI.GREEN' to Color" errors when using the submarine upgrade interface in Spanish.
|
||||||
|
- Fixed items with a projectile component (e.g. bullets, harpoons, syringes) going through external walls when dropped.
|
||||||
|
- Fixed incorrect value in the "too many lights" error message in the sub editor.
|
||||||
|
- Fixed lightcomponent not getting refreshed when flipping a lightcomponent horizontally.
|
||||||
|
- Fixed extra cargo defined in the server settings spawning every round in multiplayer campaign.
|
||||||
|
- Fixes wreck corpses' damage visuals (bloodstains, burns) not showing client-side.
|
||||||
|
- Fixed wearables that are worn (or held) in multiple limbs applying skill bonuses multiple times (e.g. when holding a bandolier with both hands).
|
||||||
|
- Fixed console error when deselecting all target types from a motion sensor in the sub editor.
|
||||||
|
- Fixed crashing when multi-editing motion sensor targets in the sub editor.
|
||||||
|
- Fixed one of the path unlock event texts still using the old price (talking about 12,000 mk even though the price is 4,000 mk).
|
||||||
|
- Fixed money getting incorrectly deducted on the client side when buying items from the vending machine.
|
||||||
|
- Fixed item transfer taking items from non-interactable containers.
|
||||||
|
- Made depleted fuel sprite darker to match the rest of the "depleted" items.
|
||||||
|
- Fixed PUCS's autoinjection feature sometimes causing performance drops in multiplayer.
|
||||||
|
- Fixed "tried to overwrite a submarine that's not in a local package" error when you delete a sub that's in a local package and try to resave it.
|
||||||
|
- Fixed misaligned broken duffelbag sprite.
|
||||||
|
- Fixed full-white x-ray monitors.
|
||||||
|
- Fixed FPS drop when adjusting character appearance in the campaign setup menu or server lobby.
|
||||||
|
- Fixed tunnels at the beginning or end of the level sometimes being too narrow to pass through (especially with a small sub) when there's no outpost at that side of the level.
|
||||||
|
- Fixed missing background sprite in duct block.
|
||||||
|
- Fixed water particles not showing up when water is flowing down a duct block.
|
||||||
|
- Fixed changing the scale of resizeable structures (such as background doors) messing up the outline of linked subs in the sub editor.
|
||||||
|
- Fixed non-player-team interactable items getting transferred on sub switch.
|
||||||
|
- Fixed ballast flora root emitting particles when damaged client-side, even if it's already been destroyed.
|
||||||
|
- Fixed recycle recipes for Piercing Ammunition Box and Pulse Tri-Laser Fuel Box.
|
||||||
|
- Fixed friendly fire and karma always showing up as disabled on dedicated servers in the server list.
|
||||||
|
- Fixed some lights (e.g. vending machines, neon lights, holographics displays) looking different in the sub editor than they do in-game.
|
||||||
|
- Fixed undocked shuttles remaining undocked if you save and start a new game with the same submarine during the same session. Restarting the game fixed the issue though.
|
||||||
|
- Fixed sonar markers going crazy if the start and end locations have the same name + added some more variety to location names to prevent duplicate location names.
|
||||||
|
- Fixed multiediting an ItemComponent modifying all the components of that type in all the selected items (e.g. when editing the 1st light component of a switch, all lights in all switches would be edited).
|
||||||
|
- Fixed spineling spikes fired by a human with spineling genes not damaging any human characters (enemies in PvP, pirates in pirate missions) when friendly fire is disabled.
|
||||||
|
- Fixed melee weapons not damaging structures from outside.
|
||||||
|
|
||||||
|
Modding:
|
||||||
|
- Fixed removing a door mid-round crashing the game. Does not affect the vanilla game, because doors are never removed mid-round.
|
||||||
|
- Fixed having a vending machine in your inventory crashing the game due to the 0-capacity input inventory of the machine.
|
||||||
|
|
||||||
---------------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------------
|
||||||
v0.18.12.0
|
v0.18.12.0
|
||||||
---------------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
+4
-1
@@ -3,7 +3,10 @@
|
|||||||
Welcome to Barotrauma's GitHub repository! If you're here to report an issue or to contribute to the development, please read the instructions below before you do.
|
Welcome to Barotrauma's GitHub repository! If you're here to report an issue or to contribute to the development, please read the instructions below before you do.
|
||||||
|
|
||||||
## I have a question!
|
## I have a question!
|
||||||
Please check [our FAQ](https://barotraumagame.com/faq/) in case the question has already been answered. If not, you can post the question on the [Barotrauma discussion forum](https://undertowgames.com/forum/viewforum.php?f=17) or stop by at our [Discord Server](https://discord.gg/undertow).
|
Please check [our FAQ](https://barotraumagame.com/faq/) in case the question has already been answered. If not, you can post the question on the [GitHub discussions](https://github.com/Regalis11/Barotrauma/discussions) or stop by at our [Discord Server](https://discord.gg/undertow).
|
||||||
|
|
||||||
|
## I have an idea or feature request!
|
||||||
|
This GitHub issue tracker is only intended for bug reports. Ideas, development suggestions and feature requests should be posted in the [GitHub discussions](https://github.com/Regalis11/Barotrauma/discussions).
|
||||||
|
|
||||||
## Reporting a bug
|
## Reporting a bug
|
||||||
If you've encountered a bug, you can report it in the [issue tracker](https://github.com/Regalis11/Barotrauma/issues). Please follow the instructions in the issue template to make it easier for us to diagnose and fix the issue.
|
If you've encountered a bug, you can report it in the [issue tracker](https://github.com/Regalis11/Barotrauma/issues). Please follow the instructions in the issue template to make it easier for us to diagnose and fix the issue.
|
||||||
|
|||||||
@@ -15,16 +15,16 @@ namespace Microsoft.Xna.Framework.Input
|
|||||||
{
|
{
|
||||||
return PrimaryWindow.Handle;
|
return PrimaryWindow.Handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PlatformSetWindowHandle(IntPtr windowHandle)
|
private static void PlatformSetWindowHandle(IntPtr windowHandle)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MouseState PlatformGetState(GameWindow window)
|
private static MouseState PlatformGetState(GameWindow window)
|
||||||
{
|
{
|
||||||
int x, y;
|
|
||||||
var winFlags = Sdl.Window.GetWindowFlags(window.Handle);
|
var winFlags = Sdl.Window.GetWindowFlags(window.Handle);
|
||||||
var state = Sdl.Mouse.GetGlobalState(out x, out y);
|
var state = Sdl.Mouse.GetState(out int x, out int y);
|
||||||
|
var globalState = Sdl.Mouse.GetGlobalState(out int globalX, out int globalY);
|
||||||
|
|
||||||
if ((winFlags & Sdl.Window.State.MouseFocus) != 0)
|
if ((winFlags & Sdl.Window.State.MouseFocus) != 0)
|
||||||
{
|
{
|
||||||
@@ -42,8 +42,8 @@ namespace Microsoft.Xna.Framework.Input
|
|||||||
{
|
{
|
||||||
// Window does not have mouse focus, we need to manually get the position
|
// Window does not have mouse focus, we need to manually get the position
|
||||||
var clientBounds = window.ClientBounds;
|
var clientBounds = window.ClientBounds;
|
||||||
window.MouseState.X = x - clientBounds.X;
|
window.MouseState.X = globalX - clientBounds.X;
|
||||||
window.MouseState.Y = y - clientBounds.Y;
|
window.MouseState.Y = globalY - clientBounds.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
return window.MouseState;
|
return window.MouseState;
|
||||||
@@ -53,7 +53,6 @@ namespace Microsoft.Xna.Framework.Input
|
|||||||
{
|
{
|
||||||
PrimaryWindow.MouseState.X = x;
|
PrimaryWindow.MouseState.X = x;
|
||||||
PrimaryWindow.MouseState.Y = y;
|
PrimaryWindow.MouseState.Y = y;
|
||||||
|
|
||||||
Sdl.Mouse.WarpInWindow(PrimaryWindow.Handle, x, y);
|
Sdl.Mouse.WarpInWindow(PrimaryWindow.Handle, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user