Merge remote-tracking branch 'upstream/master' into ed-23-02-2025-upstream

# Conflicts:
#	Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs
#	Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs
#	Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml
This commit is contained in:
Ed
2025-02-23 23:07:55 +03:00
406 changed files with 70688 additions and 45859 deletions

View File

@@ -4,10 +4,8 @@ using Content.Server.Storage.Components;
using Content.Shared.Database;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction.Events;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Random;
using static Content.Shared.Storage.EntitySpawnCollection;
@@ -20,6 +18,7 @@ namespace Content.Server.Storage.EntitySystems
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly PricingSystem _pricing = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize()
{
@@ -80,26 +79,25 @@ namespace Content.Server.Storage.EntitySystems
_adminLogger.Add(LogType.EntitySpawn, LogImpact.Low, $"{ToPrettyString(args.User)} used {ToPrettyString(uid)} which spawned {ToPrettyString(entityToPlaceInHands.Value)}");
}
// The entity is often deleted, so play the sound at its position rather than parenting
if (component.Sound != null)
{
// The entity is often deleted, so play the sound at its position rather than parenting
var coordinates = Transform(uid).Coordinates;
_audio.PlayPvs(component.Sound, coordinates);
}
_audio.PlayPvs(component.Sound, coords);
component.Uses--;
// Delete entity only if component was successfully used
if (component.Uses <= 0)
{
args.Handled = true;
EntityManager.DeleteEntity(uid);
// Don't delete the entity in the event bus, so we queue it for deletion.
// We need the free hand for the new item, so we send it to nullspace.
_transform.DetachEntity(uid, Transform(uid));
QueueDel(uid);
}
if (entityToPlaceInHands != null)
{
_hands.PickupOrDrop(args.User, entityToPlaceInHands.Value);
}
args.Handled = true;
}
}
}

View File

@@ -12,6 +12,7 @@ public sealed class SpawnTableOnUseSystem : EntitySystem
[Dependency] private readonly EntityTableSystem _entityTable = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize()
{
@@ -25,17 +26,21 @@ public sealed class SpawnTableOnUseSystem : EntitySystem
if (args.Handled)
return;
args.Handled = true;
var coords = Transform(ent).Coordinates;
var spawns = _entityTable.GetSpawns(ent.Comp.Table);
// Don't delete the entity in the event bus, so we queue it for deletion.
// We need the free hand for the new item, so we send it to nullspace.
_transform.DetachEntity(ent, Transform(ent));
QueueDel(ent);
foreach (var id in spawns)
{
var spawned = Spawn(id, coords);
_adminLogger.Add(LogType.EntitySpawn, LogImpact.Low, $"{ToPrettyString(args.User):user} used {ToPrettyString(ent):spawner} which spawned {ToPrettyString(spawned)}");
_hands.TryPickupAnyHand(args.User, spawned);
_hands.PickupOrDrop(args.User, spawned);
}
Del(ent);
args.Handled = true;
}
}