Refactor drone tool checks (#6643)
This commit is contained in:
@@ -1,21 +1,13 @@
|
||||
using Content.Shared.Drone;
|
||||
using Content.Server.Drone.Components;
|
||||
using Content.Shared.Drone.Components;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.MobState;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Ghost.Roles.Components;
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Server.Actions.Events;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Player;
|
||||
using Content.Shared.Tag;
|
||||
|
||||
@@ -29,8 +21,6 @@ namespace Content.Server.Drone
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<DroneComponent, MobStateChangedEvent>(OnMobStateChanged);
|
||||
SubscribeLocalEvent<DroneComponent, DisarmAttemptEvent>(OnDisarmAttempt);
|
||||
SubscribeLocalEvent<DroneComponent, DropAttemptEvent>(OnDropAttempt);
|
||||
SubscribeLocalEvent<DroneComponent, ExaminedEvent>(OnExamined);
|
||||
SubscribeLocalEvent<DroneComponent, MindAddedMessage>(OnMindAdded);
|
||||
SubscribeLocalEvent<DroneComponent, MindRemovedMessage>(OnMindRemoved);
|
||||
@@ -66,16 +56,6 @@ namespace Content.Server.Drone
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisarmAttempt(EntityUid uid, DroneComponent drone, DisarmAttemptEvent args)
|
||||
{
|
||||
TryComp<HandsComponent>(args.TargetUid, out var hands);
|
||||
var item = hands?.GetActiveHandItem;
|
||||
if (TryComp<DroneToolComponent>(item?.Owner, out var itemInHand))
|
||||
{
|
||||
args.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMindAdded(EntityUid uid, DroneComponent drone, MindAddedMessage args)
|
||||
{
|
||||
UpdateDroneAppearance(uid, DroneStatus.On);
|
||||
@@ -110,16 +90,6 @@ namespace Content.Server.Drone
|
||||
EnsureComp<GhostTakeoverAvailableComponent>(uid);
|
||||
}
|
||||
|
||||
private void OnDropAttempt(EntityUid uid, DroneComponent drone, DropAttemptEvent args)
|
||||
{
|
||||
TryComp<HandsComponent>(uid, out var hands);
|
||||
var item = hands?.GetActiveHandItem;
|
||||
if (TryComp<DroneToolComponent>(item?.Owner, out var itemInHand))
|
||||
{
|
||||
args.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateDroneAppearance(EntityUid uid, DroneStatus status)
|
||||
{
|
||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
|
||||
Reference in New Issue
Block a user