Drone Interaction Checks & Cleanup (#6731)
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
using Content.Shared.Drone;
|
||||
using Content.Server.Drone.Components;
|
||||
using Content.Shared.Drone.Components;
|
||||
using Content.Shared.MobState;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Components;
|
||||
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.UserInterface;
|
||||
using Content.Shared.Emoting;
|
||||
using Robust.Shared.Player;
|
||||
using Content.Shared.Tag;
|
||||
@@ -21,6 +24,8 @@ namespace Content.Server.Drone
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<DroneComponent, InteractionAttemptEvent>(OnInteractionAttempt);
|
||||
SubscribeLocalEvent<DroneComponent, UserOpenActivatableUIAttemptEvent>(OnActivateUIAttempt);
|
||||
SubscribeLocalEvent<DroneComponent, MobStateChangedEvent>(OnMobStateChanged);
|
||||
SubscribeLocalEvent<DroneComponent, ExaminedEvent>(OnExamined);
|
||||
SubscribeLocalEvent<DroneComponent, MindAddedMessage>(OnMindAdded);
|
||||
@@ -28,6 +33,19 @@ namespace Content.Server.Drone
|
||||
SubscribeLocalEvent<DroneComponent, EmoteAttemptEvent>(OnEmoteAttempt);
|
||||
}
|
||||
|
||||
private void OnInteractionAttempt(EntityUid uid, DroneComponent component, InteractionAttemptEvent args)
|
||||
{
|
||||
if (HasComp<MobStateComponent>(args.Target) && !HasComp<DroneComponent>(args.Target))
|
||||
{
|
||||
args.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnActivateUIAttempt(EntityUid uid, DroneComponent component, UserOpenActivatableUIAttemptEvent args)
|
||||
{
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, DroneComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (args.IsInDetailsRange)
|
||||
@@ -75,7 +93,7 @@ namespace Content.Server.Drone
|
||||
foreach (var entry in drone.Tools)
|
||||
{
|
||||
var item = EntityManager.SpawnEntity(entry.PrototypeId, spawnCoord);
|
||||
AddComp<DroneToolComponent>(item);
|
||||
AddComp<UnremoveableComponent>(item);
|
||||
hands.PutInHand(item);
|
||||
drone.ToolUids.Add(item);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user