Merge remote-tracking branch 'upstream/stable' into ed-upstream-sync
# Conflicts: # Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs
This commit is contained in:
@@ -39,6 +39,7 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
||||
SubscribeLocalEvent<EmbeddableProjectileComponent, ThrowDoHitEvent>(OnEmbedThrowDoHit);
|
||||
SubscribeLocalEvent<EmbeddableProjectileComponent, ActivateInWorldEvent>(OnEmbedActivate);
|
||||
SubscribeLocalEvent<EmbeddableProjectileComponent, RemoveEmbeddedProjectileEvent>(OnEmbedRemove);
|
||||
SubscribeLocalEvent<EmbeddableProjectileComponent, ComponentShutdown>(OnEmbeddableCompShutdown);
|
||||
|
||||
SubscribeLocalEvent<EmbeddedContainerComponent, EntityTerminatingEvent>(OnEmbeddableTermination);
|
||||
}
|
||||
@@ -65,8 +66,7 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
||||
|
||||
private void OnEmbedRemove(Entity<EmbeddableProjectileComponent> embeddable, ref RemoveEmbeddedProjectileEvent args)
|
||||
{
|
||||
// Whacky prediction issues.
|
||||
if (args.Cancelled || _net.IsClient)
|
||||
if (args.Cancelled)
|
||||
return;
|
||||
|
||||
EmbedDetach(embeddable, embeddable.Comp, args.User);
|
||||
@@ -75,6 +75,11 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
||||
_hands.TryPickupAnyHand(args.User, embeddable);
|
||||
}
|
||||
|
||||
private void OnEmbeddableCompShutdown(Entity<EmbeddableProjectileComponent> embeddable, ref ComponentShutdown arg)
|
||||
{
|
||||
EmbedDetach(embeddable, embeddable.Comp);
|
||||
}
|
||||
|
||||
private void OnEmbedThrowDoHit(Entity<EmbeddableProjectileComponent> embeddable, ref ThrowDoHitEvent args)
|
||||
{
|
||||
if (!embeddable.Comp.EmbedOnThrow)
|
||||
@@ -130,16 +135,21 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
||||
if (!Resolve(uid, ref component))
|
||||
return;
|
||||
|
||||
if (component.DeleteOnRemove)
|
||||
{
|
||||
QueueDel(uid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (component.EmbeddedIntoUid is not null)
|
||||
{
|
||||
if (TryComp<EmbeddedContainerComponent>(component.EmbeddedIntoUid.Value, out var embeddedContainer))
|
||||
{
|
||||
embeddedContainer.EmbeddedObjects.Remove(uid);
|
||||
Dirty(component.EmbeddedIntoUid.Value, embeddedContainer);
|
||||
if (embeddedContainer.EmbeddedObjects.Count == 0)
|
||||
RemCompDeferred<EmbeddedContainerComponent>(component.EmbeddedIntoUid.Value);
|
||||
}
|
||||
}
|
||||
|
||||
if (component.DeleteOnRemove && _net.IsServer)
|
||||
{
|
||||
QueueDel(uid);
|
||||
return;
|
||||
}
|
||||
|
||||
var xform = Transform(uid);
|
||||
|
||||
Reference in New Issue
Block a user