Clothing and pronoun fields (#2689)

* Clothing & Gender fields: Add to database [MODIFIED TO NOT DEPEND ON SAPHIRE-DB-REFACTOR]

Sorry about this, Saphire.

* Clothing & Gender fields: Add UI [FALLBACK II]

* Clothing & Gender fields: Actually apply gender

* Clothing & Gender fields: Import innerclothingskirt field from my previous attempt

Couldn't import actual prototypes because of a change to IDs

* Clothing & Gender fields: Add innerclothingskirt field to everything

* Clothing & Gender fields: Jumpskirts now work

* Clothing & Gender fields: Gender field will follow sex field if it's not different (UX improvement) [FALLBACK II]

* Clothing & Gender fields: Gender -> Pronouns to reduce confusion. Also, fix profile summary. Properly. [FALLBACK II]

* Clothing & Pronoun fields: Refactor so that profile equipment adjustments are performed in StartingGearPrototype.
This commit is contained in:
20kdc
2020-12-24 13:42:40 +00:00
committed by GitHub
parent b4506b4d08
commit 6b5cded8c2
40 changed files with 1866 additions and 337 deletions

View File

@@ -577,26 +577,34 @@ namespace Content.Server.GameTicking
return Paused;
}
private IEntity _spawnPlayerMob(Job job, bool lateJoin = true)
private IEntity _spawnPlayerMob(Job job, HumanoidCharacterProfile profile, bool lateJoin = true)
{
EntityCoordinates coordinates = lateJoin ? GetLateJoinSpawnPoint() : GetJobSpawnPoint(job.Prototype.ID);
var entity = _entityManager.SpawnEntity(PlayerPrototypeName, coordinates);
var startingGear = _prototypeManager.Index<StartingGearPrototype>(job.StartingGear);
EquipStartingGear(entity, startingGear);
EquipStartingGear(entity, startingGear, profile);
if (profile != null)
{
entity.GetComponent<HumanoidAppearanceComponent>().UpdateFromProfile(profile);
entity.Name = profile.Name;
}
return entity;
}
public void EquipStartingGear(IEntity entity, StartingGearPrototype startingGear)
public void EquipStartingGear(IEntity entity, StartingGearPrototype startingGear, HumanoidCharacterProfile profile)
{
if (entity.TryGetComponent(out InventoryComponent inventory))
{
var gear = startingGear.Equipment;
foreach (var (slot, equipmentStr) in gear)
foreach (var slot in AllSlots)
{
var equipmentEntity = _entityManager.SpawnEntity(equipmentStr, entity.Transform.Coordinates);
inventory.Equip(slot, equipmentEntity.GetComponent<ItemComponent>());
var equipmentStr = startingGear.GetGear(slot, profile);
if (equipmentStr != "")
{
var equipmentEntity = _entityManager.SpawnEntity(equipmentStr, entity.Transform.Coordinates);
inventory.Equip(slot, equipmentEntity.GetComponent<ItemComponent>());
}
}
}
@@ -611,14 +619,6 @@ namespace Content.Server.GameTicking
}
}
private void ApplyCharacterProfile(IEntity entity, ICharacterProfile profile)
{
if (profile is null)
return;
entity.GetComponent<HumanoidAppearanceComponent>().UpdateFromProfile(profile);
entity.Name = profile.Name;
}
private IEntity _spawnObserverMob()
{
var coordinates = GetObserverSpawnPoint();
@@ -888,9 +888,8 @@ namespace Content.Server.GameTicking
var job = new Job(data.Mind, jobPrototype);
data.Mind.AddRole(job);
var mob = _spawnPlayerMob(job, lateJoin);
var mob = _spawnPlayerMob(job, character, lateJoin);
data.Mind.TransferTo(mob);
ApplyCharacterProfile(mob, character);
if (session.UserId == new Guid("{e887eb93-f503-4b65-95b6-2f282c014192}"))
{