0.15.21.0

This commit is contained in:
Markus Isberg
2021-12-16 01:05:43 +09:00
parent 617d9ede88
commit 7d43cb1e91
74 changed files with 487 additions and 541 deletions
@@ -207,8 +207,14 @@ namespace Barotrauma.Items.Components
if (!item.linkedTo.Contains(target.item)) { item.linkedTo.Add(target.item); }
if (!target.item.linkedTo.Contains(item)) { target.item.linkedTo.Add(item); }
if (!target.item.Submarine.DockedTo.Contains(item.Submarine)) target.item.Submarine.ConnectedDockingPorts.Add(item.Submarine, target);
if (!item.Submarine.DockedTo.Contains(target.item.Submarine)) item.Submarine.ConnectedDockingPorts.Add(target.item.Submarine, this);
if (!target.item.Submarine.DockedTo.Contains(item.Submarine))
{
target.item.Submarine.ConnectedDockingPorts.Add(item.Submarine, target);
}
if (!item.Submarine.DockedTo.Contains(target.item.Submarine))
{
item.Submarine.ConnectedDockingPorts.Add(target.item.Submarine, this);
}
DockingTarget = target;
DockingTarget.DockingTarget = this;
@@ -869,11 +875,17 @@ namespace Barotrauma.Items.Components
if (myWayPoint != null && targetWayPoint != null)
{
myWayPoint.FindHull();
myWayPoint.linkedTo.Remove(targetWayPoint);
myWayPoint.OnLinksChanged?.Invoke(myWayPoint);
if (myWayPoint.linkedTo.Contains(targetWayPoint))
{
myWayPoint.linkedTo.Remove(targetWayPoint);
myWayPoint.OnLinksChanged?.Invoke(myWayPoint);
}
targetWayPoint.FindHull();
targetWayPoint.linkedTo.Remove(myWayPoint);
targetWayPoint.OnLinksChanged?.Invoke(targetWayPoint);
if (targetWayPoint.linkedTo.Contains(myWayPoint))
{
targetWayPoint.linkedTo.Remove(myWayPoint);
targetWayPoint.OnLinksChanged?.Invoke(targetWayPoint);
}
}
}
@@ -19,7 +19,7 @@ namespace Barotrauma.Items.Components
private float userDeconstructorSpeedMultiplier = 1.0f;
private const float TinkeringSpeedIncrease = 1.5f;
private const float TinkeringSpeedIncrease = 2.5f;
private ItemContainer inputContainer, outputContainer;
@@ -37,7 +37,7 @@ namespace Barotrauma.Items.Components
[Serialize(1.0f, true)]
public float SkillRequirementMultiplier { get; set; }
private const float TinkeringSpeedIncrease = 1.5f;
private const float TinkeringSpeedIncrease = 2.5f;
private enum FabricatorState
{
@@ -70,7 +70,7 @@ namespace Barotrauma.Items.Components
public bool HasPower => IsActive && Voltage >= MinVoltage;
public bool IsAutoControlled => pumpSpeedLockTimer > 0.0f || isActiveLockTimer > 0.0f;
private const float TinkeringSpeedIncrease = 1.5f;
private const float TinkeringSpeedIncrease = 4.0f;
public Pump(Item item, XElement element)
: base(item, element)
@@ -16,8 +16,6 @@ namespace Barotrauma.Items.Components
private float deteriorationTimer;
private float deteriorateAlwaysResetTimer;
private float repairBoost;
bool wasBroken;
bool wasGoodCondition;
@@ -208,7 +206,7 @@ namespace Barotrauma.Items.Components
public float RepairDegreeOfSuccess(Character character, List<Skill> skills)
{
if (skills.Count == 0) return 1.0f;
if (skills.Count == 0) { return 1.0f; }
float skillSum = (from t in skills let characterLevel = character.GetSkillLevel(t.Identifier) select (characterLevel - (t.Level * SkillRequirementMultiplier))).Sum();
float average = skillSum / skills.Count;
@@ -220,11 +218,14 @@ namespace Barotrauma.Items.Components
{
if (qteSuccess)
{
repairBoost = RepairDegreeOfSuccess(CurrentFixer, requiredSkills) * 3 * (currentFixerAction == FixActions.Repair ? 1.0f : -1.0f);
item.Condition += RepairDegreeOfSuccess(CurrentFixer, requiredSkills) * 3 * (currentFixerAction == FixActions.Repair ? 1.0f : -1.0f);
}
else
else if (Rand.Range(0.0f, 2.0f) > RepairDegreeOfSuccess(CurrentFixer, requiredSkills))
{
repairBoost = (1 - RepairDegreeOfSuccess(CurrentFixer, requiredSkills)) * 10 * (currentFixerAction == FixActions.Repair ? -1.0f : 1.0f);
ApplyStatusEffects(ActionType.OnFailure, 1.0f, CurrentFixer);
#if SERVER
GameMain.Server?.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.ApplyStatusEffect, ActionType.OnFailure, this, CurrentFixer.ID });
#endif
}
}
@@ -312,6 +313,8 @@ namespace Barotrauma.Items.Components
currentRepairItem = null;
currentFixerAction = FixActions.None;
#if CLIENT
qteTimer = QteDuration;
qteCooldown = 0.0f;
repairSoundChannel?.FadeOutAndDispose();
repairSoundChannel = null;
#endif
@@ -423,12 +426,6 @@ namespace Barotrauma.Items.Components
wasGoodCondition = true;
}
if (!MathUtils.NearlyEqual(repairBoost, 0.0f))
{
item.Condition += repairBoost;
repairBoost = 0.0f;
}
float fixDuration = MathHelper.Lerp(FixDurationLowSkill, FixDurationHighSkill, successFactor);
fixDuration /= 1 + CurrentFixer.GetStatValue(StatTypes.RepairSpeed) + currentRepairItem?.Prefab.AddedRepairSpeedMultiplier ?? 0f;
fixDuration /= 1 + item.GetQualityModifier(Quality.StatType.RepairSpeed);
@@ -77,7 +77,7 @@ namespace Barotrauma.Items.Components
//item in water -> we definitely want to send the True output
isInWater = true;
}
else if (item.CurrentHull != null && item.CurrentHull.WaterPercentage > 0.0f)
else if (item.CurrentHull != null && item.CurrentHull.WaterPercentage > 0.0f && item.CurrentHull.WaterVolume > 1.0f)
{
//(center of the) item in not water -> check if the water surface is below the bottom of the item's rect
if (item.CurrentHull.Surface > item.Rect.Y - item.Rect.Height)
@@ -102,7 +102,7 @@ namespace Barotrauma.Items.Components
{
int waterPercentage = 0;
//ignore minuscule amounts of water
if (item.CurrentHull.WaterVolume < 1.0f)
if (item.CurrentHull.WaterVolume > 1.0f)
{
waterPercentage = MathHelper.Clamp((int)Math.Ceiling(item.CurrentHull.WaterPercentage), 0, 100);
}