Clusterbang (#2712)

* Code is ready but item now spawning

* Prototype of SeveralExplosive component

* Remaked to FlashExplosiveComponent using

* Done. But i feel myself retarted

* Remaked. Looks good

* Full loaded prototype added

* Throwing in progress. Fatal error is here

* I forgot about shared

* Sloth refactor

* Delayed spawning and fix crashes

* Full clusterbang code.

* Removed useless variable and tuned delay

* Delete wrong  in CreamPiedComponent

* Now yaml is code quality followed

* Reworked to GetLevel with bugs

* Never forget resources, guys

* RoundToLevels added. Now it works.

* New textures and sloth refactor is returned

* Now it's TryGetComponent

* Visualizer maximum fix and look fix

* Logging and no max and min check

* Removed max grenades sending

* vizualizer is better now

* GrenadesMax removed

* grammar, checks, NextFloat and no more try catch

* Unused using removed

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
komunre
2021-01-18 17:16:34 +07:00
committed by GitHub
parent c30dc030c5
commit 2172d00409
12 changed files with 303 additions and 11 deletions

View File

@@ -0,0 +1,40 @@
using Content.Shared.GameObjects.Components.Explosion;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components.Explosion
{
[UsedImplicitly]
// ReSharper disable once InconsistentNaming
public class ClusterFlashVisualizer : AppearanceVisualizer
{
private string _state;
public override void LoadData(YamlMappingNode node)
{
base.LoadData(node);
if (node.TryGetNode("state", out var state))
{
_state = state.AsString();
}
}
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
if (!component.Owner.TryGetComponent<ISpriteComponent>(out var sprite))
{
return;
}
if (component.TryGetData(ClusterFlashVisuals.GrenadesCounter, out int grenadesCounter))
{
sprite.LayerSetState(0, $"{_state}-{grenadesCounter}");
}
}
}
}