Merge branch 'master' into offmed-staging

This commit is contained in:
Janet Blackquill
2025-10-03 20:30:42 -04:00
9 changed files with 26 additions and 29 deletions

View File

@@ -54,7 +54,7 @@ public sealed class XATMagnetSystem : BaseQueryUpdateXATSystem<XATMagnetComponen
if (node.Attached == null) if (node.Attached == null)
continue; continue;
var artifact = _xenoArtifactQuery.Get(GetEntity(node.Attached.Value)); var artifact = _xenoArtifactQuery.Get(node.Attached.Value);
if (!CanTrigger(artifact, (uid, node))) if (!CanTrigger(artifact, (uid, node)))
continue; continue;

View File

@@ -32,7 +32,7 @@ public sealed partial class XenoArtifactNodeComponent : Component
/// The entity whose graph this node is a part of. /// The entity whose graph this node is a part of.
/// </summary> /// </summary>
[DataField, AutoNetworkedField] [DataField, AutoNetworkedField]
public NetEntity? Attached; public EntityUid? Attached;
#region Durability #region Durability
/// <summary> /// <summary>

View File

@@ -53,8 +53,8 @@ public abstract partial class SharedXenoArtifactSystem
/// <exception cref="ArgumentException">Throws if requested index doesn't exist on artifact. </exception> /// <exception cref="ArgumentException">Throws if requested index doesn't exist on artifact. </exception>
public Entity<XenoArtifactNodeComponent> GetNode(Entity<XenoArtifactComponent> ent, int index) public Entity<XenoArtifactNodeComponent> GetNode(Entity<XenoArtifactComponent> ent, int index)
{ {
if (ent.Comp.NodeVertices[index] is { } netUid && GetEntity(netUid) is var uid) if (ent.Comp.NodeVertices[index] is { } netUid && GetEntity(netUid) is var uid && _nodeQuery.TryComp(uid, out var comp))
return (uid, XenoArtifactNode(uid)); return (uid, comp);
throw new ArgumentException($"index {index} does not correspond to an existing node in {ToPrettyString(ent)}"); throw new ArgumentException($"index {index} does not correspond to an existing node in {ToPrettyString(ent)}");
} }
@@ -71,8 +71,8 @@ public abstract partial class SharedXenoArtifactSystem
if (index < 0 || index >= ent.Comp.NodeVertices.Length) if (index < 0 || index >= ent.Comp.NodeVertices.Length)
return false; return false;
if (ent.Comp.NodeVertices[index] is { } netUid && GetEntity(netUid) is var uid) if (ent.Comp.NodeVertices[index] is { } netUid && GetEntity(netUid) is var uid && _nodeQuery.TryComp(uid, out var comp))
node = (uid, XenoArtifactNode(uid)); node = (uid, comp);
return node != null; return node != null;
} }
@@ -102,8 +102,8 @@ public abstract partial class SharedXenoArtifactSystem
{ {
foreach (var netNode in ent.Comp.NodeVertices) foreach (var netNode in ent.Comp.NodeVertices)
{ {
if (TryGetEntity(netNode, out var node)) if (TryGetEntity(netNode, out var node) && _nodeQuery.TryComp(node, out var comp))
yield return (node.Value, XenoArtifactNode(node.Value)); yield return (node.Value, comp);
} }
} }
@@ -253,7 +253,8 @@ public abstract partial class SharedXenoArtifactSystem
return false; return false;
var uid = Spawn(entProtoId); var uid = Spawn(entProtoId);
node = (uid, XenoArtifactNode(uid)); var comp = EnsureComp<XenoArtifactNodeComponent>(uid);
node = (uid, comp);
return AddNode(ent, (node.Value, node.Value.Comp), dirty: dirty); return AddNode(ent, (node.Value, node.Value.Comp), dirty: dirty);
} }
@@ -269,11 +270,10 @@ public abstract partial class SharedXenoArtifactSystem
/// <returns>True if node adding was successful, false otherwise.</returns> /// <returns>True if node adding was successful, false otherwise.</returns>
public bool AddNode(Entity<XenoArtifactComponent?> ent, Entity<XenoArtifactNodeComponent?> node, bool dirty = true) public bool AddNode(Entity<XenoArtifactComponent?> ent, Entity<XenoArtifactNodeComponent?> node, bool dirty = true)
{ {
if (!Resolve(ent, ref ent.Comp)) if (!Resolve(ent, ref ent.Comp) || !Resolve(node, ref node.Comp, false))
return false; return false;
node.Comp ??= XenoArtifactNode(node); node.Comp.Attached = ent.Owner;
node.Comp.Attached = GetNetEntity(ent);
var nodeIdx = GetFreeNodeIndex((ent, ent.Comp)); var nodeIdx = GetFreeNodeIndex((ent, ent.Comp));
_container.Insert(node.Owner, ent.Comp.NodeContainer); _container.Insert(node.Owner, ent.Comp.NodeContainer);
@@ -300,11 +300,9 @@ public abstract partial class SharedXenoArtifactSystem
/// <returns>True if node was removed successfully, false otherwise.</returns> /// <returns>True if node was removed successfully, false otherwise.</returns>
public bool RemoveNode(Entity<XenoArtifactComponent?> ent, Entity<XenoArtifactNodeComponent?> node, bool dirty = true) public bool RemoveNode(Entity<XenoArtifactComponent?> ent, Entity<XenoArtifactNodeComponent?> node, bool dirty = true)
{ {
if (!Resolve(ent, ref ent.Comp)) if (!Resolve(ent, ref ent.Comp) || !Resolve(node, ref node.Comp, false))
return false; return false;
node.Comp ??= XenoArtifactNode(node);
if (!TryGetIndex(ent, node, out var idx)) if (!TryGetIndex(ent, node, out var idx))
return false; // node isn't attached to this entity. return false; // node isn't attached to this entity.

View File

@@ -33,21 +33,14 @@ public abstract partial class SharedXenoArtifactSystem
SetNodeDurability((ent, ent), nodeComponent.MaxDurability); SetNodeDurability((ent, ent), nodeComponent.MaxDurability);
} }
/// <summary> Gets node component by node entity uid. </summary>
public XenoArtifactNodeComponent XenoArtifactNode(EntityUid uid)
{
return _nodeQuery.Get(uid);
}
public void SetNodeUnlocked(Entity<XenoArtifactNodeComponent?> ent) public void SetNodeUnlocked(Entity<XenoArtifactNodeComponent?> ent)
{ {
if (!Resolve(ent, ref ent.Comp)) if (!Resolve(ent, ref ent.Comp))
return; return;
if (ent.Comp.Attached is not { } netArtifact) if (ent.Comp.Attached is not { } artifact)
return; return;
var artifact = GetEntity(netArtifact);
if (!TryComp<XenoArtifactComponent>(artifact, out var artifactComponent)) if (!TryComp<XenoArtifactComponent>(artifact, out var artifactComponent))
return; return;
@@ -197,7 +190,10 @@ public abstract partial class SharedXenoArtifactSystem
foreach (var netNode in segment) foreach (var netNode in segment)
{ {
var node = GetEntity(netNode); var node = GetEntity(netNode);
outSegment.Add((node, XenoArtifactNode(node))); if (!_nodeQuery.TryComp(node, out var comp))
continue;
outSegment.Add((node, comp));
} }
output.Add(outSegment); output.Add(outSegment);
@@ -385,7 +381,7 @@ public abstract partial class SharedXenoArtifactSystem
return; return;
} }
var artifact = _xenoArtifactQuery.Get(GetEntity(nodeComponent.Attached.Value)); var artifact = _xenoArtifactQuery.Get(nodeComponent.Attached.Value);
var nonactiveNodes = GetActiveNodes(artifact); var nonactiveNodes = GetActiveNodes(artifact);
var durabilityEffect = MathF.Pow((float)nodeComponent.Durability / nodeComponent.MaxDurability, 2); var durabilityEffect = MathF.Pow((float)nodeComponent.Durability / nodeComponent.MaxDurability, 2);

View File

@@ -45,7 +45,7 @@ public abstract partial class SharedXenoArtifactSystem
if (!Resolve(ent, ref ent.Comp)) if (!Resolve(ent, ref ent.Comp))
return false; return false;
var artifact = GetEntity(ent.Comp.Attached); var artifact = ent.Comp.Attached;
if (!TryComp<XenoArtifactComponent>(artifact, out var artiComp)) if (!TryComp<XenoArtifactComponent>(artifact, out var artiComp))
return false; return false;

View File

@@ -31,7 +31,7 @@ public abstract class BaseQueryUpdateXATSystem<T> : BaseXATSystem<T> where T : C
if (node.Attached == null) if (node.Attached == null)
continue; continue;
var artifact = _xenoArtifactQuery.Get(GetEntity(node.Attached.Value)); var artifact = _xenoArtifactQuery.Get(node.Attached.Value);
if (!CanTrigger(artifact, (uid, node))) if (!CanTrigger(artifact, (uid, node)))
continue; continue;

View File

@@ -36,7 +36,7 @@ public sealed class XATDeathSystem : BaseXATSystem<XATDeathComponent>
if (node.Attached == null) if (node.Attached == null)
continue; continue;
var artifact = _xenoArtifactQuery.Get(GetEntity(node.Attached.Value)); var artifact = _xenoArtifactQuery.Get(node.Attached.Value);
if (!CanTrigger(artifact, (uid, node))) if (!CanTrigger(artifact, (uid, node)))
continue; continue;

View File

@@ -64,7 +64,8 @@
- type: UnpoweredFlashlight - type: UnpoweredFlashlight
- type: PointLight - type: PointLight
enabled: false enabled: false
radius: 1.5 radius: 1.7
falloff: 3
softness: 5 softness: 5
autoRot: true autoRot: true
- type: Ringer - type: Ringer

View File

@@ -188,6 +188,8 @@
totalIntensity: 400 totalIntensity: 400
intensitySlope: 30 intensitySlope: 30
maxIntensity: 125 maxIntensity: 125
deleteAfterExplosion: false
repeatable: true
canCreateVacuum: true canCreateVacuum: true
- type: TimerTrigger - type: TimerTrigger
delay: 4.5 delay: 4.5