Gender Swap

This commit is contained in:
Jabak
2024-07-03 11:17:58 +03:00
parent 35edf6460a
commit 03ee041be9
9 changed files with 281 additions and 0 deletions

View File

@@ -359,6 +359,21 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
}
}
public void SwapSex(EntityUid uid, HumanoidAppearanceComponent? humanoid = null)
{
if (!Resolve(uid, ref humanoid) || humanoid.Sex == Sex.Unsexed)
return;
// Not set up for future possible alien sexes
if (humanoid.Sex == Sex.Male)
{
SetSex(uid,Sex.Female);
return;
}
SetSex(uid,Sex.Male);
}
public List<BodyTypePrototype> GetValidBodyTypes(SpeciesPrototype species, Sex sex)
{
return species.BodyTypes.Select(protoId => _proto.Index<BodyTypePrototype>(protoId))

View File

@@ -0,0 +1,39 @@
using System.Diagnostics.CodeAnalysis;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects.Components.Localization;
namespace Content.Shared._Amour.GrammarSystem;
public sealed class GrammarSystem : EntitySystem
{
public void Clear(Entity<GrammarComponent> grammar)
{
grammar.Comp.Attributes.Clear();
Dirty(grammar);
}
public bool TryGet(Entity<GrammarComponent> grammar, string key, [NotNullWhen(true)] out string? value)
{
return grammar.Comp.Attributes.TryGetValue(key, out value);
}
public void Set(Entity<GrammarComponent> grammar, string key, string? value)
{
if (value == null)
grammar.Comp.Attributes.Remove(key);
else
grammar.Comp.Attributes[key] = value;
Dirty(grammar);
}
public void SetGender(Entity<GrammarComponent> grammar, Gender? gender)
{
Set(grammar, "gender", gender?.ToString());
}
public void SetProperNoun(Entity<GrammarComponent> grammar, bool? proper)
{
Set(grammar, "proper", proper?.ToString());
}
}