(b0f5305f2) Unstable v0.9.10.0
This commit is contained in:
@@ -44,19 +44,20 @@ namespace Barotrauma
|
||||
var currentObjective = ObjectiveManager.CurrentObjective;
|
||||
if (currentObjective != null)
|
||||
{
|
||||
if (currentOrder == null)
|
||||
int offset = currentOrder != null ? 20 : 0;
|
||||
if (currentOrder == null || currentOrder.Priority <= 0)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 20), $"MAIN OBJECTIVE: {currentObjective.DebugTag} ({currentObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 20 + offset), $"MAIN OBJECTIVE: {currentObjective.DebugTag} ({currentObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
}
|
||||
var subObjective = currentObjective.CurrentSubObjective;
|
||||
if (subObjective != null)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 40), $"SUBOBJECTIVE: {subObjective.DebugTag} ({subObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 40 + offset), $"SUBOBJECTIVE: {subObjective.DebugTag} ({subObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
}
|
||||
var activeObjective = ObjectiveManager.GetActiveObjective();
|
||||
if (activeObjective != null)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 60), $"ACTIVE OBJECTIVE: {activeObjective.DebugTag} ({activeObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 60 + offset), $"ACTIVE OBJECTIVE: {activeObjective.DebugTag} ({activeObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,7 +87,7 @@ namespace Barotrauma
|
||||
new Vector2(path.CurrentNode.DrawPosition.X, -path.CurrentNode.DrawPosition.Y),
|
||||
Color.BlueViolet, 0, 3);
|
||||
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 80), "Path cost: " + path.Cost.FormatZeroDecimal(), Color.White, Color.Black * 0.5f);
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 100), "Path cost: " + path.Cost.FormatZeroDecimal(), Color.White, Color.Black * 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,7 +510,7 @@ namespace Barotrauma
|
||||
Collider.DebugDraw(spriteBatch, frozen ? GUI.Style.Red : (inWater ? Color.SkyBlue : Color.Gray));
|
||||
GUI.Font.DrawString(spriteBatch, Collider.LinearVelocity.X.FormatSingleDecimal(), new Vector2(Collider.DrawPosition.X, -Collider.DrawPosition.Y), Color.Orange);
|
||||
|
||||
foreach (RevoluteJoint joint in LimbJoints)
|
||||
foreach (var joint in LimbJoints)
|
||||
{
|
||||
Vector2 pos = ConvertUnits.ToDisplayUnits(joint.WorldAnchorA);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.White, true);
|
||||
|
||||
@@ -358,7 +358,16 @@ namespace Barotrauma
|
||||
|
||||
partial void OnAttackedProjSpecific(Character attacker, AttackResult attackResult, float stun)
|
||||
{
|
||||
if (attackResult.Damage <= 1.0f || IsDead) { return; }
|
||||
if (IsDead) { return; }
|
||||
if (attacker != null)
|
||||
{
|
||||
if (attackResult.Damage <= 0.01f) { return; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (attackResult.Damage <= 1.0f) { return; }
|
||||
}
|
||||
|
||||
if (soundTimer < soundInterval * 0.5f)
|
||||
{
|
||||
PlaySound(CharacterSound.SoundType.Damage);
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace Barotrauma
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
if (item.Submarine == null || item.Submarine.TeamID != character.TeamID || item.Submarine.Info.IsWreck) { continue; }
|
||||
if (!item.Repairables.Any(r => item.ConditionPercentage <= r.AIRepairThreshold)) { continue; }
|
||||
if (!item.Repairables.Any(r => item.ConditionPercentage <= r.RepairThreshold)) { continue; }
|
||||
if (Submarine.VisibleEntities != null && !Submarine.VisibleEntities.Contains(item)) { continue; }
|
||||
|
||||
Vector2 diff = item.WorldPosition - character.WorldPosition;
|
||||
|
||||
@@ -146,7 +146,8 @@ namespace Barotrauma
|
||||
"+" + ((int)((newLevel - prevLevel) * 100.0f)).ToString() + " XP",
|
||||
GUI.Style.Green,
|
||||
textPopupPos,
|
||||
Vector2.UnitY * 10.0f);
|
||||
Vector2.UnitY * 10.0f,
|
||||
playSound: Character.Controlled?.Info == this);
|
||||
}
|
||||
else if (prevLevel % 0.1f > 0.05f && newLevel % 0.1f < 0.05f)
|
||||
{
|
||||
@@ -154,7 +155,8 @@ namespace Barotrauma
|
||||
"+10 XP",
|
||||
GUI.Style.Green,
|
||||
textPopupPos,
|
||||
Vector2.UnitY * 10.0f);
|
||||
Vector2.UnitY * 10.0f,
|
||||
playSound: Character.Controlled?.Info == this);
|
||||
}
|
||||
|
||||
if ((int)newLevel > (int)prevLevel)
|
||||
|
||||
@@ -3,7 +3,6 @@ using Barotrauma.Particles;
|
||||
using Barotrauma.SpriteDeformations;
|
||||
using Barotrauma.Extensions;
|
||||
using FarseerPhysics;
|
||||
using FarseerPhysics.Dynamics.Joints;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
@@ -15,13 +14,13 @@ using SpriteParams = Barotrauma.RagdollParams.SpriteParams;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class LimbJoint : RevoluteJoint
|
||||
partial class LimbJoint
|
||||
{
|
||||
public void UpdateDeformations(float deltaTime)
|
||||
{
|
||||
float diff = Math.Abs(UpperLimit - LowerLimit);
|
||||
float strength = MathHelper.Lerp(0, 1, MathUtils.InverseLerp(0, MathHelper.Pi, diff));
|
||||
float jointAngle = this.JointAngle * strength;
|
||||
float jointAngle = JointAngle * strength;
|
||||
|
||||
JointBendDeformation limbADeformation = LimbA.Deformations.Find(d => d is JointBendDeformation) as JointBendDeformation;
|
||||
JointBendDeformation limbBDeformation = LimbB.Deformations.Find(d => d is JointBendDeformation) as JointBendDeformation;
|
||||
|
||||
@@ -658,6 +658,44 @@ namespace Barotrauma
|
||||
}
|
||||
}, isCheat: true));
|
||||
|
||||
commands.Add(new Command("listcloudfiles", "Lists all of your files on the Steam Cloud.", args =>
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var file in Steamworks.SteamRemoteStorage.Files)
|
||||
{
|
||||
NewMessage($"* {i}: {file.Filename}, {file.Size} bytes", Color.Orange);
|
||||
i++;
|
||||
}
|
||||
NewMessage($"Bytes remaining: {Steamworks.SteamRemoteStorage.QuotaRemainingBytes}/{Steamworks.SteamRemoteStorage.QuotaBytes}", Color.Yellow);
|
||||
}));
|
||||
|
||||
commands.Add(new Command("removefromcloud", "Removes a file from Steam Cloud.", args =>
|
||||
{
|
||||
if (args.Length < 1) { return; }
|
||||
var files = Steamworks.SteamRemoteStorage.Files;
|
||||
Steamworks.SteamRemoteStorage.RemoteFile file;
|
||||
if (int.TryParse(args[0], out int index) && index>=0 && index<files.Count)
|
||||
{
|
||||
file = files[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
file = files.Find(f => f.Filename.Equals(args[0], StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(file.Filename))
|
||||
{
|
||||
if (file.Delete())
|
||||
{
|
||||
NewMessage($"Deleting {file.Filename}", Color.Orange);
|
||||
}
|
||||
else
|
||||
{
|
||||
ThrowError($"Failed to delete {file.Filename}");
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
commands.Add(new Command("resetall", "Reset all items and structures to prefabs. Only applicable in the subeditor.", args =>
|
||||
{
|
||||
if (Screen.Selected == GameMain.SubEditorScreen)
|
||||
@@ -1260,6 +1298,13 @@ namespace Barotrauma
|
||||
TextManager.Language = "English";
|
||||
}));
|
||||
|
||||
commands.Add(new Command("eventstats", "", (string[] args) =>
|
||||
{
|
||||
var debugLines = ScriptedEventSet.GetDebugStatistics();
|
||||
string filePath = "eventstats.txt";
|
||||
File.WriteAllLines(filePath, debugLines);
|
||||
ToolBox.OpenFileWithShell(Path.GetFullPath(filePath));
|
||||
}));
|
||||
#if DEBUG
|
||||
commands.Add(new Command("printreceivertransfers", "", (string[] args) =>
|
||||
{
|
||||
@@ -1834,7 +1879,7 @@ namespace Barotrauma
|
||||
"giveperm",
|
||||
(string[] args) =>
|
||||
{
|
||||
if (args.Length < 1) return;
|
||||
if (args.Length < 1) { return; }
|
||||
|
||||
NewMessage("Valid permissions are:", Color.White);
|
||||
foreach (ClientPermissions permission in Enum.GetValues(typeof(ClientPermissions)))
|
||||
@@ -1891,7 +1936,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (args.Length < 1) return;
|
||||
|
||||
ShowQuestionPrompt("Console command permissions to grant to client " + args[0] + "? You may enter multiple commands separated with a space.", (commandNames) =>
|
||||
ShowQuestionPrompt("Console command permissions to grant to client " + args[0] + "? You may enter multiple commands separated with a space or use \"all\" to give the permission to use all console commands.", (commandNames) =>
|
||||
{
|
||||
GameMain.Client?.SendConsoleCommand("givecommandperm " + args[0] + " " + commandNames);
|
||||
}, args, 1);
|
||||
@@ -1904,7 +1949,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (args.Length < 1) return;
|
||||
|
||||
ShowQuestionPrompt("Console command permissions to revoke from client " + args[0] + "? You may enter multiple commands separated with a space.", (commandNames) =>
|
||||
ShowQuestionPrompt("Console command permissions to revoke from client " + args[0] + "? You may enter multiple commands separated with a space or use \"all\" to revoke the permission to use any console commands.", (commandNames) =>
|
||||
{
|
||||
GameMain.Client?.SendConsoleCommand("revokecommandperm " + args[0] + " " + commandNames);
|
||||
}, args, 1);
|
||||
|
||||
@@ -1376,32 +1376,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (assignmentNodeIcons.Any())
|
||||
{
|
||||
if (PlayerInput.KeyDown(Keys.LeftShift) || PlayerInput.KeyDown(Keys.RightShift))
|
||||
{
|
||||
if (assignmentNodeIcons.First().OrderIcon.Visible)
|
||||
{
|
||||
foreach (AssignmentNodeIconSet set in assignmentNodeIcons)
|
||||
{
|
||||
set.OrderIcon.Visible = false;
|
||||
set.JobIcon.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (assignmentNodeIcons.First().JobIcon.Visible)
|
||||
{
|
||||
foreach (AssignmentNodeIconSet set in assignmentNodeIcons)
|
||||
{
|
||||
set.JobIcon.Visible = false;
|
||||
set.OrderIcon.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var hotkeyHit = false;
|
||||
foreach (Tuple<GUIComponent, Keys> node in optionNodes)
|
||||
{
|
||||
@@ -1578,17 +1552,6 @@ namespace Barotrauma
|
||||
private List<OrderCategory> availableCategories;
|
||||
private Stack<GUIButton> historyNodes = new Stack<GUIButton>();
|
||||
private readonly List<Character> extraOptionCharacters = new List<Character>();
|
||||
private readonly List<AssignmentNodeIconSet> assignmentNodeIcons = new List<AssignmentNodeIconSet>();
|
||||
private struct AssignmentNodeIconSet
|
||||
{
|
||||
public GUIImage OrderIcon { get; private set; }
|
||||
public GUIImage JobIcon { get; private set; }
|
||||
public AssignmentNodeIconSet(GUIImage orderIcon, GUIImage jobIcon)
|
||||
{
|
||||
OrderIcon = orderIcon;
|
||||
JobIcon = jobIcon;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// node.Color = node.HighlightColor * nodeColorMultiplier
|
||||
@@ -1865,7 +1828,6 @@ namespace Barotrauma
|
||||
background = null;
|
||||
commandFrame = null;
|
||||
extraOptionCharacters.Clear();
|
||||
assignmentNodeIcons.Clear();
|
||||
isOpeningClick = isSelectionHighlighted = false;
|
||||
characterContext = null;
|
||||
itemContext = null;
|
||||
@@ -2028,7 +1990,6 @@ namespace Barotrauma
|
||||
expandNode = null;
|
||||
expandNodeHotkey = Keys.None;
|
||||
RemoveExtraOptionNodes();
|
||||
assignmentNodeIcons.Clear();
|
||||
}
|
||||
|
||||
private void RemoveExtraOptionNodes()
|
||||
@@ -2734,24 +2695,14 @@ namespace Barotrauma
|
||||
GUIImage orderIcon;
|
||||
if (character.CurrentOrder != null && !character.CurrentOrder.Identifier.Equals("dismissed"))
|
||||
{
|
||||
orderIcon = new GUIImage(new RectTransform(new Vector2(1.2f), node.RectTransform, anchor: Anchor.Center),
|
||||
character.CurrentOrder.SymbolSprite, scaleToFit: true);
|
||||
orderIcon = new GUIImage(new RectTransform(new Vector2(1.2f), node.RectTransform, anchor: Anchor.Center), character.CurrentOrder.SymbolSprite, scaleToFit: true);
|
||||
var tooltip = character.CurrentOrder.Name;
|
||||
if (!string.IsNullOrWhiteSpace(character.CurrentOrderOption)) { tooltip += " (" + character.CurrentOrder.GetOptionName(character.CurrentOrderOption) + ")"; };
|
||||
orderIcon.ToolTip = tooltip;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Replace with an icon that symbols the characters dismissed state and their availability to new orders OR localize the text
|
||||
orderIcon = new GUIImage(new RectTransform(new Vector2(1.2f), node.RectTransform, anchor: Anchor.Center),
|
||||
"CommandNodeContainer", scaleToFit: true);
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.9f / 1.2f), orderIcon.RectTransform, anchor: Anchor.Center),
|
||||
"FREE", textColor: jobColor * nodeColorMultiplier, font: GUI.SubHeadingFont, textAlignment: Alignment.Center, style: null)
|
||||
{
|
||||
CanBeFocused = false,
|
||||
ForceUpperCase = true,
|
||||
HoverTextColor = jobColor
|
||||
};
|
||||
orderIcon = new GUIImage(new RectTransform(new Vector2(1.2f), node.RectTransform, anchor: Anchor.Center), "CommandIdleNode", scaleToFit: true);
|
||||
}
|
||||
orderIcon.Color = jobColor * nodeColorMultiplier;
|
||||
orderIcon.HoverColor = jobColor;
|
||||
@@ -2765,7 +2716,7 @@ namespace Barotrauma
|
||||
var nameLabel = new GUITextBlock(
|
||||
new RectTransform(new Point(width, 0), parent: node.RectTransform, anchor: Anchor.TopCenter, pivot: Pivot.BottomCenter)
|
||||
{
|
||||
RelativeOffset = new Vector2(0f, -0.1f)
|
||||
RelativeOffset = new Vector2(0f, -0.25f)
|
||||
},
|
||||
ToolBox.LimitString(character.Info?.DisplayName, font, width), textColor: jobColor * nodeColorMultiplier, font: font, textAlignment: Alignment.Center, style: null)
|
||||
{
|
||||
@@ -2774,33 +2725,22 @@ namespace Barotrauma
|
||||
HoverTextColor = jobColor
|
||||
};
|
||||
|
||||
// Job icon
|
||||
GUIImage jobIcon = null;
|
||||
if (character?.Info?.Job?.Prefab?.Icon is Sprite sprite)
|
||||
if (character.Info?.Job?.Prefab?.IconSmall is Sprite smallJobIcon)
|
||||
{
|
||||
jobIcon = new GUIImage(new RectTransform(new Vector2(1.2f), node.RectTransform, anchor: Anchor.Center),
|
||||
"CommandNodeContainer", scaleToFit: true)
|
||||
// Job icon
|
||||
new GUIImage(
|
||||
new RectTransform(new Vector2(0.4f), node.RectTransform, anchor: Anchor.TopCenter, pivot: Pivot.Center)
|
||||
{
|
||||
RelativeOffset = new Vector2(0.0f, -((orderIcon.RectTransform.RelativeSize.Y - 1) / 2))
|
||||
},
|
||||
smallJobIcon, scaleToFit: true)
|
||||
{
|
||||
CanBeFocused = false,
|
||||
Color = jobColor * nodeColorMultiplier,
|
||||
HoverColor = jobColor,
|
||||
PressedColor = jobColor,
|
||||
SelectedColor = jobColor,
|
||||
Visible = false
|
||||
}; ;
|
||||
new GUIImage(new RectTransform(new Vector2(0.9f / 1.2f), jobIcon.RectTransform, anchor: Anchor.Center),
|
||||
sprite, scaleToFit: true)
|
||||
{
|
||||
CanBeFocused = false,
|
||||
Color = jobColor * nodeColorMultiplier,
|
||||
HoverColor = jobColor,
|
||||
PressedColor = jobColor,
|
||||
SelectedColor = jobColor
|
||||
Color = jobColor,
|
||||
HoverColor = jobColor
|
||||
};
|
||||
}
|
||||
|
||||
assignmentNodeIcons.Add(new AssignmentNodeIconSet(orderIcon, jobIcon));
|
||||
|
||||
#if DEBUG
|
||||
bool canHear = true;
|
||||
#else
|
||||
|
||||
@@ -929,24 +929,24 @@ namespace Barotrauma
|
||||
//attempt to put in a free slot first
|
||||
for (int i = capacity - 1; i >= 0; i--)
|
||||
{
|
||||
if (Items[i] != null) continue;
|
||||
if (SlotTypes[i] == InvSlotType.Any || !item.AllowedSlots.Any(a => a.HasFlag(SlotTypes[i]))) continue;
|
||||
if (Items[i] != null) { continue; }
|
||||
if (SlotTypes[i] == InvSlotType.Any || !item.AllowedSlots.Any(a => a.HasFlag(SlotTypes[i]))) { continue; }
|
||||
success = TryPutItem(item, i, true, false, Character.Controlled, true);
|
||||
if (success) break;
|
||||
if (success) { break; }
|
||||
}
|
||||
|
||||
if (!success)
|
||||
{
|
||||
for (int i = capacity - 1; i >= 0; i--)
|
||||
{
|
||||
if (SlotTypes[i] == InvSlotType.Any || !item.AllowedSlots.Any(a => a.HasFlag(SlotTypes[i]))) continue;
|
||||
if (SlotTypes[i] == InvSlotType.Any || !item.AllowedSlots.Any(a => a.HasFlag(SlotTypes[i]))) { continue; }
|
||||
// something else already equipped in a hand slot, attempt to unequip it so items aren't unnecessarily swapped to it
|
||||
if (Items[i] != null && Items[i].AllowedSlots.Contains(InvSlotType.Any) && SlotTypes[i] == InvSlotType.LeftHand || SlotTypes[i] == InvSlotType.RightHand)
|
||||
if (Items[i] != null && Items[i].AllowedSlots.Contains(InvSlotType.Any) && (SlotTypes[i] == InvSlotType.LeftHand || SlotTypes[i] == InvSlotType.RightHand))
|
||||
{
|
||||
TryPutItem(Items[i], Character.Controlled, new List<InvSlotType>() { InvSlotType.Any }, true);
|
||||
}
|
||||
success = TryPutItem(item, i, true, false, Character.Controlled, true);
|
||||
if (success) break;
|
||||
if (success) { break; }
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, bool editing, float itemDepth = -1)
|
||||
{
|
||||
if (!IsActive || picker == null || !CanBeAttached() || !picker.IsKeyDown(InputType.Aim) || picker != Character.Controlled) { return; }
|
||||
if (!IsActive || picker == null || !CanBeAttached(picker) || !picker.IsKeyDown(InputType.Aim) || picker != Character.Controlled) { return; }
|
||||
|
||||
Vector2 gridPos = picker.Position;
|
||||
Vector2 roundedGridPos = new Vector2(
|
||||
|
||||
@@ -74,6 +74,7 @@ namespace Barotrauma.Items.Components
|
||||
public readonly Vector2 TransducerWorldPos;
|
||||
public readonly Vector2 WorldPos;
|
||||
public readonly float Distance;
|
||||
public double RecalculationTime;
|
||||
|
||||
public CachedDistance(Vector2 transducerWorldPos, Vector2 worldPos, float dist)
|
||||
{
|
||||
@@ -1333,20 +1334,22 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private void DrawMarker(SpriteBatch spriteBatch, string label, string iconIdentifier, object targetIdentifier, Vector2 worldPosition, Vector2 transducerPosition, float scale, Vector2 center, float radius)
|
||||
{
|
||||
float dist = Vector2.Distance(worldPosition, transducerPosition);
|
||||
if (Vector2.DistanceSquared(worldPosition, transducerPosition) > Range * Range)
|
||||
float linearDist = Vector2.Distance(worldPosition, transducerPosition);
|
||||
float dist = linearDist;
|
||||
if (linearDist > Range)
|
||||
{
|
||||
if (markerDistances.TryGetValue(targetIdentifier, out CachedDistance cachedDistance))
|
||||
{
|
||||
if (Vector2.DistanceSquared(cachedDistance.TransducerWorldPos, transducerPosition) > 500 * 500 ||
|
||||
Vector2.DistanceSquared(cachedDistance.WorldPos, worldPosition) > 500 * 500)
|
||||
if (Timing.TotalTime > cachedDistance.RecalculationTime &&
|
||||
(Vector2.DistanceSquared(cachedDistance.TransducerWorldPos, transducerPosition) > 500 * 500 ||
|
||||
Vector2.DistanceSquared(cachedDistance.WorldPos, worldPosition) > 500 * 500))
|
||||
{
|
||||
markerDistances.Remove(targetIdentifier);
|
||||
CalculateDistance();
|
||||
}
|
||||
else
|
||||
{
|
||||
dist = cachedDistance.Distance;
|
||||
dist = Math.Max(cachedDistance.Distance, linearDist);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1361,7 +1364,11 @@ namespace Barotrauma.Items.Components
|
||||
var path = pathFinder.FindPath(ConvertUnits.ToSimUnits(transducerPosition), ConvertUnits.ToSimUnits(worldPosition));
|
||||
if (!path.Unreachable)
|
||||
{
|
||||
markerDistances.Add(targetIdentifier, new CachedDistance(transducerPosition, worldPosition, path.TotalLength));
|
||||
var cachedDistance = new CachedDistance(transducerPosition, worldPosition, path.TotalLength)
|
||||
{
|
||||
RecalculationTime = Timing.TotalTime + Rand.Range(1.0f, 5.0f)
|
||||
};
|
||||
markerDistances.Add(targetIdentifier, cachedDistance);
|
||||
dist = path.TotalLength;
|
||||
}
|
||||
}
|
||||
@@ -1375,16 +1382,16 @@ namespace Barotrauma.Items.Components
|
||||
float textAlpha = MathHelper.Clamp(1.5f - dist / 50000.0f, 0.5f, 1.0f);
|
||||
|
||||
Vector2 dir = Vector2.Normalize(position);
|
||||
Vector2 markerPos = (dist * zoom * scale > radius) ? dir * radius : position;
|
||||
Vector2 markerPos = (linearDist * zoom * scale > radius) ? dir * radius : position;
|
||||
markerPos += center;
|
||||
|
||||
markerPos.X = (int)markerPos.X;
|
||||
markerPos.Y = (int)markerPos.Y;
|
||||
|
||||
float alpha = 1.0f;
|
||||
if (dist * scale < radius)
|
||||
if (linearDist * scale < radius)
|
||||
{
|
||||
float normalizedDist = dist * scale / radius;
|
||||
float normalizedDist = linearDist * scale / radius;
|
||||
alpha = Math.Max(normalizedDist - 0.4f, 0.0f);
|
||||
|
||||
float mouseDist = Vector2.Distance(PlayerInput.MousePosition, markerPos);
|
||||
@@ -1395,14 +1402,6 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
if (!GuiFrame.Children.First().Rect.Contains(markerPos))
|
||||
{
|
||||
if (MathUtils.GetLineRectangleIntersection(center, markerPos, GuiFrame.Children.First().Rect, out Vector2 intersection))
|
||||
{
|
||||
markerPos = intersection;
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(iconIdentifier) || !targetIcons.ContainsKey(iconIdentifier))
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)markerPos.X - 3, (int)markerPos.Y - 3, 6, 6), markerColor, thickness: 2);
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Barotrauma.Items.Components
|
||||
public override bool ShouldDrawHUD(Character character)
|
||||
{
|
||||
if (!HasRequiredItems(character, false) || character.SelectedConstruction != item) return false;
|
||||
return !item.IsFullCondition || character.IsTraitor && item.ConditionPercentage > MinSabotageCondition || (CurrentFixer == character && (!item.IsFullCondition || (character.IsTraitor && item.ConditionPercentage > MinSabotageCondition)));
|
||||
return item.ConditionPercentage < RepairThreshold || character.IsTraitor && item.ConditionPercentage > MinSabotageCondition || (CurrentFixer == character && (!item.IsFullCondition || (character.IsTraitor && item.ConditionPercentage > MinSabotageCondition)));
|
||||
}
|
||||
|
||||
partial void InitProjSpecific(XElement element)
|
||||
|
||||
@@ -32,7 +32,19 @@ namespace Barotrauma
|
||||
|
||||
private readonly Dictionary<DecorativeSprite, DecorativeSprite.State> spriteAnimState = new Dictionary<DecorativeSprite, DecorativeSprite.State>();
|
||||
|
||||
public bool FakeBroken;
|
||||
private bool fakeBroken;
|
||||
public bool FakeBroken
|
||||
{
|
||||
get { return fakeBroken; }
|
||||
set
|
||||
{
|
||||
if (value != fakeBroken)
|
||||
{
|
||||
fakeBroken = value;
|
||||
SetActiveSprite();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Sprite activeSprite;
|
||||
public override Sprite Sprite
|
||||
@@ -145,11 +157,12 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
float displayCondition = FakeBroken ? 0.0f : condition;
|
||||
for (int i = 0; i < Prefab.BrokenSprites.Count;i++)
|
||||
{
|
||||
if (Prefab.BrokenSprites[i].FadeIn) { continue; }
|
||||
float minCondition = i > 0 ? Prefab.BrokenSprites[i - i].MaxCondition : 0.0f;
|
||||
if (condition <= minCondition || condition <= Prefab.BrokenSprites[i].MaxCondition)
|
||||
if (displayCondition <= minCondition || displayCondition <= Prefab.BrokenSprites[i].MaxCondition)
|
||||
{
|
||||
activeSprite = Prefab.BrokenSprites[i].Sprite;
|
||||
break;
|
||||
@@ -315,19 +328,25 @@ namespace Barotrauma
|
||||
if (holdable.Picker.SelectedItems[0] == this)
|
||||
{
|
||||
Limb holdLimb = holdable.Picker.AnimController.GetLimb(LimbType.RightHand);
|
||||
depth = holdLimb.ActiveSprite.Depth + holdable.Picker.AnimController.GetDepthOffset() + depthStep * 2;
|
||||
foreach (WearableSprite wearableSprite in holdLimb.WearingItems)
|
||||
if (holdLimb != null)
|
||||
{
|
||||
if (!wearableSprite.InheritLimbDepth && wearableSprite.Sprite != null) { depth = Math.Max(wearableSprite.Sprite.Depth + depthStep, depth); }
|
||||
depth = holdLimb.ActiveSprite.Depth + holdable.Picker.AnimController.GetDepthOffset() + depthStep * 2;
|
||||
foreach (WearableSprite wearableSprite in holdLimb.WearingItems)
|
||||
{
|
||||
if (!wearableSprite.InheritLimbDepth && wearableSprite.Sprite != null) { depth = Math.Max(wearableSprite.Sprite.Depth + depthStep, depth); }
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (holdable.Picker.SelectedItems[1] == this)
|
||||
{
|
||||
Limb holdLimb = holdable.Picker.AnimController.GetLimb(LimbType.LeftHand);
|
||||
depth = holdLimb.ActiveSprite.Depth + holdable.Picker.AnimController.GetDepthOffset() - depthStep * 2;
|
||||
foreach (WearableSprite wearableSprite in holdLimb.WearingItems)
|
||||
if (holdLimb != null)
|
||||
{
|
||||
if (!wearableSprite.InheritLimbDepth && wearableSprite.Sprite != null) { depth = Math.Min(wearableSprite.Sprite.Depth - depthStep, depth); }
|
||||
depth = holdLimb.ActiveSprite.Depth + holdable.Picker.AnimController.GetDepthOffset() - depthStep * 2;
|
||||
foreach (WearableSprite wearableSprite in holdLimb.WearingItems)
|
||||
{
|
||||
if (!wearableSprite.InheritLimbDepth && wearableSprite.Sprite != null) { depth = Math.Min(wearableSprite.Sprite.Depth - depthStep, depth); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,6 +370,30 @@ namespace Barotrauma.Lights
|
||||
}
|
||||
}
|
||||
|
||||
public static void RecalculateAll(Submarine sub)
|
||||
{
|
||||
var chList = HullLists.Find(h => h.Submarine == sub);
|
||||
if (chList != null)
|
||||
{
|
||||
foreach (ConvexHull ch in chList.List)
|
||||
{
|
||||
ch.overlappingHulls.Clear();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
ch.ignoreEdge[i] = false;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < chList.List.Count; i++)
|
||||
{
|
||||
for (int j = i + 1; j < chList.List.Count; j++)
|
||||
{
|
||||
chList.List[i].MergeOverlappingSegments(chList.List[j]);
|
||||
chList.List[j].MergeOverlappingSegments(chList.List[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVertices(Vector2[] points, Matrix? rotationMatrix = null)
|
||||
{
|
||||
Debug.Assert(points.Length == 4, "Only rectangular convex hulls are supported");
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Barotrauma
|
||||
Stream = sound.Stream;
|
||||
Range = element.GetAttributeFloat("range", 1000.0f);
|
||||
Volume = element.GetAttributeFloat("volume", 1.0f);
|
||||
sound.DisableMuffle = element.GetAttributeBool("disablemuffle", false);
|
||||
sound.IgnoreMuffling = element.GetAttributeBool("dontmuffle", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -578,7 +578,7 @@ namespace Barotrauma.Steam
|
||||
if (!isInitialized) return;
|
||||
|
||||
var query = new Steamworks.Ugc.Query(Steamworks.UgcType.All)
|
||||
.RankedByTotalUniqueSubscriptions()
|
||||
.RankedByTrend()
|
||||
.WithLongDescription();
|
||||
if (requireTags != null) query.WithTags(requireTags);
|
||||
|
||||
|
||||
@@ -1765,7 +1765,7 @@ namespace Barotrauma
|
||||
var workshopPublishStatus = SteamManager.StartPublishItem(itemContentPackage, itemEditor);
|
||||
if (workshopPublishStatus != null)
|
||||
{
|
||||
if (!itemEditor.Value.Tags.Contains("unstable")) { itemEditor.Value.Tags.Add("unstable"); }
|
||||
if (!(itemEditor?.HasTag("unstable") ?? false)) { itemEditor = itemEditor?.WithTag("unstable"); }
|
||||
CoroutineManager.StartCoroutine(WaitForPublish(workshopPublishStatus), "WaitForPublish");
|
||||
}
|
||||
msgBox.Close();
|
||||
|
||||
@@ -1234,8 +1234,6 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
|
||||
Submarine.MainSub.Info.Name = name;
|
||||
|
||||
string savePath = name + ".sub";
|
||||
string prevSavePath = null;
|
||||
if (!string.IsNullOrEmpty(Submarine.MainSub?.Info.FilePath) &&
|
||||
@@ -1740,10 +1738,24 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
var hideInMenusTickBox = nameBox.Parent.GetChildByUserData("hideinmenus") as GUITickBox;
|
||||
bool hideInMenus = hideInMenusTickBox == null ? false : hideInMenusTickBox.Selected;
|
||||
|
||||
string saveFolder = Path.Combine("Content", "Items", "Assemblies");
|
||||
bool hideInMenus = !(nameBox.Parent.GetChildByUserData("hideinmenus") is GUITickBox hideInMenusTickBox) ? false : hideInMenusTickBox.Selected;
|
||||
#if DEBUG
|
||||
string saveFolder = ItemAssemblyPrefab.VanillaSaveFolder;
|
||||
#else
|
||||
string saveFolder = ItemAssemblyPrefab.SaveFolder;
|
||||
if (!Directory.Exists(saveFolder))
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(saveFolder);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("Failed to create a directory for the item assmebly.", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
string filePath = Path.Combine(saveFolder, nameBox.Text + ".xml");
|
||||
|
||||
if (File.Exists(filePath))
|
||||
@@ -1771,7 +1783,6 @@ namespace Barotrauma
|
||||
#else
|
||||
doc.SaveSafe(filePath);
|
||||
#endif
|
||||
|
||||
new ItemAssemblyPrefab(filePath);
|
||||
UpdateEntityList();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Barotrauma.Sounds
|
||||
protected set;
|
||||
}
|
||||
|
||||
public bool DisableMuffle { get; set; }
|
||||
public bool IgnoreMuffling { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// How many instances of the same sound clip can be playing at the same time
|
||||
|
||||
@@ -648,7 +648,7 @@ namespace Barotrauma
|
||||
{
|
||||
return null;
|
||||
}
|
||||
bool muffle = !sound.DisableMuffle && ShouldMuffleSound(Character.Controlled, position, far, hullGuess);
|
||||
bool muffle = !sound.IgnoreMuffling && ShouldMuffleSound(Character.Controlled, position, far, hullGuess);
|
||||
return sound.Play(volume ?? sound.BaseGain, far, position, muffle: muffle);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user