- fix: Height on cline and some stuff

This commit is contained in:
2024-03-17 18:25:52 +03:00
parent eb78be2549
commit 31a548215c
4 changed files with 36 additions and 1 deletions

View File

@@ -182,6 +182,13 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
grammar.Gender = sourceHumanoid.Gender;
}
// AMOUR START
var ev = new HumanoidAppearanceClonedEvent(
new Entity<HumanoidAppearanceComponent>(source,sourceHumanoid),
new Entity<HumanoidAppearanceComponent>(target,targetHumanoid));
RaiseLocalEvent(source, ev);
// AMOUR END
Dirty(targetHumanoid);
}

View File

@@ -15,6 +15,15 @@ public abstract class SharedCustomHeightSystem : EntitySystem
base.Initialize();
SubscribeLocalEvent<CustomHeightComponent,ComponentInit>(OnInit);
SubscribeLocalEvent<CustomHeightComponent,HumanoidAppearanceLoadedEvent>(OnLoaded);
SubscribeLocalEvent<CustomHeightComponent,HumanoidAppearanceClonedEvent>(OnCloned);
}
private void OnCloned(EntityUid uid, CustomHeightComponent component, HumanoidAppearanceClonedEvent args)
{
if(!AppearanceSystem.TryGetData<float>(uid, HeightVisuals.State, out var height))
return;
SetHeight(args.Target.Owner,height);
}
private void OnLoaded(EntityUid uid, CustomHeightComponent component, HumanoidAppearanceLoadedEvent args)

View File

@@ -13,6 +13,21 @@ public abstract partial class SharedHoleSystem
{
SubscribeLocalEvent<HoleContainerComponent,ComponentInit>(OnContainerInit);
SubscribeLocalEvent<HoleContainerComponent,HumanoidAppearanceLoadedEvent>(OnAppearanceLoaded);
SubscribeLocalEvent<HoleContainerComponent, HumanoidAppearanceClonedEvent>(OnClone);
}
private void OnClone(EntityUid uid, HoleContainerComponent component, HumanoidAppearanceClonedEvent args)
{
var holeContainerComponent = EnsureComp<HoleContainerComponent>(args.Target);
foreach (var entity in component.Slot.ContainedEntities)
{
var meta = MetaData(entity);
if(meta.EntityPrototype is null || !TryComp<HoleComponent>(entity, out var holeComponent))
continue;
AddHole(new Entity<HoleContainerComponent?>(args.Target,holeContainerComponent), meta.EntityPrototype.ID, holeComponent.Layers[0].Color);
}
Dirty(args.Target,holeContainerComponent);
}
private void OnAppearanceLoaded(EntityUid uid, HoleContainerComponent component, HumanoidAppearanceLoadedEvent args)
@@ -55,6 +70,6 @@ public abstract partial class SharedHoleSystem
entity.Comp.MainHole = GetNetEntity(spawned);
_containerSystem.Insert(spawned, entity.Comp.Slot);
Dirty(entity);
Dirty(spawned,component);
}
}

View File

@@ -11,3 +11,7 @@ public record struct HumanoidAppearanceLoadingEvent(
public record struct HumanoidAppearanceLoadedEvent(
Entity<HumanoidAppearanceComponent> Entity,
HumanoidCharacterProfile Profile);
public record struct HumanoidAppearanceClonedEvent(
Entity<HumanoidAppearanceComponent> Source,
Entity<HumanoidAppearanceComponent> Target);