-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #391 from FoxxoTrystan/Floofstation-V7
Floofstation Release V7
- Loading branch information
Showing
745 changed files
with
8,914 additions
and
4,082 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using Content.Shared.DisplacementMap; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Graphics; | ||
using Robust.Shared.Serialization.Manager; | ||
|
||
namespace Content.Client.DisplacementMap; | ||
|
||
public sealed class DisplacementMapSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly ISerializationManager _serialization = default!; | ||
|
||
public bool TryAddDisplacement(DisplacementData data, SpriteComponent sprite, int index, string key, HashSet<string> revealedLayers) | ||
{ | ||
if (data.ShaderOverride != null) | ||
sprite.LayerSetShader(index, data.ShaderOverride); | ||
|
||
var displacementKey = $"{key}-displacement"; | ||
if (!revealedLayers.Add(displacementKey)) | ||
{ | ||
Log.Warning($"Duplicate key for DISPLACEMENT: {displacementKey}."); | ||
return false; | ||
} | ||
|
||
//allows you not to write it every time in the YML | ||
foreach (var pair in data.SizeMaps) | ||
{ | ||
pair.Value.CopyToShaderParameters??= new() | ||
{ | ||
LayerKey = "dummy", | ||
ParameterTexture = "displacementMap", | ||
ParameterUV = "displacementUV", | ||
}; | ||
} | ||
|
||
if (!data.SizeMaps.ContainsKey(32)) | ||
{ | ||
Log.Error($"DISPLACEMENT: {displacementKey} don't have 32x32 default displacement map"); | ||
return false; | ||
} | ||
|
||
// We choose a displacement map from the possible ones, matching the size with the original layer size. | ||
// If there is no such a map, we use a standard 32 by 32 one | ||
var displacementDataLayer = data.SizeMaps[EyeManager.PixelsPerMeter]; | ||
var actualRSI = sprite.LayerGetActualRSI(index); | ||
if (actualRSI is not null) | ||
{ | ||
if (actualRSI.Size.X != actualRSI.Size.Y) | ||
Log.Warning($"DISPLACEMENT: {displacementKey} has a resolution that is not 1:1, things can look crooked"); | ||
|
||
var layerSize = actualRSI.Size.X; | ||
if (data.SizeMaps.ContainsKey(layerSize)) | ||
displacementDataLayer = data.SizeMaps[layerSize]; | ||
} | ||
|
||
var displacementLayer = _serialization.CreateCopy(displacementDataLayer, notNullableOverride: true); | ||
displacementLayer.CopyToShaderParameters!.LayerKey = key; | ||
|
||
sprite.AddLayer(displacementLayer, index); | ||
sprite.LayerMapSet(displacementKey, index); | ||
|
||
revealedLayers.Add(displacementKey); | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using Content.Shared.FloofStation; | ||
using Robust.Shared.Audio.Systems; | ||
using Robust.Shared.Player; | ||
|
||
namespace Content.Client.Floofstation; | ||
|
||
public sealed partial class VoredSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly SharedAudioSystem _audio = default!; | ||
[Dependency] private readonly ISharedPlayerManager _playerMan = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<VoredComponent, ComponentInit>(OnInit); | ||
SubscribeLocalEvent<VoredComponent, ComponentShutdown>(Onhutdown); | ||
SubscribeLocalEvent<VoredComponent, LocalPlayerAttachedEvent>(OnPlayerAttached); | ||
SubscribeLocalEvent<VoredComponent, LocalPlayerDetachedEvent>(OnPlayerDetached); | ||
} | ||
|
||
private void OnInit(EntityUid uid, VoredComponent component, ComponentInit args) | ||
{ | ||
if (uid != _playerMan.LocalEntity) | ||
return; | ||
|
||
component.Stream = _audio.PlayGlobal(component.SoundBelly, Filter.Local(), false)?.Entity; | ||
} | ||
|
||
private void Onhutdown(EntityUid uid, VoredComponent component, ComponentShutdown args) | ||
{ | ||
if (uid != _playerMan.LocalEntity) | ||
return; | ||
|
||
QueueDel(component.Stream); | ||
} | ||
|
||
private void OnPlayerAttached(EntityUid uid, VoredComponent component, LocalPlayerAttachedEvent args) | ||
{ | ||
component.Stream = _audio.PlayGlobal(component.SoundBelly, Filter.Local(), false)?.Entity; | ||
} | ||
|
||
private void OnPlayerDetached(EntityUid uid, VoredComponent component, LocalPlayerDetachedEvent args) | ||
{ | ||
QueueDel(component.Stream); | ||
} | ||
} |
Oops, something went wrong.