Unstable v0.15.17.0 (Hex is out of town edition)

This commit is contained in:
Juan Pablo Arce
2021-12-03 13:31:10 -03:00
parent cd5c8f3e13
commit 617d9ede88
245 changed files with 8088 additions and 5842 deletions
@@ -365,6 +365,30 @@ namespace Barotrauma
public const int MaxCurrentOrders = 3;
public static int HighestManualOrderPriority => MaxCurrentOrders;
public int GetManualOrderPriority(Order order)
{
if (order != null && order.AssignmentPriority < 100 && CurrentOrders.Any())
{
int orderPriority = HighestManualOrderPriority;
for (int i = 0; i < CurrentOrders.Count; i++)
{
if (CurrentOrders[i].Order is Order currentOrder && order.AssignmentPriority >= currentOrder.AssignmentPriority)
{
break;
}
else
{
orderPriority--;
}
}
return Math.Max(orderPriority, 1);
}
else
{
return HighestManualOrderPriority;
}
}
public List<OrderInfo> CurrentOrders { get; } = new List<OrderInfo>();
//unique ID given to character infos in MP
@@ -1387,7 +1411,6 @@ namespace Barotrauma
foreach (var savedStat in statValuePair.Value)
{
if (savedStat.StatValue == 0f) { continue; }
if (savedStat.RemoveAfterRound) { continue; }
savedStatElement.Add(new XElement("savedstatvalue",
new XAttribute("stattype", statValuePair.Key.ToString()),
@@ -1745,6 +1768,20 @@ namespace Barotrauma
OnPermanentStatChanged(statType);
}
public void RemoveSavedStatValuesOnDeath()
{
foreach (StatTypes statType in SavedStatValues.Keys)
{
foreach (SavedStatValue savedStatValue in SavedStatValues[statType])
{
if (!savedStatValue.RemoveOnDeath) { continue; }
if (MathUtils.NearlyEqual(savedStatValue.StatValue, 0.0f)) { continue; }
savedStatValue.StatValue = 0.0f;
// no need to make a network update, as this is only done after the character has died
}
}
}
public void ResetSavedStatValue(string statIdentifier)
{
foreach (StatTypes statType in SavedStatValues.Keys)
@@ -1784,7 +1821,7 @@ namespace Barotrauma
}
}
public void ChangeSavedStatValue(StatTypes statType, float value, string statIdentifier, bool removeOnDeath, bool removeAfterRound = false, float maxValue = float.MaxValue, bool setValue = false)
public void ChangeSavedStatValue(StatTypes statType, float value, string statIdentifier, bool removeOnDeath, float maxValue = float.MaxValue, bool setValue = false)
{
if (!SavedStatValues.ContainsKey(statType))
{
@@ -1800,7 +1837,7 @@ namespace Barotrauma
}
else
{
SavedStatValues[statType].Add(new SavedStatValue(statIdentifier, MathHelper.Min(value, maxValue), removeOnDeath, removeAfterRound));
SavedStatValues[statType].Add(new SavedStatValue(statIdentifier, MathHelper.Min(value, maxValue), removeOnDeath));
changed = true;
}
if (changed) { OnPermanentStatChanged(statType); }
@@ -1812,14 +1849,12 @@ namespace Barotrauma
public string StatIdentifier { get; set; }
public float StatValue { get; set; }
public bool RemoveOnDeath { get; set; }
public bool RemoveAfterRound { get; set; }
public SavedStatValue(string statIdentifier, float value, bool removeOnDeath, bool retainAfterRound)
public SavedStatValue(string statIdentifier, float value, bool removeOnDeath)
{
StatValue = value;
RemoveOnDeath = removeOnDeath;
StatIdentifier = statIdentifier;
RemoveAfterRound = retainAfterRound;
}
}