More rules tweaks (#16918)
This commit is contained in:
@@ -58,7 +58,7 @@ public sealed class NearbyTilesPercentRule : RulesRule
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// If there are anchored entities on the tile do we ignore the tile.
|
/// If there are anchored entities on the tile do we ignore the tile.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("anchored")] public bool Anchored;
|
[DataField("ignoreAnchored")] public bool IgnoreAnchored;
|
||||||
|
|
||||||
[DataField("percent", required: true)]
|
[DataField("percent", required: true)]
|
||||||
public float Percent;
|
public float Percent;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Access.Components;
|
|||||||
using Content.Shared.Access.Systems;
|
using Content.Shared.Access.Systems;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
|
using Robust.Shared.Physics.Components;
|
||||||
|
|
||||||
namespace Content.Shared.Random;
|
namespace Content.Shared.Random;
|
||||||
|
|
||||||
@@ -72,8 +73,10 @@ public sealed class RulesSystem : EntitySystem
|
|||||||
foreach (var comp in _lookup.GetComponentsInRange<AccessReaderComponent>(xform.MapID,
|
foreach (var comp in _lookup.GetComponentsInRange<AccessReaderComponent>(xform.MapID,
|
||||||
worldPos, access.Range))
|
worldPos, access.Range))
|
||||||
{
|
{
|
||||||
if (access.Anchored && !xformQuery.GetComponent(comp.Owner).Anchored ||
|
if (!_reader.AreAccessTagsAllowed(access.Access, comp) ||
|
||||||
!_reader.AreAccessTagsAllowed(access.Access, comp))
|
access.Anchored &&
|
||||||
|
(!xformQuery.TryGetComponent(comp.Owner, out var compXform) ||
|
||||||
|
!compXform.Anchored))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -113,7 +116,8 @@ public sealed class RulesSystem : EntitySystem
|
|||||||
worldPos, nearbyComps.Range))
|
worldPos, nearbyComps.Range))
|
||||||
{
|
{
|
||||||
if (nearbyComps.Anchored &&
|
if (nearbyComps.Anchored &&
|
||||||
(!xformQuery.TryGetComponent(comp.Owner, out var compXform) || !compXform.Anchored))
|
(!xformQuery.TryGetComponent(comp.Owner, out var compXform) ||
|
||||||
|
!compXform.Anchored))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -186,7 +190,7 @@ public sealed class RulesSystem : EntitySystem
|
|||||||
if (!tiles.Tiles.Contains(_tileDef[tile.Tile.TypeId].ID))
|
if (!tiles.Tiles.Contains(_tileDef[tile.Tile.TypeId].ID))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (tiles.Anchored && grid.GetAnchoredEntitiesEnumerator(tile.GridIndices).MoveNext(out _))
|
if (tiles.IgnoreAnchored && grid.GetAnchoredEntitiesEnumerator(tile.GridIndices).MoveNext(out _))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
matchingTileCount++;
|
matchingTileCount++;
|
||||||
|
|||||||
@@ -225,7 +225,7 @@
|
|||||||
id: NearMaintenance
|
id: NearMaintenance
|
||||||
rules:
|
rules:
|
||||||
- !type:NearbyTilesPercentRule
|
- !type:NearbyTilesPercentRule
|
||||||
anchored: false
|
ignoreAnchored: true
|
||||||
percent: 0.25
|
percent: 0.25
|
||||||
tiles:
|
tiles:
|
||||||
- Plating
|
- Plating
|
||||||
@@ -235,10 +235,11 @@
|
|||||||
id: NearMedical
|
id: NearMedical
|
||||||
rules:
|
rules:
|
||||||
- !type:NearbyTilesPercentRule
|
- !type:NearbyTilesPercentRule
|
||||||
|
ignoreAnchored: true
|
||||||
percent: 0.5
|
percent: 0.5
|
||||||
tiles:
|
tiles:
|
||||||
- FloorWhite
|
- FloorWhite
|
||||||
range: 5
|
range: 3
|
||||||
|
|
||||||
- type: rules
|
- type: rules
|
||||||
id: NearPrayable
|
id: NearPrayable
|
||||||
@@ -253,6 +254,7 @@
|
|||||||
id: NearMorgue
|
id: NearMorgue
|
||||||
rules:
|
rules:
|
||||||
- !type:NearbyComponentsRule
|
- !type:NearbyComponentsRule
|
||||||
|
anchored: true
|
||||||
count: 2
|
count: 2
|
||||||
components:
|
components:
|
||||||
- type: Morgue
|
- type: Morgue
|
||||||
|
|||||||
Reference in New Issue
Block a user