forked from space-syndicate/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,496 changed files
with
16,318 additions
and
2,163 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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,11 +1,11 @@ | ||
# Last match in file takes precedence. | ||
|
||
# Ping for all PRs | ||
* @Morb0 | ||
# C# | ||
*.cs @Tornado-Technology @AwareFoxy @FireNameFN | ||
|
||
# Ping for all PRs that include translations/editing fluent strings | ||
*.ftl @ficcialfaint | ||
# Prototypes | ||
*.yml @Vonsant | ||
|
||
# Map files | ||
/Resources/Prototypes/Maps/** @Ko4ergaPunk | ||
/Resources/Maps/** @Ko4ergaPunk | ||
# TTS | ||
|
||
/Content.*/Corvax/TTS @Morb0 |
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
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,9 @@ | ||
// CorvaxNext Change Start | ||
|
||
using Content.Shared.Smoking.Systems; | ||
|
||
namespace Content.Client.Smoking; | ||
|
||
public sealed class MatchstickSystem : SharedMatchstickSystem; | ||
|
||
// CorvaxNext Change End |
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,89 @@ | ||
using System.Linq; | ||
using Content.Shared._CorvaxNext.Cards.Card; | ||
using Robust.Client.GameObjects; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Client._CorvaxNext.Cards.Card; | ||
|
||
/// <summary> | ||
/// Handles the initialization and updating of card sprites on the client side, | ||
/// particularly when a card is flipped or when the component starts up. | ||
/// </summary> | ||
public sealed class CardSystem : EntitySystem | ||
{ | ||
/// <inheritdoc/> | ||
public override void Initialize() | ||
{ | ||
SubscribeLocalEvent<CardComponent, ComponentStartup>(OnComponentStartupEvent); | ||
SubscribeNetworkEvent<CardFlipUpdatedEvent>(OnFlip); | ||
} | ||
|
||
private void OnComponentStartupEvent(EntityUid uid, CardComponent comp, ComponentStartup args) | ||
{ | ||
if (!TryComp(uid, out SpriteComponent? spriteComponent)) | ||
return; | ||
|
||
var layerCount = spriteComponent.AllLayers.Count(); | ||
for (var i = 0; i < layerCount; i++) | ||
{ | ||
if (!spriteComponent.TryGetLayer(i, out var layer) || layer.State == null || layer.State.Name == null) | ||
continue; | ||
|
||
var rsi = layer.RSI ?? spriteComponent.BaseRSI; | ||
if (rsi == null) | ||
continue; | ||
|
||
comp.FrontSprite.Add(new SpriteSpecifier.Rsi(rsi.Path, layer.State.Name)); | ||
} | ||
|
||
comp.BackSprite ??= comp.FrontSprite; | ||
|
||
// Removed Dirty(uid, comp); as calling Dirty on the client is inappropriate. | ||
UpdateSprite(uid, comp); | ||
} | ||
|
||
private void OnFlip(CardFlipUpdatedEvent args) | ||
{ | ||
var entity = GetEntity(args.Card); | ||
if (!TryComp(entity, out CardComponent? comp)) | ||
return; | ||
|
||
UpdateSprite(entity, comp); | ||
} | ||
|
||
private void UpdateSprite(EntityUid uid, CardComponent comp) | ||
{ | ||
var newSprite = comp.Flipped ? comp.BackSprite : comp.FrontSprite; | ||
if (newSprite == null) | ||
return; | ||
|
||
if (!TryComp(uid, out SpriteComponent? spriteComponent)) | ||
return; | ||
|
||
var layerCount = newSprite.Count; | ||
var spriteLayerCount = spriteComponent.AllLayers.Count(); | ||
|
||
// Inserts missing layers | ||
if (spriteLayerCount < layerCount) | ||
{ | ||
for (var i = spriteLayerCount; i < layerCount; i++) | ||
{ | ||
spriteComponent.AddBlankLayer(i); | ||
} | ||
} | ||
// Removes extra layers | ||
else if (spriteLayerCount > layerCount) | ||
{ | ||
for (var i = spriteLayerCount - 1; i >= layerCount; i--) | ||
{ | ||
spriteComponent.RemoveLayer(i); | ||
} | ||
} | ||
|
||
for (var i = 0; i < layerCount; i++) | ||
{ | ||
var layer = newSprite[i]; | ||
spriteComponent.LayerSetSprite(i, layer); | ||
} | ||
} | ||
} |
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,85 @@ | ||
using System.Linq; | ||
using Content.Shared._CorvaxNext.Cards.Stack; | ||
using Robust.Client.GameObjects; | ||
|
||
namespace Content.Client._CorvaxNext.Cards; | ||
|
||
/// <summary> | ||
/// Manages the visual representation of card stacks by dynamically adjusting and configuring sprite layers | ||
/// based on the number of cards in the stack and their properties. | ||
/// </summary> | ||
public sealed class CardSpriteSystem : EntitySystem | ||
{ | ||
/// <inheritdoc/> | ||
public override void Initialize() | ||
{ | ||
|
||
} | ||
|
||
public bool TryAdjustLayerQuantity(Entity<SpriteComponent, CardStackComponent> uid, int? cardLimit = null) | ||
{ | ||
var sprite = uid.Comp1; | ||
var stack = uid.Comp2; | ||
var cardCount = cardLimit == null ? stack.Cards.Count : Math.Min(stack.Cards.Count, cardLimit.Value); | ||
|
||
var layerCount = 0; | ||
//Gets the quantity of layers | ||
foreach (var card in stack.Cards.TakeLast(cardCount)) | ||
{ | ||
if (!TryComp(card, out SpriteComponent? cardSprite)) | ||
return false; | ||
|
||
layerCount += cardSprite.AllLayers.Count(); | ||
} | ||
//inserts Missing Layers | ||
if (sprite.AllLayers.Count() < layerCount) | ||
{ | ||
for (var i = sprite.AllLayers.Count(); i < layerCount; i++) | ||
{ | ||
sprite.AddBlankLayer(i); | ||
} | ||
} | ||
//Removes extra layers | ||
else if (sprite.AllLayers.Count() > layerCount) | ||
{ | ||
for (var i = sprite.AllLayers.Count() - 1; i >= layerCount; i--) | ||
{ | ||
sprite.RemoveLayer(i); | ||
} | ||
} | ||
|
||
|
||
return true; | ||
} | ||
|
||
public bool TryHandleLayerConfiguration(Entity<SpriteComponent, CardStackComponent> uid, int cardCount, Func<Entity<SpriteComponent>, int, int, bool> layerFunc) | ||
{ | ||
var sprite = uid.Comp1; | ||
var stack = uid.Comp2; | ||
|
||
// int = index of what card it is from | ||
List<(int, ISpriteLayer)> layers = []; | ||
|
||
var i = 0; | ||
foreach (var card in stack.Cards.TakeLast(cardCount)) | ||
{ | ||
if (!TryComp(card, out SpriteComponent? cardSprite)) | ||
return false; | ||
layers.AddRange(cardSprite.AllLayers.Select(layer => (i, layer))); | ||
i++; | ||
} | ||
|
||
var j = 0; | ||
foreach (var obj in layers) | ||
{ | ||
var (cardIndex, layer) = obj; | ||
sprite.LayerSetVisible(j, true); | ||
sprite.LayerSetTexture(j, layer.Texture); | ||
sprite.LayerSetState(j, layer.RsiState.Name); | ||
layerFunc.Invoke((uid, sprite), cardIndex, j); | ||
j++; | ||
} | ||
|
||
return true; | ||
} | ||
} |
Oops, something went wrong.