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:
@@ -141,19 +141,25 @@ public sealed class InteractionOutlineSystem : EntitySystem
|
||||
var inRange = false;
|
||||
if (localPlayer.ControlledEntity != null && !Deleted(entityToClick))
|
||||
{
|
||||
inRange = _interactionSystem.InRangeUnobstructed(localPlayer.ControlledEntity.Value, entityToClick.Value);
|
||||
|
||||
// WD START
|
||||
if (_combatMode.IsInCombatMode(localPlayer.ControlledEntity) &&
|
||||
(_meleeWeapon.TryGetWeapon(localPlayer.ControlledEntity.Value, out _, out var weapon) ||
|
||||
TryComp(localPlayer.ControlledEntity, out weapon)))
|
||||
{
|
||||
inRange = _interactionSystem.InRangeUnobstructed(localPlayer.ControlledEntity.Value,
|
||||
entityToClick.Value, weapon.Range);
|
||||
|
||||
var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition);
|
||||
var userPos = Transform(localPlayer.ControlledEntity.Value).MapPosition;
|
||||
|
||||
if (mousePos.MapId != userPos.MapId || (userPos.Position - mousePos.Position).Length() > weapon.Range)
|
||||
inRange = false;
|
||||
} // WD END
|
||||
}
|
||||
else
|
||||
{
|
||||
inRange = _interactionSystem.InRangeUnobstructed(localPlayer.ControlledEntity.Value, entityToClick.Value);
|
||||
}
|
||||
// WD END
|
||||
}
|
||||
|
||||
InteractionOutlineComponent? outline;
|
||||
|
||||
66
Content.Client/_White/Chaplain/ArmamentsBeaconBui.cs
Normal file
66
Content.Client/_White/Chaplain/ArmamentsBeaconBui.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using Content.Client._White.UserInterface.Radial;
|
||||
using Content.Shared._White.Chaplain;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client._White.Chaplain;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class ArmamentsBeaconBui : BoundUserInterface
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
private SpriteSystem _spriteSystem = default!;
|
||||
|
||||
private bool _selected;
|
||||
private RadialContainer? _armorSelector;
|
||||
|
||||
public ArmamentsBeaconBui(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_spriteSystem = _entityManager.EntitySysManager.GetEntitySystem<SpriteSystem>();
|
||||
var beacon = _entityManager.GetComponent<ArmamentsBeaconComponent>(Owner);
|
||||
|
||||
_armorSelector = new RadialContainer();
|
||||
|
||||
_armorSelector.Closed += () =>
|
||||
{
|
||||
if (_selected)
|
||||
return;
|
||||
|
||||
SendMessage(new ArmorSelectedEvent(-1));
|
||||
Close();
|
||||
};
|
||||
|
||||
for (var i = 0; i < beacon.Armor.Count; i++)
|
||||
{
|
||||
var armorPrototype = _prototypeManager.Index<EntityPrototype>(beacon.Armor[i]);
|
||||
var button = _armorSelector.AddButton(armorPrototype.Name,
|
||||
_spriteSystem.GetPrototypeIcon(armorPrototype).Default);
|
||||
|
||||
var index = i;
|
||||
button.Controller.OnPressed += _ =>
|
||||
{
|
||||
_selected = true;
|
||||
SendMessage(new ArmorSelectedEvent(index));
|
||||
_armorSelector.Close();
|
||||
Close();
|
||||
};
|
||||
}
|
||||
|
||||
_armorSelector.OpenAttachedLocalPlayer();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
_armorSelector?.Close();
|
||||
}
|
||||
}
|
||||
65
Content.Client/_White/Chaplain/NullRodBui.cs
Normal file
65
Content.Client/_White/Chaplain/NullRodBui.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using Content.Client._White.UserInterface.Radial;
|
||||
using Content.Shared._White.Chaplain;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client._White.Chaplain;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class NullRodBui : BoundUserInterface
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
private SpriteSystem _spriteSystem = default!;
|
||||
|
||||
private bool _selected;
|
||||
private RadialContainer? _weaponSelector;
|
||||
|
||||
public NullRodBui(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_spriteSystem = _entityManager.EntitySysManager.GetEntitySystem<SpriteSystem>();
|
||||
var nullRod = _entityManager.GetComponent<NullRodComponent>(Owner);
|
||||
|
||||
_weaponSelector = new RadialContainer();
|
||||
|
||||
_weaponSelector.Closed += () =>
|
||||
{
|
||||
if (_selected)
|
||||
return;
|
||||
|
||||
SendMessage(new WeaponSelectedEvent(string.Empty));
|
||||
Close();
|
||||
};
|
||||
|
||||
foreach (var weapon in nullRod.Weapons)
|
||||
{
|
||||
var weaponPrototype = _prototypeManager.Index<EntityPrototype>(weapon);
|
||||
var button = _weaponSelector.AddButton(weaponPrototype.Name,
|
||||
_spriteSystem.GetPrototypeIcon(weaponPrototype).Default);
|
||||
|
||||
button.Controller.OnPressed += _ =>
|
||||
{
|
||||
_selected = true;
|
||||
SendMessage(new WeaponSelectedEvent(weapon));
|
||||
_weaponSelector.Close();
|
||||
Close();
|
||||
};
|
||||
}
|
||||
|
||||
_weaponSelector.OpenAttachedLocalPlayer();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
_weaponSelector?.Close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user