Station AI (#30944)

* Station AI overlay

* implement

* Bunch of ports

* Fix a heap of bugs and basic scouting

* helldivers

* Shuffle interactions a bit

* navmap stuff

* Revert "navmap stuff"

This reverts commit d1f89dd4be83233e22cf5dd062b2581f3c6da062.

* AI wires implemented

* Fix examines

* Optimise the overlay significantly

* Back to old static

* BUI radial working

* lots of work

* Saving work

* thanks fork

* alright

* pc

* AI upload console

* AI upload

* stuff

* Fix copy-paste shitcode

* AI actions

* navmap work

* Fixes

* first impressions

* a

* reh

* Revert "navmap work"

This reverts commit 6f63fea6e9245e189f368f97be3e32e9b210580e.

# Conflicts:
#	Content.Client/Silicons/StationAi/StationAiOverlay.cs

* OD

* radar

* weh

* Fix examines

* scoop mine eyes

* fixes

* reh

* Optimise

* Final round of optimisations

* Fixes

* fixes
This commit is contained in:
metalgearsloth
2024-08-28 10:57:12 +10:00
committed by GitHub
parent 3a4affd438
commit afd0618a60
153 changed files with 2384 additions and 344 deletions

View File

@@ -17,6 +17,7 @@ using Content.Shared.Movement.Components;
using Content.Shared.Movement.Pulling.Systems;
using Content.Shared.Physics;
using Content.Shared.Popups;
using Content.Shared.Silicons.StationAi;
using Content.Shared.Storage;
using Content.Shared.Tag;
using Content.Shared.Timing;
@@ -74,7 +75,6 @@ namespace Content.Shared.Interaction
private EntityQuery<WallMountComponent> _wallMountQuery;
private EntityQuery<UseDelayComponent> _delayQuery;
private EntityQuery<ActivatableUIComponent> _uiQuery;
private EntityQuery<ComplexInteractionComponent> _complexInteractionQuery;
private const CollisionGroup InRangeUnobstructedMask = CollisionGroup.Impassable | CollisionGroup.InteractImpassable;
@@ -97,7 +97,6 @@ namespace Content.Shared.Interaction
_wallMountQuery = GetEntityQuery<WallMountComponent>();
_delayQuery = GetEntityQuery<UseDelayComponent>();
_uiQuery = GetEntityQuery<ActivatableUIComponent>();
_complexInteractionQuery = GetEntityQuery<ComplexInteractionComponent>();
SubscribeLocalEvent<BoundUserInterfaceCheckRangeEvent>(HandleUserInterfaceRangeCheck);
SubscribeLocalEvent<BoundUserInterfaceMessageAttempt>(OnBoundInterfaceInteractAttempt);
@@ -165,7 +164,7 @@ namespace Content.Shared.Interaction
return;
}
if (uiComp.RequireHands && !_handsQuery.HasComp(ev.Actor))
if (uiComp.RequiresComplex && !_actionBlockerSystem.CanComplexInteract(ev.Actor))
ev.Cancel();
}
@@ -440,7 +439,7 @@ namespace Content.Shared.Interaction
public void InteractHand(EntityUid user, EntityUid target)
{
var complexInteractions = SupportsComplexInteractions(user);
var complexInteractions = _actionBlockerSystem.CanComplexInteract(user);
if (!complexInteractions)
{
InteractionActivate(user,
@@ -630,6 +629,14 @@ namespace Content.Shared.Interaction
if (!Resolve(other, ref other.Comp))
return false;
var ev = new InRangeOverrideEvent(origin, other);
RaiseLocalEvent(origin, ref ev);
if (ev.Handled)
{
return ev.InRange;
}
return InRangeUnobstructed(origin,
other,
other.Comp.Coordinates,
@@ -1128,7 +1135,7 @@ namespace Content.Shared.Interaction
// Get list of alt-interact verbs
var verbs = _verbSystem.GetLocalVerbs(target, user, typeof(AlternativeVerb));
if (!verbs.Any())
if (verbs.Count == 0)
return false;
_verbSystem.ExecuteVerb(verbs.First(), user, target);
@@ -1182,6 +1189,13 @@ namespace Content.Shared.Interaction
/// </summary>
public bool IsAccessible(Entity<TransformComponent?> user, Entity<TransformComponent?> target)
{
var ev = new AccessibleOverrideEvent(user, target);
RaiseLocalEvent(user, ref ev);
if (ev.Handled)
return ev.Accessible;
if (_containerSystem.IsInSameOrParentContainer(user, target, out _, out var container))
return true;
@@ -1324,13 +1338,10 @@ namespace Content.Shared.Interaction
return ev.Handled;
}
/// <summary>
/// Checks if a given entity is able to do specific complex interactions.
/// This is used to gate manipulation to general humanoids. If a mouse shouldn't be able to do something, then it's complex.
/// </summary>
[Obsolete("Use ActionBlockerSystem")]
public bool SupportsComplexInteractions(EntityUid user)
{
return _complexInteractionQuery.HasComp(user);
return _actionBlockerSystem.CanComplexInteract(user);
}
}
@@ -1368,13 +1379,6 @@ namespace Content.Shared.Interaction
public bool Handled => Used != null;
};
/// <summary>
/// Raised directed by-ref on an item and a user to determine if interactions can occur.
/// </summary>
/// <param name="Cancelled">Whether the hand interaction should be cancelled.</param>
[ByRefEvent]
public record struct AttemptUseInteractEvent(EntityUid User, EntityUid Used, bool Cancelled = false);
/// <summary>
/// Raised directed by-ref on an item to determine if hand interactions should go through.
/// Defaults to allowing hand interactions to go through. Cancel to force the item to be attacked instead.
@@ -1382,4 +1386,32 @@ namespace Content.Shared.Interaction
/// <param name="Cancelled">Whether the hand interaction should be cancelled.</param>
[ByRefEvent]
public record struct CombatModeShouldHandInteractEvent(bool Cancelled = false);
/// <summary>
/// Override event raised directed on the user to say the target is accessible.
/// </summary>
/// <param name="User"></param>
/// <param name="Target"></param>
[ByRefEvent]
public record struct AccessibleOverrideEvent(EntityUid User, EntityUid Target)
{
public readonly EntityUid User = User;
public readonly EntityUid Target = Target;
public bool Handled;
public bool Accessible = false;
}
/// <summary>
/// Override event raised directed on a user to check InRangeUnoccluded AND InRangeUnobstructed to the target if you require custom logic.
/// </summary>
[ByRefEvent]
public record struct InRangeOverrideEvent(EntityUid User, EntityUid Target)
{
public readonly EntityUid User = User;
public readonly EntityUid Target = Target;
public bool Handled;
public bool InRange = false;
}
}