Изменения связанные с полиморфом. (#1668)

This commit is contained in:
banumbas 2025-04-07 13:33:56 +03:00 committed by GitHub
parent bea8ffcd89
commit 202e80693d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 247 additions and 86 deletions

View file

@ -1,5 +1,6 @@
using Content.Shared.Humanoid.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
using Content.Shared.Humanoid.Markings; // Sunrise-Edit
namespace Content.Server.CharacterAppearance.Components;
@ -7,8 +8,29 @@ namespace Content.Server.CharacterAppearance.Components;
public sealed partial class RandomHumanoidAppearanceComponent : Component
{
[DataField("randomizeName")] public bool RandomizeName = true;
/// <summary>
/// After randomizing, sets the hair style to this, if possible
/// </summary>
[DataField] public string? Hair = null;
}
// Sunrise-Start
/// <summary>
/// Настраивает цвет кожи в HEX формате. Учитывайте что только бежевые и темные цвета могут подойти человекоподобным. Советую подбирать цвет прям в игре.
/// </summary>
[DataField]
public Color? SkinColor = null;
/// <summary>
/// Настраивает цвет волос в HEX формате
/// </summary>
[DataField]
public Color? HairColor = null;
/// <summary>
/// Настраивает цвет бороды в HEX формате
/// </summary>
[DataField]
public Color? FacialHairColor = null;
// Sunrise-End
}

View file

@ -1,6 +1,7 @@
using Content.Server.CharacterAppearance.Components;
using Content.Shared.Humanoid;
using Content.Shared.Preferences;
using Content.Shared.Humanoid.Markings; // Sunrise-Edit
namespace Content.Server.Humanoid.Systems;
@ -33,5 +34,38 @@ public sealed class RandomHumanoidAppearanceSystem : EntitySystem
if (component.RandomizeName)
_metaData.SetEntityName(uid, profile.Name);
// Sunrise-Start
if (TryComp<HumanoidAppearanceComponent>(uid, out var humanoidAppearance))
{
if (component.SkinColor != null)
_humanoid.SetSkinColor(uid, component.SkinColor.Value, humanoid: humanoidAppearance);
if (component.HairColor != null)
SetMarkingColor(uid, MarkingCategories.Hair, component.HairColor.Value, humanoidAppearance);
if (component.FacialHairColor != null) // Да, цвет бороды, йоу.
SetMarkingColor(uid, MarkingCategories.FacialHair, component.FacialHairColor.Value, humanoidAppearance);
}
// Sunrise-End
}
}
// Sunrise-Start
private void SetMarkingColor(EntityUid uid, MarkingCategories category, Color color,
HumanoidAppearanceComponent humanoid)
{
if (!humanoid.MarkingSet.Markings.TryGetValue(category, out var markings))
return;
foreach (var marking in markings)
{
for (var i = 0; i < marking.MarkingColors.Count; i++)
{
marking.SetColor(i, color);
}
}
Dirty(uid, humanoid);
}
// Sunrise-End
}

View file

@ -22,6 +22,10 @@ using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
// Sunrise-Start
using Content.Shared.EntityEffects;
using Content.Shared.Mind.Components;
// Sunrise-End
namespace Content.Server.Polymorph.Systems;
@ -183,6 +187,14 @@ public sealed partial class PolymorphSystem : EntitySystem
/// <returns></returns>
public EntityUid? PolymorphEntity(EntityUid uid, PolymorphConfiguration configuration)
{
// Sunrise-Start
if (configuration.BlockIfHasMind
&& TryComp<MindContainerComponent>(uid, out var mindContainer)
&& mindContainer.HasMind)
{
return null;
}
// Sunrise-End
// if it's already morphed, don't allow it again with this condition active.
if (!configuration.AllowRepeatedMorphs && HasComp<PolymorphedEntityComponent>(uid))
return null;

View file

@ -140,6 +140,14 @@ public sealed partial record PolymorphConfiguration
/// </summary>
[DataField]
public LocId? ExitPolymorphPopup = "polymorph-revert-popup-generic";
// Sunrise-Start
/// <summary>
/// Если true, полиморф будет заблокирован для сущностей с MindContainerComponent.HasMind
/// </summary>
[DataField(serverOnly: false)]
public bool BlockIfHasMind = false;
// Sunrise-End
}
public enum PolymorphInventoryChange : byte

View file

@ -21,16 +21,16 @@
group: InferiorVulpkanin
- type: LizardAccent
- type: ReplacementAccent
accent: kobold
accent: dog
- type: Speech
speechSounds: Lizard
speechVerb: Reptilian
allowedEmotes: ['Thump']
speechSounds: Vulpkanin
speechVerb: Vulpkanin
allowedEmotes: ['Growl', 'Bark', 'Howl', 'Whines']
- type: Vocal
sounds:
Male: MaleReptilian
Female: FemaleReptilian
Unsexed: MaleReptilian
Male: MaleVulpkanin
Female: FemaleVulpkanin
Unsexed: MaleVulpkanin
- type: BodyEmotes
soundsId: ReptilianBodyEmotes
- type: TypingIndicator

View file

@ -12,6 +12,10 @@
components:
- type: RandomHumanoidAppearance
randomizeName: false
hair: HumanHairBigafro
skinColor: "#331500FF"
hairColor: "#331500FF"
facialHairColor: "#331500FF" #На случай если вдруг появится борода.
- type: NpcFactionMember
factions:
- Syndicate

View file

@ -0,0 +1,73 @@
- type: entity
parent: MobHuman
id: MobHumanRandomization
categories: [ HideSpawnMenu ]
components:
- type: RandomHumanoidAppearance
randomizeName: false
skinColor: "#E5BDA0FF"
- type: entity
parent: MobReptilian
id: MobReptilianRandomization
categories: [ HideSpawnMenu ]
components:
- type: RandomHumanoidAppearance
randomizeName: false
- type: entity
parent: MobTajaran
id: MobTajaranRandomization
categories: [ HideSpawnMenu ]
components:
- type: RandomHumanoidAppearance
randomizeName: false
- type: entity
parent: MobSlimePerson
id: MobSlimePersonRandomization
categories: [ HideSpawnMenu ]
components:
- type: RandomHumanoidAppearance
randomizeName: false
- type: entity
parent: MobMoth
id: MobMothRandomization
categories: [ HideSpawnMenu ]
components:
- type: RandomHumanoidAppearance
randomizeName: false
- type: entity
parent: MobSwine
id: MobSwineRandomization
categories: [ HideSpawnMenu ]
components:
- type: RandomHumanoidAppearance
randomizeName: false
- type: entity
parent: MobVox
id: MobVoxRandomization
categories: [ HideSpawnMenu ]
components:
- type: RandomHumanoidAppearance
randomizeName: false
- type: entity
parent: MobVulpkanin
id: MobVulpkaninRandomization
categories: [ HideSpawnMenu ]
components:
- type: RandomHumanoidAppearance
randomizeName: false
- type: entity
parent: MobFelinid
id: MobFelinidRandomization
categories: [ HideSpawnMenu ]
components:
- type: RandomHumanoidAppearance
randomizeName: false
skinColor: "#E5BDA0FF"

View file

@ -41,4 +41,4 @@
components:
- type: Rehydratable
possibleSpawns:
- MobFelinid
- MobFelinidRandomization

View file

@ -11,81 +11,89 @@
- type: polymorph
id: PermanentlyHuman
configuration:
entity: MobHuman
entity: MobHumanRandomization
forced: true
transferName: true
inventory: Transfer
revertOnCrit: false
revertOnDeath: false
blockIfHasMind: true
- type: polymorph
id: PermanentlyReptilian
configuration:
entity: MobReptilian
entity: MobReptilianRandomization
forced: true
transferName: true
inventory: Transfer
revertOnCrit: false
revertOnDeath: false
blockIfHasMind: true
- type: polymorph
id: PermanentlyTajaran
configuration:
entity: MobTajaran
entity: MobTajaranRandomization
forced: true
transferName: true
inventory: Transfer
revertOnCrit: false
revertOnDeath: false
allowRepeatedMorphs: true
blockIfHasMind: true
- type: polymorph
id: PermanentlySlime
configuration:
entity: MobSlimePerson
entity: MobSlimePersonRandomization
forced: true
transferName: true
revertOnCrit: false
revertOnDeath: false
blockIfHasMind: true
- type: polymorph
id: PermanentlyMoth
configuration:
entity: MobMoth
entity: MobMothRandomization
forced: true
transferName: true
inventory: Transfer
revertOnCrit: false
revertOnDeath: false
blockIfHasMind: true
- type: polymorph
id: PermanentlySwine
configuration:
entity: MobSwine
entity: MobSwineRandomization
forced: true
transferName: true
inventory: Transfer
revertOnCrit: false
revertOnDeath: false
blockIfHasMind: true
- type: polymorph
id: PermanentlyVox
configuration:
entity: MobVox
entity: MobVoxRandomization
forced: true
transferName: true
revertOnCrit: false
revertOnDeath: false
blockIfHasMind: true
- type: polymorph
id: PermanentlyVulpkanin
configuration:
entity: MobVulpkanin
entity: MobVulpkaninRandomization
forced: true
transferName: true
transferName: true
inventory: Transfer
revertOnCrit: false
revertOnDeath: false
blockIfHasMind: true
# TODO: Генетика
#- type: polymorph

View file

@ -1,67 +0,0 @@
- type: reagent
id: Darvinium
name: reagent-name-darvinium
group: Medicine
desc: reagent-desc-darvinium
physicalDesc: reagent-physical-desc-glowing
color: "#59b23a"
metabolisms:
Medicine:
metabolismRate: 250
effects:
- !type:Polymorph
prototype: PermanentlyHuman
conditions:
- !type:OrganType
type: Primate
- !type:ReagentThreshold
min: 5
- !type:Polymorph
prototype: PermanentlyReptilian
conditions:
- !type:OrganType
type: Kobold
- !type:ReagentThreshold
min: 5
- !type:Polymorph
prototype: PermanentlyTajaran
conditions:
- !type:OrganType
type: Felinid
- !type:ReagentThreshold
min: 5
- !type:Polymorph
prototype: PermanentlySlime
conditions:
- !type:OrganType
type: WildSlime
- !type:ReagentThreshold
min: 5
- !type:Polymorph
prototype: PermanentlyMoth
conditions:
- !type:OrganType
type: Mothroach
- !type:ReagentThreshold
min: 5
- !type:Polymorph
prototype: PermanentlySwine
conditions:
- !type:OrganType
type: Pig
- !type:ReagentThreshold
min: 5
- !type:Polymorph
prototype: PermanentlyVox
conditions:
- !type:OrganType
type: Chiken
- !type:ReagentThreshold
min: 5
- !type:Polymorph
prototype: PermanentlyVulpkanin
conditions:
- !type:OrganType
type: InferiorVulpkanin
- !type:ReagentThreshold
min: 5

View file

@ -0,0 +1,67 @@
- type: reagent
id: Darvinium
name: reagent-name-darvinium
group: Special
desc: reagent-desc-darvinium
physicalDesc: reagent-physical-desc-glowing
color: "#59b23a"
metabolisms:
Medicine:
metabolismRate: 250
effects:
- !type:Polymorph
prototype: PermanentlyHuman
conditions:
- !type:OrganType
type: Primate
- !type:ReagentThreshold
min: 5
- !type:Polymorph
prototype: PermanentlyReptilian
conditions:
- !type:OrganType
type: Kobold
- !type:ReagentThreshold
min: 5
- !type:Polymorph
prototype: PermanentlyTajaran
conditions:
- !type:OrganType
type: Felinid
- !type:ReagentThreshold
min: 5
- !type:Polymorph
prototype: PermanentlySlime
conditions:
- !type:OrganType
type: WildSlime
- !type:ReagentThreshold
min: 5
- !type:Polymorph
prototype: PermanentlyMoth
conditions:
- !type:OrganType
type: Mothroach
- !type:ReagentThreshold
min: 5
- !type:Polymorph
prototype: PermanentlySwine
conditions:
- !type:OrganType
type: Pig
- !type:ReagentThreshold
min: 5
- !type:Polymorph
prototype: PermanentlyVox
conditions:
- !type:OrganType
type: Chiken
- !type:ReagentThreshold
min: 5
- !type:Polymorph
prototype: PermanentlyVulpkanin
conditions:
- !type:OrganType
type: InferiorVulpkanin
- !type:ReagentThreshold
min: 5

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 3 KiB