Fix DNA scrambler (#19079)

This commit is contained in:
Nemanja
2023-08-13 12:56:21 -04:00
committed by GitHub
parent ff4f01e9d8
commit 2f2df5c74b
4 changed files with 13 additions and 30 deletions

View File

@@ -1,21 +1,24 @@
using Content.Server.Cuffs;
using Content.Server.Humanoid;
using Content.Server.Store.Components;
using Content.Server.Store.Systems;
using Content.Shared.Cuffs.Components;
using Content.Shared.Humanoid;
using Content.Shared.Implants;
using Content.Shared.Implants.Components;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Content.Server.Polymorph.Systems;
using Content.Shared.Preferences;
namespace Content.Server.Implants;
public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem
{
[Dependency] private readonly CuffableSystem _cuffable = default!;
[Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearance = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly StoreSystem _store = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly PolymorphSystem _polymorph = default!;
public override void Initialize()
{
@@ -69,20 +72,17 @@ public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem
private void OnDnaScramblerImplant(EntityUid uid, SubdermalImplantComponent component, UseDnaScramblerImplantEvent args)
{
if (component.ImplantedEntity == null)
if (component.ImplantedEntity is not { } ent)
return;
var newIdentity = _polymorph.PolymorphEntity(component.ImplantedEntity.Value, "Scrambled");
//checks if someone is trying to use a dna scrambler implant while already scrambled
if (newIdentity == null)
if (TryComp<HumanoidAppearanceComponent>(ent, out var humanoid))
{
_popup.PopupEntity(Loc.GetString("scramble-attempt-while-scrambled-popup"), component.ImplantedEntity.Value, component.ImplantedEntity.Value);
return;
var newProfile = HumanoidCharacterProfile.RandomWithSpecies(humanoid.Species);
_humanoidAppearance.LoadProfile(ent, newProfile, humanoid);
_metaData.SetEntityName(ent, newProfile.Name);
_popup.PopupEntity(Loc.GetString("scramble-implant-activated-popup"), ent, ent);
}
_popup.PopupEntity(Loc.GetString("scramble-implant-activated-popup", ("identity", newIdentity.Value)), newIdentity.Value, newIdentity.Value);
args.Handled = true;
QueueDel(uid);
}

View File

@@ -35,12 +35,11 @@ use-emp-implant-action-name = Activate EMP
use-emp-implant-action-description = Triggers a small EMP pulse around you
use-dna-scrambler-implant-action-name = Scramble DNA
use-dna-scrambler-implant-action-description = LING IN MAINTS!
use-dna-scrambler-implant-action-description = Randomly changes your name and appearance.
## Implant Popups
scramble-attempt-while-scrambled-popup = Scrambled DNA detected, please extract implant before undoing the current scramble.
scramble-implant-activated-popup = You transformed into {$identity}
scramble-implant-activated-popup = Your appearance shifts and changes!
## Implant Messages

View File

@@ -53,11 +53,3 @@
- type: NpcFactionMember
factions:
- Syndicate
# DNA Scrambler
- type: entity
parent: MobHuman
id: MobHumanScrambled
name: Scrambled Human
components:
- type: RandomHumanoidAppearance

View File

@@ -4,14 +4,6 @@
forced: true
duration: 30
- type: polymorph
id: Scrambled
entity: MobHumanScrambled
forced: false
inventory: Transfer
revertOnCrit: true
revertOnDeath: true
- type: polymorph
id: Chicken
entity: MobChicken