Release v0.15.13.0
This commit is contained in:
@@ -80,6 +80,8 @@ namespace Barotrauma.Items.Components
|
||||
if ((picker.PickingItem == null || picker.PickingItem == item) && PickingTime <= float.MaxValue)
|
||||
{
|
||||
#if SERVER
|
||||
// Set active picker before creating the server event to make sure it's set correctly
|
||||
activePicker = picker;
|
||||
item.CreateServerEvent(this);
|
||||
#endif
|
||||
pickingCoroutine = CoroutineManager.StartCoroutine(WaitForPick(picker, abilityPickingTime.Value));
|
||||
|
||||
@@ -72,9 +72,9 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
get
|
||||
{
|
||||
Matrix bodyTransform = Matrix.CreateRotationZ(item.body.Rotation);
|
||||
Matrix bodyTransform = Matrix.CreateRotationZ(item.body == null ? MathHelper.ToRadians(item.Rotation) : item.body.Rotation);
|
||||
Vector2 flippedPos = barrelPos;
|
||||
if (item.body.Dir < 0.0f) { flippedPos.X = -flippedPos.X; }
|
||||
if (item.body != null && item.body.Dir < 0.0f) { flippedPos.X = -flippedPos.X; }
|
||||
return Vector2.Transform(flippedPos, bodyTransform) * item.Scale;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
float percentageHealth = targetItem.Condition / targetItem.MaxCondition;
|
||||
|
||||
if (percentageHealth <= deconstructProduct.MinCondition || percentageHealth > deconstructProduct.MaxCondition) { return; }
|
||||
if (percentageHealth < deconstructProduct.MinCondition || percentageHealth > deconstructProduct.MaxCondition) { return; }
|
||||
|
||||
if (!(MapEntityPrefab.Find(null, deconstructProduct.ItemIdentifier) is ItemPrefab itemPrefab))
|
||||
{
|
||||
|
||||
@@ -347,22 +347,20 @@ namespace Barotrauma.Items.Components
|
||||
float outCondition = fabricatedItem.OutCondition;
|
||||
if (i < amountFittingContainer)
|
||||
{
|
||||
Entity.Spawner.AddToSpawnQueue(fabricatedItem.TargetItem, outputContainer.Inventory, fabricatedItem.TargetItem.Health * outCondition,
|
||||
Entity.Spawner.AddToSpawnQueue(fabricatedItem.TargetItem, outputContainer.Inventory, fabricatedItem.TargetItem.Health * outCondition, quality,
|
||||
onSpawned: (Item spawnedItem) =>
|
||||
{
|
||||
onItemSpawned(spawnedItem, tempUser);
|
||||
spawnedItem.Quality = quality;
|
||||
//reset the condition in case the max condition is higher than the prefab's due to e.g. quality modifiers
|
||||
spawnedItem.Condition = spawnedItem.MaxCondition * outCondition;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Entity.Spawner.AddToSpawnQueue(fabricatedItem.TargetItem, item.Position, item.Submarine, fabricatedItem.TargetItem.Health * outCondition,
|
||||
Entity.Spawner.AddToSpawnQueue(fabricatedItem.TargetItem, item.Position, item.Submarine, fabricatedItem.TargetItem.Health * outCondition, quality,
|
||||
onSpawned: (Item spawnedItem) =>
|
||||
{
|
||||
onItemSpawned(spawnedItem, tempUser);
|
||||
spawnedItem.Quality = quality;
|
||||
//reset the condition in case the max condition is higher than the prefab's due to e.g. quality modifiers
|
||||
spawnedItem.Condition = spawnedItem.MaxCondition * outCondition;
|
||||
});
|
||||
|
||||
@@ -75,6 +75,7 @@ namespace Barotrauma.Items.Components
|
||||
float closestDist = float.PositiveInfinity;
|
||||
foreach (Item targetItem in Item.ItemList)
|
||||
{
|
||||
if (targetItem.NonInteractable || targetItem.NonPlayerTeamInteractable || targetItem.HiddenInGame) { continue; }
|
||||
if (OnlyInOwnSub)
|
||||
{
|
||||
if (targetItem.Submarine != item.Submarine) { continue; }
|
||||
|
||||
@@ -547,6 +547,11 @@ namespace Barotrauma.Items.Components
|
||||
//power transfer items (junction boxes, relays) don't deteriorate if they're no carrying any power
|
||||
if (Math.Abs(pt.CurrPowerConsumption) > 0.1f) { return true; }
|
||||
}
|
||||
else if (ic is PowerContainer pc)
|
||||
{
|
||||
//batteries don't deteriorate if they're not charging/discharging
|
||||
if (Math.Abs(pc.CurrPowerConsumption) > 0.1f || Math.Abs(pc.CurrPowerOutput) > 0.1f) { return true; }
|
||||
}
|
||||
else if (ic is Engine engine)
|
||||
{
|
||||
//engines don't deteriorate if they're not running
|
||||
@@ -555,7 +560,7 @@ namespace Barotrauma.Items.Components
|
||||
else if (ic is Pump pump)
|
||||
{
|
||||
//pumps don't deteriorate if they're not running
|
||||
if (Math.Abs(pump.FlowPercentage) > 1.0f && pump.IsActive) { return true; }
|
||||
if (Math.Abs(pump.FlowPercentage) > 1.0f && pump.IsActive && pump.HasPower) { return true; }
|
||||
}
|
||||
else if (ic is Reactor reactor)
|
||||
{
|
||||
|
||||
@@ -127,6 +127,8 @@ namespace Barotrauma.Items.Components
|
||||
if (source == null || target == null || target.Removed ||
|
||||
(source is Entity sourceEntity && sourceEntity.Removed))
|
||||
{
|
||||
source = null;
|
||||
target = null;
|
||||
IsActive = false;
|
||||
return;
|
||||
}
|
||||
|
||||
+16
-3
@@ -225,10 +225,23 @@ namespace Barotrauma.Items.Components
|
||||
//no electrocution in sub editor
|
||||
if (Screen.Selected == GameMain.SubEditorScreen) { return true; }
|
||||
|
||||
var powered = item.GetComponent<Powered>();
|
||||
if (powered != null)
|
||||
var reactor = item.GetComponent<Reactor>();
|
||||
if (reactor != null)
|
||||
{
|
||||
//unpowered panels can be rewired without a risk of electrical shock
|
||||
//reactors that arent generating power atm can be rewired without the risk of electrical shock
|
||||
if (MathUtils.NearlyEqual(reactor.CurrPowerConsumption, 0.0f)) { return true; }
|
||||
}
|
||||
var powerContainer = item.GetComponent<PowerContainer>();
|
||||
if (powerContainer != null)
|
||||
{
|
||||
//empty batteries/supercapacitors can be rewired without the risk of electrical shock
|
||||
//non-empty ones always have a chance of zapping the user
|
||||
if (powerContainer.Charge <= 0.0f) { return true; }
|
||||
}
|
||||
var powered = item.GetComponent<Powered>();
|
||||
if (powered != null && powerContainer == null)
|
||||
{
|
||||
//unpowered panels can be rewired without the risk of electrical shock
|
||||
if (powered.Voltage < 0.1f) { return true; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user