Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop
This commit is contained in:
+5
-1
@@ -255,7 +255,11 @@ namespace Barotrauma
|
||||
}
|
||||
if (subObjectives.Any(so => so.CanBeCompleted)) { return; }
|
||||
UpdateSimpleEscape(deltaTime);
|
||||
if (cannotFindSafeHull && !character.IsInFriendlySub && objectiveManager.Objectives.None(o => o is AIObjectiveReturn))
|
||||
|
||||
bool inFriendlySub =
|
||||
character.IsInFriendlySub ||
|
||||
(character.IsEscorted && character.IsInPlayerSub);
|
||||
if (cannotFindSafeHull && !inFriendlySub && objectiveManager.Objectives.None(o => o is AIObjectiveReturn))
|
||||
{
|
||||
if (OrderPrefab.Prefabs.TryGet("return".ToIdentifier(), out OrderPrefab orderPrefab))
|
||||
{
|
||||
|
||||
+4
-1
@@ -436,7 +436,10 @@ namespace Barotrauma
|
||||
break;
|
||||
case "statvalue":
|
||||
var newStatValue = new AppliedStatValue(subElement);
|
||||
afflictionStatValues.Add(newStatValue.StatType, newStatValue);
|
||||
if (newStatValue.StatType == StatTypes.None || !afflictionStatValues.TryAdd(newStatValue.StatType, newStatValue))
|
||||
{
|
||||
DebugConsole.ThrowError($"Invalid stat value in the affliction \"{parentDebugName}\".", contentPackage: element.ContentPackage);
|
||||
}
|
||||
break;
|
||||
case "abilityflag":
|
||||
AbilityFlags flagType = subElement.GetAttributeEnum("flagtype", AbilityFlags.None);
|
||||
|
||||
@@ -3141,6 +3141,7 @@ namespace Barotrauma
|
||||
if (character.IsDead) { return; }
|
||||
if (!UseInHealthInterface) { return; }
|
||||
|
||||
GameAnalyticsManager.AddDesignEvent("ApplyTreatment:" + Prefab.Identifier);
|
||||
#if CLIENT
|
||||
if (user == Character.Controlled)
|
||||
{
|
||||
|
||||
@@ -834,7 +834,7 @@ namespace Barotrauma
|
||||
[Serialize(true, IsPropertySaveable.No)]
|
||||
public bool CanFlipY { get; private set; }
|
||||
|
||||
[Serialize(0.1f, IsPropertySaveable.No)]
|
||||
[Serialize(0.01f, IsPropertySaveable.No)]
|
||||
public float MinScale { get; private set; }
|
||||
|
||||
[Serialize(10.0f, IsPropertySaveable.No)]
|
||||
|
||||
@@ -11,6 +11,7 @@ using System.Xml.Linq;
|
||||
using System.Collections.Immutable;
|
||||
using Barotrauma.Abilities;
|
||||
#if CLIENT
|
||||
using System.Diagnostics;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Barotrauma.Lights;
|
||||
#endif
|
||||
@@ -281,14 +282,21 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public float ScaleWhenTextureOffsetSet { get; private set; } = 1.0f;
|
||||
|
||||
protected Vector2 textureOffset = Vector2.Zero;
|
||||
[Editable(MinValueFloat = -1000f, MaxValueFloat = 1000f, ValueStep = 10f), Serialize("0.0, 0.0", IsPropertySaveable.Yes)]
|
||||
[Editable(ForceShowPlusMinusButtons = true, ValueStep = 1f), Serialize("0.0, 0.0", IsPropertySaveable.Yes)]
|
||||
public Vector2 TextureOffset
|
||||
{
|
||||
get { return textureOffset; }
|
||||
set
|
||||
{
|
||||
textureOffset = value;
|
||||
textureOffset.X =
|
||||
MathUtils.PositiveModulo(textureOffset.X, Sprite.SourceRect.Width * TextureScale.X * Scale);
|
||||
textureOffset.Y =
|
||||
MathUtils.PositiveModulo(textureOffset.Y, Sprite.SourceRect.Height * TextureScale.Y * Scale);
|
||||
ScaleWhenTextureOffsetSet = Scale;
|
||||
#if CLIENT
|
||||
SetLightTextureOffset();
|
||||
#endif
|
||||
@@ -1584,6 +1592,9 @@ namespace Barotrauma
|
||||
Submarine = submarine,
|
||||
};
|
||||
|
||||
bool flippedX = element.GetAttributeBool(nameof(FlippedX), false);
|
||||
bool flippedY = element.GetAttributeBool(nameof(FlippedY), false);
|
||||
|
||||
if (submarine?.Info.GameVersion != null)
|
||||
{
|
||||
SerializableProperty.UpgradeGameVersion(s, s.Prefab.ConfigElement, submarine.Info.GameVersion);
|
||||
@@ -1594,6 +1605,19 @@ namespace Barotrauma
|
||||
{
|
||||
s.CrushDepth = Math.Max(s.CrushDepth, GameMain.GameSession.LevelData.InitialDepth * Physics.DisplayToRealWorldRatio + 500);
|
||||
}
|
||||
|
||||
#if CLIENT
|
||||
s.TextureOffset = UpgradeTextureOffset(
|
||||
targetSize: rect.Size.ToVector2(),
|
||||
originalTextureOffset:
|
||||
// Note: cannot use s.TextureOffset because wrapping is very weird in the old logic
|
||||
element.GetAttributeVector2("TextureOffset", Vector2.Zero),
|
||||
submarineInfo: submarine.Info,
|
||||
sourceRect: s.Sprite.SourceRect,
|
||||
scale: s.Scale * s.TextureScale,
|
||||
flippedX: flippedX,
|
||||
flippedY: flippedY);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool hasDamage = false;
|
||||
@@ -1637,8 +1661,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (element.GetAttributeBool(nameof(FlippedX), false)) { s.FlipX(false); }
|
||||
if (element.GetAttributeBool(nameof(FlippedY), false)) { s.FlipY(false); }
|
||||
if (flippedX) { s.FlipX(false); }
|
||||
if (flippedY) { s.FlipY(false); }
|
||||
|
||||
//structures with a body drop a shadow by default
|
||||
if (element.GetAttribute(nameof(UseDropShadow)) == null)
|
||||
|
||||
+19
-5
@@ -45,7 +45,7 @@ sealed class ConditionallyEditable : Editable
|
||||
=> (entity is Item { body: null } item && item.Prefab.AllowRotatingInEditor)
|
||||
|| (entity is Structure structure && structure.Prefab.AllowRotatingInEditor),
|
||||
ConditionType.Attachable
|
||||
=> entity is Holdable { Attachable: true },
|
||||
=> GetComponent<Holdable>(entity) is Holdable { Attachable: true },
|
||||
ConditionType.HasBody
|
||||
=> entity is Structure { HasBody: true } or Item { body: not null },
|
||||
ConditionType.Pickable
|
||||
@@ -53,14 +53,28 @@ sealed class ConditionallyEditable : Editable
|
||||
ConditionType.OnlyByStatusEffectsAndNetwork
|
||||
=> GameMain.NetworkMember is { IsServer: true },
|
||||
ConditionType.HasIntegratedButtons
|
||||
=> entity is Door { HasIntegratedButtons: true },
|
||||
=> GetComponent<Door>(entity) is { HasIntegratedButtons: true },
|
||||
ConditionType.IsToggleableController
|
||||
=> entity is Controller { IsToggle: true } controller && controller.Item.GetComponent<ConnectionPanel>() != null,
|
||||
=> GetComponent<Controller>(entity) is Controller { IsToggle: true } controller &&
|
||||
controller.Item.GetComponent<ConnectionPanel>() != null,
|
||||
ConditionType.HasConnectionPanel
|
||||
=> (entity is Item item && item.GetComponent<ConnectionPanel>() != null)
|
||||
|| (entity is ItemComponent ic && ic.Item.GetComponent<ConnectionPanel>() != null),
|
||||
=> GetComponent<ConnectionPanel>(entity) != null,
|
||||
_
|
||||
=> false
|
||||
};
|
||||
|
||||
static T GetComponent<T>(ISerializableEntity e) where T : ItemComponent
|
||||
{
|
||||
if (e is T t) { return t; }
|
||||
if (e is Item item)
|
||||
{
|
||||
return item.GetComponent<T>();
|
||||
}
|
||||
if (e is ItemComponent ic)
|
||||
{
|
||||
return ic.Item.GetComponent<T>();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
v1.2.8.0
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Changes:
|
||||
- Allow scaling most items below 0.1 in the submarine editor again. We set 0.1 as a hard limit because smaller scales caused issues with tiling items (such as labels), without realizing some sub builders have found some creative uses for heavily downscaled items (such as tiny turrets used as "dials").
|
||||
|
||||
Fixes:
|
||||
- Fixed escorted characters trying to leave the sub if they can't find a safe hull to get to (e.g. when the sub is flooded).
|
||||
- Fixed rotated structures not appearing rotated on the status monitor.
|
||||
- Fixed wires getting misaligned when saving them in an item assembly.
|
||||
- Fixed security NPCs being unable to swap batteries in stun batons.
|
||||
- Fixed inability to edit the false output of a switch in multiplayer.
|
||||
- (Finally) fixed texture offsets on tiled sprites such as background walls behaving erratically on non-default texture scales and mirrored entities.
|
||||
|
||||
Modding:
|
||||
- Fixed crashing if an affliction prefab contains stat values with a duplicate type, or multiple stat values whose type can't be parsed.
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
v1.2.7.0
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user