Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into artifact-book-update
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGrimbeeper committed Dec 27, 2024
2 parents b4ccb4e + 20b8c4e commit 7b7e223
Show file tree
Hide file tree
Showing 50 changed files with 132,949 additions and 26,101 deletions.
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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ private void OnActivated(EntityUid uid, KnockdownArtifactComponent component, Ar
_stuns.TryParalyze(child, TimeSpan.FromSeconds(component.KnockdownTime), true, status);
}



}
else // knock over only people in range
{
Expand Down
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 Content.Shared/_Impstation/RemoveComp/RemoveCompComponent.cs
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 Content.Shared/_Impstation/RemoveComp/SharedRemoveCompSystem.cs
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 modified Resources/Audio/Announcers/Intern/comms/announce/14.ogg
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions Resources/Audio/_Impstation/Ambience/attributions.yml
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"
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- highheels2.ogg
- highheels3.ogg
- highheels4.ogg
license: "Custom"
copyright: "Ripped from the video game Thief Gold (1998), distributed by Eidos Interactive Corp."
source: "NA"
- highheels5.ogg
license: "CC-BY-3.0"
copyright: "Original audio from Allen2001 on freesound.org, modified by DinnerCalzone (github)"
source: "https://freesound.org/people/Allen2001/sounds/595107/"
Binary file modified Resources/Audio/_Impstation/Effects/Footsteps/highheels1.ogg
Binary file not shown.
Binary file modified Resources/Audio/_Impstation/Effects/Footsteps/highheels2.ogg
Binary file not shown.
Binary file modified Resources/Audio/_Impstation/Effects/Footsteps/highheels3.ogg
Binary file not shown.
Binary file modified Resources/Audio/_Impstation/Effects/Footsteps/highheels4.ogg
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions Resources/Audio/_Impstation/Effects/attributions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@
license: "CC-BY-SA-3.0"
copyright: "Foley by DinnerCalzone"
source: "https://github.com/impstation/imp-station-14/pull/1071"

- files: ["grapple_impact"]
license: "CC-BY-SA-3.0"
copyright: "Taken from /tg/station, modified by DinnerCalzone"
source: "https://github.com/tgstation/tgstation/blob/3df5d3b42bfb6b3b5adba1067ab41f83816255bb/sound/effects/picaxe1.ogg"
Binary file not shown.
Binary file added Resources/Audio/_Impstation/Items/minidrill.ogg
Binary file not shown.
Loading

0 comments on commit 7b7e223

Please sign in to comment.