Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

SS14 Graphics SpriteSystem

БесплатноБез исполняемых скриптовНе проверен

An in-depth practical guide to SpriteSystem in Space Station 14: lifecycle, full API for groups of methods, working with layers and layer-map, practical…

makura-gamesот makura-games★ 74 звезды на GitHub

Об этом скилле

#SpriteSystem in SS14

This skill only covers SpriteSystem and the practice of its application in the current SS14 architecture :) Related topics (GenericVisualizer, Appearance, overlays, shaders, UI) are covered in separate skills.

When to use

Use SpriteSystem when you need:

  • change the appearance of an entity in runtime on the client;
  • manage layers, their visibility, color, offset, RSI/texture;
  • dynamically add/remove layers;
  • use layer map for stable addressing of layers by key;
  • make accurate visual updates from visualizer systems.

Don’t bring logic here that can only be prototyped (static Sprite without dynamics), and don’t mix SpriteSystem with network business logic.

Source of truth

  • Consider outdated examples on direct calls to SpriteComponent historical.

SpriteSystem mental model

  1. The server and shared layer decide the state of the gameplay.
  2. The client receives state data (often via an appearance/visualizer).
  3. The client system calls SpriteSystem and changes only the visual appearance.
  4. The sprite is rendered from a set of layers (Layer) with their parameters.
  5. Layer map gives stable keys (Enum/string) instead of "magic" indexes.

Idea: the visual changes locally, deterministically and cheaply over the network :)

API parsing (by groups)

1) Entity-level setters

Use for properties of the entire sprite:

  • SetScale, SetRotation, SetOffset
  • SetVisible, SetDrawDepth, SetColor
  • SetBaseRsi, SetContainerOccluded
  • SetSnapCardinals, SetGranularLayersRendering

2) Layer CRUD

Creating/deleting layers:

  • AddBlankLayer
  • AddLayer (from Layer, SpriteSpecifier, PrototypeLayerData)
  • AddRsiLayer
  • AddTextureLayer
  • RemoveLayer
  • TryGetLayer
  • LayerExists

3) Layer map API

Key mapping operations:

  • LayerMapSet, LayerMapAdd
  • LayerMapRemove
  • LayerMapTryGet, LayerMapGet
  • LayerMapReserve

The Enum and string keys are supported. For project code, usually choose Enum.

4) Layer mutators (main working set)

  • LayerSetData
  • LayerSetSprite
  • LayerSetTexture
  • LayerSetRsiState
  • LayerSetRsi
  • LayerSetScale
  • LayerSetRotation
  • LayerSetOffset
  • LayerSetVisible
  • LayerSetColor
  • LayerSetDirOffset
  • LayerSetAnimationTime
  • LayerSetAutoAnimated
  • LayerSetRenderingStrategy

5) Layer getters

  • LayerGetRsiState
  • LayerGetEffectiveRsi
  • LayerGetDirections
  • LayerGetDirectionCount

6) Bounds / Render / Helpers

  • GetLocalBounds (for the entire sprite and a separate layer)
  • CalculateBounds
  • RenderSprite
  • GetFrame
  • Frame0, RsiStateLike
  • GetIcon, GetPrototypeIcon, GetPrototypeTextures
  • GetFallbackState, GetFallbackTexture
  • GetState, GetTexture
  • GetSpriteWorldPosition, GetSpriteScreenCoordinates

7) Utility methods

  • ForceUpdate
  • SetAutoAnimateSync (for sprite/layer)
  • CopySprite
  • QueueUpdateIsInert / QueueUpdateInert

Overload pattern

Most layer methods have variants:

  • by index int;
  • by key Enum;
  • by key string;
  • by object Layer.

Rule: in gameplay code, Enum keys via layer map are preferable.

Must know about obsolete wrappers

SpriteComponent has many deprecated proxy methods ([Obsolete]) that redirect to SpriteSystem.

Why is direct calls to SpriteComponent an anti-pattern:

  • blurring the unified update API;
  • complicate refactoring and auditing of visual changes;
  • break consistency with the modern ECS style in the project;
  • increase the risk of silent regressions when changing the engine ⚠

Briefly: new code is written through SpriteSystem, not through the old component methods.

Practical examples

Example 1: Basic entity sprite setup

public void ApplyMachineLook(EntityUid uid, SpriteComponent sprite, bool highlighted)
{
    // We change only the visual properties of the entity.
    _sprite.SetVisible((uid, sprite), true);
    _sprite.SetDrawDepth((uid, sprite), (int)DrawDepth.Machines);
    _sprite.SetColor((uid, sprite), highlighted ? Color.Cyan : Color.White);
}

Example 2: layer reserve by enum key and data filling

private enum MachineLayerKey : byte
{
    Base,
    Status
}

public void SetStatusLayer(EntityUid uid, SpriteComponent sprite, PrototypeLayerData data)
{
    // We guarantee the presence of a layer under the key.
    var index = _sprite.LayerMapReserve((uid, sprite), MachineLayerKey.Status);

    // We update the entire layer via PrototypeLayerData.
    _sprite.LayerSetData((uid, sprite), index, data);
    _sprite.LayerSetVisible((uid, sprite), index, true);
}

Example 3: Safely deleting a layer by key

public void HideStatusLayer(EntityUid uid, SpriteComponent sprite)
{
    // We don’t consider the absence of a layer an error: this is a normal idempotent flow.
    _sprite.RemoveLayer((uid, sprite), MachineLayerKey.Status, logMissing: false);
}

Example 4: Dynamically generati

Полный SKILL.md на GitHub

Установить SS14 Graphics SpriteSystem в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл SS14 Graphics SpriteSystem?

An in-depth practical guide to SpriteSystem in Space Station 14: lifecycle, full API for groups of methods, working with layers and layer-map, practical patterns and anti-patterns. Use it when developing dynamic sprites, visualizer systems and refactoring outdated SpriteComponent calls.

Как установить скилл SS14 Graphics SpriteSystem?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл SS14 Graphics SpriteSystem запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить SS14 Graphics SpriteSystem с