@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Destructible.Thresholds;
|
||||
using Content.Shared.EntityTable.EntitySelectors;
|
||||
using Content.Shared.Xenoarchaeology.Artifact.Prototypes;
|
||||
@@ -158,4 +159,15 @@ public sealed partial class XenoArtifactComponent : Component
|
||||
Variation = 0.1f
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Action that allows the artifact to self activate.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public EntProtoId<InstantActionComponent> SelfActivateAction = "ActionArtifactActivate";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event raised by sentient artifact to activate itself at no durability cost.
|
||||
/// </summary>
|
||||
public sealed partial class ArtifactSelfActivateEvent : InstantActionEvent;
|
||||
|
||||
@@ -51,12 +51,14 @@ public abstract partial class SharedXenoArtifactSystem
|
||||
/// <param name="user">Character that attempted to activate artifact.</param>
|
||||
/// <param name="target">Target, on which artifact activation attempt was used (for hand-held artifact - it can be 'clicked' over someone).</param>
|
||||
/// <param name="coordinates">Coordinates of <paramref name="target"/> entity.</param>
|
||||
/// <param name="consumeDurability">Whether this activation will deplete durability on the activated nodes.</param>
|
||||
/// <returns>True, if activation was successful, false otherwise.</returns>
|
||||
public bool TryActivateXenoArtifact(
|
||||
Entity<XenoArtifactComponent> artifact,
|
||||
EntityUid? user,
|
||||
EntityUid? target,
|
||||
EntityCoordinates coordinates
|
||||
EntityCoordinates coordinates,
|
||||
bool consumeDurability = true
|
||||
)
|
||||
{
|
||||
XenoArtifactComponent xenoArtifactComponent = artifact;
|
||||
@@ -69,7 +71,7 @@ public abstract partial class SharedXenoArtifactSystem
|
||||
var success = false;
|
||||
foreach (var node in GetActiveNodes(artifact))
|
||||
{
|
||||
success |= ActivateNode(artifact, node, user, target, coordinates);
|
||||
success |= ActivateNode(artifact, node, user, target, coordinates, consumeDurability: consumeDurability);
|
||||
}
|
||||
|
||||
if (!success)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Xenoarchaeology.Artifact.Components;
|
||||
using Robust.Shared.Containers;
|
||||
@@ -17,6 +18,7 @@ public abstract partial class SharedXenoArtifactSystem : EntitySystem
|
||||
[Dependency] private readonly INetManager _net = default!;
|
||||
[Dependency] protected readonly IPrototypeManager PrototypeManager = default!;
|
||||
[Dependency] protected readonly IRobustRandom RobustRandom = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _actions = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
|
||||
@@ -24,6 +26,7 @@ public abstract partial class SharedXenoArtifactSystem : EntitySystem
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<XenoArtifactComponent, ComponentStartup>(OnStartup);
|
||||
SubscribeLocalEvent<XenoArtifactComponent, ArtifactSelfActivateEvent>(OnSelfActivate);
|
||||
|
||||
InitializeNode();
|
||||
InitializeUnlock();
|
||||
@@ -42,9 +45,15 @@ public abstract partial class SharedXenoArtifactSystem : EntitySystem
|
||||
/// <summary> As all artifacts have to contain nodes - we ensure that they are containers. </summary>
|
||||
private void OnStartup(Entity<XenoArtifactComponent> ent, ref ComponentStartup args)
|
||||
{
|
||||
_actions.AddAction(ent, ent.Comp.SelfActivateAction);
|
||||
ent.Comp.NodeContainer = _container.EnsureContainer<Container>(ent, XenoArtifactComponent.NodeContainerId);
|
||||
}
|
||||
|
||||
private void OnSelfActivate(Entity<XenoArtifactComponent> ent, ref ArtifactSelfActivateEvent args)
|
||||
{
|
||||
args.Handled = TryActivateXenoArtifact(ent, ent, null, Transform(ent).Coordinates, false);
|
||||
}
|
||||
|
||||
public void SetSuppressed(Entity<XenoArtifactComponent> ent, bool val)
|
||||
{
|
||||
if (ent.Comp.Suppressed == val)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
- type: entity
|
||||
id: BaseXenoArtifact
|
||||
parent: BaseMob # we use this since it can technically get inhabited
|
||||
name: artifact
|
||||
description: A strange artifact from time unknown. Looks like a good time.
|
||||
abstract: true
|
||||
@@ -29,6 +30,9 @@
|
||||
- type: Actions
|
||||
- type: Physics
|
||||
bodyType: Dynamic
|
||||
- type: MovementSpeedModifier
|
||||
baseWalkSpeed: 0.25
|
||||
baseSprintSpeed: 0.5
|
||||
- type: UseDelay
|
||||
- type: StealTarget
|
||||
stealGroup: XenoArtifact
|
||||
@@ -41,3 +45,15 @@
|
||||
# These components are needed for certain triggers to work.
|
||||
- type: RadiationReceiver
|
||||
- type: Reactive
|
||||
|
||||
- type: entity
|
||||
id: ActionArtifactActivate
|
||||
name: Activate Artifact
|
||||
description: Activate yourself, causing chaos to those near you.
|
||||
components:
|
||||
- type: InstantAction
|
||||
icon:
|
||||
sprite: Objects/Specific/Xenoarchaeology/xeno_artifacts.rsi
|
||||
state: ano29
|
||||
useDelay: 300
|
||||
event: !type:ArtifactSelfActivateEvent
|
||||
|
||||
@@ -363,9 +363,6 @@
|
||||
mindRoles:
|
||||
- MindRoleGhostRoleFreeAgent
|
||||
- type: GhostTakeoverAvailable
|
||||
- type: MovementSpeedModifier
|
||||
baseWalkSpeed: 0.25
|
||||
baseSprintSpeed: 0.5
|
||||
|
||||
- type: entity
|
||||
id: XenoArtifactOmnitool
|
||||
|
||||
Reference in New Issue
Block a user