-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Fansana:master' into Nikko-Items
- Loading branch information
Showing
469 changed files
with
5,821 additions
and
3,142 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Publish | ||
name: Publish test | ||
|
||
concurrency: | ||
group: publish | ||
|
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
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
Oops, something went wrong.