Give silicons proper lobby/character editor previews (#33763)
* Give silicons proper lobby/character editor previews No more naked dummies, properly show a borg/AI sprite now. This means taking the JobEntity into account when spawning the dummy. For AIs I had to add a "JobPreviewEntity" field because they'd look like a posibrain otherwise. AI therefore uses a custom dummy entity I defined. Also I had to add some margins to the UI, because otherwise the 32x32 sprite of the AI would look bad. * Update Content.Shared/Roles/JobPrototype.cs * Update Content.Client/Lobby/LobbyUIController.cs * Update Resources/Prototypes/Entities/Mobs/Player/silicon.yml --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
3d53e748fa
commit
299b13f21b
@@ -455,7 +455,21 @@ public sealed class LobbyUIController : UIController, IOnStateEntered<LobbyState
|
|||||||
{
|
{
|
||||||
EntityUid dummyEnt;
|
EntityUid dummyEnt;
|
||||||
|
|
||||||
if (humanoid is not null)
|
EntProtoId? previewEntity = null;
|
||||||
|
if (humanoid != null && jobClothes)
|
||||||
|
{
|
||||||
|
job ??= GetPreferredJob(humanoid);
|
||||||
|
|
||||||
|
previewEntity = job.JobPreviewEntity ?? (EntProtoId?)job?.JobEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (previewEntity != null)
|
||||||
|
{
|
||||||
|
// Special type like borg or AI, do not spawn a human just spawn the entity.
|
||||||
|
dummyEnt = EntityManager.SpawnEntity(previewEntity, MapCoordinates.Nullspace);
|
||||||
|
return dummyEnt;
|
||||||
|
}
|
||||||
|
else if (humanoid is not null)
|
||||||
{
|
{
|
||||||
var dummy = _prototypeManager.Index<SpeciesPrototype>(humanoid.Species).DollPrototype;
|
var dummy = _prototypeManager.Index<SpeciesPrototype>(humanoid.Species).DollPrototype;
|
||||||
dummyEnt = EntityManager.SpawnEntity(dummy, MapCoordinates.Nullspace);
|
dummyEnt = EntityManager.SpawnEntity(dummy, MapCoordinates.Nullspace);
|
||||||
@@ -469,7 +483,8 @@ public sealed class LobbyUIController : UIController, IOnStateEntered<LobbyState
|
|||||||
|
|
||||||
if (humanoid != null && jobClothes)
|
if (humanoid != null && jobClothes)
|
||||||
{
|
{
|
||||||
job ??= GetPreferredJob(humanoid);
|
DebugTools.Assert(job != null);
|
||||||
|
|
||||||
GiveDummyJobClothes(dummyEnt, humanoid, job);
|
GiveDummyJobClothes(dummyEnt, humanoid, job);
|
||||||
|
|
||||||
if (_prototypeManager.HasIndex<RoleLoadoutPrototype>(LoadoutSystem.GetJobPrototype(job.ID)))
|
if (_prototypeManager.HasIndex<RoleLoadoutPrototype>(LoadoutSystem.GetJobPrototype(job.ID)))
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
SeparationOverride="0"
|
SeparationOverride="0"
|
||||||
Name="InternalHBox">
|
Name="InternalHBox">
|
||||||
<SpriteView Scale="2 2"
|
<SpriteView Scale="2 2"
|
||||||
|
Margin="0 4 4 4"
|
||||||
OverrideDirection="South"
|
OverrideDirection="South"
|
||||||
Name="View"/>
|
Name="View"/>
|
||||||
<Label Name="DescriptionLabel"
|
<Label Name="DescriptionLabel"
|
||||||
|
|||||||
@@ -140,7 +140,7 @@
|
|||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
<!-- Right side -->
|
<!-- Right side -->
|
||||||
<BoxContainer Orientation="Vertical" VerticalExpand="True" VerticalAlignment="Center">
|
<BoxContainer Orientation="Vertical" VerticalExpand="True" VerticalAlignment="Center">
|
||||||
<SpriteView Name="SpriteView" Scale="8 8" SizeFlagsStretchRatio="1" />
|
<SpriteView Name="SpriteView" Scale="8 8" Margin="4" SizeFlagsStretchRatio="1" />
|
||||||
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 5">
|
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 5">
|
||||||
<Button Name="SpriteRotateLeft" Text="◀" StyleClasses="OpenRight" />
|
<Button Name="SpriteRotateLeft" Text="◀" StyleClasses="OpenRight" />
|
||||||
<cc:VSeparator Margin="2 0 3 0" />
|
<cc:VSeparator Margin="2 0 3 0" />
|
||||||
|
|||||||
@@ -119,6 +119,13 @@ namespace Content.Shared.Roles
|
|||||||
[DataField("jobEntity", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
[DataField("jobEntity", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||||
public string? JobEntity = null;
|
public string? JobEntity = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Entity to use as a preview in the lobby/character editor.
|
||||||
|
/// Same restrictions as <see cref="JobEntity"/> apply.
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public EntProtoId? JobPreviewEntity = null;
|
||||||
|
|
||||||
[DataField]
|
[DataField]
|
||||||
public ProtoId<JobIconPrototype> Icon { get; private set; } = "JobIconUnknown";
|
public ProtoId<JobIconPrototype> Icon { get; private set; } = "JobIconUnknown";
|
||||||
|
|
||||||
|
|||||||
@@ -304,6 +304,17 @@
|
|||||||
Occupied: { state: full }
|
Occupied: { state: full }
|
||||||
- type: Intellicard
|
- type: Intellicard
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: PlayerStationAiPreview
|
||||||
|
categories: [ HideSpawnMenu ]
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
sprite: Mobs/Silicon/station_ai.rsi
|
||||||
|
layers:
|
||||||
|
- state: base
|
||||||
|
- state: ai
|
||||||
|
shader: unshaded
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: PlayerStationAiEmpty
|
id: PlayerStationAiEmpty
|
||||||
name: AI Core
|
name: AI Core
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
icon: JobIconStationAi
|
icon: JobIconStationAi
|
||||||
supervisors: job-supervisors-rd
|
supervisors: job-supervisors-rd
|
||||||
jobEntity: StationAiBrain
|
jobEntity: StationAiBrain
|
||||||
|
jobPreviewEntity: PlayerStationAiPreview
|
||||||
applyTraits: false
|
applyTraits: false
|
||||||
|
|
||||||
- type: job
|
- type: job
|
||||||
|
|||||||
Reference in New Issue
Block a user