New event: Approaching unknown shuttle (#24490)
* setup codebase * Add first shuttle * tak * sync striker * sync 2 * pipipi * Preloaded roundstart shuttles! * Make it abstract "PreloaderGrid" not "PreloaderShuttle" * to do * added china cuisin shuttle * fixes * add disaster evacpod * remove enemy * final shuttles * weight 5 -> 10 * move data to component * remove autotrailer touching * doc, respath * fix frozen positioning * fixes + cvar * finally * fix evacpod * remove blacklistrules * remove `UnknownShuttleSpawnRule`, refactor `LoadMapRule` to support preloaded grids * use tryload * cleanup * fixes * use preloadedgrid for loneops * weight unknown shuttles differently (preliminal) * leftover * cleanup and raffling * partial review * singleton gridpreloader no station coupling * fix grid atmoses * `roleLoadout` support for `LoadoutComponent`, fix missing gear * weighting changes * init logic fix --------- Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Preferences.Loadouts;
|
||||
using Content.Shared.Roles;
|
||||
using Content.Shared.Storage;
|
||||
using Content.Shared.Storage.EntitySystems;
|
||||
@@ -31,6 +33,34 @@ public abstract class SharedStationSpawningSystem : EntitySystem
|
||||
_xformQuery = GetEntityQuery<TransformComponent>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equips the given starting gears from a `RoleLoadout` onto an entity.
|
||||
/// </summary>
|
||||
public void EquipRoleLoadout(EntityUid entity, RoleLoadout loadout, RoleLoadoutPrototype roleProto)
|
||||
{
|
||||
// Order loadout selections by the order they appear on the prototype.
|
||||
foreach (var group in loadout.SelectedLoadouts.OrderBy(x => roleProto.Groups.FindIndex(e => e == x.Key)))
|
||||
{
|
||||
foreach (var items in group.Value)
|
||||
{
|
||||
if (!PrototypeManager.TryIndex(items.Prototype, out var loadoutProto))
|
||||
{
|
||||
Log.Error($"Unable to find loadout prototype for {items.Prototype}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!PrototypeManager.TryIndex(loadoutProto.Equipment, out var startingGear))
|
||||
{
|
||||
Log.Error($"Unable to find starting gear {loadoutProto.Equipment} for loadout {loadoutProto}");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Handle any extra data here.
|
||||
EquipStartingGear(entity, startingGear, raiseEvent: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="EquipStartingGear(Robust.Shared.GameObjects.EntityUid,System.Nullable{Robust.Shared.Prototypes.ProtoId{Content.Shared.Roles.StartingGearPrototype}},bool)"/>
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user