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

View File

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

View File

@@ -1,22 +0,0 @@
using System.Collections.Immutable;
using Content.Shared.Storage;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Shared.EntityList;
[Prototype]
public sealed partial class EntityLootTablePrototype : IPrototype
{
[IdDataField]
public string ID { get; private set; } = default!;
[DataField("entries")]
public ImmutableList<EntitySpawnEntry> Entries = ImmutableList<EntitySpawnEntry>.Empty;
/// <inheritdoc cref="EntitySpawnCollection.GetSpawns"/>
public List<string> GetSpawns(IRobustRandom random)
{
return EntitySpawnCollection.GetSpawns(Entries, random);
}
}

View File

@@ -24,7 +24,9 @@
components: components:
- Hands - Hands
loot: loot:
All: SpaceshroomGather All: !type:GroupSelector
children:
- id: FoodSpaceshroom
- type: Damageable - type: Damageable
damageContainer: StructuralInorganic damageContainer: StructuralInorganic
damageModifierSet: Wood damageModifierSet: Wood
@@ -37,13 +39,6 @@
- !type:DoActsBehavior - !type:DoActsBehavior
acts: [ "Destruction" ] acts: [ "Destruction" ]
- type: entityLootTable
id: SpaceshroomGather
entries:
- id: FoodSpaceshroom
amount: 1
maxAmount: 1
- type: entity - type: entity
name: spaceshroom name: spaceshroom
parent: FoodProduceBase parent: FoodProduceBase

View File

@@ -1,148 +0,0 @@
# These will be spawned randomly around the station
- type: entityLootTable
id: SuspicionRule
entries:
- id: WeaponRifleAk
amount: 0
maxAmount: 5
- id: WeaponRifleM90GrenadeLauncher
amount: 0
maxAmount: 5
- id: WeaponRifleLecter
amount: 0
maxAmount: 5
- id: WeaponPistolViper
amount: 0
maxAmount: 5
- id: WeaponPistolCobra
amount: 0
maxAmount: 5
- id: WeaponPistolMk58
amount: 0
maxAmount: 5
- id: ButchCleaver
maxAmount: 5
- id: Pickaxe
maxAmount: 5
- id: Spear
maxAmount: 5
- id: ToolboxEmergency
maxAmount: 5
- id: CrowbarRed
maxAmount: 5
- id: Stunbaton
maxAmount: 10
- id: WeaponRevolverDeckard
amount: 0
maxAmount: 5
- id: WeaponRevolverInspector
amount: 0
maxAmount: 5
- id: WeaponRevolverMateba
amount: 0
maxAmount: 5
- id: WeaponShotgunBulldog
amount: 0
maxAmount: 5
- id: WeaponShotgunDoubleBarreled
amount: 0
maxAmount: 5
- id: WeaponShotgunEnforcer
amount: 0
maxAmount: 5
- id: WeaponShotgunKammerer
amount: 0
maxAmount: 5
- id: WeaponShotgunSawn
amount: 0
maxAmount: 5
- id: WeaponShotgunHandmade
amount: 0
maxAmount: 5
- id: WeaponSubMachineGunAtreides
amount: 0
maxAmount: 5
- id: WeaponSubMachineGunC20r
amount: 0
maxAmount: 5
- id: WeaponSubMachineGunWt550
amount: 0
maxAmount: 5
- id: WeaponSniperMosin
amount: 0
maxAmount: 5
- id: WeaponSniperHristov
amount: 0
maxAmount: 5
- id: WeaponLaserGun
amount: 0
maxAmount: 1
- id: WeaponLaserCannon
amount: 0
maxAmount: 1
- id: WeaponXrayCannon
amount: 0
maxAmount: 2
- id: WeaponDisabler
amount: 0
maxAmount: 4
- id: WeaponLauncherChinaLake
prob: 0.30
maxAmount: 3
- id: WeaponLauncherRocket
prob: 0.20
maxAmount: 3
- id: LidSalami
amount: 0
maxAmount: 10
- id: ExGrenade
prob: 0.10
amount: 0
maxAmount: 2
- id: GrenadeFlashBang
- id: SyndieMiniBomb
prob: 0.05
amount: 0
maxAmount: 5
- id: GrenadeFlash
- id: GrenadeBlast
- id: GrenadeFrag
- id: GrenadeBaton
- id: SoapSyndie
amount: 0
maxAmount: 3
# Spawn a bunch of ammo around!
- id: MagazineRifle
maxAmount: 15
- id: MagazineCaselessRifle
maxAmount: 15
- id: MagazineCaselessRifle10x24
maxAmount: 15
- id: MagazinePistolCaselessRifle
maxAmount: 15
- id: MagazineLightRifle
maxAmount: 15
- id: MagazineShotgun
maxAmount: 15
- id: MagazinePistol
maxAmount: 15
- id: MagazinePistolHighCapacity
maxAmount: 15
- id: MagazinePistolSubMachineGun
maxAmount: 15
- id: CartridgeRocket
maxAmount: 15
- id: GrenadeFrag
maxAmount: 15