Unstable 1.2.4.0
This commit is contained in:
@@ -383,7 +383,7 @@ namespace Barotrauma
|
||||
|
||||
public float RotationRad { get; private set; }
|
||||
|
||||
[ConditionallyEditable(ConditionallyEditable.ConditionType.AllowRotating, MinValueFloat = 0.0f, MaxValueFloat = 360.0f, DecimalCount = 1, ValueStep = 1f), Serialize(0.0f, IsPropertySaveable.Yes)]
|
||||
[ConditionallyEditable(ConditionallyEditable.ConditionType.AllowRotating, DecimalCount = 3, ForceShowPlusMinusButtons = true, ValueStep = 0.1f), Serialize(0.0f, IsPropertySaveable.Yes)]
|
||||
public float Rotation
|
||||
{
|
||||
get
|
||||
@@ -393,7 +393,7 @@ namespace Barotrauma
|
||||
set
|
||||
{
|
||||
if (!Prefab.AllowRotatingInEditor) { return; }
|
||||
RotationRad = MathHelper.ToRadians(value);
|
||||
RotationRad = MathUtils.WrapAnglePi(MathHelper.ToRadians(value));
|
||||
#if CLIENT
|
||||
if (Screen.Selected == GameMain.SubEditorScreen)
|
||||
{
|
||||
@@ -1327,8 +1327,11 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (FlippedX) clone.FlipX(false);
|
||||
if (FlippedY) clone.FlipY(false);
|
||||
if (FlippedX) { clone.FlipX(false); }
|
||||
if (FlippedY) { clone.FlipY(false); }
|
||||
|
||||
// Flipping an item tampers with its rotation, so restore it
|
||||
clone.Rotation = Rotation;
|
||||
|
||||
foreach (ItemComponent component in clone.components)
|
||||
{
|
||||
@@ -1640,6 +1643,9 @@ namespace Barotrauma
|
||||
return transformedRect;
|
||||
}
|
||||
|
||||
public override Quad2D GetTransformedQuad()
|
||||
=> Quad2D.FromSubmarineRectangle(rect).Rotated(-RotationRad);
|
||||
|
||||
/// <summary>
|
||||
/// goes through every item and re-checks which hull they are in
|
||||
/// </summary>
|
||||
@@ -2516,7 +2522,7 @@ namespace Barotrauma
|
||||
|
||||
if (Prefab.AllowRotatingInEditor)
|
||||
{
|
||||
RotationRad = MathUtils.WrapAngleTwoPi(-RotationRad);
|
||||
RotationRad = MathUtils.WrapAnglePi(-RotationRad);
|
||||
}
|
||||
#if CLIENT
|
||||
if (Prefab.CanSpriteFlipX)
|
||||
@@ -2543,6 +2549,10 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
if (Prefab.AllowRotatingInEditor)
|
||||
{
|
||||
RotationRad = MathUtils.WrapAngleTwoPi(-RotationRad);
|
||||
}
|
||||
#if CLIENT
|
||||
if (Prefab.CanSpriteFlipY)
|
||||
{
|
||||
@@ -3043,7 +3053,10 @@ namespace Barotrauma
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void Use(float deltaTime, Character user = null, Limb targetLimb = null, Entity useTarget = null)
|
||||
/// <param name="userForOnUsedEvent">User to pass to the OnUsed event. May need to be different than the user in cases like loaders using ammo boxes:
|
||||
/// the box is technically being used by the loader, and doesn't allow a character to use it, but we may still need to know which character caused
|
||||
/// the box to be used.</param>
|
||||
public void Use(float deltaTime, Character user = null, Limb targetLimb = null, Entity useTarget = null, Character userForOnUsedEvent = null)
|
||||
{
|
||||
if (RequireAimToUse && (user == null || !user.IsKeyDown(InputType.Aim)))
|
||||
{
|
||||
@@ -3068,7 +3081,7 @@ namespace Barotrauma
|
||||
ic.PlaySound(ActionType.OnUse, user);
|
||||
#endif
|
||||
ic.ApplyStatusEffects(ActionType.OnUse, deltaTime, user, targetLimb, useTarget: useTarget, user: user);
|
||||
ic.OnUsed.Invoke(new ItemComponent.ItemUseInfo(this, user));
|
||||
ic.OnUsed.Invoke(new ItemComponent.ItemUseInfo(this, user ?? userForOnUsedEvent));
|
||||
if (ic.DeleteOnUse) { remove = true; }
|
||||
}
|
||||
}
|
||||
@@ -3526,7 +3539,26 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer)
|
||||
{
|
||||
if (!CanClientAccess(sender) || !(property.GetAttribute<ConditionallyEditable>()?.IsEditable(this) ?? true))
|
||||
bool conditionAllowsEditing = true;
|
||||
if (property.GetAttribute<ConditionallyEditable>() is { } condition)
|
||||
{
|
||||
conditionAllowsEditing = condition.IsEditable(this);
|
||||
}
|
||||
|
||||
bool canAccess = false;
|
||||
if (Container?.GetComponent<CircuitBox>() != null &&
|
||||
Container.CanClientAccess(sender))
|
||||
{
|
||||
//items inside circuit boxes are inaccessible by "normal" means,
|
||||
//but the properties can still be edited through the circuit box UI
|
||||
canAccess = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
canAccess = CanClientAccess(sender);
|
||||
}
|
||||
|
||||
if (!canAccess || !conditionAllowsEditing)
|
||||
{
|
||||
allowEditing = false;
|
||||
}
|
||||
@@ -3799,6 +3831,11 @@ namespace Barotrauma
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "itemstats":
|
||||
{
|
||||
item.StatManager.Load(subElement);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ItemComponent component = unloadedComponents.Find(x => x.Name == subElement.Name.ToString());
|
||||
@@ -3924,7 +3961,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (ItemComponent component in item.components)
|
||||
{
|
||||
if (component.Parent != null) { component.IsActive = component.Parent.IsActive; }
|
||||
if (component.Parent != null && component.InheritParentIsActive) { component.IsActive = component.Parent.IsActive; }
|
||||
component.OnItemLoaded();
|
||||
}
|
||||
|
||||
@@ -3994,6 +4031,8 @@ namespace Barotrauma
|
||||
upgrade.Save(element);
|
||||
}
|
||||
|
||||
statManager?.Save(element);
|
||||
|
||||
element.Add(new XAttribute("conditionpercentage", ConditionPercentage.ToString("G", CultureInfo.InvariantCulture)));
|
||||
|
||||
var conditionAttribute = element.GetAttribute("condition");
|
||||
|
||||
Reference in New Issue
Block a user