v1.4.4.1 (Blood in the Water Update)
This commit is contained in:
@@ -331,7 +331,6 @@ namespace Barotrauma
|
||||
}
|
||||
private GUIComponent CreateEditingHUD(bool inGame = false)
|
||||
{
|
||||
|
||||
editingHUD = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.15f), GUI.Canvas, Anchor.CenterRight) { MinSize = new Point(400, 0) })
|
||||
{
|
||||
UserData = this
|
||||
|
||||
@@ -170,16 +170,18 @@ namespace Barotrauma
|
||||
{
|
||||
if (!pendingSectionUpdates.Any() && !pendingDecalUpdates.Any())
|
||||
{
|
||||
GameMain.NetworkMember?.CreateEntityEvent(this, new StatusEventData());
|
||||
//these are used to modify the amount water/fire in the hull with console commands
|
||||
//they should be usable even when not controlling a character
|
||||
GameMain.Client?.CreateEntityEvent(this, new StatusEventData(), requireControlledCharacter: false);
|
||||
}
|
||||
foreach (Decal decal in pendingDecalUpdates)
|
||||
{
|
||||
GameMain.NetworkMember?.CreateEntityEvent(this, new DecalEventData(decal));
|
||||
GameMain.Client?.CreateEntityEvent(this, new DecalEventData(decal));
|
||||
}
|
||||
pendingDecalUpdates.Clear();
|
||||
foreach (int pendingSectionUpdate in pendingSectionUpdates)
|
||||
{
|
||||
GameMain.NetworkMember?.CreateEntityEvent(this, new BackgroundSectionsEventData(pendingSectionUpdate));
|
||||
GameMain.Client?.CreateEntityEvent(this, new BackgroundSectionsEventData(pendingSectionUpdate));
|
||||
}
|
||||
pendingSectionUpdates.Clear();
|
||||
networkUpdatePending = false;
|
||||
|
||||
@@ -16,27 +16,34 @@ namespace Barotrauma
|
||||
|
||||
float scale = Math.Min(drawArea.Width / (float)Bounds.Width, drawArea.Height / (float)Bounds.Height) * 0.9f;
|
||||
|
||||
foreach ((Identifier identifier, Rectangle rect) in DisplayEntities)
|
||||
foreach (var displayEntity in DisplayEntities)
|
||||
{
|
||||
var entityPrefab = FindByIdentifier(identifier);
|
||||
var entityPrefab = FindByIdentifier(displayEntity.Identifier);
|
||||
if (entityPrefab is CoreEntityPrefab || entityPrefab == null) { continue; }
|
||||
var drawRect = new Rectangle(
|
||||
(int)(rect.X * scale) + drawArea.Center.X, (int)((rect.Y) * scale) - drawArea.Center.Y,
|
||||
(int)(rect.Width * scale), (int)(rect.Height * scale));
|
||||
entityPrefab.DrawPlacing(spriteBatch, drawRect, entityPrefab.Scale * scale);
|
||||
(int)(displayEntity.Rect.X * scale) + drawArea.Center.X, (int)((displayEntity.Rect.Y) * scale) - drawArea.Center.Y,
|
||||
(int)(displayEntity.Rect.Width * scale), (int)(displayEntity.Rect.Height * scale));
|
||||
entityPrefab.DrawPlacing(spriteBatch, drawRect, entityPrefab.Scale * scale, rotation: displayEntity.RotationRad);
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawPlacing(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
base.DrawPlacing(spriteBatch, cam);
|
||||
foreach ((Identifier identifier, Rectangle rect) in DisplayEntities)
|
||||
Draw(
|
||||
spriteBatch,
|
||||
placePosition != Vector2.Zero ? placePosition : Submarine.MouseToWorldGrid(cam, Submarine.MainSub));
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, Vector2 pos)
|
||||
{
|
||||
foreach (var displayEntity in DisplayEntities)
|
||||
{
|
||||
var entityPrefab = FindByIdentifier(identifier);
|
||||
var entityPrefab = FindByIdentifier(displayEntity.Identifier);
|
||||
if (entityPrefab == null) { continue; }
|
||||
Rectangle drawRect = rect;
|
||||
drawRect.Location += placePosition != Vector2.Zero ? placePosition.ToPoint() : Submarine.MouseToWorldGrid(cam, Submarine.MainSub).ToPoint();
|
||||
entityPrefab.DrawPlacing(spriteBatch, drawRect, entityPrefab.Scale);
|
||||
Rectangle drawRect = displayEntity.Rect;
|
||||
drawRect.Location += pos.ToPoint();
|
||||
entityPrefab.DrawPlacing(spriteBatch, drawRect, entityPrefab.Scale, rotation: displayEntity.RotationRad);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,9 +54,12 @@ namespace Barotrauma
|
||||
new XAttribute("description", description),
|
||||
new XAttribute("hideinmenus", hideInMenus));
|
||||
|
||||
|
||||
//move the entities so that their "center of mass" is at {0,0}
|
||||
var assemblyEntities = MapEntity.CopyEntities(entities);
|
||||
for (int i = 0; i < assemblyEntities.Count && i < entities.Count; i++)
|
||||
{
|
||||
assemblyEntities[i].Layer = entities[i].Layer;
|
||||
}
|
||||
|
||||
//find wires and items that are contained inside another item
|
||||
//place them at {0,0} to prevent them from messing up the origin of the prefab and to hide them in preview
|
||||
@@ -86,7 +96,7 @@ namespace Barotrauma
|
||||
MathUtils.RoundTowardsClosest(center.Y, Submarine.GridSize.Y) - center.Y - Submarine.GridSize.Y / 2);
|
||||
|
||||
MapEntity.SelectedList.Clear();
|
||||
entities.ForEach(e => MapEntity.AddSelection(e));
|
||||
assemblyEntities.ForEach(e => MapEntity.AddSelection(e));
|
||||
|
||||
foreach (MapEntity mapEntity in assemblyEntities)
|
||||
{
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Barotrauma
|
||||
{
|
||||
if (damage <= 0.0f) { return; }
|
||||
Vector2 particlePos = worldPosition;
|
||||
Vector2 particleDir = particlePos - WorldPosition;
|
||||
if (particleDir.LengthSquared() > 0.0001f) { particleDir = Vector2.Normalize(particleDir); }
|
||||
if (!Cells.Any(c => c.IsPointInside(particlePos)))
|
||||
{
|
||||
bool intersectionFound = false;
|
||||
@@ -31,6 +33,7 @@ namespace Barotrauma
|
||||
{
|
||||
intersectionFound = true;
|
||||
particlePos = intersection;
|
||||
particleDir = edge.GetNormal(cell);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -38,14 +41,15 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 particleDir = particlePos - WorldPosition;
|
||||
if (particleDir.LengthSquared() > 0.0001f) { particleDir = Vector2.Normalize(particleDir); }
|
||||
int particleAmount = MathHelper.Clamp((int)damage, 1, 10);
|
||||
for (int i = 0; i < particleAmount; i++)
|
||||
{
|
||||
var particle = GameMain.ParticleManager.CreateParticle("iceshards",
|
||||
var particle = GameMain.ParticleManager.CreateParticle("iceexplosionsmall",
|
||||
particlePos + Rand.Vector(5.0f),
|
||||
particleDir * Rand.Range(200.0f, 500.0f) + Rand.Vector(100.0f));
|
||||
particleDir * Rand.Range(30.0f, 500.0f) + Rand.Vector(20.0f));
|
||||
GameMain.ParticleManager.CreateParticle("iceshards",
|
||||
particlePos + Rand.Vector(5.0f),
|
||||
particleDir * Rand.Range(100.0f, 500.0f) + Rand.Vector(100.0f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var rects in blockedRects.Values)
|
||||
{
|
||||
foreach (var rect in rects)
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ namespace Barotrauma
|
||||
|
||||
//Maximum number of visible objects drawn at once. Should be large enough to not have an effect during normal gameplay,
|
||||
//but small enough to prevent wrecking performance when zooming out very far
|
||||
const int MaxVisibleObjects = 500;
|
||||
const int MaxVisibleObjects = 600;
|
||||
|
||||
private Rectangle currentGridIndices;
|
||||
|
||||
|
||||
@@ -362,6 +362,13 @@ namespace Barotrauma
|
||||
GUI.DrawLine(spriteBatch, new Vector2(edge.Point1.X + cell.Translation.X, -(edge.Point1.Y + cell.Translation.Y)),
|
||||
new Vector2(edge.Point2.X + cell.Translation.X, -(edge.Point2.Y + cell.Translation.Y)), edge.NextToCave ? Color.Red : (cell.Body == null ? Color.Cyan * 0.5f : (edge.IsSolid ? Color.White : Color.Gray)),
|
||||
width: edge.NextToCave ? 8 : 1);
|
||||
|
||||
Vector2 normal = edge.GetNormal(cell);
|
||||
GUI.DrawLine(spriteBatch,
|
||||
(edge.Center + cell.Translation).FlipY(),
|
||||
(edge.Center + cell.Translation + normal * 32).FlipY(),
|
||||
Color.Red * 0.5f,
|
||||
width: 3);
|
||||
}
|
||||
|
||||
foreach (Vector2 point in cell.BodyVertices)
|
||||
|
||||
@@ -156,17 +156,7 @@ namespace Barotrauma.Lights
|
||||
BoundingBox = rect;
|
||||
|
||||
this.isHorizontal = isHorizontal;
|
||||
if (ParentEntity is Structure structure)
|
||||
{
|
||||
Debug.Assert(!structure.Removed);
|
||||
isHorizontal = structure.IsHorizontal;
|
||||
}
|
||||
else if (ParentEntity is Item item)
|
||||
{
|
||||
Debug.Assert(!item.Removed);
|
||||
var door = item.GetComponent<Door>();
|
||||
if (door != null) { isHorizontal = door.IsHorizontal; }
|
||||
}
|
||||
Debug.Assert(!ParentEntity.Removed);
|
||||
|
||||
Vector2[] verts = new Vector2[]
|
||||
{
|
||||
|
||||
@@ -268,8 +268,7 @@ namespace Barotrauma.Lights
|
||||
{
|
||||
if (!light.Enabled) { continue; }
|
||||
if ((light.Color.A < 1 || light.Range < 1.0f) && !light.LightSourceParams.OverrideLightSpriteAlpha.HasValue) { continue; }
|
||||
//above the top boundary of the level (in an inactive respawn shuttle?)
|
||||
if (Level.Loaded != null && light.WorldPosition.Y > Level.Loaded.Size.Y) { continue; }
|
||||
|
||||
if (light.ParentBody != null)
|
||||
{
|
||||
light.ParentBody.UpdateDrawPosition();
|
||||
@@ -696,12 +695,24 @@ namespace Barotrauma.Lights
|
||||
if (diff.LengthSquared() > 20.0f * 20.0f) { losOffset = diff; }
|
||||
float rotation = MathUtils.VectorToAngle(losOffset);
|
||||
|
||||
//the visible area stretches to the maximum when the cursor is this far from the character
|
||||
const float MaxOffset = 256.0f;
|
||||
const float MinHorizontalScale = 2.2f;
|
||||
const float MaxHorizontalScale = 2.8f;
|
||||
const float VerticalScale = 2.5f;
|
||||
|
||||
//Starting point and scale-based modifier that moves the point of origin closer to the edge of the texture if the player moves their mouse further away, or vice versa.
|
||||
float relativeOriginStartPosition = 0.22f; //Increasing this value moves the origin further behind the character
|
||||
float originStartPosition = visionCircle.Width * relativeOriginStartPosition;
|
||||
float relativeOriginLookAtPosModifier = -0.055f; //Increase this value increases how much the vision changes by moving the mouse
|
||||
float originLookAtPosModifier = visionCircle.Width * relativeOriginLookAtPosModifier;
|
||||
|
||||
Vector2 scale = new Vector2(
|
||||
MathHelper.Clamp(losOffset.Length() / 256.0f, 4.0f, 5.0f), 3.0f);
|
||||
MathHelper.Clamp(losOffset.Length() / MaxOffset, MinHorizontalScale, MaxHorizontalScale), VerticalScale);
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, transformMatrix: cam.Transform * Matrix.CreateScale(new Vector3(GameSettings.CurrentConfig.Graphics.LightMapScale, GameSettings.CurrentConfig.Graphics.LightMapScale, 1.0f)));
|
||||
spriteBatch.Draw(visionCircle, new Vector2(ViewTarget.WorldPosition.X, -ViewTarget.WorldPosition.Y), null, Color.White, rotation,
|
||||
new Vector2(visionCircle.Width * 0.2f, visionCircle.Height / 2), scale, SpriteEffects.None, 0.0f);
|
||||
new Vector2(originStartPosition + (scale.X * originLookAtPosModifier), visionCircle.Height / 2), scale, SpriteEffects.None, 0.0f);
|
||||
spriteBatch.End();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -461,7 +461,9 @@ namespace Barotrauma
|
||||
new GUICustomComponent(new RectTransform(new Vector2(0.6f, 1.0f), repBarHolder.RectTransform), onDraw: (sb, component) =>
|
||||
{
|
||||
if (location.Reputation == null) { return; }
|
||||
RoundSummary.DrawReputationBar(sb, component.Rect, location.Reputation.NormalizedValue);
|
||||
RoundSummary.DrawReputationBar(sb, component.Rect,
|
||||
location.Reputation.NormalizedValue,
|
||||
location.Reputation.MinReputation, location.Reputation.MaxReputation);
|
||||
});
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.4f, 1.0f), repBarHolder.RectTransform),
|
||||
@@ -1128,8 +1130,11 @@ namespace Barotrauma
|
||||
|
||||
if (connection.LevelData.HasBeaconStation)
|
||||
{
|
||||
var beaconStationIconStyle = connection.LevelData.IsBeaconActive ? "BeaconStationActive" : "BeaconStationInactive";
|
||||
DrawIcon(beaconStationIconStyle, (int)(28 * zoom), connection.LevelData.IsBeaconActive ? beaconStationActiveText : beaconStationInactiveText);
|
||||
bool beaconActive =
|
||||
connection.LevelData.IsBeaconActive ||
|
||||
(Level.Loaded?.LevelData == connection.LevelData && Level.Loaded.CheckBeaconActive());
|
||||
var beaconStationIconStyle = beaconActive ? "BeaconStationActive" : "BeaconStationInactive";
|
||||
DrawIcon(beaconStationIconStyle, (int)(28 * zoom), beaconActive ? beaconStationActiveText : beaconStationInactiveText);
|
||||
}
|
||||
|
||||
if (connection.Locked)
|
||||
|
||||
@@ -808,8 +808,16 @@ namespace Barotrauma
|
||||
{
|
||||
if (structure.FlippedX && structure.Prefab.CanSpriteFlipX) { spriteEffects ^= SpriteEffects.FlipHorizontally; }
|
||||
if (structure.FlippedY && structure.Prefab.CanSpriteFlipY) { spriteEffects ^= SpriteEffects.FlipVertically; }
|
||||
spriteRotation = MathHelper.ToRadians(structure.Rotation);
|
||||
rectangleRotation = spriteRotation;
|
||||
rectangleRotation = MathHelper.ToRadians(structure.Rotation);
|
||||
|
||||
spriteRotation = rectangleRotation;
|
||||
bool spriteIsFlippedHorizontally = structure.Sprite.effects.HasFlag(SpriteEffects.FlipHorizontally);
|
||||
bool spriteIsFlippedVertically = structure.Sprite.effects.HasFlag(SpriteEffects.FlipVertically);
|
||||
if (spriteIsFlippedHorizontally != spriteIsFlippedVertically)
|
||||
{
|
||||
spriteRotation = -spriteRotation;
|
||||
}
|
||||
|
||||
if (structure.FlippedX != structure.FlippedY) { rectangleRotation = -rectangleRotation; }
|
||||
break;
|
||||
}
|
||||
@@ -978,6 +986,11 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public static void ResetEditingHUD()
|
||||
{
|
||||
editingHUD = null;
|
||||
}
|
||||
|
||||
public static void DrawEditor(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
if (SelectedList.Count == 1)
|
||||
|
||||
@@ -1,12 +1,32 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
abstract partial class MapEntityPrefab : PrefabWithUintIdentifier
|
||||
{
|
||||
public RichString CreateTooltipText()
|
||||
{
|
||||
LocalizedString name = Category.HasFlag(MapEntityCategory.Legacy) ? TextManager.GetWithVariable("legacyitemformat", "[name]", Name) : Name;
|
||||
LocalizedString tooltip = $"‖color:{XMLExtensions.ToStringHex(GUIStyle.TextColorBright)}‖{name}‖color:end‖";
|
||||
|
||||
if (!Description.IsNullOrEmpty())
|
||||
{
|
||||
tooltip += '\n' + Description;
|
||||
}
|
||||
|
||||
if (IsModded)
|
||||
{
|
||||
tooltip = $"{tooltip}\n‖color:{Color.MediumPurple.ToStringHex()}‖{ContentPackage?.Name}‖color:end‖";
|
||||
}
|
||||
|
||||
return RichString.Rich(tooltip);
|
||||
}
|
||||
|
||||
public bool IsModded
|
||||
=> ContentPackage != GameMain.VanillaContent && ContentPackage != null;
|
||||
|
||||
public virtual void UpdatePlacing(Camera cam)
|
||||
{
|
||||
if (PlayerInput.SecondaryMouseButtonClicked())
|
||||
|
||||
@@ -25,8 +25,10 @@ namespace Barotrauma
|
||||
Stream = sound.Stream;
|
||||
Range = element.GetAttributeFloat("range", 1000.0f);
|
||||
Volume = element.GetAttributeFloat("volume", 1.0f);
|
||||
IgnoreMuffling = element.GetAttributeBool("dontmuffle", false);
|
||||
|
||||
FrequencyMultiplierRange = new Vector2(1.0f);
|
||||
string freqMultAttr = element.GetAttributeString("frequencymultiplier", element.GetAttributeString("frequency", "1.0"))!;
|
||||
string freqMultAttr = element.GetAttributeString("frequencymultiplier", element.GetAttributeString("frequency", "1.0"));
|
||||
if (!freqMultAttr.Contains(','))
|
||||
{
|
||||
if (float.TryParse(freqMultAttr, NumberStyles.Any, CultureInfo.InvariantCulture, out float freqMult))
|
||||
@@ -47,7 +49,6 @@ namespace Barotrauma
|
||||
DebugConsole.ThrowError($"Loaded frequency range exceeds max value: {FrequencyMultiplierRange} (original string was \"{freqMultAttr}\")",
|
||||
contentPackage: element.ContentPackage);
|
||||
}
|
||||
IgnoreMuffling = element.GetAttributeBool("dontmuffle", false);
|
||||
}
|
||||
|
||||
public float GetRandomFrequencyMultiplier()
|
||||
|
||||
@@ -221,6 +221,12 @@ namespace Barotrauma
|
||||
editor.AddCustomContent(tickBox, 1);
|
||||
}
|
||||
|
||||
if (!Layer.IsNullOrEmpty())
|
||||
{
|
||||
var layerText = new GUITextBlock(new RectTransform(new Point(listBox.Content.Rect.Width, heightScaled)) { MinSize = new Point(0, heightScaled) }, TextManager.AddPunctuation(':', TextManager.Get("editor.layer"), Layer));
|
||||
editor.AddCustomContent(layerText, 1);
|
||||
}
|
||||
|
||||
var buttonContainer = new GUILayoutGroup(new RectTransform(new Point(listBox.Content.Rect.Width, heightScaled)), isHorizontal: true)
|
||||
{
|
||||
Stretch = true,
|
||||
@@ -435,13 +441,12 @@ namespace Barotrauma
|
||||
dropShadowOffset.Y = -dropShadowOffset.Y;
|
||||
}
|
||||
|
||||
SpriteEffects oldEffects = Prefab.BackgroundSprite.effects;
|
||||
Prefab.BackgroundSprite.effects ^= SpriteEffects;
|
||||
|
||||
Vector2 backGroundOffset = new Vector2(
|
||||
MathUtils.PositiveModulo(-textureOffset.X, Prefab.BackgroundSprite.SourceRect.Width * TextureScale.X * Scale),
|
||||
MathUtils.PositiveModulo(-textureOffset.Y, Prefab.BackgroundSprite.SourceRect.Height * TextureScale.Y * Scale));
|
||||
|
||||
float rotationRad = rotationForSprite(this.rotationRad, Prefab.BackgroundSprite);
|
||||
|
||||
Prefab.BackgroundSprite.DrawTiled(
|
||||
spriteBatch,
|
||||
new Vector2(rect.X + rect.Width / 2 + drawOffset.X, -(rect.Y - rect.Height / 2 + drawOffset.Y)),
|
||||
@@ -451,7 +456,8 @@ namespace Barotrauma
|
||||
color: Prefab.BackgroundSpriteColor,
|
||||
textureScale: TextureScale * Scale,
|
||||
startOffset: backGroundOffset,
|
||||
depth: Math.Max(GetDrawDepth(Prefab.BackgroundSprite.Depth, Prefab.BackgroundSprite), depth + 0.000001f));
|
||||
depth: Math.Max(GetDrawDepth(Prefab.BackgroundSprite.Depth, Prefab.BackgroundSprite), depth + 0.000001f),
|
||||
spriteEffects: Prefab.BackgroundSprite.effects ^ SpriteEffects);
|
||||
|
||||
if (UseDropShadow)
|
||||
{
|
||||
@@ -464,18 +470,14 @@ namespace Barotrauma
|
||||
color: Color.Black * 0.5f,
|
||||
textureScale: TextureScale * Scale,
|
||||
startOffset: backGroundOffset,
|
||||
depth: (depth + Prefab.BackgroundSprite.Depth) / 2.0f);
|
||||
depth: (depth + Prefab.BackgroundSprite.Depth) / 2.0f,
|
||||
spriteEffects: Prefab.BackgroundSprite.effects ^ SpriteEffects);
|
||||
}
|
||||
|
||||
Prefab.BackgroundSprite.effects = oldEffects;
|
||||
}
|
||||
}
|
||||
|
||||
if (back == GetRealDepth() > 0.5f)
|
||||
{
|
||||
SpriteEffects oldEffects = Prefab.Sprite.effects;
|
||||
Prefab.Sprite.effects ^= SpriteEffects;
|
||||
|
||||
Vector2 advanceX = MathUtils.RotatedUnitXRadians(this.rotationRad).FlipY();
|
||||
Vector2 advanceY = advanceX.YX().FlipX();
|
||||
if (FlippedX != FlippedY)
|
||||
@@ -483,6 +485,9 @@ namespace Barotrauma
|
||||
advanceX = advanceX.FlipY();
|
||||
advanceY = advanceY.FlipX();
|
||||
}
|
||||
|
||||
float sectionSpriteRotationRad = rotationForSprite(this.rotationRad, Prefab.Sprite);
|
||||
|
||||
for (int i = 0; i < Sections.Length; i++)
|
||||
{
|
||||
Rectangle drawSection = Sections[i].rect;
|
||||
@@ -528,22 +533,17 @@ namespace Barotrauma
|
||||
pos += rect.Location.ToVector2();
|
||||
pos = new Vector2(pos.X + rect.Width / 2 + drawOffset.X, -(pos.Y - rect.Height / 2 + drawOffset.Y));
|
||||
|
||||
Vector2 pos = new Vector2(drawSection.X, drawSection.Y);
|
||||
pos -= rect.Location.ToVector2();
|
||||
pos = advanceX * pos.X + advanceY * pos.Y;
|
||||
pos += rect.Location.ToVector2();
|
||||
pos = new Vector2(pos.X + rect.Width / 2 + drawOffset.X, -(pos.Y - rect.Height / 2 + drawOffset.Y));
|
||||
|
||||
Prefab.Sprite.DrawTiled(
|
||||
spriteBatch,
|
||||
pos,
|
||||
new Vector2(drawSection.Width, drawSection.Height),
|
||||
rotation: rotationRad,
|
||||
rotation: sectionSpriteRotationRad,
|
||||
origin: rect.Size.ToVector2() * new Vector2(0.5f, 0.5f),
|
||||
color: color,
|
||||
startOffset: sectionOffset,
|
||||
depth: depth,
|
||||
textureScale: TextureScale * Scale);
|
||||
textureScale: TextureScale * Scale,
|
||||
spriteEffects: Prefab.Sprite.effects ^ SpriteEffects);
|
||||
}
|
||||
|
||||
foreach (var decorativeSprite in Prefab.DecorativeSprites)
|
||||
@@ -551,27 +551,42 @@ namespace Barotrauma
|
||||
if (!spriteAnimState[decorativeSprite].IsActive) { continue; }
|
||||
float rotation = decorativeSprite.GetRotation(ref spriteAnimState[decorativeSprite].RotationState, spriteAnimState[decorativeSprite].RandomRotationFactor) + this.rotationRad;
|
||||
Vector2 offset = decorativeSprite.GetOffset(ref spriteAnimState[decorativeSprite].OffsetState, spriteAnimState[decorativeSprite].RandomOffsetMultiplier) * Scale;
|
||||
decorativeSprite.Sprite.Draw(spriteBatch, new Vector2(DrawPosition.X + offset.X, -(DrawPosition.Y + offset.Y)), color,
|
||||
rotation, decorativeSprite.GetScale(spriteAnimState[decorativeSprite].RandomScaleFactor) * Scale, Prefab.Sprite.effects,
|
||||
Vector2 drawPos = DrawPosition + MathUtils.RotatePoint(offset, -this.rotationRad);
|
||||
decorativeSprite.Sprite.Draw(
|
||||
spriteBatch: spriteBatch,
|
||||
pos: drawPos.FlipY(),
|
||||
color: color,
|
||||
rotate: rotation,
|
||||
scale: decorativeSprite.GetScale(spriteAnimState[decorativeSprite].RandomScaleFactor) * Scale,
|
||||
spriteEffect: Prefab.Sprite.effects ^ SpriteEffects,
|
||||
depth: Math.Min(depth + (decorativeSprite.Sprite.Depth - Prefab.Sprite.Depth), 0.999f));
|
||||
}
|
||||
Prefab.Sprite.effects = oldEffects;
|
||||
}
|
||||
|
||||
static float rotationForSprite(float rotationRad, Sprite sprite)
|
||||
{
|
||||
if (sprite.effects.HasFlag(SpriteEffects.FlipHorizontally) != sprite.effects.HasFlag(SpriteEffects.FlipVertically))
|
||||
{
|
||||
rotationRad = -rotationRad;
|
||||
}
|
||||
return rotationRad;
|
||||
}
|
||||
|
||||
if (GameMain.DebugDraw && Screen.Selected.Cam.Zoom > 0.5f)
|
||||
{
|
||||
if (Bodies != null)
|
||||
{
|
||||
for (int i = 0; i < Bodies.Count; i++)
|
||||
foreach (var body in Bodies)
|
||||
{
|
||||
Vector2 pos = FarseerPhysics.ConvertUnits.ToDisplayUnits(Bodies[i].Position);
|
||||
Vector2 pos = ConvertUnits.ToDisplayUnits(body.Position);
|
||||
if (Submarine != null) { pos += Submarine.DrawPosition; }
|
||||
pos.Y = -pos.Y;
|
||||
var dimensions = bodyDimensions[body];
|
||||
GUI.DrawRectangle(spriteBatch,
|
||||
pos,
|
||||
FarseerPhysics.ConvertUnits.ToDisplayUnits(bodyDebugDimensions[i].X),
|
||||
FarseerPhysics.ConvertUnits.ToDisplayUnits(bodyDebugDimensions[i].Y),
|
||||
-Bodies[i].Rotation, Color.White);
|
||||
ConvertUnits.ToDisplayUnits(dimensions.X),
|
||||
ConvertUnits.ToDisplayUnits(dimensions.Y),
|
||||
-body.Rotation, Color.White);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -506,6 +507,47 @@ namespace Barotrauma
|
||||
Hull.ShowHulls = true;
|
||||
}
|
||||
|
||||
if (!IsWarningSuppressed(SubEditorScreen.WarningType.NotEnoughContainers))
|
||||
{
|
||||
HashSet<ContainerTagPrefab> missingContainerTags = new();
|
||||
foreach (var prefab in ContainerTagPrefab.Prefabs)
|
||||
{
|
||||
if (!prefab.IsRecommendedForSub(this) || !prefab.WarnIfLess) { continue; }
|
||||
|
||||
int count = Item.ItemList.Count(i => i.HasTag(prefab.Identifier));
|
||||
if (count < prefab.RecommendedAmount)
|
||||
{
|
||||
missingContainerTags.Add(prefab);
|
||||
}
|
||||
}
|
||||
|
||||
if (missingContainerTags.Any())
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
int count = 0;
|
||||
foreach (var tag in missingContainerTags)
|
||||
{
|
||||
sb.AppendLine($"- {tag.Name}");
|
||||
count++;
|
||||
if (missingContainerTags.Count > count && count >= 3)
|
||||
{
|
||||
var moreIndicator = TextManager.GetWithVariable(
|
||||
"upgradeuitooltip.moreindicator",
|
||||
"[amount]",
|
||||
(missingContainerTags.Count - count).ToString()).Value;
|
||||
sb.AppendLine(moreIndicator);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
errorMsgs.Add(TextManager.GetWithVariable(
|
||||
"ContainerTagUI.CountWarning",
|
||||
"[tags]",
|
||||
sb.ToString()).Value);
|
||||
warnings.Add(SubEditorScreen.WarningType.NotEnoughContainers);
|
||||
}
|
||||
}
|
||||
|
||||
if (Info.Type == SubmarineType.Player)
|
||||
{
|
||||
foreach (Item item in Item.ItemList)
|
||||
@@ -521,7 +563,40 @@ namespace Barotrauma
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
if (item.GetComponent<OxygenGenerator>() is not OxygenGenerator oxygenGenerator) { continue; }
|
||||
|
||||
Dictionary<Hull, float> hullOxygenFlow = new Dictionary<Hull, float>();
|
||||
|
||||
foreach (var linkedTo in item.linkedTo)
|
||||
{
|
||||
if (linkedTo is not Item linkedItem || linkedItem.GetComponent<Vent>() is not Vent vent) { continue; }
|
||||
if (vent.Item.CurrentHull == null)
|
||||
{
|
||||
vent.Item.FindHull();
|
||||
if (vent.Item.CurrentHull == null) { continue; }
|
||||
}
|
||||
float oxygenFlow = oxygenGenerator.GetVentOxygenFlow(vent);
|
||||
if (!hullOxygenFlow.ContainsKey(vent.Item.CurrentHull))
|
||||
{
|
||||
hullOxygenFlow[vent.Item.CurrentHull] = oxygenFlow;
|
||||
}
|
||||
else
|
||||
{
|
||||
hullOxygenFlow[vent.Item.CurrentHull] += oxygenFlow;
|
||||
}
|
||||
}
|
||||
foreach ((Hull hull, float oxygenFlow) in hullOxygenFlow)
|
||||
{
|
||||
if (oxygenFlow < Hull.OxygenConsumptionSpeed)
|
||||
{
|
||||
errorMsgs.Add(TextManager.GetWithVariable("LowOxygenOutputWarning", "[roomname]",
|
||||
hull.DisplayName).Value);
|
||||
warnings.Add(SubEditorScreen.WarningType.LowOxygenOutputWarning);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!WayPoint.WayPointList.Any(wp => wp.ShouldBeSaved && wp.SpawnType == SpawnType.Human))
|
||||
{
|
||||
if (!IsWarningSuppressed(SubEditorScreen.WarningType.NoHumanSpawnpoints))
|
||||
@@ -554,6 +629,15 @@ namespace Barotrauma
|
||||
warnings.Add(SubEditorScreen.WarningType.NoHiddenContainers);
|
||||
}
|
||||
}
|
||||
if (Info.Dimensions.X * Physics.DisplayToRealWorldRatio > 80 ||
|
||||
Info.Dimensions.Y * Physics.DisplayToRealWorldRatio > 32)
|
||||
{
|
||||
if (!IsWarningSuppressed(SubEditorScreen.WarningType.TooLargeForEndGame))
|
||||
{
|
||||
errorMsgs.Add(TextManager.Get("TooLargeForEndGameWarning").Value);
|
||||
warnings.Add(SubEditorScreen.WarningType.TooLargeForEndGame);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Info.Type == SubmarineType.OutpostModule)
|
||||
{
|
||||
@@ -749,7 +833,9 @@ namespace Barotrauma
|
||||
|
||||
public void ClientEventRead(IReadMessage msg, float sendingTime)
|
||||
{
|
||||
throw new Exception($"Error while reading a network event for the submarine \"{Info.Name} ({ID})\". Submarines are not even supposed to receive events!");
|
||||
Identifier layerIdentifier = msg.ReadIdentifier();
|
||||
bool enabled = msg.ReadBoolean();
|
||||
SetLayerEnabled(layerIdentifier, enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,52 @@
|
||||
using FarseerPhysics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Voronoi2;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class SubmarineBody
|
||||
{
|
||||
|
||||
partial void HandleLevelCollisionProjSpecific(Impact impact)
|
||||
{
|
||||
float wallImpact = Vector2.Dot(impact.Velocity, -impact.Normal);
|
||||
int particleAmount = (int)Math.Min(wallImpact, 10);
|
||||
|
||||
const float BurstParticleThreshold = 5.0f;
|
||||
|
||||
float velocityFactor = MathHelper.Clamp(wallImpact / 10.0f, 0.0f, 1.0f);
|
||||
for (int i = 0; i < particleAmount * 5; i++)
|
||||
{
|
||||
GameMain.ParticleManager.CreateParticle("iceshards",
|
||||
ConvertUnits.ToDisplayUnits(impact.ImpactPos) + Rand.Vector(Rand.Range(1.0f, 50.0f)),
|
||||
(Rand.Vector(0.9f) + impact.Normal) * Rand.Range(100.0f, 10000) * velocityFactor);
|
||||
}
|
||||
for (int i = 0; i < particleAmount; i++)
|
||||
{
|
||||
float particleVelocityMultiplier = Rand.Range(0.0f, 1);
|
||||
var p = GameMain.ParticleManager.CreateParticle("iceexplosion",
|
||||
ConvertUnits.ToDisplayUnits(impact.ImpactPos) + Rand.Vector(Rand.Range(1.0f, 50.0f)),
|
||||
(Rand.Vector(0.5f) + impact.Normal) * particleVelocityMultiplier * 500 * velocityFactor);
|
||||
if (p != null)
|
||||
{
|
||||
p.VelocityChangeMultiplier = particleVelocityMultiplier * Rand.Range(0.0f, 1.0f);
|
||||
p.Size *= Math.Max(particleVelocityMultiplier, 0);
|
||||
}
|
||||
}
|
||||
if (wallImpact > BurstParticleThreshold)
|
||||
{
|
||||
for (int i = 0; i < particleAmount; i++)
|
||||
{
|
||||
GameMain.ParticleManager.CreateParticle("iceburst",
|
||||
ConvertUnits.ToDisplayUnits(impact.ImpactPos) + Rand.Vector(Rand.Range(1.0f, 50.0f)),
|
||||
angle: MathUtils.VectorToAngle(impact.Normal.FlipY() + Rand.Vector(0.25f)), speed: 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
partial void ClientUpdatePosition(float deltaTime)
|
||||
{
|
||||
if (GameMain.Client == null) { return; }
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace Barotrauma
|
||||
|
||||
private bool IsHidden()
|
||||
{
|
||||
if (!SubEditorScreen.IsLayerVisible(this)) { return false; }
|
||||
if (!SubEditorScreen.IsLayerVisible(this)) { return true; }
|
||||
if (spawnType == SpawnType.Path)
|
||||
{
|
||||
return (!GameMain.DebugDraw && !ShowWayPoints);
|
||||
@@ -316,6 +316,11 @@ namespace Barotrauma
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), paddedFrame.RectTransform), TextManager.Get("Spawnpoint"), font: GUIStyle.LargeFont);
|
||||
|
||||
if (!Layer.IsNullOrEmpty())
|
||||
{
|
||||
var layerText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedFrame.RectTransform), TextManager.AddPunctuation(':', TextManager.Get("editor.layer"), Layer));
|
||||
}
|
||||
|
||||
var spawnTypeContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.2f), paddedFrame.RectTransform), isHorizontal: true)
|
||||
{
|
||||
Stretch = true,
|
||||
|
||||
Reference in New Issue
Block a user