Upstream species (#6066)

* Step 1 of porting; grabbed most of the files via patches.

* Add species field to the DB

* Appearance patches for slimes.

* Fix the db test.

* Add slime's biocompat.

* slimby

* Fixes, allow specifying if a species is playable or not.

* Update Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

Co-authored-by: Javier Guardia Fernández <DrSmugleaf@users.noreply.github.com>

* Update Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

Co-authored-by: Javier Guardia Fernández <DrSmugleaf@users.noreply.github.com>

* Update Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs

Co-authored-by: Javier Guardia Fernández <DrSmugleaf@users.noreply.github.com>

* Address reviews.

* Address reviews.

* make an if-case.

* Fix a goof where species wouldn't get shown in the editor correctly (it'd always default to human)

Co-authored-by: Javier Guardia Fernández <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
Moony
2022-01-08 19:53:14 -06:00
committed by GitHub
parent a3e73889b2
commit ca984036d6
31 changed files with 2436 additions and 108 deletions

View File

@@ -158,6 +158,7 @@ namespace Content.Server.Cloning
struct ClonerDNAEntry {
public Mind.Mind Mind;
public HumanoidCharacterProfile Profile;
public ClonerDNAEntry(Mind.Mind m, HumanoidCharacterProfile hcp)
{
Mind = m;

View File

@@ -8,12 +8,14 @@ using Content.Shared.CharacterAppearance.Systems;
using Content.Shared.Cloning;
using Content.Shared.MobState.Components;
using Content.Shared.Popups;
using Content.Shared.Species;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
@@ -24,6 +26,7 @@ namespace Content.Server.Cloning.Components
{
[Dependency] private readonly IPlayerManager _playerManager = null!;
[Dependency] private readonly IEntityManager _entities = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly EuiManager _euiManager = null!;
@@ -138,7 +141,8 @@ namespace Content.Server.Cloning.Components
return; // If we can't track down the client, we can't offer transfer. That'd be quite bad.
}
var mob = _entities.SpawnEntity("MobHuman", _entities.GetComponent<TransformComponent>(Owner).MapPosition);
var speciesProto = _prototype.Index<SpeciesPrototype>(dna.Profile.Species).Prototype;
var mob = _entities.SpawnEntity(speciesProto, _entities.GetComponent<TransformComponent>(Owner).MapPosition);
EntitySystem.Get<SharedHumanoidAppearanceSystem>().UpdateFromProfile(mob, dna.Profile);

View File

@@ -10,10 +10,13 @@ using Content.Server.Administration.Logs;
using Content.Shared.Administration.Logs;
using Content.Shared.CharacterAppearance;
using Content.Shared.Preferences;
using Content.Shared.Species;
using Microsoft.EntityFrameworkCore;
using Robust.Shared.Enums;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Server.Database
@@ -177,6 +180,7 @@ namespace Content.Server.Database
return new HumanoidCharacterProfile(
profile.CharacterName,
profile.Species,
profile.Age,
sex,
gender,
@@ -204,6 +208,7 @@ namespace Content.Server.Database
var entity = new Profile
{
CharacterName = humanoid.Name,
Species = humanoid.Species,
Age = humanoid.Age,
Sex = humanoid.Sex.ToString(),
Gender = humanoid.Gender.ToString(),

View File

@@ -19,6 +19,7 @@ using Content.Shared.Inventory;
using Content.Shared.PDA;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Content.Shared.Species;
using Content.Shared.Station;
using Robust.Server.Player;
using Robust.Shared.GameObjects;
@@ -33,7 +34,6 @@ namespace Content.Server.GameTicking
{
public partial class GameTicker
{
private const string PlayerPrototypeName = "MobHuman";
private const string ObserverPrototypeName = "MobObserver";
[Dependency] private readonly IdCardSystem _cardSystem = default!;
@@ -212,7 +212,9 @@ namespace Content.Server.GameTicking
private EntityUid SpawnPlayerMob(Job job, HumanoidCharacterProfile? profile, StationId station, bool lateJoin = true)
{
var coordinates = lateJoin ? GetLateJoinSpawnPoint(station) : GetJobSpawnPoint(job.Prototype.ID, station);
var entity = EntityManager.SpawnEntity(PlayerPrototypeName, coordinates);
var entity = EntityManager.SpawnEntity(
_prototypeManager.Index<SpeciesPrototype>(profile?.Species ?? SpeciesManager.DefaultSpecies).Prototype,
coordinates);
if (job.StartingGear != null)
{

View File

@@ -7,6 +7,7 @@ using Content.Shared;
using Content.Shared.CCVar;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Content.Shared.Species;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.IoC;
@@ -262,13 +263,22 @@ namespace Content.Server.Preferences.Managers
{
case HumanoidCharacterProfile hp:
{
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
var selectedSpecies = SpeciesManager.DefaultSpecies;
if (prototypeManager.TryIndex<SpeciesPrototype>(hp.Species, out var species) && species.RoundStart)
{
selectedSpecies = hp.Species;
}
newProf = hp
.WithJobPriorities(
hp.JobPriorities.Where(job =>
_protos.HasIndex<JobPrototype>(job.Key)))
.WithAntagPreferences(
hp.AntagPreferences.Where(antag =>
_protos.HasIndex<AntagPrototype>(antag)));
_protos.HasIndex<AntagPrototype>(antag)))
.WithSpecies(selectedSpecies);
break;
}
default: