* mech system, fix hands, fix fraction * fix * fix fake hypo * fix triple airlocks big sizing * fix * upd clown hulk * xd fix 2 * bigger exit delay * mechs reflect changes * guns changes * draike up * mechs in another category * add equipment * Revert "upd clown hulk" This reverts commit b8084967040be5d442b2d4770cf7fdece1daa2a8. * SPIN MY MECH ASS * mech no rot * some resprite * no injections in hardsuits * some species can not be injectable * medipans can ignore armor, admeme hypospray ignore armor * fix * fix admeme hypo * mob fraction fix * rover + nt gygax add * fix description * fix id * some better dome effects * если пустая гильза в стволе -> Кнопки "казнь" не будет * phazon added * fix server crashes * full rework mechs on mobstates, coils fix mechs, diagnostic hud show health bar for mechs, mechs fastest repair, add mech analyzer * some fixes * configure health of all mechs * upd * add rover to uplink * translate bundle * change price * phazon construction * fix * fix * Finish phazon construction * add phazon research and recipes * phazon construction translate * fix * Mech lights * fix * translate light action * Mech sounds, fix damage * fix * fix hello sound * upd * fix linter * change damagePercentage * fix * fix hello sound * temp disable damage sounds * fix battery needed on construct * some changes * add mech painting system as DEBUG(in dev) * Fix yaml, durand paintings * mech spray cans textures * change sprite * fix * ripley, clarke new textures * ripley,clarke paints * fix * sec pod texture --------- Co-authored-by: Vigers Ray <60344369+VigersRay@users.noreply.github.com>
66 lines
2 KiB
C#
66 lines
2 KiB
C#
using Content.Shared.Mech;
|
|
using Content.Shared.Mech.Components;
|
|
using Content.Shared.Mech.EntitySystems;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Shared.GameObjects;
|
|
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;
|
|
|
|
namespace Content.Client.Mech;
|
|
|
|
/// <inheritdoc/>
|
|
public sealed class MechSystem : SharedMechSystem
|
|
{
|
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
|
|
|
/// <inheritdoc/>
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<MechComponent, AppearanceChangeEvent>(OnAppearanceChanged);
|
|
SubscribeLocalEvent<MechComponent, UpdateAppearanceEvent>(OnUpdateAppearanceEvent);
|
|
}
|
|
|
|
private void OnAppearanceChanged(EntityUid uid, MechComponent component, ref AppearanceChangeEvent args)
|
|
{
|
|
if (args.Sprite == null)
|
|
return;
|
|
|
|
UpdateAppearance(uid, component, args.Sprite);
|
|
}
|
|
|
|
private void OnUpdateAppearanceEvent(EntityUid uid, MechComponent component, ref UpdateAppearanceEvent args)
|
|
{
|
|
if (!TryComp<SpriteComponent>(uid, out var sprite))
|
|
return;
|
|
|
|
UpdateAppearance(uid, component, sprite);
|
|
}
|
|
|
|
private void UpdateAppearance(EntityUid uid, MechComponent component, SpriteComponent sprite)
|
|
{
|
|
if (!sprite.TryGetLayer((int) MechVisualLayers.Base, out var layer))
|
|
return;
|
|
|
|
var state = component.BaseState;
|
|
var drawDepth = DrawDepth.Mobs;
|
|
|
|
if (component.BrokenState != null
|
|
&& _appearance.TryGetData<bool>(uid, MechVisuals.Broken, out var broken)
|
|
&& broken)
|
|
{
|
|
state = component.BrokenState;
|
|
drawDepth = DrawDepth.SmallMobs;
|
|
}
|
|
else if (component.OpenState != null
|
|
&& _appearance.TryGetData<bool>(uid, MechVisuals.Open, out var open)
|
|
&& open)
|
|
{
|
|
state = component.OpenState;
|
|
drawDepth = DrawDepth.SmallMobs;
|
|
}
|
|
|
|
layer.SetState(state);
|
|
sprite.DrawDepth = (int) drawDepth;
|
|
}
|
|
}
|