Minor appearance changes (#2370)
* Minor appearance changes * Remove that redundant deleted property * Fixes and remove redundant checks Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com> Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
This commit is contained in:
@@ -60,12 +60,6 @@ namespace Content.Client.GameObjects.Components.Conveyor
|
|||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (component.Owner.Deleted)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ChangeState(component);
|
ChangeState(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,12 +60,6 @@ namespace Content.Client.GameObjects.Components.Conveyor
|
|||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (component.Owner.Deleted)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ChangeState(component);
|
ChangeState(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,12 +150,6 @@ namespace Content.Client.GameObjects.Components.Disposal
|
|||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (component.Owner.Deleted)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ChangeState(component);
|
ChangeState(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,12 +69,6 @@ namespace Content.Client.GameObjects.Components.Disposal
|
|||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (component.Owner.Deleted)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ChangeState(component);
|
ChangeState(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,8 +103,7 @@ namespace Content.Client.GameObjects.Components.Doors
|
|||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
if (component.Owner.Deleted)
|
base.OnChangeData(component);
|
||||||
return;
|
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||||
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
|
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
|
||||||
|
|||||||
@@ -12,11 +12,6 @@ namespace Content.Client.GameObjects.Components.MedicalScanner
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (component.Owner.Deleted)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||||
if (!component.TryGetData(MedicalScannerVisuals.Status, out MedicalScannerStatus status)) return;
|
if (!component.TryGetData(MedicalScannerVisuals.Status, out MedicalScannerStatus status)) return;
|
||||||
sprite.LayerSetState(MedicalScannerVisualLayers.Machine, StatusToMachineStateId(status));
|
sprite.LayerSetState(MedicalScannerVisualLayers.Machine, StatusToMachineStateId(status));
|
||||||
|
|||||||
@@ -22,10 +22,8 @@ namespace Content.Client.GameObjects.Components.Nutrition
|
|||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
if(!component.Owner.TryGetComponent<ISpriteComponent>(out var sprite))
|
base.OnChangeData(component);
|
||||||
{
|
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!component.TryGetData<float>(SharedFoodComponent.FoodVisuals.MaxUses, out var maxUses))
|
if (!component.TryGetData<float>(SharedFoodComponent.FoodVisuals.MaxUses, out var maxUses))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,10 +49,7 @@ namespace Content.Client.GameObjects.Components.PDA
|
|||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
if (component.Owner.Deleted)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||||
sprite.LayerSetVisible(PDAVisualLayers.Flashlight, false);
|
sprite.LayerSetVisible(PDAVisualLayers.Flashlight, false);
|
||||||
if (component.TryGetData(PDAVisuals.FlashlightLit, out bool isScreenLit))
|
if (component.TryGetData(PDAVisuals.FlashlightLit, out bool isScreenLit))
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace Content.Client.GameObjects.Components
|
|||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
if (!entity.TryGetComponent<SpriteComponent>(out var sprite))
|
if (!entity.TryGetComponent<ISpriteComponent>(out var sprite))
|
||||||
{
|
{
|
||||||
throw new EntityCreationException("No sprite component found in entity that has ParticleAcceleratorPartVisualizer");
|
throw new EntityCreationException("No sprite component found in entity that has ParticleAcceleratorPartVisualizer");
|
||||||
}
|
}
|
||||||
@@ -56,9 +56,7 @@ namespace Content.Client.GameObjects.Components
|
|||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
if (component.Owner.Deleted)
|
base.OnChangeData(component);
|
||||||
return;
|
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent<ISpriteComponent>(out var sprite)) return;
|
if (!component.Owner.TryGetComponent<ISpriteComponent>(out var sprite)) return;
|
||||||
if (!component.TryGetData(ParticleAcceleratorVisuals.VisualState, out ParticleAcceleratorVisualState state))
|
if (!component.TryGetData(ParticleAcceleratorVisuals.VisualState, out ParticleAcceleratorVisualState state))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,8 +57,7 @@ namespace Content.Client.GameObjects.Components
|
|||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
if (component.Owner.Deleted)
|
base.OnChangeData(component);
|
||||||
return;
|
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent<ISpriteComponent>(out var sprite)) return;
|
if (!component.Owner.TryGetComponent<ISpriteComponent>(out var sprite)) return;
|
||||||
if (!component.Owner.TryGetComponent<AnimationPlayerComponent>(out var animPlayer)) return;
|
if (!component.Owner.TryGetComponent<AnimationPlayerComponent>(out var animPlayer)) return;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ namespace Content.Client.GameObjects.Components.VendingMachines
|
|||||||
public sealed class VendingMachineVisualizer : AppearanceVisualizer
|
public sealed class VendingMachineVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
// TODO: Should default to off or broken if damaged
|
// TODO: Should default to off or broken if damaged
|
||||||
//
|
//
|
||||||
|
|
||||||
// TODO: The length of these animations is supposed to be dictated
|
// TODO: The length of these animations is supposed to be dictated
|
||||||
// by the vending machine's pack prototype's `AnimationDuration`
|
// by the vending machine's pack prototype's `AnimationDuration`
|
||||||
// but we have no good way of passing that data from the server
|
// but we have no good way of passing that data from the server
|
||||||
@@ -38,7 +38,7 @@ namespace Content.Client.GameObjects.Components.VendingMachines
|
|||||||
{"deny-unshaded", VendingMachineVisualLayers.BaseUnshaded},
|
{"deny-unshaded", VendingMachineVisualLayers.BaseUnshaded},
|
||||||
{"broken", VendingMachineVisualLayers.Unlit},
|
{"broken", VendingMachineVisualLayers.Unlit},
|
||||||
};
|
};
|
||||||
|
|
||||||
private Dictionary<string, Animation> _animations = new Dictionary<string, Animation>();
|
private Dictionary<string, Animation> _animations = new Dictionary<string, Animation>();
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
public override void LoadData(YamlMappingNode node)
|
||||||
@@ -71,7 +71,7 @@ namespace Content.Client.GameObjects.Components.VendingMachines
|
|||||||
_baseStates[textureState] = false;
|
_baseStates[textureState] = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
_baseStates.Add(textureState, yamlNode.AsBool());
|
_baseStates.Add(textureState, yamlNode.AsBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ namespace Content.Client.GameObjects.Components.VendingMachines
|
|||||||
private void InitializeAnimation(string key, bool unshaded = false)
|
private void InitializeAnimation(string key, bool unshaded = false)
|
||||||
{
|
{
|
||||||
_animations.Add(key, new Animation {Length = TimeSpan.FromSeconds(1.2f)});
|
_animations.Add(key, new Animation {Length = TimeSpan.FromSeconds(1.2f)});
|
||||||
|
|
||||||
var flick = new AnimationTrackSpriteFlick();
|
var flick = new AnimationTrackSpriteFlick();
|
||||||
_animations[key].AnimationTracks.Add(flick);
|
_animations[key].AnimationTracks.Add(flick);
|
||||||
flick.LayerKey = unshaded ? VendingMachineVisualLayers.BaseUnshaded : VendingMachineVisualLayers.Base;
|
flick.LayerKey = unshaded ? VendingMachineVisualLayers.BaseUnshaded : VendingMachineVisualLayers.Base;
|
||||||
@@ -128,13 +128,15 @@ namespace Content.Client.GameObjects.Components.VendingMachines
|
|||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||||
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
|
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
|
||||||
if (!component.TryGetData(VendingMachineVisuals.VisualState, out VendingMachineVisualState state))
|
if (!component.TryGetData(VendingMachineVisuals.VisualState, out VendingMachineVisualState state))
|
||||||
{
|
{
|
||||||
state = VendingMachineVisualState.Normal;
|
state = VendingMachineVisualState.Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide last state
|
// Hide last state
|
||||||
HideLayers(sprite);
|
HideLayers(sprite);
|
||||||
ActivateState(sprite, "off");
|
ActivateState(sprite, "off");
|
||||||
@@ -146,10 +148,10 @@ namespace Content.Client.GameObjects.Components.VendingMachines
|
|||||||
ActivateState(sprite, "normal-unshaded");
|
ActivateState(sprite, "normal-unshaded");
|
||||||
ActivateState(sprite, "normal");
|
ActivateState(sprite, "normal");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VendingMachineVisualState.Off:
|
case VendingMachineVisualState.Off:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VendingMachineVisualState.Broken:
|
case VendingMachineVisualState.Broken:
|
||||||
ActivateState(sprite, "broken-unshaded");
|
ActivateState(sprite, "broken-unshaded");
|
||||||
ActivateState(sprite, "broken");
|
ActivateState(sprite, "broken");
|
||||||
@@ -171,7 +173,7 @@ namespace Content.Client.GameObjects.Components.VendingMachines
|
|||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper methods just to avoid all of that hard-to-read-indented code
|
// Helper methods just to avoid all of that hard-to-read-indented code
|
||||||
private void ActivateState(ISpriteComponent spriteComponent, string stateId)
|
private void ActivateState(ISpriteComponent spriteComponent, string stateId)
|
||||||
{
|
{
|
||||||
@@ -192,14 +194,14 @@ namespace Content.Client.GameObjects.Components.VendingMachines
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!animationPlayer.HasRunningAnimation(key))
|
if (!animationPlayer.HasRunningAnimation(key))
|
||||||
{
|
{
|
||||||
spriteComponent.LayerSetVisible(LayerMap[key], true);
|
spriteComponent.LayerSetVisible(LayerMap[key], true);
|
||||||
animationPlayer.Play(animation, key);
|
animationPlayer.Play(animation, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum VendingMachineVisualLayers
|
public enum VendingMachineVisualLayers
|
||||||
{
|
{
|
||||||
// Off / Broken. The other layers will overlay this if the machine is on.
|
// Off / Broken. The other layers will overlay this if the machine is on.
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels.Visualize
|
|||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
|
base.OnChangeData(component);
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||||
|
|
||||||
if (!component.TryGetData(BarrelBoltVisuals.BoltOpen, out bool boltOpen))
|
if (!component.TryGetData(BarrelBoltVisuals.BoltOpen, out bool boltOpen))
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels.Visualize
|
|||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
|
base.OnChangeData(component);
|
||||||
|
|
||||||
// tl;dr
|
// tl;dr
|
||||||
// 1.If no mag then hide it OR
|
// 1.If no mag then hide it OR
|
||||||
// 2. If step 0 isn't visible then hide it (mag or unshaded)
|
// 2. If step 0 isn't visible then hide it (mag or unshaded)
|
||||||
|
|||||||
@@ -9,15 +9,16 @@ namespace Content.Client.GameObjects.Components.Wires
|
|||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (component.Owner.Deleted)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||||
if (component.TryGetData<bool>(WiresVisuals.MaintenancePanelState, out var state))
|
if (component.TryGetData<bool>(WiresVisuals.MaintenancePanelState, out var state))
|
||||||
{
|
{
|
||||||
sprite.LayerSetVisible(WiresVisualLayers.MaintenancePanel, state);
|
sprite.LayerSetVisible(WiresVisualLayers.MaintenancePanel, state);
|
||||||
}
|
}
|
||||||
|
// Mainly for spawn window
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprite.LayerSetVisible(WiresVisualLayers.MaintenancePanel, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum WiresVisualLayers
|
public enum WiresVisualLayers
|
||||||
|
|||||||
Reference in New Issue
Block a user