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,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));
}
}