Ling stuff (#245)
* - fix: Absorb is transfered on transform. * - fix: Transfer absorbed count on transform. * - fix: Transfer rev roles on transform. * - add: Ling mood effect. * - tweak: Buff armblade. * - fix: Transfer mood on transform. * - tweak: Better absorbed desc. * - add: Hive head. * - remove: No popup.
This commit is contained in:
50
Content.Server/Changeling/HiveHeadSystem.cs
Normal file
50
Content.Server/Changeling/HiveHeadSystem.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Content.Server.Actions;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Changeling;
|
||||
using Content.Shared.Inventory;
|
||||
|
||||
namespace Content.Server.Changeling;
|
||||
|
||||
public sealed class HiveHeadSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ActionsSystem _actions = default!;
|
||||
[Dependency] private readonly ActionContainerSystem _actionContainer = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<HiveHeadComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<HiveHeadComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<HiveHeadComponent, GetItemActionsEvent>(OnGetActions);
|
||||
SubscribeLocalEvent<HiveHeadComponent, ReleaseBeesEvent>(OnReleaseBees);
|
||||
}
|
||||
|
||||
private void OnReleaseBees(Entity<HiveHeadComponent> ent, ref ReleaseBeesEvent args)
|
||||
{
|
||||
args.Handled = true;
|
||||
|
||||
var coords = Transform(args.Performer).Coordinates;
|
||||
|
||||
for (var i = 0; i < ent.Comp.BeesAmount; i++)
|
||||
{
|
||||
Spawn(ent.Comp.BeeProto, coords);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGetActions(Entity<HiveHeadComponent> ent, ref GetItemActionsEvent args)
|
||||
{
|
||||
if (args.SlotFlags == SlotFlags.HEAD)
|
||||
args.AddAction(ref ent.Comp.ActionEntity, ent.Comp.Action);
|
||||
}
|
||||
|
||||
private void OnShutdown(Entity<HiveHeadComponent> ent, ref ComponentShutdown args)
|
||||
{
|
||||
_actions.RemoveAction(ent, ent.Comp.ActionEntity);
|
||||
}
|
||||
|
||||
private void OnMapInit(Entity<HiveHeadComponent> ent, ref MapInitEvent args)
|
||||
{
|
||||
_actionContainer.EnsureAction(ent, ref ent.Comp.ActionEntity, ent.Comp.Action);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user