Merge remote-tracking branch 'upstream/master' into ed-21-06-2024-upstream-sync
# Conflicts: # Resources/Prototypes/Maps/europa.yml # Resources/Prototypes/Maps/train.yml
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Shared.Buckle;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.Rotation;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Client.Buckle;
|
||||
|
||||
@@ -14,40 +15,63 @@ internal sealed class BuckleSystem : SharedBuckleSystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<BuckleComponent, AfterAutoHandleStateEvent>(OnBuckleAfterAutoHandleState);
|
||||
SubscribeLocalEvent<BuckleComponent, ComponentHandleState>(OnHandleState);
|
||||
SubscribeLocalEvent<BuckleComponent, AppearanceChangeEvent>(OnAppearanceChange);
|
||||
SubscribeLocalEvent<StrapComponent, MoveEvent>(OnStrapMoveEvent);
|
||||
}
|
||||
|
||||
private void OnBuckleAfterAutoHandleState(EntityUid uid, BuckleComponent component, ref AfterAutoHandleStateEvent args)
|
||||
private void OnStrapMoveEvent(EntityUid uid, StrapComponent component, ref MoveEvent args)
|
||||
{
|
||||
ActionBlocker.UpdateCanMove(uid);
|
||||
// I'm moving this to the client-side system, but for the sake of posterity let's keep this comment:
|
||||
// > This is mega cursed. Please somebody save me from Mr Buckle's wild ride
|
||||
|
||||
if (!TryComp<SpriteComponent>(uid, out var ownerSprite))
|
||||
// The nice thing is its still true, this is quite cursed, though maybe not omega cursed anymore.
|
||||
// This code is garbage, it doesn't work with rotated viewports. I need to finally get around to reworking
|
||||
// sprite rendering for entity layers & direction dependent sorting.
|
||||
|
||||
if (args.NewRotation == args.OldRotation)
|
||||
return;
|
||||
|
||||
// Adjust draw depth when the chair faces north so that the seat back is drawn over the player.
|
||||
// Reset the draw depth when rotated in any other direction.
|
||||
// TODO when ECSing, make this a visualizer
|
||||
// This code was written before rotatable viewports were introduced, so hard-coding Direction.North
|
||||
// and comparing it against LocalRotation now breaks this in other rotations. This is a FIXME, but
|
||||
// better to get it working for most people before we look at a more permanent solution.
|
||||
if (component is { Buckled: true, LastEntityBuckledTo: { } } &&
|
||||
Transform(component.LastEntityBuckledTo.Value).LocalRotation.GetCardinalDir() == Direction.North &&
|
||||
TryComp<SpriteComponent>(component.LastEntityBuckledTo, out var buckledSprite))
|
||||
{
|
||||
component.OriginalDrawDepth ??= ownerSprite.DrawDepth;
|
||||
ownerSprite.DrawDepth = buckledSprite.DrawDepth - 1;
|
||||
if (!TryComp<SpriteComponent>(uid, out var strapSprite))
|
||||
return;
|
||||
}
|
||||
|
||||
// If here, we're not turning north and should restore the saved draw depth.
|
||||
if (component.OriginalDrawDepth.HasValue)
|
||||
var isNorth = Transform(uid).LocalRotation.GetCardinalDir() == Direction.North;
|
||||
foreach (var buckledEntity in component.BuckledEntities)
|
||||
{
|
||||
ownerSprite.DrawDepth = component.OriginalDrawDepth.Value;
|
||||
component.OriginalDrawDepth = null;
|
||||
if (!TryComp<BuckleComponent>(buckledEntity, out var buckle))
|
||||
continue;
|
||||
|
||||
if (!TryComp<SpriteComponent>(buckledEntity, out var buckledSprite))
|
||||
continue;
|
||||
|
||||
if (isNorth)
|
||||
{
|
||||
buckle.OriginalDrawDepth ??= buckledSprite.DrawDepth;
|
||||
buckledSprite.DrawDepth = strapSprite.DrawDepth - 1;
|
||||
}
|
||||
else if (buckle.OriginalDrawDepth.HasValue)
|
||||
{
|
||||
buckledSprite.DrawDepth = buckle.OriginalDrawDepth.Value;
|
||||
buckle.OriginalDrawDepth = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnHandleState(Entity<BuckleComponent> ent, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not BuckleState state)
|
||||
return;
|
||||
|
||||
ent.Comp.DontCollide = state.DontCollide;
|
||||
ent.Comp.BuckleTime = state.BuckleTime;
|
||||
var strapUid = EnsureEntity<BuckleComponent>(state.BuckledTo, ent);
|
||||
|
||||
SetBuckledTo(ent, strapUid == null ? null : new (strapUid.Value, null));
|
||||
|
||||
var (uid, component) = ent;
|
||||
|
||||
}
|
||||
|
||||
private void OnAppearanceChange(EntityUid uid, BuckleComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
if (!TryComp<RotationVisualsComponent>(uid, out var rotVisuals))
|
||||
|
||||
19
Content.Client/Clothing/Systems/PilotedByClothingSystem.cs
Normal file
19
Content.Client/Clothing/Systems/PilotedByClothingSystem.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Content.Shared.Clothing.Components;
|
||||
using Robust.Client.Physics;
|
||||
|
||||
namespace Content.Client.Clothing.Systems;
|
||||
|
||||
public sealed partial class PilotedByClothingSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<PilotedByClothingComponent, UpdateIsPredictedEvent>(OnUpdatePredicted);
|
||||
}
|
||||
|
||||
private void OnUpdatePredicted(Entity<PilotedByClothingComponent> entity, ref UpdateIsPredictedEvent args)
|
||||
{
|
||||
args.BlockPrediction = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
using Content.Shared.DeviceNetwork.Systems;
|
||||
|
||||
namespace Content.Client.DeviceNetwork.Systems;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public sealed class DeviceNetworkJammerSystem : SharedDeviceNetworkJammerSystem;
|
||||
@@ -2,8 +2,10 @@ using Content.Shared.Effects;
|
||||
using Robust.Client.Animations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Animations;
|
||||
using Robust.Shared.Collections;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.Effects;
|
||||
|
||||
@@ -11,13 +13,13 @@ public sealed class ColorFlashEffectSystem : SharedColorFlashEffectSystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly AnimationPlayerSystem _animation = default!;
|
||||
[Dependency] private readonly IComponentFactory _factory = default!;
|
||||
|
||||
/// <summary>
|
||||
/// It's a little on the long side but given we use multiple colours denoting what happened it makes it easier to register.
|
||||
/// </summary>
|
||||
private const float AnimationLength = 0.30f;
|
||||
private const string AnimationKey = "color-flash-effect";
|
||||
private ValueList<EntityUid> _toRemove = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -44,8 +46,28 @@ public sealed class ColorFlashEffectSystem : SharedColorFlashEffectSystem
|
||||
{
|
||||
sprite.Color = component.Color;
|
||||
}
|
||||
}
|
||||
|
||||
RemCompDeferred<ColorFlashEffectComponent>(uid);
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
var query = AllEntityQuery<ColorFlashEffectComponent>();
|
||||
_toRemove.Clear();
|
||||
|
||||
// Can't use deferred removal on animation completion or it will cause issues.
|
||||
while (query.MoveNext(out var uid, out _))
|
||||
{
|
||||
if (_animation.HasRunningAnimation(uid, AnimationKey))
|
||||
continue;
|
||||
|
||||
_toRemove.Add(uid);
|
||||
}
|
||||
|
||||
foreach (var ent in _toRemove)
|
||||
{
|
||||
RemComp<ColorFlashEffectComponent>(ent);
|
||||
}
|
||||
}
|
||||
|
||||
private Animation? GetDamageAnimation(EntityUid uid, Color color, SpriteComponent? sprite = null)
|
||||
@@ -82,51 +104,31 @@ public sealed class ColorFlashEffectSystem : SharedColorFlashEffectSystem
|
||||
{
|
||||
var ent = GetEntity(nent);
|
||||
|
||||
if (Deleted(ent))
|
||||
if (Deleted(ent) || !TryComp(ent, out SpriteComponent? sprite))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!TryComp(ent, out AnimationPlayerComponent? player))
|
||||
{
|
||||
player = (AnimationPlayerComponent) _factory.GetComponent(typeof(AnimationPlayerComponent));
|
||||
player.Owner = ent;
|
||||
player.NetSyncEnabled = false;
|
||||
AddComp(ent, player);
|
||||
}
|
||||
|
||||
// Need to stop the existing animation first to ensure the sprite color is fixed.
|
||||
// Otherwise we might lerp to a red colour instead.
|
||||
if (_animation.HasRunningAnimation(ent, player, AnimationKey))
|
||||
{
|
||||
_animation.Stop(ent, player, AnimationKey);
|
||||
}
|
||||
|
||||
if (!TryComp<SpriteComponent>(ent, out var sprite))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (TryComp<ColorFlashEffectComponent>(ent, out var effect))
|
||||
{
|
||||
sprite.Color = effect.Color;
|
||||
}
|
||||
|
||||
var animation = GetDamageAnimation(ent, color, sprite);
|
||||
|
||||
if (animation == null)
|
||||
continue;
|
||||
|
||||
if (!TryComp(ent, out ColorFlashEffectComponent? comp))
|
||||
{
|
||||
comp = (ColorFlashEffectComponent) _factory.GetComponent(typeof(ColorFlashEffectComponent));
|
||||
comp.Owner = ent;
|
||||
comp.NetSyncEnabled = false;
|
||||
AddComp(ent, comp);
|
||||
#if DEBUG
|
||||
DebugTools.Assert(!_animation.HasRunningAnimation(ent, AnimationKey));
|
||||
#endif
|
||||
}
|
||||
|
||||
_animation.Stop(ent, AnimationKey);
|
||||
var animation = GetDamageAnimation(ent, color, sprite);
|
||||
|
||||
if (animation == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
EnsureComp<ColorFlashEffectComponent>(ent, out comp);
|
||||
comp.NetSyncEnabled = false;
|
||||
comp.Color = sprite.Color;
|
||||
_animation.Play((ent, player), animation, AnimationKey);
|
||||
|
||||
_animation.Play(ent, animation, AnimationKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,6 @@ public sealed class FloatingVisualizerSystem : SharedFloatingVisualizerSystem
|
||||
if (args.Key != component.AnimationKey)
|
||||
return;
|
||||
|
||||
FloatAnimation(uid, component.Offset, component.AnimationKey, component.AnimationTime, !component.CanFloat);
|
||||
FloatAnimation(uid, component.Offset, component.AnimationKey, component.AnimationTime, stop: !component.CanFloat);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
// CanInteract() doesn't support checking a second "target" entity.
|
||||
// Doing so manually:
|
||||
var ev = new GettingInteractedWithAttemptEvent(user, dragged);
|
||||
RaiseLocalEvent(dragged, ev, true);
|
||||
RaiseLocalEvent(dragged, ref ev);
|
||||
|
||||
if (ev.Cancelled)
|
||||
return false;
|
||||
|
||||
@@ -100,12 +100,11 @@
|
||||
Margin="5 0 0 0"
|
||||
Text="{Loc 'lathe-menu-fabricating-message'}">
|
||||
</Label>
|
||||
<TextureRect
|
||||
Name="Icon"
|
||||
HorizontalExpand="True"
|
||||
SizeFlagsStretchRatio="2"
|
||||
Margin="100 0 0 0">
|
||||
</TextureRect>
|
||||
<EntityPrototypeView
|
||||
Name="FabricatingEntityProto"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="100 0 0 0"
|
||||
/>
|
||||
<Label
|
||||
Name="NameLabel"
|
||||
RectClipContent="True"
|
||||
@@ -114,12 +113,15 @@
|
||||
</Label>
|
||||
</PanelContainer>
|
||||
</BoxContainer>
|
||||
<ItemList
|
||||
Name="QueueList"
|
||||
VerticalExpand="True"
|
||||
SizeFlagsStretchRatio="3"
|
||||
SelectMode="None">
|
||||
</ItemList>
|
||||
<ScrollContainer VerticalExpand="True" HScrollEnabled="False">
|
||||
<BoxContainer
|
||||
Name="QueueList"
|
||||
Orientation="Vertical"
|
||||
HorizontalExpand="True"
|
||||
VerticalExpand="True"
|
||||
RectClipContent="True">
|
||||
</BoxContainer>
|
||||
</ScrollContainer>
|
||||
</BoxContainer>
|
||||
<BoxContainer
|
||||
VerticalExpand="True"
|
||||
|
||||
@@ -78,9 +78,6 @@ public sealed partial class LatheMenu : DefaultWindow
|
||||
/// </summary>
|
||||
public void PopulateRecipes()
|
||||
{
|
||||
if (!_entityManager.TryGetComponent<LatheComponent>(_owner, out var component))
|
||||
return;
|
||||
|
||||
var recipesToShow = new List<LatheRecipePrototype>();
|
||||
foreach (var recipe in Recipes)
|
||||
{
|
||||
@@ -108,21 +105,13 @@ public sealed partial class LatheMenu : DefaultWindow
|
||||
RecipeList.Children.Clear();
|
||||
foreach (var prototype in sortedRecipesToShow)
|
||||
{
|
||||
List<Texture> textures;
|
||||
EntityPrototype? recipeProto = null;
|
||||
if (_prototypeManager.TryIndex(prototype.Result, out EntityPrototype? entityProto) && entityProto != null)
|
||||
{
|
||||
textures = SpriteComponent.GetPrototypeTextures(entityProto, _resources).Select(o => o.Default).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
textures = prototype.Icon == null
|
||||
? new List<Texture> { _spriteSystem.GetPrototypeIcon(prototype.Result).Default }
|
||||
: new List<Texture> { _spriteSystem.Frame0(prototype.Icon) };
|
||||
}
|
||||
recipeProto = entityProto;
|
||||
|
||||
var canProduce = _lathe.CanProduce(_owner, prototype, quantity);
|
||||
|
||||
var control = new RecipeControl(prototype, () => GenerateTooltipText(prototype), canProduce, textures);
|
||||
var control = new RecipeControl(prototype, () => GenerateTooltipText(prototype), canProduce, recipeProto);
|
||||
control.OnButtonPressed += s =>
|
||||
{
|
||||
if (!int.TryParse(AmountLineEdit.Text, out var amount) || amount <= 0)
|
||||
@@ -219,14 +208,23 @@ public sealed partial class LatheMenu : DefaultWindow
|
||||
/// <param name="queue"></param>
|
||||
public void PopulateQueueList(List<LatheRecipePrototype> queue)
|
||||
{
|
||||
QueueList.Clear();
|
||||
QueueList.DisposeAllChildren();
|
||||
|
||||
var idx = 1;
|
||||
foreach (var recipe in queue)
|
||||
{
|
||||
var icon = recipe.Icon == null
|
||||
? _spriteSystem.GetPrototypeIcon(recipe.Result).Default
|
||||
: _spriteSystem.Frame0(recipe.Icon);
|
||||
QueueList.AddItem($"{idx}. {recipe.Name}", icon);
|
||||
var queuedRecipeBox = new BoxContainer();
|
||||
queuedRecipeBox.Orientation = BoxContainer.LayoutOrientation.Horizontal;
|
||||
|
||||
var queuedRecipeProto = new EntityPrototypeView();
|
||||
if (_prototypeManager.TryIndex(recipe.Result, out EntityPrototype? entityProto) && entityProto != null)
|
||||
queuedRecipeProto.SetPrototype(entityProto);
|
||||
|
||||
var queuedRecipeLabel = new Label();
|
||||
queuedRecipeLabel.Text = $"{idx}. {recipe.Name}";
|
||||
queuedRecipeBox.AddChild(queuedRecipeProto);
|
||||
queuedRecipeBox.AddChild(queuedRecipeLabel);
|
||||
QueueList.AddChild(queuedRecipeBox);
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
@@ -236,9 +234,10 @@ public sealed partial class LatheMenu : DefaultWindow
|
||||
FabricatingContainer.Visible = recipe != null;
|
||||
if (recipe == null)
|
||||
return;
|
||||
Icon.Texture = recipe.Icon == null
|
||||
? _spriteSystem.GetPrototypeIcon(recipe.Result).Default
|
||||
: _spriteSystem.Frame0(recipe.Icon);
|
||||
|
||||
if (_prototypeManager.TryIndex(recipe.Result, out EntityPrototype? entityProto) && entityProto != null)
|
||||
FabricatingEntityProto.SetPrototype(entityProto);
|
||||
|
||||
NameLabel.Text = $"{recipe.Name}";
|
||||
}
|
||||
|
||||
|
||||
@@ -5,14 +5,12 @@
|
||||
Margin="0"
|
||||
StyleClasses="ButtonSquare">
|
||||
<BoxContainer Orientation="Horizontal">
|
||||
<LayeredTextureRect
|
||||
Name="RecipeTextures"
|
||||
<EntityPrototypeView
|
||||
Name="RecipePrototype"
|
||||
Margin="0 0 4 0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Stretch="KeepAspectCentered"
|
||||
MinSize="32 32"
|
||||
CanShrink="true"
|
||||
/>
|
||||
<Label Name="RecipeName" HorizontalExpand="True" />
|
||||
</BoxContainer>
|
||||
|
||||
@@ -4,6 +4,7 @@ using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.Lathe.UI;
|
||||
|
||||
@@ -13,12 +14,13 @@ public sealed partial class RecipeControl : Control
|
||||
public Action<string>? OnButtonPressed;
|
||||
public Func<string> TooltipTextSupplier;
|
||||
|
||||
public RecipeControl(LatheRecipePrototype recipe, Func<string> tooltipTextSupplier, bool canProduce, List<Texture> textures)
|
||||
public RecipeControl(LatheRecipePrototype recipe, Func<string> tooltipTextSupplier, bool canProduce, EntityPrototype? entityPrototype = null)
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
RecipeName.Text = recipe.Name;
|
||||
RecipeTextures.Textures = textures;
|
||||
if (entityPrototype != null)
|
||||
RecipePrototype.SetPrototype(entityPrototype);
|
||||
Button.Disabled = !canProduce;
|
||||
TooltipTextSupplier = tooltipTextSupplier;
|
||||
Button.TooltipSupplier = SupplyTooltip;
|
||||
|
||||
@@ -29,6 +29,9 @@ public sealed partial class LoadoutWindow : FancyWindow
|
||||
if (!protoManager.TryIndex(group, out var groupProto))
|
||||
continue;
|
||||
|
||||
if (groupProto.Hidden)
|
||||
continue;
|
||||
|
||||
var container = new LoadoutGroupContainer(profile, loadout, protoManager.Index(group), session, collection);
|
||||
LoadoutGroupsContainer.AddTab(container, Loc.GetString(groupProto.Name));
|
||||
_groups.Add(container);
|
||||
|
||||
@@ -38,7 +38,7 @@ public sealed partial class StencilOverlay
|
||||
foreach (var tile in grid.Comp.GetTilesIntersecting(worldAABB))
|
||||
{
|
||||
// Ignored tiles for stencil
|
||||
if (_weather.CanWeatherAffect(grid, tile))
|
||||
if (_weather.CanWeatherAffect(grid.Owner, grid, tile))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public sealed partial class ReplaySpectatorSystem
|
||||
SubscribeLocalEvent<ReplaySpectatorComponent, UseAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<ReplaySpectatorComponent, PickupAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<ReplaySpectatorComponent, ThrowAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<ReplaySpectatorComponent, InteractionAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<ReplaySpectatorComponent, InteractionAttemptEvent>(OnInteractAttempt);
|
||||
SubscribeLocalEvent<ReplaySpectatorComponent, AttackAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<ReplaySpectatorComponent, DropAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<ReplaySpectatorComponent, IsEquippingAttemptEvent>(OnAttempt);
|
||||
@@ -27,6 +27,11 @@ public sealed partial class ReplaySpectatorSystem
|
||||
SubscribeLocalEvent<ReplaySpectatorComponent, PullAttemptEvent>(OnPullAttempt);
|
||||
}
|
||||
|
||||
private void OnInteractAttempt(Entity<ReplaySpectatorComponent> ent, ref InteractionAttemptEvent args)
|
||||
{
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
private void OnAttempt(EntityUid uid, ReplaySpectatorComponent component, CancellableEntityEventArgs args)
|
||||
{
|
||||
args.Cancel();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
MinSize="700 700">
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True">
|
||||
<!-- First Informational panel -->
|
||||
<Label Text="{Loc 'thief-backpack-window-description'}" Margin="5 5"/>
|
||||
<Label Name="Description" Margin="5 5"/>
|
||||
<controls:HLine Color="#404040" Thickness="2" Margin="0 5"/>
|
||||
<Label Name="SelectedSets" Text="{Loc 'thief-backpack-window-selected'}" Margin="5 5"/>
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ public sealed partial class ThiefBackpackMenu : FancyWindow
|
||||
selectedNumber++;
|
||||
}
|
||||
|
||||
Description.Text = Loc.GetString("thief-backpack-window-description", ("maxCount", state.MaxSelectedSets));
|
||||
SelectedSets.Text = Loc.GetString("thief-backpack-window-selected", ("selectedCount", selectedNumber), ("maxCount", state.MaxSelectedSets));
|
||||
ApproveButton.Disabled = selectedNumber == state.MaxSelectedSets ? false : true;
|
||||
}
|
||||
|
||||
@@ -2,16 +2,11 @@ using System.Numerics;
|
||||
using Content.Shared.Weather;
|
||||
using Robust.Client.Audio;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Player;
|
||||
using AudioComponent = Robust.Shared.Audio.Components.AudioComponent;
|
||||
|
||||
@@ -62,7 +57,7 @@ public sealed class WeatherSystem : SharedWeatherSystem
|
||||
if (TryComp<MapGridComponent>(entXform.GridUid, out var grid))
|
||||
{
|
||||
var gridId = entXform.GridUid.Value;
|
||||
// Floodfill to the nearest tile and use that for audio.
|
||||
// FloodFill to the nearest tile and use that for audio.
|
||||
var seed = _mapSystem.GetTileRef(gridId, grid, entXform.Coordinates);
|
||||
var frontier = new Queue<TileRef>();
|
||||
frontier.Enqueue(seed);
|
||||
@@ -75,7 +70,7 @@ public sealed class WeatherSystem : SharedWeatherSystem
|
||||
if (!visited.Add(node.GridIndices))
|
||||
continue;
|
||||
|
||||
if (!CanWeatherAffect(grid, node))
|
||||
if (!CanWeatherAffect(entXform.GridUid.Value, grid, node))
|
||||
{
|
||||
// Add neighbors
|
||||
// TODO: Ideally we pick some deterministically random direction and use that
|
||||
@@ -107,7 +102,7 @@ public sealed class WeatherSystem : SharedWeatherSystem
|
||||
if (nearestNode != null)
|
||||
{
|
||||
var entPos = _transform.GetMapCoordinates(entXform);
|
||||
var nodePosition = nearestNode.Value.ToMap(EntityManager, _transform).Position;
|
||||
var nodePosition = _transform.ToMapCoordinates(nearestNode.Value).Position;
|
||||
var delta = nodePosition - entPos.Position;
|
||||
var distance = delta.Length();
|
||||
occlusion = _audio.GetOcclusion(entPos, delta, distance);
|
||||
|
||||
Reference in New Issue
Block a user