2022-07-29 14:13:12 +12:00
|
|
|
using Robust.Shared.Audio;
|
2021-07-12 01:32:10 -07:00
|
|
|
using Robust.Shared.GameStates;
|
2021-06-27 07:43:39 +02:00
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.Gravity
|
|
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
2021-07-12 01:32:10 -07:00
|
|
|
[NetworkedComponent]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class GravityComponent : Component
|
2021-06-27 07:43:39 +02:00
|
|
|
{
|
2021-07-10 17:35:33 +02:00
|
|
|
[DataField("gravityShakeSound")]
|
|
|
|
|
public SoundSpecifier GravityShakeSound { get; set; } = new SoundPathSpecifier("/Audio/Effects/alert.ogg");
|
|
|
|
|
|
2021-06-27 07:43:39 +02:00
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2022-07-25 15:10:23 +10:00
|
|
|
public bool EnabledVV
|
2021-06-27 07:43:39 +02:00
|
|
|
{
|
2022-07-25 15:10:23 +10:00
|
|
|
get => Enabled;
|
2021-06-27 07:43:39 +02:00
|
|
|
set
|
|
|
|
|
{
|
2022-07-25 15:10:23 +10:00
|
|
|
if (Enabled == value) return;
|
|
|
|
|
Enabled = value;
|
2022-12-18 16:03:23 +11:00
|
|
|
var ev = new GravityChangedEvent(Owner, value);
|
|
|
|
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ref ev);
|
2021-06-27 07:43:39 +02:00
|
|
|
Dirty();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-25 15:10:23 +10:00
|
|
|
[DataField("enabled")]
|
|
|
|
|
public bool Enabled;
|
2023-07-16 20:01:54 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Inherent gravity ensures GravitySystem won't change Enabled according to the gravity generators attached to this entity.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[DataField("inherent")]
|
|
|
|
|
public bool Inherent;
|
2021-06-27 07:43:39 +02:00
|
|
|
}
|
|
|
|
|
}
|