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:
metalgearsloth
2022-07-25 15:10:23 +10:00
committed by GitHub
parent aad6a22a6a
commit bfac53e7bc
36 changed files with 607 additions and 412 deletions

View File

@@ -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;
}
}