Revert "Actions Rework" (#6888)

This commit is contained in:
Leon Friedrich
2022-02-25 18:55:18 +13:00
committed by GitHub
parent 5ac5dd6a64
commit 49ae383f06
135 changed files with 5165 additions and 3119 deletions

View File

@@ -1,7 +1,6 @@
using Content.Shared.Actions;
using Content.Shared.Actions.ActionTypes;
using System;
using Content.Shared.Ghost;
using Robust.Shared.Utility;
using Robust.Shared.GameObjects;
namespace Content.Server.Ghost.Components
{
@@ -10,23 +9,5 @@ namespace Content.Server.Ghost.Components
public sealed class GhostComponent : SharedGhostComponent
{
public TimeSpan TimeOfDeath { get; set; } = TimeSpan.Zero;
[DataField("booRadius")]
public float BooRadius = 3;
[DataField("booMaxTargets")]
public int BooMaxTargets = 3;
[DataField("action")]
public InstantAction Action = new()
{
UseDelay = TimeSpan.FromSeconds(120),
Icon = new SpriteSpecifier.Texture(new ResourcePath("Interface/Actions/scream.png")),
Name = "action-name-boo",
Description = "action-description-boo",
Event = new BooActionEvent(),
};
}
public sealed class BooActionEvent : PerformActionEvent { }
}

View File

@@ -7,7 +7,6 @@ using Content.Server.Mind.Components;
using Content.Server.Players;
using Content.Server.Visible;
using Content.Server.Warps;
using Content.Shared.Actions;
using Content.Shared.Examine;
using Content.Shared.Follower;
using Content.Shared.Ghost;
@@ -16,6 +15,10 @@ using Content.Shared.Movement.EntitySystems;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
using Robust.Shared.Timing;
namespace Content.Server.Ghost
@@ -27,9 +30,7 @@ namespace Content.Server.Ghost
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly GameTicker _ticker = default!;
[Dependency] private readonly MindSystem _mindSystem = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly VisibilitySystem _visibilitySystem = default!;
[Dependency] private readonly IEntityLookup _lookup = default!;
[Dependency] private readonly FollowerSystem _followerSystem = default!;
public override void Initialize()
@@ -50,30 +51,6 @@ namespace Content.Server.Ghost
SubscribeNetworkEvent<GhostReturnToBodyRequest>(OnGhostReturnToBodyRequest);
SubscribeNetworkEvent<GhostWarpToLocationRequestEvent>(OnGhostWarpToLocationRequest);
SubscribeNetworkEvent<GhostWarpToTargetRequestEvent>(OnGhostWarpToTargetRequest);
SubscribeLocalEvent<GhostComponent, BooActionEvent>(OnActionPerform);
}
private void OnActionPerform(EntityUid uid, GhostComponent component, BooActionEvent args)
{
if (args.Handled)
return;
var ents = _lookup.GetEntitiesInRange(args.Performer, component.BooRadius);
var booCounter = 0;
foreach (var ent in ents)
{
var ghostBoo = new GhostBooEvent();
RaiseLocalEvent(ent, ghostBoo);
if (ghostBoo.Handled)
booCounter++;
if (booCounter >= component.BooMaxTargets)
break;
}
args.Handled = true;
}
private void OnRelayMoveInput(EntityUid uid, GhostOnMoveComponent component, RelayMoveInputEvent args)
@@ -101,8 +78,6 @@ namespace Content.Server.Ghost
}
component.TimeOfDeath = _gameTiming.RealTime;
_actions.AddAction(uid, component.Action, null);
}
private void OnGhostShutdown(EntityUid uid, GhostComponent component, ComponentShutdown args)
@@ -123,8 +98,6 @@ namespace Content.Server.Ghost
{
eye.VisibilityMask &= ~(uint) VisibilityFlags.Ghost;
}
_actions.RemoveAction(uid, component.Action);
}
}