Per-map parallax support (#9786)
* Per-map parallax support * Comments for future sloth * c * bet * Fix exception * VV support * Fix parallax * mem * weightless sounds * Gravity stuff * placeholder coz im too lazy to stash don't @ me son * decent clouds * sky * Fast parallax * Imagine spelling * Loicense * perish * Fix weightless status Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -12,48 +12,19 @@ namespace Content.Shared.Gravity
|
||||
public SoundSpecifier GravityShakeSound { get; set; } = new SoundPathSpecifier("/Audio/Effects/alert.ogg");
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool Enabled
|
||||
public bool EnabledVV
|
||||
{
|
||||
get => _enabled;
|
||||
get => Enabled;
|
||||
set
|
||||
{
|
||||
if (_enabled == value) return;
|
||||
_enabled = value;
|
||||
if (_enabled)
|
||||
{
|
||||
Logger.Info($"Enabled gravity for {Owner}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Info($"Disabled gravity for {Owner}");
|
||||
}
|
||||
if (Enabled == value) return;
|
||||
Enabled = value;
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new GravityChangedEvent(Owner, value));
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
|
||||
private bool _enabled;
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
return new GravityComponentState(_enabled);
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
if (curState is not GravityComponentState state) return;
|
||||
Enabled = state.Enabled;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
private sealed class GravityComponentState : ComponentState
|
||||
{
|
||||
public bool Enabled { get; }
|
||||
|
||||
public GravityComponentState(bool enabled)
|
||||
{
|
||||
Enabled = enabled;
|
||||
}
|
||||
}
|
||||
[DataField("enabled")]
|
||||
public bool Enabled;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user