Deathrattle implant for uplink and slight tracking implant tweak (#17722)
This commit is contained in:
@@ -13,7 +13,7 @@ public sealed class TriggerOnMobstateChangeComponent : Component
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
[DataField("mobState", required: true)]
|
[DataField("mobState", required: true)]
|
||||||
public MobState MobState = MobState.Alive;
|
public List<MobState> MobState = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If true, prevents suicide attempts for the trigger to prevent cheese.
|
/// If true, prevents suicide attempts for the trigger to prevent cheese.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public sealed partial class TriggerSystem
|
|||||||
|
|
||||||
private void OnMobStateChanged(EntityUid uid, TriggerOnMobstateChangeComponent component, MobStateChangedEvent args)
|
private void OnMobStateChanged(EntityUid uid, TriggerOnMobstateChangeComponent component, MobStateChangedEvent args)
|
||||||
{
|
{
|
||||||
if (component.MobState != args.NewMobState)
|
if (!component.MobState.Contains(args.NewMobState))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//This chains Mobstate Changed triggers with OnUseTimerTrigger if they have it
|
//This chains Mobstate Changed triggers with OnUseTimerTrigger if they have it
|
||||||
|
|||||||
@@ -5,10 +5,13 @@ using Content.Server.Chemistry.Components.SolutionManager;
|
|||||||
using Content.Server.Explosion.Components;
|
using Content.Server.Explosion.Components;
|
||||||
using Content.Server.Flash;
|
using Content.Server.Flash;
|
||||||
using Content.Server.Flash.Components;
|
using Content.Server.Flash.Components;
|
||||||
|
using Content.Server.Radio.EntitySystems;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Implants.Components;
|
using Content.Shared.Implants.Components;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Payload.Components;
|
using Content.Shared.Payload.Components;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Content.Shared.Radio;
|
||||||
using Content.Shared.Slippery;
|
using Content.Shared.Slippery;
|
||||||
using Content.Shared.StepTrigger.Systems;
|
using Content.Shared.StepTrigger.Systems;
|
||||||
using Content.Shared.Trigger;
|
using Content.Shared.Trigger;
|
||||||
@@ -17,6 +20,8 @@ using Robust.Shared.Audio;
|
|||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Physics.Events;
|
using Robust.Shared.Physics.Events;
|
||||||
using Robust.Shared.Physics.Systems;
|
using Robust.Shared.Physics.Systems;
|
||||||
|
using Content.Shared.Mobs;
|
||||||
|
using Content.Shared.Mobs.Components;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.Explosion.EntitySystems
|
namespace Content.Server.Explosion.EntitySystems
|
||||||
@@ -53,6 +58,8 @@ namespace Content.Server.Explosion.EntitySystems
|
|||||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||||
[Dependency] private readonly BodySystem _body = default!;
|
[Dependency] private readonly BodySystem _body = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
|
[Dependency] private readonly RadioSystem _radioSystem = default!;
|
||||||
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -76,6 +83,7 @@ namespace Content.Server.Explosion.EntitySystems
|
|||||||
SubscribeLocalEvent<ExplodeOnTriggerComponent, TriggerEvent>(HandleExplodeTrigger);
|
SubscribeLocalEvent<ExplodeOnTriggerComponent, TriggerEvent>(HandleExplodeTrigger);
|
||||||
SubscribeLocalEvent<FlashOnTriggerComponent, TriggerEvent>(HandleFlashTrigger);
|
SubscribeLocalEvent<FlashOnTriggerComponent, TriggerEvent>(HandleFlashTrigger);
|
||||||
SubscribeLocalEvent<GibOnTriggerComponent, TriggerEvent>(HandleGibTrigger);
|
SubscribeLocalEvent<GibOnTriggerComponent, TriggerEvent>(HandleGibTrigger);
|
||||||
|
SubscribeLocalEvent<RattleComponent, TriggerEvent>(HandleRattleTrigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSpawnTrigger(EntityUid uid, SpawnOnTriggerComponent component, TriggerEvent args)
|
private void OnSpawnTrigger(EntityUid uid, SpawnOnTriggerComponent component, TriggerEvent args)
|
||||||
@@ -121,11 +129,40 @@ namespace Content.Server.Explosion.EntitySystems
|
|||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HandleRattleTrigger(EntityUid uid, RattleComponent component, TriggerEvent args)
|
||||||
|
{
|
||||||
|
if (!TryComp<SubdermalImplantComponent?>(uid, out var implanted))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (implanted.ImplantedEntity == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Gets location of the implant
|
||||||
|
var ownerXform = Transform(uid);
|
||||||
|
var pos = ownerXform.MapPosition;
|
||||||
|
var x = (int) pos.X;
|
||||||
|
var y = (int) pos.Y;
|
||||||
|
var posText = $"({x}, {y})";
|
||||||
|
|
||||||
|
var critMessage = Loc.GetString(component.CritMessage, ("user", implanted.ImplantedEntity.Value), ("position", posText));
|
||||||
|
var deathMessage = Loc.GetString(component.DeathMessage, ("user", implanted.ImplantedEntity.Value), ("position", posText));
|
||||||
|
|
||||||
|
if (!TryComp<MobStateComponent>(implanted.ImplantedEntity, out var mobstate))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Sends a message to the radio channel specified by the implant
|
||||||
|
if (mobstate.CurrentState == MobState.Critical)
|
||||||
|
_radioSystem.SendRadioMessage(uid, critMessage, _prototypeManager.Index<RadioChannelPrototype>(component.RadioChannel), uid);
|
||||||
|
if (mobstate.CurrentState == MobState.Dead)
|
||||||
|
_radioSystem.SendRadioMessage(uid, deathMessage, _prototypeManager.Index<RadioChannelPrototype>(component.RadioChannel), uid);
|
||||||
|
|
||||||
|
args.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnTriggerCollide(EntityUid uid, TriggerOnCollideComponent component, ref StartCollideEvent args)
|
private void OnTriggerCollide(EntityUid uid, TriggerOnCollideComponent component, ref StartCollideEvent args)
|
||||||
{
|
{
|
||||||
if(args.OurFixture.ID == component.FixtureID && (!component.IgnoreOtherNonHard || args.OtherFixture.Hard))
|
if (args.OurFixture.ID == component.FixtureID && (!component.IgnoreOtherNonHard || args.OtherFixture.Hard))
|
||||||
Trigger(component.Owner);
|
Trigger(component.Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnActivate(EntityUid uid, TriggerOnActivateComponent component, ActivateInWorldEvent args)
|
private void OnActivate(EntityUid uid, TriggerOnActivateComponent component, ActivateInWorldEvent args)
|
||||||
|
|||||||
20
Content.Shared/Implants/Components/RattleComponent.cs
Normal file
20
Content.Shared/Implants/Components/RattleComponent.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Content.Shared.Radio;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
|
namespace Content.Shared.Implants.Components;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed class RattleComponent : Component
|
||||||
|
{
|
||||||
|
// The radio channel the message will be sent to
|
||||||
|
[DataField("radioChannel", customTypeSerializer: typeof(PrototypeIdSerializer<RadioChannelPrototype>))]
|
||||||
|
public string RadioChannel = "Syndicate";
|
||||||
|
|
||||||
|
// The message that the implant will send when crit
|
||||||
|
[DataField("critMessage")]
|
||||||
|
public string CritMessage = "deathrattle-implant-critical-message";
|
||||||
|
|
||||||
|
// The message that the implant will send when dead
|
||||||
|
[DataField("deathMessage")]
|
||||||
|
public string DeathMessage = "deathrattle-implant-dead-message";
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
|
using Content.Shared.Radio;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
namespace Content.Shared.Implants.Components;
|
namespace Content.Shared.Implants.Components;
|
||||||
|
|
||||||
|
|||||||
@@ -29,3 +29,8 @@ open-uplink-implant-action-description = Opens the syndicate uplink embedded und
|
|||||||
|
|
||||||
action-name-honk = Honk!
|
action-name-honk = Honk!
|
||||||
action-desc-honk = Activates your honking implant, which will produce the signature sound of the clown.
|
action-desc-honk = Activates your honking implant, which will produce the signature sound of the clown.
|
||||||
|
|
||||||
|
## Implanter Messages
|
||||||
|
|
||||||
|
deathrattle-implant-dead-message = {$user} has died at {$position}.
|
||||||
|
deathrattle-implant-critical-message = {$user} life signs critical, immediate assistance required at {$position}.
|
||||||
|
|||||||
@@ -115,6 +115,9 @@ uplink-macro-bomb-implanter-desc = Inject this and on death you'll create a larg
|
|||||||
uplink-uplink-implanter-name = Uplink Implanter
|
uplink-uplink-implanter-name = Uplink Implanter
|
||||||
uplink-uplink-implanter-desc = Stealthily order equipment without the need for a PDA. Swallow telecrystals to top up the uplink.
|
uplink-uplink-implanter-desc = Stealthily order equipment without the need for a PDA. Swallow telecrystals to top up the uplink.
|
||||||
|
|
||||||
|
uplink-deathrattle-implant-name = Box Of Deathrattle Implants
|
||||||
|
uplink-deathrattle-implant-desc = A box containing enough deathrattle implants for the whole squad. Relays a message containing your position to the syndicate channel when you go into a critical state or die.
|
||||||
|
|
||||||
# Bundles
|
# Bundles
|
||||||
uplink-c20r-bundle-name = C-20r Bundle
|
uplink-c20r-bundle-name = C-20r Bundle
|
||||||
uplink-c20r-bundle-desc = Old faithful: The classic C-20r Submachine Gun, bundled with three magazines.
|
uplink-c20r-bundle-desc = Old faithful: The classic C-20r Submachine Gun, bundled with three magazines.
|
||||||
|
|||||||
@@ -393,3 +393,24 @@
|
|||||||
amount: 2
|
amount: 2
|
||||||
- type: Storage
|
- type: Storage
|
||||||
capacity: 15
|
capacity: 15
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
name: deathrattle implant box
|
||||||
|
parent: BoxCardboard
|
||||||
|
id: BoxDeathRattleImplants
|
||||||
|
description: Six deathrattle implants and handheld GPS devices for the whole squad.
|
||||||
|
components:
|
||||||
|
- type: Item
|
||||||
|
size: 60
|
||||||
|
- type: StorageFill
|
||||||
|
contents:
|
||||||
|
- id: DeathRattleImplanter
|
||||||
|
amount: 6
|
||||||
|
- id: HandheldGPSBasic
|
||||||
|
amount: 6
|
||||||
|
- type: Storage
|
||||||
|
capacity: 60
|
||||||
|
- type: Sprite
|
||||||
|
layers:
|
||||||
|
- state: box
|
||||||
|
- state: syringe
|
||||||
|
|||||||
@@ -434,6 +434,25 @@
|
|||||||
tags:
|
tags:
|
||||||
- NukeOpsUplink
|
- NukeOpsUplink
|
||||||
|
|
||||||
|
- type: listing
|
||||||
|
id: UplinkDeathRattle
|
||||||
|
name: uplink-deathrattle-implant-name
|
||||||
|
description: uplink-deathrattle-implant-desc
|
||||||
|
productEntity: BoxDeathRattleImplants
|
||||||
|
cost:
|
||||||
|
Telecrystal: 4
|
||||||
|
categories:
|
||||||
|
- UplinkImplants
|
||||||
|
conditions:
|
||||||
|
- !type:StoreWhitelistCondition
|
||||||
|
whitelist:
|
||||||
|
tags:
|
||||||
|
- NukeOpsUplink
|
||||||
|
- !type:BuyerWhitelistCondition
|
||||||
|
blacklist:
|
||||||
|
components:
|
||||||
|
- SurplusBundle
|
||||||
|
|
||||||
# Bundles
|
# Bundles
|
||||||
|
|
||||||
- type: listing
|
- type: listing
|
||||||
|
|||||||
@@ -160,3 +160,12 @@
|
|||||||
components:
|
components:
|
||||||
- type: Implanter
|
- type: Implanter
|
||||||
implant: MacroBombImplant
|
implant: MacroBombImplant
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: DeathRattleImplanter
|
||||||
|
name: Deathrattle implanter
|
||||||
|
description: a single use implanter, the implant will inform anyone with access to the syndicate radio channel of your death.
|
||||||
|
parent: BaseImplantOnlyImplanter
|
||||||
|
components:
|
||||||
|
- type: Implanter
|
||||||
|
implant: DeathRattleImplant
|
||||||
|
|||||||
@@ -22,7 +22,8 @@
|
|||||||
components:
|
components:
|
||||||
- type: SubdermalImplant
|
- type: SubdermalImplant
|
||||||
- type: TriggerOnMobstateChange
|
- type: TriggerOnMobstateChange
|
||||||
mobState: Dead
|
mobState:
|
||||||
|
- Dead
|
||||||
- type: EmitSoundOnTrigger
|
- type: EmitSoundOnTrigger
|
||||||
sound:
|
sound:
|
||||||
collection: SadTrombone
|
collection: SadTrombone
|
||||||
@@ -97,6 +98,11 @@
|
|||||||
- type: StationLimitedNetwork
|
- type: StationLimitedNetwork
|
||||||
- type: WirelessNetworkConnection
|
- type: WirelessNetworkConnection
|
||||||
range: 500
|
range: 500
|
||||||
|
- type: TriggerOnMobstateChange
|
||||||
|
mobState:
|
||||||
|
- Critical
|
||||||
|
- type: Rattle
|
||||||
|
radioChannel: "Security"
|
||||||
|
|
||||||
#Traitor implants
|
#Traitor implants
|
||||||
|
|
||||||
@@ -163,7 +169,8 @@
|
|||||||
permanent: true
|
permanent: true
|
||||||
implantAction: ActivateMicroBomb
|
implantAction: ActivateMicroBomb
|
||||||
- type: TriggerOnMobstateChange
|
- type: TriggerOnMobstateChange
|
||||||
mobState: Dead
|
mobState:
|
||||||
|
- Dead
|
||||||
- type: TriggerImplantAction
|
- type: TriggerImplantAction
|
||||||
- type: ExplodeOnTrigger
|
- type: ExplodeOnTrigger
|
||||||
- type: GibOnTrigger
|
- type: GibOnTrigger
|
||||||
@@ -191,7 +198,8 @@
|
|||||||
- type: SubdermalImplant
|
- type: SubdermalImplant
|
||||||
permanent: true
|
permanent: true
|
||||||
- type: TriggerOnMobstateChange #Chains with OnUseTimerTrigger
|
- type: TriggerOnMobstateChange #Chains with OnUseTimerTrigger
|
||||||
mobState: Dead
|
mobState:
|
||||||
|
- Dead
|
||||||
preventSuicide: true
|
preventSuicide: true
|
||||||
- type: OnUseTimerTrigger
|
- type: OnUseTimerTrigger
|
||||||
delay: 7
|
delay: 7
|
||||||
@@ -213,3 +221,19 @@
|
|||||||
- SubdermalImplant
|
- SubdermalImplant
|
||||||
- HideContextMenu
|
- HideContextMenu
|
||||||
- MacroBomb
|
- MacroBomb
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
parent: BaseSubdermalImplant
|
||||||
|
id: DeathRattleImplant
|
||||||
|
name: deathrattle implant
|
||||||
|
description: sends a message with your location to the syndicate radio channel when you fall into a critical state or die.
|
||||||
|
noSpawn: true
|
||||||
|
components:
|
||||||
|
- type: SubdermalImplant
|
||||||
|
permanent: true
|
||||||
|
- type: TriggerOnMobstateChange
|
||||||
|
mobState:
|
||||||
|
- Critical
|
||||||
|
- Dead
|
||||||
|
- type: Rattle
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user