-using Content.Shared.EntityList;
+using Content.Shared.EntityTable.EntitySelectors;
using Content.Shared.Whitelist;
-using Robust.Shared.Prototypes;
namespace Content.Server.Gatherable.Components;
/// - 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
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()
{
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));
+++ /dev/null
-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);
- }
-}
components:
- Hands
loot:
- All: SpaceshroomGather
+ All: !type:GroupSelector
+ children:
+ - id: FoodSpaceshroom
- type: Damageable
damageContainer: StructuralInorganic
damageModifierSet: Wood
- !type:DoActsBehavior
acts: [ "Destruction" ]
-- type: entityLootTable
- id: SpaceshroomGather
- entries:
- - id: FoodSpaceshroom
- amount: 1
- maxAmount: 1
-
- type: entity
name: spaceshroom
parent: FoodProduceBase
+++ /dev/null
-# 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