Let species prototypes define valid sexes (Sex Refactor) (#11520)

This commit is contained in:
Rane
2022-10-15 17:45:47 -04:00
committed by GitHub
parent 0e18ba567c
commit c70e423ff6
14 changed files with 161 additions and 97 deletions

View File

@@ -2,9 +2,7 @@ using System.Linq;
using Content.Server.Administration.Commands;
using Content.Server.Cargo.Systems;
using Content.Server.Chat.Managers;
using Content.Server.GameTicking.Rules.Configurations;
using Content.Server.Preferences.Managers;
using Content.Server.RoundEnd;
using Content.Server.Spawners.Components;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
@@ -19,6 +17,7 @@ using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using Robust.Shared.Enums;
namespace Content.Server.GameTicking.Rules;
@@ -37,6 +36,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem
[Dependency] private readonly StationSpawningSystem _stationSpawningSystem = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly PricingSystem _pricingSystem = default!;
[Dependency] private readonly NamingSystem _namingSystem = default!;
[ViewVariables]
private List<Mind.Mind> _pirates = new();
@@ -198,8 +198,9 @@ public sealed class PiratesRuleSystem : GameRuleSystem
for (var i = 0; i < ops.Length; i++)
{
var sex = _random.Prob(0.5f) ? Sex.Male : Sex.Female;
var gender = sex == Sex.Male ? Gender.Male : Gender.Female;
var name = sex.GetName("Human", _prototypeManager, _random);
var name = _namingSystem.GetName("Human", gender);
var session = ops[i];
var newMind = new Mind.Mind(session.UserId)

View File

@@ -122,7 +122,7 @@ public class IdentitySystem : SharedIdentitySystem
HumanoidComponent? appearance=null)
{
int age = HumanoidCharacterProfile.MinimumAge;
Gender gender = Gender.Neuter;
Gender gender = Gender.Epicene;
// Always use their actual age and gender, since that can't really be changed by an ID.
if (Resolve(target, ref appearance, false))

View File

@@ -17,6 +17,9 @@ public sealed class VocalComponent : Component
[DataField("femaleScream")]
public SoundSpecifier FemaleScream = new SoundCollectionSpecifier("FemaleScreams");
[DataField("unsexedScream")]
public SoundSpecifier UnsexedScream = new SoundCollectionSpecifier("MaleScreams");
[DataField("wilhelm")]
public SoundSpecifier Wilhelm = new SoundPathSpecifier("/Audio/Voice/Human/wilhelm_scream.ogg");

View File

@@ -67,9 +67,7 @@ public sealed class VocalSystem : EntitySystem
if (!_blocker.CanSpeak(uid))
return false;
var sex = Sex.Male; //the default is male because requiring humanoid appearance for this is dogshit
if (TryComp(uid, out HumanoidComponent? humanoid))
sex = humanoid.Sex;
var sex = CompOrNull<HumanoidComponent>(uid)?.Sex ?? Sex.Unsexed;
if (_random.Prob(component.WilhelmProbability))
{
@@ -89,7 +87,8 @@ public sealed class VocalSystem : EntitySystem
SoundSystem.Play(component.FemaleScream.GetSound(), Filter.Pvs(uid), uid, pitchedParams);
break;
default:
throw new ArgumentOutOfRangeException();
SoundSystem.Play(component.UnsexedScream.GetSound(), Filter.Pvs(uid), uid, pitchedParams);
break;
}
return true;