[RegisterComponent, Access(typeof(DamagePopupSystem))]
public sealed partial class DamagePopupComponent : Component
{
+ /// <summary>
+ /// Bool that will be used to determine if the popup type can be changed with a left click.
+ /// </summary>
+ [DataField("allowTypeChange")] [ViewVariables(VVAccess.ReadWrite)]
+ public bool AllowTypeChange = false;
/// <summary>
/// Enum that will be used to determine the type of damage popup displayed.
/// </summary>
+using System.Linq;
using Content.Server.Damage.Components;
using Content.Server.Popups;
using Content.Shared.Damage;
-using Robust.Shared.Player;
+using Content.Shared.Interaction;
namespace Content.Server.Damage.Systems;
{
base.Initialize();
SubscribeLocalEvent<DamagePopupComponent, DamageChangedEvent>(OnDamageChange);
+ SubscribeLocalEvent<DamagePopupComponent, InteractHandEvent>(OnInteractHand);
}
private void OnDamageChange(EntityUid uid, DamagePopupComponent component, DamageChangedEvent args)
_popupSystem.PopupEntity(msg, uid);
}
}
+
+ private void OnInteractHand(EntityUid uid, DamagePopupComponent component, InteractHandEvent args)
+ {
+ if (component.AllowTypeChange)
+ {
+ if (component.Type == Enum.GetValues(typeof(DamagePopupType)).Cast<DamagePopupType>().Last())
+ {
+ component.Type = Enum.GetValues(typeof(DamagePopupType)).Cast<DamagePopupType>().First();
+ }
+ else
+ {
+ component.Type = (DamagePopupType) (int) component.Type + 1;
+ }
+ _popupSystem.PopupEntity("Target set to type: " + component.Type.ToString(), uid);
+ }
+ }
}