EntityLootTable deleted (#37604)

This commit is contained in:
Red
2025-05-19 12:53:29 +03:00
committed by GitHub
parent 791ce3a5cd
commit b07fadf5b0
5 changed files with 12 additions and 187 deletions

View File

@@ -1,6 +1,5 @@
using Content.Shared.EntityList;
using Content.Shared.EntityTable.EntitySelectors;
using Content.Shared.Whitelist;
using Robust.Shared.Prototypes;
namespace Content.Server.Gatherable.Components;
@@ -25,11 +24,13 @@ public sealed partial class GatherableComponent : Component
/// - Tag1
/// - Tag2
/// loot:
/// Tag1: LootTableID1
/// Tag2: LootTableID2
/// Tag1: !type:NestedSelector
/// tableId: LootTableID1
/// Tag2: !type:NestedSelector
/// tableId: LootTableID2
/// </summary>
[DataField]
public Dictionary<string, ProtoId<EntityLootTablePrototype>>? Loot = new();
public Dictionary<string, EntityTableSelector>? Loot = new();
/// <summary>
/// Random shift of the appearing entity during gathering

View File

@@ -1,25 +1,25 @@
using Content.Server.Destructible;
using Content.Server.Gatherable.Components;
using Content.Shared.EntityTable;
using Content.Shared.Interaction;
using Content.Shared.Tag;
using Content.Shared.Weapons.Melee.Events;
using Content.Shared.Whitelist;
using Robust.Server.GameObjects;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Server.Gatherable;
public sealed partial class GatherableSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly DestructibleSystem _destructible = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
[Dependency] private readonly EntityTableSystem _entityTable = default!;
public override void Initialize()
{
@@ -76,8 +76,7 @@ public sealed partial class GatherableSystem : EntitySystem
if (gatherer != null && !_tagSystem.HasTag(gatherer.Value, tag))
continue;
}
var getLoot = _proto.Index(table);
var spawnLoot = getLoot.GetSpawns(_random);
var spawnLoot = _entityTable.GetSpawns(table);
foreach (var loot in spawnLoot)
{
var spawnPos = pos.Offset(_random.NextVector2(component.GatherOffset));