increase thieving beacon range to 2 (#31340)
* increase thieving beacon range to 2 * add obstruction check * review * Entity<T?> strikes again * webedit ops because github died or something --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.Objectives.Components;
|
using Content.Server.Objectives.Components;
|
||||||
using Content.Server.Objectives.Components.Targets;
|
using Content.Server.Objectives.Components.Targets;
|
||||||
using Content.Shared.CartridgeLoader;
|
using Content.Shared.CartridgeLoader;
|
||||||
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Mind;
|
using Content.Shared.Mind;
|
||||||
using Content.Shared.Objectives.Components;
|
using Content.Shared.Objectives.Components;
|
||||||
using Content.Shared.Objectives.Systems;
|
using Content.Shared.Objectives.Systems;
|
||||||
@@ -21,11 +22,14 @@ public sealed class StealConditionSystem : EntitySystem
|
|||||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||||
|
[Dependency] private readonly SharedInteractionSystem _interaction = default!;
|
||||||
[Dependency] private readonly SharedObjectivesSystem _objectives = default!;
|
[Dependency] private readonly SharedObjectivesSystem _objectives = default!;
|
||||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||||
|
|
||||||
private EntityQuery<ContainerManagerComponent> _containerQuery;
|
private EntityQuery<ContainerManagerComponent> _containerQuery;
|
||||||
|
|
||||||
|
private HashSet<Entity<TransformComponent>> _nearestEnts = new();
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -103,15 +107,19 @@ public sealed class StealConditionSystem : EntitySystem
|
|||||||
//check stealAreas
|
//check stealAreas
|
||||||
if (condition.CheckStealAreas)
|
if (condition.CheckStealAreas)
|
||||||
{
|
{
|
||||||
var areasQuery = AllEntityQuery<StealAreaComponent>();
|
var areasQuery = AllEntityQuery<StealAreaComponent, TransformComponent>();
|
||||||
while (areasQuery.MoveNext(out var uid, out var area))
|
while (areasQuery.MoveNext(out var uid, out var area, out var xform))
|
||||||
{
|
{
|
||||||
if (!area.Owners.Contains(mind.Owner))
|
if (!area.Owners.Contains(mind.Owner))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var nearestEnt = _lookup.GetEntitiesInRange(uid, area.Range);
|
_nearestEnts.Clear();
|
||||||
foreach (var ent in nearestEnt)
|
_lookup.GetEntitiesInRange<TransformComponent>(xform.Coordinates, area.Range, _nearestEnts);
|
||||||
|
foreach (var ent in _nearestEnts)
|
||||||
{
|
{
|
||||||
|
if (!_interaction.InRangeUnobstructed((uid, xform), (ent, ent.Comp), range: area.Range))
|
||||||
|
continue;
|
||||||
|
|
||||||
CheckEntity(ent, condition, ref containerStack, ref count);
|
CheckEntity(ent, condition, ref containerStack, ref count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
components:
|
components:
|
||||||
- type: ThiefBeacon
|
- type: ThiefBeacon
|
||||||
- type: StealArea
|
- type: StealArea
|
||||||
|
range: 2 # Slightly larger than fulton beacon's random offset
|
||||||
- type: Item
|
- type: Item
|
||||||
size: Normal
|
size: Normal
|
||||||
- type: Physics
|
- type: Physics
|
||||||
|
|||||||
Reference in New Issue
Block a user