Make buckle mint (#32370)
- Fix the unbuckle mispredicts. - Fix unbuckle offset existing. - Fix interaction range not aligning with interactionoutline system.
This commit is contained in:
@@ -58,13 +58,6 @@ public abstract partial class SharedBuckleSystem
|
||||
{
|
||||
BuckleDoafterEarly((uid, comp), ev.Event, ev);
|
||||
});
|
||||
|
||||
SubscribeLocalEvent<BuckleComponent, ComponentGetState>(OnGetState);
|
||||
}
|
||||
|
||||
private void OnGetState(Entity<BuckleComponent> ent, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new BuckleState(GetNetEntity(ent.Comp.BuckledTo), ent.Comp.DontCollide, ent.Comp.BuckleTime);
|
||||
}
|
||||
|
||||
private void OnBuckleComponentShutdown(Entity<BuckleComponent> ent, ref ComponentShutdown args)
|
||||
@@ -196,11 +189,15 @@ public abstract partial class SharedBuckleSystem
|
||||
protected void SetBuckledTo(Entity<BuckleComponent> buckle, Entity<StrapComponent?>? strap)
|
||||
{
|
||||
if (TryComp(buckle.Comp.BuckledTo, out StrapComponent? old))
|
||||
{
|
||||
old.BuckledEntities.Remove(buckle);
|
||||
Dirty(buckle.Comp.BuckledTo.Value, old);
|
||||
}
|
||||
|
||||
if (strap is {} strapEnt && Resolve(strapEnt.Owner, ref strapEnt.Comp))
|
||||
{
|
||||
strapEnt.Comp.BuckledEntities.Add(buckle);
|
||||
Dirty(strapEnt);
|
||||
_alerts.ShowAlert(buckle, strapEnt.Comp.BuckledAlertType);
|
||||
}
|
||||
else
|
||||
@@ -463,13 +460,17 @@ public abstract partial class SharedBuckleSystem
|
||||
|
||||
if (buckleXform.ParentUid == strap.Owner && !Terminating(buckleXform.ParentUid))
|
||||
{
|
||||
_container.AttachParentToContainerOrGrid((buckle, buckleXform));
|
||||
_transform.PlaceNextTo((buckle, buckleXform), (strap.Owner, oldBuckledXform));
|
||||
buckleXform.ActivelyLerping = false;
|
||||
|
||||
var oldBuckledToWorldRot = _transform.GetWorldRotation(strap);
|
||||
_transform.SetWorldRotation(buckleXform, oldBuckledToWorldRot);
|
||||
_transform.SetWorldRotationNoLerp((buckle, buckleXform), oldBuckledToWorldRot);
|
||||
|
||||
if (strap.Comp.UnbuckleOffset != Vector2.Zero)
|
||||
buckleXform.Coordinates = oldBuckledXform.Coordinates.Offset(strap.Comp.UnbuckleOffset);
|
||||
// TODO: This is doing 4 moveevents this is why I left the warning in, if you're going to remove it make it only do 1 moveevent.
|
||||
if (strap.Comp.BuckleOffset != Vector2.Zero)
|
||||
{
|
||||
buckleXform.Coordinates = oldBuckledXform.Coordinates.Offset(strap.Comp.BuckleOffset);
|
||||
}
|
||||
}
|
||||
|
||||
_rotationVisuals.ResetHorizontalAngle(buckle.Owner);
|
||||
|
||||
Reference in New Issue
Block a user