Spiders Buff and critters change (#13377)
This commit is contained in:
7
Content.Shared/Spider/IgnoreSpiderWebComponent.cs
Normal file
7
Content.Shared/Spider/IgnoreSpiderWebComponent.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Content.Shared.Spider;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed class IgnoreSpiderWebComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
35
Content.Shared/Spider/SharedSpiderSystem.cs
Normal file
35
Content.Shared/Spider/SharedSpiderSystem.cs
Normal 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));
|
||||
}
|
||||
}
|
||||
22
Content.Shared/Spider/SpiderComponent.cs
Normal file
22
Content.Shared/Spider/SpiderComponent.cs
Normal 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 { }
|
||||
9
Content.Shared/Spider/SpiderWebObjectComponent.cs
Normal file
9
Content.Shared/Spider/SpiderWebObjectComponent.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Spider;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[Access(typeof(SharedSpiderSystem))]
|
||||
public sealed class SpiderWebObjectComponent : Component
|
||||
{
|
||||
}
|
||||
9
Content.Shared/Spider/SpiderWebVisualsComponent.cs
Normal file
9
Content.Shared/Spider/SpiderWebVisualsComponent.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Spider;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum SpiderWebVisuals
|
||||
{
|
||||
Variant
|
||||
}
|
||||
Reference in New Issue
Block a user