Skip to content

Commit

Permalink
Merge branch 'RevertContent' of https://github.com/Succuberry/Frontie…
Browse files Browse the repository at this point in the history
…rTSP into master

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.Nado
  • Loading branch information
Succuberry committed Aug 11, 2024
2 parents 3473a10 + ea0f694 commit dfc62a1
Show file tree
Hide file tree
Showing 103 changed files with 1,185 additions and 57 deletions.
7 changes: 7 additions & 0 deletions Content.Client/IconSmoothing/IconSmoothComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,12 @@ public enum IconSmoothingMode : byte
/// Where this component contributes to our neighbors being calculated but we do not update our own sprite.
/// </summary>
NoSprite,

// Frontier: pretty diagonal windows
/// <summary>
/// The icon represents a triangular sprite with 5 states, representing which combinations of South and East are being occupied or not.
/// </summary>
DiagonalNF,
// End Frontier
}
}
108 changes: 88 additions & 20 deletions Content.Client/IconSmoothing/IconSmoothSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Numerics;
using Content.Client.Anomaly.Ui;
using Content.Client.Overlays;
using Content.Shared.IconSmoothing;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
Expand Down Expand Up @@ -154,7 +156,7 @@ public void DirtyNeighbours(EntityUid uid, IconSmoothComponent? comp = null, Tra
DirtyEntities(grid.GetAnchoredEntitiesEnumerator(pos + new Vector2i(0, 1)));
DirtyEntities(grid.GetAnchoredEntitiesEnumerator(pos + new Vector2i(0, -1)));

if (comp.Mode is IconSmoothingMode.Corners or IconSmoothingMode.NoSprite or IconSmoothingMode.Diagonal)
if (comp.Mode is IconSmoothingMode.Corners or IconSmoothingMode.NoSprite or IconSmoothingMode.Diagonal or IconSmoothingMode.DiagonalNF) // Frontier: add DiagonalNF
{
DirtyEntities(grid.GetAnchoredEntitiesEnumerator(pos + new Vector2i(1, 1)));
DirtyEntities(grid.GetAnchoredEntitiesEnumerator(pos + new Vector2i(-1, -1)));
Expand Down Expand Up @@ -208,13 +210,13 @@ private void CalculateNewSprite(EntityUid uid,
{
var pos = grid.TileIndicesFor(xform.Coordinates);

if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.North)), smoothQuery))
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.North)), smoothQuery, new(0, 1))) // Frontier: added (0, 1) vector
directions |= DirectionFlag.North;
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.South)), smoothQuery))
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.South)), smoothQuery, new(0, -1))) // Frontier: added (0, -1) vector
directions |= DirectionFlag.South;
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.East)), smoothQuery))
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.East)), smoothQuery, new(1, 0))) // Frontier: added (1, 0) vector
directions |= DirectionFlag.East;
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.West)), smoothQuery))
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.West)), smoothQuery, new(-1, 0))) // Frontier: added (-1, 0) vector
directions |= DirectionFlag.West;
}

Expand Down Expand Up @@ -256,6 +258,9 @@ private void CalculateNewSprite(EntityUid uid,
case IconSmoothingMode.Diagonal:
CalculateNewSpriteDiagonal(grid, smooth, spriteEnt, xform, smoothQuery);
break;
case IconSmoothingMode.DiagonalNF: // Frontier
CalculateNewSpriteDiagonalNF(grid, smooth, spriteEnt, xform, smoothQuery); // Frontier
break; // Frontier
default:
throw new ArgumentOutOfRangeException();
}
Expand Down Expand Up @@ -284,7 +289,7 @@ private void CalculateNewSpriteDiagonal(MapGridComponent? grid, IconSmoothCompon
for (var i = 0; i < neighbors.Length; i++)
{
var neighbor = (Vector2i) rotation.RotateVec(neighbors[i]);
matching = matching && MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos + neighbor), smoothQuery);
matching = matching && MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos + neighbor), smoothQuery, pos); // Frontier: add pos
}

if (matching)
Expand All @@ -297,6 +302,68 @@ private void CalculateNewSpriteDiagonal(MapGridComponent? grid, IconSmoothCompon
}
}

// New Frontiers - Better icon smoothing - icon smoothing that supports more diagonal window states
// and respects the empty sides of diagonal walls/windows
// This code is licensed under AGPLv3. See AGPLv3.txt

// Frontier: 5-state diagonal windows
private void CalculateNewSpriteDiagonalNF(MapGridComponent? grid, IconSmoothComponent smooth,
Entity<SpriteComponent> sprite, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
{
if (grid == null)
{
sprite.Comp.LayerSetState(0, $"{smooth.StateBase}0");
return;
}

var neighbors = new Vector2[]
{
new(1, 0),
new(0, -1),
};

var pos = grid.TileIndicesFor(xform.Coordinates);
var rotation = xform.LocalRotation;
int value = 0;

for (var i = 0; i < neighbors.Length; i++)
{
var neighbor = (Vector2i) rotation.RotateVec(neighbors[i]);
if(MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos + neighbor), smoothQuery, neighbor))
value |= 1 << i;
}

// both walls checked, check the corner
if (value == 3)
{
var neighbor = (Vector2i) rotation.RotateVec(new(1, -1));
if(MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos + neighbor), smoothQuery, neighbor))
value = 4;
}

sprite.Comp.LayerSetState(0, $"{smooth.StateBase}{value}");
}

// Check if a particular window/wall allows smoothing on a given edge
private bool EntityIsSmoothOnEdge(EntityUid? target, IconSmoothComponent targetComp, Vector2 sourceDir)
{
var xformQuery = GetEntityQuery<TransformComponent>();
xformQuery.TryGetComponent(target, out var xform);
if (xform is null)
return false;

if (targetComp.Mode is IconSmoothingMode.Diagonal or IconSmoothingMode.DiagonalNF)
{
var rot = -xform.LocalRotation; // Source direction must be transformed into our reference.
var angle = new Angle(rot.RotateVec(-sourceDir)); // Direction is given from sourge to target, we need the direction from target to source.
angle += Math.PI / 2; // Cardinal directions start at north(?), but positive X angle is 0.
var dir = angle.GetCardinalDir();
return dir is Direction.South or Direction.SouthEast or Direction.East;
}
return true; // All other target components use all sides
}
// End of modified code

private void CalculateNewSpriteCardinal(MapGridComponent? grid, IconSmoothComponent smooth, Entity<SpriteComponent> sprite, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
{
var dirs = CardinalConnectDirs.None;
Expand All @@ -308,13 +375,13 @@ private void CalculateNewSpriteCardinal(MapGridComponent? grid, IconSmoothCompon
}

var pos = grid.TileIndicesFor(xform.Coordinates);
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.North)), smoothQuery))
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.North)), smoothQuery, new(0, 1))) // Frontier: add vector
dirs |= CardinalConnectDirs.North;
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.South)), smoothQuery))
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.South)), smoothQuery, new(0, -1))) // Frontier: add vector
dirs |= CardinalConnectDirs.South;
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.East)), smoothQuery))
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.East)), smoothQuery, new(1, 0))) // Frontier: add vector
dirs |= CardinalConnectDirs.East;
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.West)), smoothQuery))
if (MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.West)), smoothQuery, new(-1, 0))) // Frontier: add vector
dirs |= CardinalConnectDirs.West;

sprite.Comp.LayerSetState(0, $"{smooth.StateBase}{(int) dirs}");
Expand All @@ -333,13 +400,14 @@ private void CalculateNewSpriteCardinal(MapGridComponent? grid, IconSmoothCompon
CalculateEdge(sprite, directions, sprite);
}

private bool MatchingEntity(IconSmoothComponent smooth, AnchoredEntitiesEnumerator candidates, EntityQuery<IconSmoothComponent> smoothQuery)
private bool MatchingEntity(IconSmoothComponent smooth, AnchoredEntitiesEnumerator candidates, EntityQuery<IconSmoothComponent> smoothQuery, Vector2 offset)
{
while (candidates.MoveNext(out var entity))
{
if (smoothQuery.TryGetComponent(entity, out var other) &&
other.SmoothKey == smooth.SmoothKey &&
other.Enabled)
other.Enabled &&
EntityIsSmoothOnEdge(entity, other, offset)) // Frontier: added EntityIsSmo
{
return true;
}
Expand Down Expand Up @@ -385,14 +453,14 @@ private void CalculateNewSpriteCorners(MapGridComponent? grid, IconSmoothCompone
private (CornerFill ne, CornerFill nw, CornerFill sw, CornerFill se) CalculateCornerFill(MapGridComponent grid, IconSmoothComponent smooth, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
{
var pos = grid.TileIndicesFor(xform.Coordinates);
var n = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.North)), smoothQuery);
var ne = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.NorthEast)), smoothQuery);
var e = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.East)), smoothQuery);
var se = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.SouthEast)), smoothQuery);
var s = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.South)), smoothQuery);
var sw = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.SouthWest)), smoothQuery);
var w = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.West)), smoothQuery);
var nw = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.NorthWest)), smoothQuery);
var n = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.North)), smoothQuery, new(0, 1)); // Frontier: add vector
var ne = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.NorthEast)), smoothQuery, new(1, 1)); // Frontier: add vector
var e = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.East)), smoothQuery, new(1, 0)); // Frontier: add vector
var se = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.SouthEast)), smoothQuery, new(1, -1)); // Frontier: add vector
var s = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.South)), smoothQuery, new(0, -1)); // Frontier: add vector
var sw = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.SouthWest)), smoothQuery, new(-1, -1)); // Frontier: add vector
var w = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.West)), smoothQuery, new(-1, 0)); // Frontier: add vector
var nw = MatchingEntity(smooth, grid.GetAnchoredEntitiesEnumerator(pos.Offset(Direction.NorthWest)), smoothQuery, new(-1, 1)); // Frontier: add vector

// ReSharper disable InconsistentNaming
var cornerNE = CornerFill.None;
Expand Down
20 changes: 20 additions & 0 deletions Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Robust.Shared.Audio;

namespace Content.Server.Corvax.Elzuosa
{
[RegisterComponent]
public sealed partial class ElzuosaColorComponent : Component
{
public Color SkinColor { get; set; }

public bool Hacked { get; set; } = false;

[DataField("cycleRate")]
public float CycleRate = 1f;
}
}
37 changes: 37 additions & 0 deletions Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Content.Shared.Humanoid;
using Content.Shared.Preferences;
using Robust.Server.GameObjects;
using Content.Server.GameTicking;
namespace Content.Server.Corvax.Elzuosa
{
public sealed class ElzuosaColorSystem : EntitySystem
{
[Dependency] private readonly PointLightSystem _pointLightSystem = default!;
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ElzuosaColorComponent, PlayerSpawnCompleteEvent>(OnPlayerSpawn);
}

private void OnPlayerSpawn(EntityUid uid, ElzuosaColorComponent comp, PlayerSpawnCompleteEvent args)
{
if (!HasComp<HumanoidAppearanceComponent>(uid))
return;
if (args == null)
return;
var profile = args.Profile;
SetEntityPointLightColor(uid, profile);
}

public void SetEntityPointLightColor(EntityUid uid, HumanoidCharacterProfile? profile)
{
if (profile == null)
return;

var color = profile.Appearance.SkinColor;
_pointLightSystem.SetColor(uid,color);

}
}
}
2 changes: 1 addition & 1 deletion Content.Shared/Atmos/Atmospherics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public static class Atmospherics
/// so it just applies this flat value).
/// </summary>
// Original value is 4, buff back when we have proper ways for players to deal with breaches.
public const int LowPressureDamage = 1;
public const int LowPressureDamage = 4; // Frontier: 1<4

public const float WindowHeatTransferCoefficient = 0.1f;

Expand Down
8 changes: 8 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6165,3 +6165,11 @@ Entries:
message: Public transit should now properly prioritize bus docks.
id: 5183
time: '2024-08-09T16:23:08.0000000+00:00'
- author: whatstone and whatstone
changes:
- type: Tweak
message: >-
Walls/windows/secret doors icons once again smoothly transition into
each other.
id: 5184
time: '2024-08-09T18:24:00.0000000+00:00'
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Corvax Interaction

## Elzuosa

pat-success-elzuosa = вы обнимаете { $target }, чувствуя, как по вам проходит высоковольтный ток.
pat-success-elzuosa-others = { CAPITALIZE($user) } обнимает { $target }, наэлектризовываясь.
pat-success-elzuosa-target = { CAPITALIZE($user) } обнимает вас.
41 changes: 41 additions & 0 deletions Resources/Locale/ru-RU/corvax/markings/elzuosa.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
marking-EtherealPartsMElzuHornsClipped = рога (вросшие)
marking-EtherealPartsMElzuHornsClipped-ethereal_parts_m_elzu_horns_clipped_ADJ = рога
marking-EtherealPartsMElzuHornsClipped-ethereal_parts_m_elzu_horns_clipped_FRONT = рога (вросшие, передние)
marking-EtherealPartsMElzuHornsHelm = рога (шлем)
marking-EtherealPartsMElzuHornsHelm-ethereal_parts_m_elzu_horns_helm_ADJ = рога (шлем)
marking-EtherealPartsMElzuHornsHelm-ethereal_parts_m_elzu_horns_helm_FRONT = рога (шлем, передние)
marking-EtherealPartsMElzuHornsInward = рога (загнутые назад)
marking-EtherealPartsMElzuHornsInward-ethereal_parts_m_elzu_horns_inward_ADJ = рога (загнутые назад)
marking-EtherealPartsMElzuHornsInward-ethereal_parts_m_elzu_horns_inward_FRONT = рога (загнутые назад, передние)
marking-EtherealPartsMElzuHornsLunar = рога (лунные)
marking-EtherealPartsMElzuHornsLunar-ethereal_parts_m_elzu_horns_lunar_ADJ = рога (лунные)
marking-EtherealPartsMElzuHornsLunar-ethereal_parts_m_elzu_horns_lunar_FRONT = рога (лунные, передние)
marking-EtherealPartsMElzuHornsMajesty = рога (величественные)
marking-EtherealPartsMElzuHornsMajesty-ethereal_parts_m_elzu_horns_majesty_ADJ = рога (величественные)
marking-EtherealPartsMElzuHornsMajesty-ethereal_parts_m_elzu_horns_majesty_FRONT = рога (величественные, передние)
marking-EtherealPartsMElzuHornsSharp = рога (острые)
marking-EtherealPartsMElzuHornsSharp-ethereal_parts_m_elzu_horns_sharp_ADJ = рога (острые)
marking-EtherealPartsMElzuHornsSharp-ethereal_parts_m_elzu_horns_sharp_FRONT = рога (острые, передние)
marking-EtherealPartsMElzuHornsShort = рога (короткие)
marking-EtherealPartsMElzuHornsShort-ethereal_parts_m_elzu_horns_short_ADJ = рога (короткие)
marking-EtherealPartsMElzuHornsShort-ethereal_parts_m_elzu_horns_short_FRONT = рога (короткие, передние)
marking-EtherealPartsMTailBifurcated = хвост (разделённый)
marking-EtherealPartsMTailBifurcated-ethereal_parts_m_tail_bifurcated_BEHIND = хвост (разделённый)
marking-EtherealPartsMTailBifurcated-ethereal_parts_m_tail_bifurcated_FRONT = хвост (разделённый, кончик)
marking-EtherealPartsMTailLong = хвост (длинный)
marking-EtherealPartsMTailLong-ethereal_parts_m_tail_long_BEHIND = хвост (длинный)
marking-EtherealPartsMTailLong-ethereal_parts_m_tail_long_FRONT = хвост (длинный, кончик)
marking-EtherealPartsMTailStubby = хвост (коренастый)
marking-EtherealPartsMTailStubby-ethereal_parts_m_tail_stubby_BEHIND = хвост (коренастый)
marking-EtherealPartsMTailStubby-ethereal_parts_m_tail_stubby_FRONT = хвост (коренастый, кончик)
marking-EtherealPartsMAnimatedtailBifurcated = хвост (разделённый, анимированный)
marking-EtherealPartsMAnimatedtailBifurcated-ethereal_parts_m_waggingtail_bifurcated_BEHIND = хвост (разделённый, анимированный)
marking-EtherealPartsMAnimatedtailBifurcated-ethereal_parts_m_waggingtail_bifurcated_FRONT = хвост (разделённый, анимированный, кончик)
marking-EtherealPartsMAnimatedtailLong = хвост (длинный, анимированный)
marking-EtherealPartsMAnimatedtailLong-ethereal_parts_m_waggingtail_long_BEHIND = хвост (длинный, анимированный)
marking-EtherealPartsMAnimatedtailLong-ethereal_parts_m_waggingtail_long_FRONT = хвост (длинный, анимированный, кончик)
marking-EtherealPartsMAnimatedtailStubby = хвост (коренастый, анимированный)
marking-EtherealPartsMAnimatedtailStubby-ethereal_parts_m_waggingtail_stubby_BEHIND = хвост (коренастый, анимированный)
marking-EtherealPartsMAnimatedtailStubby-ethereal_parts_m_waggingtail_stubby_FRONT = хвост (коренастый, анимированный, кончик)
marking-EtherealPartsEyesGlowGs = глаза (светящиеся)
marking-EtherealPartsEyesGlowGs-ethereal_parts_eyes_glow_gs = глаза
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
metabolizer-type-elzuosa = Elzuosa
Loading

0 comments on commit dfc62a1

Please sign in to comment.