public static HumanoidVisualLayers?ToHumanoidLayer(this SharedBodyPartComponent part) { return(part.PartType switch { BodyPartType.Other => null, BodyPartType.Torso => HumanoidVisualLayers.Chest, BodyPartType.Head => HumanoidVisualLayers.Head, BodyPartType.Arm => part.Symmetry switch { BodyPartSymmetry.None => null, BodyPartSymmetry.Left => HumanoidVisualLayers.LArm, BodyPartSymmetry.Right => HumanoidVisualLayers.RArm, _ => throw new ArgumentOutOfRangeException() },
private void UpdateBodyPartBox(SharedBodyPartComponent part, string slotName) { BodyPartLabel.Text = $"{Loc.GetString(slotName)}: {Loc.GetString(part.Owner.Name)}"; // TODO BODY Part damage if (part.Owner.TryGetComponent(out IDamageableComponent? damageable)) { BodyPartHealth.Text = Loc.GetString("body-scanner-display-body-part-damage-text", ("damage", damageable.TotalDamage)); } MechanismList.Clear(); foreach (var mechanism in part.Mechanisms) { MechanismList.AddItem(mechanism.Name); } }
private void UpdateBodyPartBox(SharedBodyPartComponent part, string slotName) { var entMan = IoCManager.Resolve <IEntityManager>(); BodyPartLabel.Text = $"{Loc.GetString(slotName)}: {Loc.GetString(entMan.GetComponent<MetaDataComponent>(part.Owner).EntityName)}"; // TODO BODY Part damage if (entMan.TryGetComponent(part.Owner, out DamageableComponent? damageable)) { BodyPartHealth.Text = Loc.GetString("body-scanner-display-body-part-damage-text", ("damage", damageable.TotalDamage)); } MechanismList.Clear(); foreach (var mechanism in part.Mechanisms) { MechanismList.AddItem(mechanism.Name); } }
protected override void OnAddedToPartInBody(SharedBodyComponent body, SharedBodyPartComponent part) { base.OnAddedToPartInBody(body, part); HandleMind(body.Owner, Owner); }
protected override void OnAddedToPart(SharedBodyPartComponent part) { base.OnAddedToPart(part); HandleMind(part.Owner, Owner); }
protected virtual void OnRemovedFromPartInBody(SharedBodyComponent oldBody, SharedBodyPartComponent oldPart) { }
public RemovedFromPartEvent(SharedBodyPartComponent old) { Old = old; }
protected override bool CanAddPart(string slotId, SharedBodyPartComponent part) { return(base.CanAddPart(slotId, part) && _partContainer.CanInsert(part.Owner)); }
protected override void OnAddedToPart(SharedBodyPartComponent part) { base.OnAddedToPart(part); WasAddedToPart = true; }
public AddedToPartEvent(SharedBodyPartComponent part) { Part = part; }
/// <summary> /// Called when the parent mechanism is added into a part that is not attached to a body. /// For instance, adding a brain to a dismembered head. /// DO NOT CALL THIS DIRECTLY FROM OUTSIDE BODY SYSTEM CODE! /// </summary> /// <param name="part"> /// The part that the containing mechanism was added to. /// </param> public abstract void AddedToPart(SharedBodyPartComponent part);
/// <summary> /// Called when the parent mechanism is added to a part that is attached to a body. /// For instance, adding a brain to a head that is attached to a body. /// DO NOT CALL THIS DIRECTLY FROM OUTSIDE BODY SYSTEM CODE! /// </summary> /// <param name="body"> /// The body that the containing mechanism was added to. /// </param> /// <param name="part"> /// The part that the containing mechanism was added to. /// </param> public abstract void AddedToPartInBody(SharedBodyComponent body, SharedBodyPartComponent part);
/// <summary> /// Called when the parent mechanism is removed from a part that is attached to a body. /// For instance, removing a brain from a head that is attached to a body. /// DO NOT CALL THIS DIRECTLY FROM OUTSIDE BODY SYSTEM CODE! /// </summary> /// <param name="oldBody"> /// The body that the containing mechanism was removed from. /// </param> /// <param name="oldPart"> /// The part that the containing mechanism was removed from. /// </param> public abstract void RemovedFromPartInBody(SharedBodyComponent oldBody, SharedBodyPartComponent oldPart);
/// <summary> /// Called when the parent mechanism is removed from a part that is not attached to a body. /// For instance, removing a brain from a dismembered head. /// DO NOT CALL THIS DIRECTLY FROM OUTSIDE BODY SYSTEM CODE! /// </summary> /// <param name="old"> /// The part that the containing mechanism was removed from. /// </param> public abstract void RemovedFromPart(SharedBodyPartComponent old);
public static IEnumerable <HumanoidVisualLayers> ToHumanoidLayers(this SharedBodyPartComponent part) { switch (part.PartType) { case BodyPartType.Other: yield break; case BodyPartType.Torso: yield return(HumanoidVisualLayers.Chest); break; case BodyPartType.Head: yield return(HumanoidVisualLayers.Head); yield return(HumanoidVisualLayers.Eyes); yield return(HumanoidVisualLayers.FacialHair); yield return(HumanoidVisualLayers.Hair); yield return(HumanoidVisualLayers.StencilMask); break; case BodyPartType.Arm: switch (part.Symmetry) { case BodyPartSymmetry.None: yield break; case BodyPartSymmetry.Left: yield return(HumanoidVisualLayers.LArm); break; case BodyPartSymmetry.Right: yield return(HumanoidVisualLayers.RArm); break; default: yield break; } yield break; case BodyPartType.Hand: switch (part.Symmetry) { case BodyPartSymmetry.None: yield break; case BodyPartSymmetry.Left: yield return(HumanoidVisualLayers.LHand); break; case BodyPartSymmetry.Right: yield return(HumanoidVisualLayers.RHand); break; default: yield break; } yield break; case BodyPartType.Leg: switch (part.Symmetry) { case BodyPartSymmetry.None: yield break; case BodyPartSymmetry.Left: yield return(HumanoidVisualLayers.LLeg); break; case BodyPartSymmetry.Right: yield return(HumanoidVisualLayers.RLeg); break; default: yield break; } yield break; case BodyPartType.Foot: switch (part.Symmetry) { case BodyPartSymmetry.None: yield break; case BodyPartSymmetry.Left: yield return(HumanoidVisualLayers.LFoot); break; case BodyPartSymmetry.Right: yield return(HumanoidVisualLayers.RFoot); break; default: yield break; } yield break; default: yield break; } }
protected override void OnRemovedFromPart(SharedBodyPartComponent old) { base.OnRemovedFromPart(old); HandleMind(Owner, old.Owner); }
protected override void OnAddedToPartInBody(SharedBodyComponent body, SharedBodyPartComponent part) { base.OnAddedToPartInBody(body, part); WasAddedToPartInBody = true; }
protected override void OnRemovedFromPartInBody(SharedBodyComponent oldBody, SharedBodyPartComponent oldPart) { base.OnRemovedFromPartInBody(oldBody, oldPart); HandleMind(oldBody.Owner, Owner); }
protected override void OnRemovedFromPart(SharedBodyPartComponent old) { base.OnRemovedFromPart(old); WasRemovedFromPart = true; }
public AddedToPartInBodyEvent(SharedBodyComponent body, SharedBodyPartComponent part) { Body = body; Part = part; }
protected override void OnRemovedFromPartInBody(SharedBodyComponent oldBody, SharedBodyPartComponent oldPart) { base.OnRemovedFromPartInBody(oldBody, oldPart); WasRemovedFromPartInBody = true; }
public RemovedFromPartInBodyEvent(SharedBodyComponent oldBody, SharedBodyPartComponent oldPart) { OldBody = oldBody; OldPart = oldPart; }
protected virtual void OnAddedToPartInBody(SharedBodyComponent body, SharedBodyPartComponent part) { }
protected override void OnAddPart(BodyPartSlot slot, SharedBodyPartComponent part) { base.OnAddPart(slot, part); _partContainer.Insert(part.Owner); }
public bool CanAddPart(SharedBodyPartComponent part) { return(Part == null && part.PartType == PartType); }
protected virtual void OnAddedToPart(SharedBodyPartComponent part) { }
protected virtual void OnRemovedFromPart(SharedBodyPartComponent old) { }