еще приколы
This commit is contained in:
@@ -73,8 +73,8 @@ public sealed partial class HumanoidAppearanceComponent : Component
|
||||
/// <summary>
|
||||
/// Current body type.
|
||||
/// </summary>
|
||||
[DataField("bodyType", customTypeSerializer: typeof(PrototypeIdSerializer<BodyTypePrototype>)), AutoNetworkedField]
|
||||
public string BodyType = SharedHumanoidAppearanceSystem.DefaultBodyType;
|
||||
[DataField("bodyType"), AutoNetworkedField]
|
||||
public ProtoId<BodyTypePrototype> BodyType = SharedHumanoidAppearanceSystem.DefaultBodyType;
|
||||
|
||||
[DataField, AutoNetworkedField]
|
||||
public Color EyeColor = Color.Brown;
|
||||
@@ -101,7 +101,9 @@ public readonly partial struct CustomBaseLayerInfo
|
||||
{
|
||||
public CustomBaseLayerInfo(string? id, Color? color = null)
|
||||
{
|
||||
DebugTools.Assert(id == null || IoCManager.Resolve<IPrototypeManager>().HasIndex<HumanoidSpeciesSpriteLayer>(id));
|
||||
DebugTools.Assert(
|
||||
id == null || IoCManager.Resolve<IPrototypeManager>().HasIndex<HumanoidSpeciesSpriteLayer>(id));
|
||||
|
||||
Id = id;
|
||||
Color = color;
|
||||
}
|
||||
@@ -117,4 +119,4 @@ public readonly partial struct CustomBaseLayerInfo
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public Color? Color { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -218,6 +218,32 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
|
||||
Dirty(uid, humanoid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set a humanoid mob's body yupe. This will change their base sprites.
|
||||
/// </summary>
|
||||
/// <param name="uid">The humanoid mob's UID.</param>
|
||||
/// <param name="bodyType">The body type to set the mob to. Will return if the body type prototype was invalid.</param>
|
||||
/// <param name="sync">Whether to immediately synchronize this to the humanoid mob, or not.</param>
|
||||
/// <param name="humanoid">Humanoid component of the entity</param>
|
||||
public void SetBodyType(
|
||||
EntityUid uid,
|
||||
ProtoId<BodyTypePrototype> bodyType,
|
||||
bool sync = true,
|
||||
HumanoidAppearanceComponent? humanoid = null)
|
||||
{
|
||||
if (!Resolve(uid, ref humanoid) || !_proto.TryIndex(bodyType, out _))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
humanoid.BodyType = bodyType;
|
||||
|
||||
if (sync)
|
||||
{
|
||||
Dirty(uid, humanoid);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the base layer ID of this humanoid mob. A humanoid mob's 'base layer' is
|
||||
/// the skin sprite that is applied to the mob's sprite upon appearance refresh.
|
||||
@@ -327,6 +353,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
|
||||
humanoid.EyeColor = profile.Appearance.EyeColor;
|
||||
|
||||
SetSkinColor(uid, profile.Appearance.SkinColor, false);
|
||||
SetBodyType(uid, profile.BodyType, false);
|
||||
|
||||
humanoid.MarkingSet.Clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user