Compare commits

...

1 Commits

Author SHA1 Message Date
Ed
a406ca419a token unfinished 2025-01-12 23:46:53 +03:00
2 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
namespace Content.Server._CP14.Jobs;
/// <summary>
///
/// </summary>
[RegisterComponent]
public sealed partial class CP14JobTokenComponent : Component
{
[DataField]
public LocId? Description;
}

View File

@@ -0,0 +1,33 @@
using Content.Shared.GameTicking;
using Content.Shared.Inventory;
using Content.Shared.Mind;
using Robust.Server.Player;
namespace Content.Server._CP14.Jobs;
public partial class CP14JobTokenSystem : EntitySystem
{
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly InventorySystem _inventory = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(GivePlayerToken);
}
private void GivePlayerToken(PlayerSpawnCompleteEvent ev)
{
var playerName = ev.Player.Name;
var playerEntity = ev.Player.AttachedEntity;
if (playerEntity is null)
return;
if (!_inventory.TryGetSlot(playerEntity.Value, "back", out var backSlot))
return;
var token = Spawn("CP14Paper");
}
}