Merge branch 'master' into replace-sounds-with-sound-specifier
This commit is contained in:
@@ -37,7 +37,7 @@ namespace Content.Client.Animations
|
||||
new AnimationTrackComponentProperty
|
||||
{
|
||||
ComponentType = typeof(ITransformComponent),
|
||||
Property = nameof(ITransformComponent.WorldPosition),
|
||||
Property = nameof(ITransformComponent.LocalPosition),
|
||||
InterpolationMode = AnimationInterpolationMode.Linear,
|
||||
KeyFrames =
|
||||
{
|
||||
|
||||
@@ -40,9 +40,7 @@ namespace Content.Client.Atmos.Overlays
|
||||
if (!_gasTileOverlaySystem.HasData(mapGrid.Index))
|
||||
continue;
|
||||
|
||||
var gridBounds = new Box2(mapGrid.WorldToLocal(worldBounds.BottomLeft), mapGrid.WorldToLocal(worldBounds.TopRight));
|
||||
|
||||
foreach (var tile in mapGrid.GetTilesIntersecting(gridBounds))
|
||||
foreach (var tile in mapGrid.GetTilesIntersecting(worldBounds))
|
||||
{
|
||||
foreach (var (texture, color) in _gasTileOverlaySystem.GetOverlays(mapGrid.Index, tile.GridIndices))
|
||||
{
|
||||
|
||||
@@ -9,22 +9,13 @@ namespace Content.Client.Atmos.Visualizers
|
||||
[UsedImplicitly]
|
||||
public abstract class EnabledAtmosDeviceVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("disabledState")]
|
||||
private string _disabledState = string.Empty;
|
||||
[DataField("enabledState")]
|
||||
private string _enabledState = string.Empty;
|
||||
protected abstract object LayerMap { get; }
|
||||
protected abstract Enum DataKey { get; }
|
||||
|
||||
public override void InitializeEntity(IEntity entity)
|
||||
{
|
||||
base.InitializeEntity(entity);
|
||||
|
||||
if (!entity.TryGetComponent(out ISpriteComponent? sprite))
|
||||
return;
|
||||
|
||||
sprite.LayerMapSet(LayerMap, sprite.AddLayerState(_enabledState));
|
||||
sprite.LayerSetVisible(LayerMap, false);
|
||||
}
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
@@ -32,8 +23,8 @@ namespace Content.Client.Atmos.Visualizers
|
||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||
return;
|
||||
|
||||
if(component.TryGetData(DataKey, out bool enabled))
|
||||
sprite.LayerSetVisible(LayerMap, enabled);
|
||||
if(component.TryGetData(DataKey, out bool enabled) && sprite.LayerMapTryGet(LayerMap, out var layer))
|
||||
sprite.LayerSetState(layer, enabled ? _enabledState : _disabledState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
Content.Client/Atmos/Visualizers/GasFilterVisualizer.cs
Normal file
18
Content.Client/Atmos/Visualizers/GasFilterVisualizer.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using Content.Shared.Atmos.Piping;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Client.Atmos.Visualizers
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class GasFilterVisualizer : EnabledAtmosDeviceVisualizer
|
||||
{
|
||||
protected override object LayerMap => Layers.Enabled;
|
||||
protected override Enum DataKey => FilterVisuals.Enabled;
|
||||
|
||||
enum Layers : byte
|
||||
{
|
||||
Enabled,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ namespace Content.Client.Atmos.Visualizers
|
||||
}
|
||||
}
|
||||
|
||||
private enum Layers
|
||||
private enum Layers : byte
|
||||
{
|
||||
ConnectedToPort,
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Content.Client.Atmos.Visualizers
|
||||
protected override object LayerMap => Layers.Enabled;
|
||||
protected override Enum DataKey => OutletInjectorVisuals.Enabled;
|
||||
|
||||
enum Layers
|
||||
enum Layers : byte
|
||||
{
|
||||
Enabled,
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Content.Client.Atmos.Visualizers
|
||||
protected override object LayerMap => Layers.Enabled;
|
||||
protected override Enum DataKey => PassiveVentVisuals.Enabled;
|
||||
|
||||
enum Layers
|
||||
enum Layers : byte
|
||||
{
|
||||
Enabled,
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Atmos.Piping;
|
||||
using Content.Shared.SubFloor;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
@@ -69,13 +70,16 @@ namespace Content.Client.Atmos.Visualizers
|
||||
if (!component.TryGetData(PipeVisuals.VisualState, out PipeVisualState state))
|
||||
return;
|
||||
|
||||
if(!component.TryGetData(SubFloorVisuals.SubFloor, out bool subfloor))
|
||||
subfloor = true;
|
||||
|
||||
foreach (Layer layerKey in Enum.GetValues(typeof(Layer)))
|
||||
{
|
||||
var dir = (PipeDirection) layerKey;
|
||||
var layerVisible = state.ConnectedDirections.HasDirection(dir);
|
||||
|
||||
var layer = sprite.LayerMapGet(layerKey);
|
||||
sprite.LayerSetVisible(layer, layerVisible);
|
||||
sprite.LayerSetVisible(layer, layerVisible && subfloor);
|
||||
sprite.LayerSetColor(layer, color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Content.Client.Atmos.Visualizers
|
||||
protected override object LayerMap => Layers.Enabled;
|
||||
protected override Enum DataKey => PressurePumpVisuals.Enabled;
|
||||
|
||||
enum Layers
|
||||
enum Layers : byte
|
||||
{
|
||||
Enabled,
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.Client.Atmos.Visualizers
|
||||
}
|
||||
}
|
||||
|
||||
public enum ScrubberVisualLayers
|
||||
public enum ScrubberVisualLayers : byte
|
||||
{
|
||||
Scrubber,
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Content.Client.Atmos.Visualizers
|
||||
protected override object LayerMap => Layers.Enabled;
|
||||
protected override Enum DataKey => ThermoMachineVisuals.Enabled;
|
||||
|
||||
enum Layers
|
||||
enum Layers : byte
|
||||
{
|
||||
Enabled,
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Content.Client.Atmos.Visualizers
|
||||
}
|
||||
}
|
||||
|
||||
public enum VentVisualLayers
|
||||
public enum VentVisualLayers : byte
|
||||
{
|
||||
Vent,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Client.Cuffs.Components;
|
||||
using Content.Client.Cuffs.Components;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Body.Part;
|
||||
using Content.Shared.CharacterAppearance;
|
||||
@@ -120,15 +120,10 @@ namespace Content.Client.CharacterAppearance
|
||||
return;
|
||||
}
|
||||
|
||||
var layer = args.Part.ToHumanoidLayer();
|
||||
|
||||
if (layer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var layers = args.Part.ToHumanoidLayers();
|
||||
// TODO BODY Layer color, sprite and state
|
||||
sprite.LayerSetVisible(layer, true);
|
||||
foreach (var layer in layers)
|
||||
sprite.LayerSetVisible(layer, true);
|
||||
}
|
||||
|
||||
public void BodyPartRemoved(BodyPartRemovedEventArgs args)
|
||||
@@ -143,15 +138,10 @@ namespace Content.Client.CharacterAppearance
|
||||
return;
|
||||
}
|
||||
|
||||
var layer = args.Part.ToHumanoidLayer();
|
||||
|
||||
if (layer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var layers = args.Part.ToHumanoidLayers();
|
||||
// TODO BODY Layer color, sprite and state
|
||||
sprite.LayerSetVisible(layer, false);
|
||||
foreach (var layer in layers)
|
||||
sprite.LayerSetVisible(layer, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,18 +17,26 @@ namespace Content.Client.Doors
|
||||
{
|
||||
private const string AnimationKey = "airlock_animation";
|
||||
|
||||
[DataField("open_sound", required: true)]
|
||||
private SoundSpecifier _openSound = default!;
|
||||
|
||||
[DataField("close_sound", required: true)]
|
||||
private SoundSpecifier _closeSound = default!;
|
||||
|
||||
[DataField("deny_sound", required: true)]
|
||||
private SoundSpecifier _denySound = default!;
|
||||
|
||||
[DataField("animation_time")]
|
||||
[DataField("animationTime")]
|
||||
private float _delay = 0.8f;
|
||||
|
||||
[DataField("denyAnimationTime")]
|
||||
private float _denyDelay = 0.3f;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the maintenance panel is animated or stays static.
|
||||
/// False for windoors.
|
||||
/// </summary>
|
||||
[DataField("animatedPanel")]
|
||||
private bool _animatedPanel = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the BaseUnlit layer should still be visible when the airlock
|
||||
/// is opened.
|
||||
/// </summary>
|
||||
[DataField("openUnlitVisible")]
|
||||
private bool _openUnlitVisible = false;
|
||||
|
||||
private Animation CloseAnimation = default!;
|
||||
private Animation OpenAnimation = default!;
|
||||
private Animation DenyAnimation = default!;
|
||||
@@ -47,15 +55,13 @@ namespace Content.Client.Doors
|
||||
flickUnlit.LayerKey = DoorVisualLayers.BaseUnlit;
|
||||
flickUnlit.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("closing_unlit", 0f));
|
||||
|
||||
var flickMaintenancePanel = new AnimationTrackSpriteFlick();
|
||||
CloseAnimation.AnimationTracks.Add(flickMaintenancePanel);
|
||||
flickMaintenancePanel.LayerKey = WiresVisualizer.WiresVisualLayers.MaintenancePanel;
|
||||
flickMaintenancePanel.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("panel_closing", 0f));
|
||||
|
||||
var sound = new AnimationTrackPlaySound();
|
||||
CloseAnimation.AnimationTracks.Add(sound);
|
||||
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_closeSound.GetSound(), 0));
|
||||
if (_animatedPanel)
|
||||
{
|
||||
var flickMaintenancePanel = new AnimationTrackSpriteFlick();
|
||||
CloseAnimation.AnimationTracks.Add(flickMaintenancePanel);
|
||||
flickMaintenancePanel.LayerKey = WiresVisualizer.WiresVisualLayers.MaintenancePanel;
|
||||
flickMaintenancePanel.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("panel_closing", 0f));
|
||||
}
|
||||
}
|
||||
|
||||
OpenAnimation = new Animation {Length = TimeSpan.FromSeconds(_delay)};
|
||||
@@ -70,28 +76,21 @@ namespace Content.Client.Doors
|
||||
flickUnlit.LayerKey = DoorVisualLayers.BaseUnlit;
|
||||
flickUnlit.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("opening_unlit", 0f));
|
||||
|
||||
var flickMaintenancePanel = new AnimationTrackSpriteFlick();
|
||||
OpenAnimation.AnimationTracks.Add(flickMaintenancePanel);
|
||||
flickMaintenancePanel.LayerKey = WiresVisualizer.WiresVisualLayers.MaintenancePanel;
|
||||
flickMaintenancePanel.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("panel_opening", 0f));
|
||||
|
||||
var sound = new AnimationTrackPlaySound();
|
||||
OpenAnimation.AnimationTracks.Add(sound);
|
||||
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_openSound.GetSound(), 0));
|
||||
if (_animatedPanel)
|
||||
{
|
||||
var flickMaintenancePanel = new AnimationTrackSpriteFlick();
|
||||
OpenAnimation.AnimationTracks.Add(flickMaintenancePanel);
|
||||
flickMaintenancePanel.LayerKey = WiresVisualizer.WiresVisualLayers.MaintenancePanel;
|
||||
flickMaintenancePanel.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("panel_opening", 0f));
|
||||
}
|
||||
}
|
||||
|
||||
DenyAnimation = new Animation {Length = TimeSpan.FromSeconds(0.3f)};
|
||||
DenyAnimation = new Animation {Length = TimeSpan.FromSeconds(_denyDelay)};
|
||||
{
|
||||
var flick = new AnimationTrackSpriteFlick();
|
||||
DenyAnimation.AnimationTracks.Add(flick);
|
||||
flick.LayerKey = DoorVisualLayers.BaseUnlit;
|
||||
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("deny_unlit", 0f));
|
||||
|
||||
var sound = new AnimationTrackPlaySound();
|
||||
DenyAnimation.AnimationTracks.Add(sound);
|
||||
|
||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_denySound.GetSound(), 0, () => AudioHelpers.WithVariation(0.05f)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,13 +125,16 @@ namespace Content.Client.Doors
|
||||
{
|
||||
case DoorVisualState.Open:
|
||||
sprite.LayerSetState(DoorVisualLayers.Base, "open");
|
||||
unlitVisible = false;
|
||||
unlitVisible = _openUnlitVisible;
|
||||
if (_openUnlitVisible)
|
||||
{
|
||||
sprite.LayerSetState(DoorVisualLayers.BaseUnlit, "open_unlit");
|
||||
}
|
||||
break;
|
||||
case DoorVisualState.Closed:
|
||||
sprite.LayerSetState(DoorVisualLayers.Base, "closed");
|
||||
sprite.LayerSetState(DoorVisualLayers.BaseUnlit, "closed_unlit");
|
||||
sprite.LayerSetState(DoorVisualLayers.BaseBolted, "bolted_unlit");
|
||||
sprite.LayerSetState(WiresVisualizer.WiresVisualLayers.MaintenancePanel, "panel_open");
|
||||
break;
|
||||
case DoorVisualState.Opening:
|
||||
animPlayer.Play(OpenAnimation, AnimationKey);
|
||||
|
||||
@@ -154,7 +154,8 @@ namespace Content.Client.Entry
|
||||
"GasPassiveGate",
|
||||
"GasValve",
|
||||
"GasThermoMachine",
|
||||
"Metabolism",
|
||||
"Respirator",
|
||||
"Metabolizer",
|
||||
"AiFactionTag",
|
||||
"PressureProtection",
|
||||
"AMEPart",
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Content.Client.Hands
|
||||
if (!_gameTiming.IsFirstTimePredicted)
|
||||
return;
|
||||
|
||||
ReusableAnimations.AnimateEntityPickup(entity, msg.InitialPosition, msg.PickupDirection);
|
||||
ReusableAnimations.AnimateEntityPickup(entity, msg.InitialPosition, msg.FinalPosition);
|
||||
}
|
||||
|
||||
public HandsGuiState GetGuiState()
|
||||
|
||||
@@ -19,7 +19,18 @@ namespace Content.Client.Physics.Controllers
|
||||
!player.TryGetComponent(out IMoverComponent? mover) ||
|
||||
!player.TryGetComponent(out PhysicsComponent? body)) return;
|
||||
|
||||
body.Predict = true; // TODO: equal prediction instead of true?
|
||||
// Essentially we only want to set our mob to predicted so every other entity we just interpolate
|
||||
// (i.e. only see what the server has sent us).
|
||||
// The exception to this is joints.
|
||||
body.Predict = true;
|
||||
|
||||
// We set joints to predicted given these can affect how our mob moves.
|
||||
// I would only recommend disabling this if you make pulling not use joints anymore (someday maybe?)
|
||||
foreach (var joint in body.Joints)
|
||||
{
|
||||
joint.BodyA.Predict = true;
|
||||
joint.BodyB.Predict = true;
|
||||
}
|
||||
|
||||
// Server-side should just be handled on its own so we'll just do this shizznit
|
||||
if (player.TryGetComponent(out IMobMoverComponent? mobMover))
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Content.Client.Storage
|
||||
|
||||
if (Owner.EntityManager.TryGetEntity(entityId, out var entity))
|
||||
{
|
||||
ReusableAnimations.AnimateEntityPickup(entity, initialPosition, Owner.Transform.WorldPosition);
|
||||
ReusableAnimations.AnimateEntityPickup(entity, initialPosition, Owner.Transform.LocalPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
40
Content.Client/SubFloor/SubFloorShowLayerVisualizer.cs
Normal file
40
Content.Client/SubFloor/SubFloorShowLayerVisualizer.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Content.Shared.SubFloor;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client.SubFloor
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class SubFloorShowLayerVisualizer : AppearanceVisualizer
|
||||
{
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
|
||||
if (!component.Owner.TryGetComponent(out SpriteComponent? sprite))
|
||||
return;
|
||||
|
||||
if (component.TryGetData(SubFloorVisuals.SubFloor, out bool subfloor))
|
||||
{
|
||||
sprite.Visible = true;
|
||||
|
||||
// Due to the way this visualizer works, you might want to specify it before any other
|
||||
// visualizer that hides/shows layers depending on certain conditions, such as PipeConnectorVisualizer.
|
||||
foreach (var layer in sprite.AllLayers)
|
||||
{
|
||||
layer.Visible = subfloor;
|
||||
}
|
||||
|
||||
if (sprite.LayerMapTryGet(Layers.FirstLayer, out var firstLayer))
|
||||
{
|
||||
sprite.LayerSetVisible(firstLayer, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum Layers : byte
|
||||
{
|
||||
FirstLayer,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user