Spiders Buff and critters change (#13377)

This commit is contained in:
Jackrost
2023-01-23 01:50:05 +03:00
committed by GitHub
parent 4915ff6f5b
commit 12fb4b2097
18 changed files with 332 additions and 6 deletions

View File

@@ -0,0 +1,7 @@
namespace Content.Shared.Spider;
[RegisterComponent]
public sealed class IgnoreSpiderWebComponent : Component
{
}

View File

@@ -0,0 +1,35 @@
using System.Linq;
using Content.Shared.Spider;
using Content.Shared.Actions;
using Content.Shared.Actions.ActionTypes;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Shared.Spider;
public abstract class SharedSpiderSystem : EntitySystem
{
[Dependency] private readonly SharedActionsSystem _action = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SpiderWebObjectComponent, ComponentStartup>(OnWebStartup);
SubscribeLocalEvent<SpiderComponent, ComponentStartup>(OnSpiderStartup);
}
private void OnSpiderStartup(EntityUid uid, SpiderComponent component, ComponentStartup args)
{
var netAction = new InstantAction(_proto.Index<InstantActionPrototype>(component.WebActionName));
_action.AddAction(uid, netAction, null);
}
private void OnWebStartup(EntityUid uid, SpiderWebObjectComponent component, ComponentStartup args)
{
_appearance.SetData(uid, SpiderWebVisuals.Variant, _robustRandom.Next(1, 3));
}
}

View File

@@ -0,0 +1,22 @@
using Content.Shared.Actions;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Spider;
[RegisterComponent, NetworkedComponent]
[Access(typeof(SharedSpiderSystem))]
public sealed class SpiderComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField("webPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string WebPrototype = "SpiderWeb";
[ViewVariables(VVAccess.ReadWrite)]
[DataField("webActionName")]
public string WebActionName = "SpiderWebAction";
}
public sealed class SpiderWebActionEvent : InstantActionEvent { }

View File

@@ -0,0 +1,9 @@
using Robust.Shared.GameStates;
namespace Content.Shared.Spider;
[RegisterComponent, NetworkedComponent]
[Access(typeof(SharedSpiderSystem))]
public sealed class SpiderWebObjectComponent : Component
{
}

View File

@@ -0,0 +1,9 @@
using Robust.Shared.Serialization;
namespace Content.Shared.Spider;
[Serializable, NetSerializable]
public enum SpiderWebVisuals
{
Variant
}