forked from space-wizards/space-station-14
-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into artifact-book-update
- Loading branch information
Showing
50 changed files
with
132,949 additions
and
26,101 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...pstation/Xenoarchaeology/XenoArtifacts/Effects/Components/ScrambleDNAArtifactComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components; | ||
|
||
/// <summary> | ||
/// Scrambles DNA of some number of people within some range, possibly outside of their species | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class ScrambleDNAArtifactComponent : Component | ||
{ | ||
/// <summary> | ||
/// Distance from the artifact find people to scramble DNA | ||
/// </summary> | ||
[DataField("range"), ViewVariables(VVAccess.ReadWrite)] | ||
public float Range = 6f; | ||
|
||
/// <summary> | ||
/// Number of people to DNA scramble | ||
/// </summary> | ||
[DataField("count"), ViewVariables(VVAccess.ReadWrite)] | ||
public int Count = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...er/_Impstation/Xenoarchaeology/XenoArtifacts/Effects/Systems/ScrambleDNAArtifactSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components; | ||
using Content.Server.Xenoarchaeology.XenoArtifacts.Events; | ||
using Content.Shared.Preferences; | ||
using Content.Server.Humanoid; | ||
using System.Linq; | ||
using Robust.Shared.Random; | ||
using Content.Shared.Humanoid; | ||
using Content.Shared.Forensics; | ||
using Content.Server.Forensics; | ||
|
||
|
||
|
||
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems; | ||
|
||
public sealed class ScrambleDNAArtifactSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly EntityLookupSystem _lookup = default!; | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
[Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearance = default!; | ||
[Dependency] private readonly MetaDataSystem _metaData = default!; | ||
[Dependency] private readonly ForensicsSystem _forensicsSystem = default!; | ||
|
||
|
||
|
||
/// <inheritdoc/> | ||
public override void Initialize() | ||
{ | ||
SubscribeLocalEvent<ScrambleDNAArtifactComponent, ArtifactActivatedEvent>(OnActivated); | ||
} | ||
|
||
private void OnActivated(EntityUid uid, ScrambleDNAArtifactComponent component, ArtifactActivatedEvent args) | ||
{ | ||
// Get all entities in range, and the person who activated the artifact even if they are not within range | ||
var ents = _lookup.GetEntitiesInRange(uid, component.Range); | ||
if (args.Activator != null) | ||
ents.Add(args.Activator.Value); | ||
|
||
//Extract the people who can be scrambled | ||
var possibleVictims = new List<EntityUid>(); | ||
foreach (var ent in ents) | ||
{ | ||
if (HasComp<HumanoidAppearanceComponent>(ent)) | ||
possibleVictims.Add(ent); | ||
} | ||
|
||
//Select random targets to scramble DNA | ||
var numScrambled = 0; | ||
while (numScrambled < component.Count){ | ||
var targetIndex = _random.Next(0, possibleVictims.Count); | ||
var target = possibleVictims.ElementAt(targetIndex); | ||
possibleVictims.Remove(target); | ||
|
||
ScrambleTargetDNA(target, component); | ||
numScrambled ++; | ||
} | ||
} | ||
|
||
private void ScrambleTargetDNA(EntityUid target, ScrambleDNAArtifactComponent component) | ||
{ | ||
if (TryComp<HumanoidAppearanceComponent>(target, out var humanoid)) | ||
{ | ||
var newProfile = (HumanoidCharacterProfile.RandomWithSpecies(humanoid.Species)); | ||
_humanoidAppearance.LoadProfile(target, newProfile, humanoid); | ||
_metaData.SetEntityName(target, newProfile.Name); | ||
if (TryComp<DnaComponent>(target, out var dna)) | ||
{ | ||
dna.DNA = _forensicsSystem.GenerateDNA(); | ||
|
||
var ev = new GenerateDnaEvent { Owner = target, DNA = dna.DNA }; | ||
RaiseLocalEvent(target, ref ev); | ||
} | ||
if (TryComp<FingerprintComponent>(target, out var fingerprint)) | ||
{ | ||
fingerprint.Fingerprint = _forensicsSystem.GenerateFingerprint(); | ||
} | ||
} | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
Content.Shared/_Impstation/RemoveComp/RemoveCompComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Content.Shared.Whitelist; | ||
|
||
namespace Content.Shared._Impstation.RemoveComp | ||
{ | ||
/// <summary> | ||
/// If there is any other possible way to do what you want to do, reconsider using this. | ||
/// Takes a list of components and removes them from the entity. | ||
/// Necessary for removing components from entities which are parented. | ||
/// </summary> | ||
[RegisterComponent, AutoGenerateComponentState, Access(typeof(RemoveCompSystem))] | ||
public sealed partial class RemoveCompComponent : Component | ||
{ | ||
/// <summary> | ||
/// The list of components to be removed. | ||
/// I must reiterate, exhaust all other options before using this component. | ||
/// </summary> | ||
[DataField("unwantedComponents"), AutoNetworkedField] | ||
public EntityWhitelist UnwantedComponents = new(); | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
Content.Shared/_Impstation/RemoveComp/SharedRemoveCompSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using Content.Shared.Whitelist; | ||
using Content.Shared.IdentityManagement; | ||
using Robust.Shared.Timing; | ||
using Content.Shared.GameTicking; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
|
||
namespace Content.Shared._Impstation.RemoveComp; | ||
|
||
public sealed class RemoveCompSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!; | ||
[Dependency] private readonly IGameTiming _gameTiming = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<RemoveCompComponent, MapInitEvent>(OnMapInit); | ||
} | ||
|
||
|
||
/// <summary> | ||
/// complains if an entity has this but it is either defined wrong or undefined, and if not, runs RemoveComponents | ||
/// </summary> | ||
/// <param name="uid"></param> | ||
/// <param name="component"></param> | ||
/// <param name="args"></param> | ||
/// <exception cref="ArgumentException"></exception> | ||
private void OnMapInit(EntityUid uid, RemoveCompComponent comp, ref MapInitEvent args) | ||
{ | ||
// log a message and quit if RequireAll is false. | ||
if (!comp.UnwantedComponents.RequireAll) | ||
{ | ||
Log.Error("RemoveComp only supports RequireAll = true!"); | ||
return; | ||
} | ||
|
||
// if there are no components listed, throw an "improperly defined" error. | ||
if (comp.UnwantedComponents.Components == null) | ||
{ | ||
Log.Error($"RemoveComp on {ToPrettyString(Identity.Entity(uid, EntityManager))} must use at least 1 component as a filter in UnwantedComponents!"); | ||
throw new ArgumentException($"RemoveComp on {ToPrettyString(Identity.Entity(uid, EntityManager))} must use at least 1 component as a filter in UnwantedComponents!"); | ||
} | ||
|
||
// if the blacklist contains a component that the entity does not possess, throw an error. | ||
if (_whitelist.IsBlacklistFail(comp.UnwantedComponents, uid)) | ||
{ | ||
Log.Error($"RemoveComp on {ToPrettyString(Identity.Entity(uid, EntityManager))} is trying to remove a component that does not exist."); | ||
throw new ArgumentException($"RemoveComp on {ToPrettyString(Identity.Entity(uid, EntityManager))} is trying to remove a component that does not exist."); | ||
} | ||
|
||
// if no errors are detected, run RemoveComponents() and then delete yourself. | ||
else | ||
{ | ||
RemoveComponents(uid, comp); | ||
EntityManager.RemoveComponent<RemoveCompComponent>(uid); | ||
} | ||
} | ||
|
||
// This is unfortunately something I have to do because we do not have a team big enough to refactor stuff. Don't be like me. | ||
/// <summary> | ||
/// Removes components from the list until there are no components left to remove. | ||
/// </summary> | ||
/// <param name="uid"></param> | ||
/// <param name="comp"></param> | ||
private void RemoveComponents(EntityUid uid, RemoveCompComponent comp) | ||
{ | ||
// if the entity has any of the components on the list, | ||
if (_whitelist.IsBlacklistPass(comp.UnwantedComponents, uid)) | ||
{ | ||
// loop through each component in the list, | ||
for (var i = 0; i < comp.UnwantedComponents.Components!.Length; i++) | ||
{ | ||
// set a variable to return the type of each component, and... | ||
var compType = EntityManager.ComponentFactory.GetRegistration(comp.UnwantedComponents.Components[i]).Type; | ||
|
||
// remove the offending components. | ||
EntityManager.RemoveComponent(uid, compType); | ||
} | ||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- files: ["RW_Stargazer.ogg"] | ||
license: "Custom" | ||
copyright: "Taken from Rain World; composed by James Primate and published by Black Screen Records." | ||
source: "https://www.youtube.com/watch?v=HPOKeoa1qOU" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+9.19 KB
(270%)
Resources/Audio/_Impstation/Effects/Footsteps/highheels1.ogg
Binary file not shown.
Binary file modified
BIN
+8.86 KB
(270%)
Resources/Audio/_Impstation/Effects/Footsteps/highheels2.ogg
Binary file not shown.
Binary file modified
BIN
+10.6 KB
(310%)
Resources/Audio/_Impstation/Effects/Footsteps/highheels3.ogg
Binary file not shown.
Binary file modified
BIN
+9.42 KB
(270%)
Resources/Audio/_Impstation/Effects/Footsteps/highheels4.ogg
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Oops, something went wrong.