Chaplain stuff (#98)
* - add: Null rod. * - add: Only chaplain can use holy weapons. * - add: Chaplain is cult immune. * - fix: Fix component granting. * - add: Only chaplain can use null rod. * - add: Armaments beacon. * - add: Chaplain playtime requirement.
This commit is contained in:
40
Content.Server/_White/Chaplain/NullRodSystem.cs
Normal file
40
Content.Server/_White/Chaplain/NullRodSystem.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Content.Server.Hands.Systems;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared._White.Chaplain;
|
||||
using Content.Shared.Ghost;
|
||||
|
||||
namespace Content.Server._White.Chaplain;
|
||||
|
||||
public sealed class NullRodSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly HandsSystem _hands = default!;
|
||||
[Dependency] private readonly PopupSystem _popup = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<NullRodComponent, WeaponSelectedEvent>(OnWeaponSelected);
|
||||
}
|
||||
|
||||
private void OnWeaponSelected(Entity<NullRodComponent> ent, ref WeaponSelectedEvent args)
|
||||
{
|
||||
var entity = args.Session.AttachedEntity;
|
||||
|
||||
if (args.SelectedWeapon == string.Empty || entity == null)
|
||||
return;
|
||||
|
||||
if (!HasComp<HolyComponent>(entity.Value) && !HasComp<GhostComponent>(entity.Value))
|
||||
{
|
||||
_popup.PopupEntity($"Вам не хватает веры, чтобы использовать {Name(ent)}", entity.Value, entity.Value);
|
||||
return;
|
||||
}
|
||||
|
||||
var weapon = Spawn(args.SelectedWeapon, Transform(entity.Value).Coordinates);
|
||||
EnsureComp<HolyWeaponComponent>(weapon);
|
||||
|
||||
Del(ent);
|
||||
|
||||
_hands.PickupOrDrop(entity.Value, weapon, true, false, false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user