Release 1.11.4.1 (Winter Update)
This commit is contained in:
@@ -461,10 +461,25 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public float ImpactTolerance => Prefab.ImpactTolerance;
|
||||
private float impactTolerance;
|
||||
[Serialize(0.0f, IsPropertySaveable.No), ConditionallyEditable(ConditionallyEditable.ConditionType.ReceivesSubmarineImpacts, MinValueFloat = 0, MaxValueFloat = 100)]
|
||||
public float ImpactTolerance
|
||||
{
|
||||
get { return impactTolerance; }
|
||||
set { impactTolerance = Math.Max(value, 0.0f); }
|
||||
}
|
||||
|
||||
public float ImpactDamage => Prefab.ImpactDamage;
|
||||
public float ImpactDamageProbability => Prefab.ImpactDamageProbability;
|
||||
[Serialize(0.0f, IsPropertySaveable.No, description: "The amount of damage the item takes from impacts. Acts as a multiplier on the strength of the impact. Note that ImpactTolerance must be set for impacts to register."),
|
||||
ConditionallyEditable(ConditionallyEditable.ConditionType.ReceivesSubmarineImpacts, MinValueFloat = 0, MaxValueFloat = 100)]
|
||||
public float ImpactDamage { get; set; }
|
||||
|
||||
[Serialize(1.0f, IsPropertySaveable.No, description: "Probability for impacts to register. Defaults to 1. Note that ImpactTolerance must also be set for impacts to register."),
|
||||
ConditionallyEditable(ConditionallyEditable.ConditionType.ReceivesSubmarineImpacts, MinValueFloat = 0, MaxValueFloat = 1)]
|
||||
public float ImpactDamageProbability { get; set; }
|
||||
|
||||
public const float SubmarineImpactCooldown = 0.1f;
|
||||
|
||||
public double LastSubmarineImpactTime;
|
||||
|
||||
public float InteractDistance => Prefab.InteractDistance;
|
||||
|
||||
@@ -1556,7 +1571,7 @@ namespace Barotrauma
|
||||
if (!updateableComponents.Contains(component))
|
||||
{
|
||||
updateableComponents.Add(component);
|
||||
this.isActive = true;
|
||||
this.IsActive = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1647,7 +1662,19 @@ namespace Barotrauma
|
||||
contained.Container = null;
|
||||
}
|
||||
|
||||
public void SetTransform(Vector2 simPosition, float rotation, bool findNewHull = true, bool setPrevTransform = true)
|
||||
/// <summary>
|
||||
/// Sets the position and rotation of the item, and its physics body if it has one.
|
||||
/// </summary>
|
||||
/// <param name="simPosition">Position in simulation units.</param>
|
||||
/// <param name="rotation">Rotation in radians</param>
|
||||
/// <param name="findNewHull">Should the hull the item is inside be immediately updated? Generally only useful to set to false
|
||||
/// for performance reasons when finding the hull is unnecessary (e.g. if it's being forced to something after setting the transform).</param>
|
||||
/// <param name="setPrevTransform">Should the previous transform of the item be immediately set to the new one?
|
||||
/// The previous transform is used to interpolate draw positions/rotations, and you should generally only set this to false if
|
||||
/// you're trying to simulate movement instead of simply teleporting the item somewhere.</param>
|
||||
/// <param name="forceSubmarine">If you know the position is in a specific sub's coordinate space and want to ensure the item
|
||||
/// is still considered to be in that sub even if the transform ended up outside hulls.</param>
|
||||
public void SetTransform(Vector2 simPosition, float rotation, bool findNewHull = true, bool setPrevTransform = true, Submarine forceSubmarine = null)
|
||||
{
|
||||
if (!MathUtils.IsValid(simPosition))
|
||||
{
|
||||
@@ -1685,6 +1712,7 @@ namespace Barotrauma
|
||||
rect.Y = (int)MathF.Round(displayPos.Y + rect.Height / 2.0f);
|
||||
|
||||
if (findNewHull) { FindHull(); }
|
||||
if (forceSubmarine != null) { Submarine = forceSubmarine; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1856,7 +1884,7 @@ namespace Barotrauma
|
||||
if (newRootContainer != RootContainer)
|
||||
{
|
||||
RootContainer = newRootContainer;
|
||||
isActive = true;
|
||||
IsActive = true;
|
||||
foreach (Item containedItem in ContainedItems)
|
||||
{
|
||||
containedItem.RefreshRootContainer();
|
||||
@@ -2371,12 +2399,16 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private bool isActive = true;
|
||||
/// <summary>
|
||||
/// Inactive items are not updated. Note that actions such as dropping can reactivate the item, and that the item can go inactive by itself if it no longer needs updating;
|
||||
/// </summary>
|
||||
public bool IsActive = true;
|
||||
|
||||
public bool IsInRemoveQueue;
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
if (!isActive || IsLayerHidden || IsInRemoveQueue) { return; }
|
||||
if (!IsActive || IsLayerHidden || IsInRemoveQueue) { return; }
|
||||
|
||||
if (impactQueue != null)
|
||||
{
|
||||
@@ -2542,7 +2574,7 @@ namespace Barotrauma
|
||||
#if CLIENT
|
||||
positionBuffer.Clear();
|
||||
#endif
|
||||
isActive = false;
|
||||
IsActive = false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2703,7 +2735,7 @@ namespace Barotrauma
|
||||
impactQueue.Enqueue(impact);
|
||||
}
|
||||
|
||||
isActive = true;
|
||||
IsActive = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -3484,7 +3516,7 @@ namespace Barotrauma
|
||||
|
||||
if (body != null)
|
||||
{
|
||||
isActive = true;
|
||||
IsActive = true;
|
||||
body.Enabled = true;
|
||||
body.PhysEnabled = true;
|
||||
body.ResetDynamics();
|
||||
@@ -3624,7 +3656,7 @@ namespace Barotrauma
|
||||
item.body.Enabled = item.body.PhysEnabled = isFirst;
|
||||
if (isFirst)
|
||||
{
|
||||
item.isActive = true;
|
||||
item.IsActive = true;
|
||||
item.body.ResetDynamics();
|
||||
}
|
||||
}
|
||||
@@ -4385,13 +4417,18 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (var connection in thisConnectionPanel.Connections)
|
||||
{
|
||||
var newConnection = newConnectionPanel.Connections.FirstOrDefault(c => c.Name == connection.Name);
|
||||
if (newConnection == null) { continue; }
|
||||
foreach (var wire in connection.Wires)
|
||||
{
|
||||
int connectionIndex = wire.Connections.IndexOf(connection);
|
||||
int wireConnectionIndex = wire.Connections.IndexOf(connection);
|
||||
wire.RemoveConnection(this);
|
||||
wire.Connect(newConnection, connectionIndex, addNode: false);
|
||||
int thisConnectionIndex = connection.ConnectionPanel.Connections.IndexOf(connection);
|
||||
if (thisConnectionIndex < 0 || thisConnectionIndex >= newConnectionPanel.Connections.Count)
|
||||
{
|
||||
DebugConsole.AddWarning($"Failed to move a wire from the connection {connection.Name} when swapping the item {Name} with {newItem.Name}. The new item probably does not have the same number of connections as the previous one.");
|
||||
continue;
|
||||
}
|
||||
Connection newConnection = newConnectionPanel.Connections[thisConnectionIndex];
|
||||
wire.Connect(newConnection, wireConnectionIndex, addNode: false);
|
||||
newConnection.ConnectWire(wire);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user