Compare commits
1 Commits
master
...
ed-12-01-2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a406ca419a |
11
Content.Server/_CP14/Jobs/CP14JobTokenComponent.cs
Normal file
11
Content.Server/_CP14/Jobs/CP14JobTokenComponent.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
namespace Content.Server._CP14.Jobs;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed partial class CP14JobTokenComponent : Component
|
||||||
|
{
|
||||||
|
[DataField]
|
||||||
|
public LocId? Description;
|
||||||
|
}
|
||||||
33
Content.Server/_CP14/Jobs/CP14JobTokenSystem.cs
Normal file
33
Content.Server/_CP14/Jobs/CP14JobTokenSystem.cs
Normal 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");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user