CombatModeComponent.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using Content.Shared.MouseRotator;
  2. using Content.Shared.Movement.Components;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.GameStates;
  5. using Robust.Shared.Prototypes;
  6. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  7. namespace Content.Shared.CombatMode
  8. {
  9. /// <summary>
  10. /// Stores whether an entity is in "combat mode"
  11. /// This is used to differentiate between regular item interactions or
  12. /// using *everything* as a weapon.
  13. /// </summary>
  14. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
  15. [Access(typeof(SharedCombatModeSystem))]
  16. public sealed partial class CombatModeComponent : Component
  17. {
  18. #region Disarm
  19. /// <summary>
  20. /// Whether we are able to disarm. This requires our active hand to be free.
  21. /// False if it's toggled off for whatever reason, null if it's not possible.
  22. /// </summary>
  23. [ViewVariables(VVAccess.ReadWrite), DataField("canDisarm")]
  24. public bool? CanDisarm;
  25. [DataField("disarmSuccessSound")]
  26. public SoundSpecifier DisarmSuccessSound = new SoundPathSpecifier("/Audio/Effects/thudswoosh.ogg");
  27. [DataField("disarmFailChance")]
  28. public float BaseDisarmFailChance = 0.75f;
  29. #endregion
  30. [DataField("combatToggleAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
  31. public string CombatToggleAction = "ActionCombatModeToggle";
  32. [DataField, AutoNetworkedField]
  33. public EntityUid? CombatToggleActionEntity;
  34. [ViewVariables(VVAccess.ReadWrite), DataField("isInCombatMode"), AutoNetworkedField]
  35. public bool IsInCombatMode;
  36. /// <summary>
  37. /// Will add <see cref="MouseRotatorComponent"/> and <see cref="NoRotateOnMoveComponent"/>
  38. /// to entities with this flag enabled that enter combat mode, and vice versa for removal.
  39. /// </summary>
  40. [DataField, AutoNetworkedField]
  41. public bool ToggleMouseRotator = true;
  42. }
  43. }