Skip to content

підствольні ліхтарики#301

Draft
CyberLanos wants to merge 4 commits intoSpaceStationUA:masterfrom
CyberLanos:feature/pistol-attachments
Draft

підствольні ліхтарики#301
CyberLanos wants to merge 4 commits intoSpaceStationUA:masterfrom
CyberLanos:feature/pistol-attachments

Conversation

@CyberLanos
Copy link

@CyberLanos CyberLanos commented Feb 11, 2026

About the PR

украв код з модифікаціями у шахтарських PKA, прикрутив можливість вішати ліхтарики на пістолети. в планах було прикрутити це взагалі на ВСЮ зброю, але мене розчарувало скільки там виходить повторюваного бойлеплейту, який особливо нікуди не заховаєш.

image

якщо якийсь провтикав - пишіть
можна повісити на:

  • Viper
  • Echis
  • Cobra
  • MK58
  • N1984
  • pulse pistol
  • makeshift laser pistol
  • disabler
  • advanced disabler
  • practice disabler
  • miniature energy gun
  • antique laser pistol
  • Dualetta
  • Anaconda
  • PDW-9 Energy Pistol
  • DT-12 Lawbringer
  • mk 32 "Universal" (+ unlethal)
  • M8

це не фінальний список, хай поки повисить, може ще щось додам або приберу, якщо виглядатиме дуже всрато

Media

image
compressed-video.1.mp4

Changelog

🆑

  • add: можливість вішати ліхтарики на пістолети
  • fix: випадково пофіксив - не з'являвся action коли в руках тримаєш пістолет\PKA і вішаєш на нього ліхтарик

Summary by CodeRabbit

Примітки до випуску

  • Нові функції
    • Додано підтримку прикріплюваних ліхтарів для зброї: слот модернізації, предмет ліхтаря та можливість вмикати/вимикати світло.
  • Покращення
    • Візуалізація ліхтаря на зброї зображається коректно (стан увімкн./вимкн., позиція).
    • Багато прототипів зброї оновлено для підтримки флешлайтів та контейнерів для них.

@github-actions
Copy link

github-actions bot commented Feb 11, 2026

RSI Diff Bot; head commit a3dcd5b merging into eb93dca
This PR makes changes to 1 or more RSIs. Here is a summary of all changes:

Resources/Textures/_Pirate/Objects/Weapons/Guns/Upgrades/gun_flashlight_attachment.rsi

State Old New Status
flight-on Added
flight Added

Edit: diff updated after a3dcd5b

@coderabbitai
Copy link

coderabbitai bot commented Feb 11, 2026

Walkthrough

Додає клієнтський візуалізатор ліхтарика для зброї, серверну логіку вставлення/видалення/перемикання ліхтарика, спільний метод для стилізації іконок дій, новий компонент конфігурації ліхтарика та мережеві візуали; а також оновлює прототипи та метадані текстур для підтримки апгрейду ліхтарика.

Changes

Cohort / File(s) Summary
Клієнтський візуалізатор
Content.Client/_Pirate/Weapons/Ranged/Upgrades/GunFlashlightAttachmentVisualizerSystem.cs
Додано систему візуалізації шару gun_flashlight, ініціалізує стан (on/off), слухає AppearanceChangeEvent і оновлює RSI, стан, зсув та видимість шару.
Серверна логіка апгрейдів
Content.Server/_Lavaland/Weapons/Ranged/Upgrades/GunUpgradeSystem.cs
Додано обробку вставлення, видалення та перемикання ліхтарика, інтеграцію з HandheldLightSystem і оновлення візуалів/доступних дій для зброї.
Спільна система дій
Content.Shared/Actions/SharedActionsSystem.cs
Додано публічний метод SetItemIconStyle(...) для оновлення стилю іконки дії та позначення компонента як dirty.
Компонент та мережеві візуали
Content.Shared/_Pirate/Weapons/Ranged/Upgrades/Components/GunFlashlightAttachmentComponent.cs, Content.Shared/_Pirate/Weapons/Ranged/Upgrades/GunFlashlightVisuals.cs
Додано компонент конфігурації ліхтарика (ResPath, стани, зсув) та NetSerializable enum GunFlashlightVisuals з Attached і LightOn.
Модифікації компонентів апгрейду
Content.Shared/_Lavaland/Weapons/Ranged/Upgrades/Components/GunUpgradeFlashlightComponent.cs
Розгорнуто декларацію компонента: додано поля для збереження оригінального ItemIconStyle, OriginalUseDelay та прапор HasSavedActionDefaults.
Прототипи — батарейна зброя
Resources/Prototypes/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml, Resources/Prototypes/_Goobstation/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml, Resources/Prototypes/_Pirate/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml
Додає GunFlashlightAttachment, UpgradeableWeapon, слот flashlight в ItemSlots та відповідні ContainerContainer/ContainerSlot для багатьох батарейних зброєн.
Прототипи — пістолети
Resources/Prototypes/Entities/Objects/Weapons/Guns/Pistols/pistols.yml, Resources/Prototypes/_Goobstation/Entities/Objects/Weapons/Guns/Pistols/pistol.yml, Resources/Prototypes/_Pirate/Entities/Objects/Weapons/Guns/Pistols/pistols.yml
Додає GunFlashlightAttachment з офсетом, слот апгрейду flashlight, UpgradeableWeapon і ContainerContainer/ContainerSlot для численних пістолетних прототипів; дрібні структурні корекції.
Текстури метадані
Resources/Textures/_Pirate/Objects/Weapons/Guns/Upgrades/gun_flashlight_attachment.rsi/meta.json
Додано meta.json з версією, ліцензією, розмірами і станами flight та flight-on.

Sequence Diagram(s)

sequenceDiagram
    participant Player
    participant Gun
    participant Server as GunUpgradeSystem (Server)
    participant Shared as SharedActionsSystem (Server)
    participant Client as GunFlashlightVisualizer (Client)
    Player->>Gun: Insert flashlight into upgrade slot
    Gun->>Server: FlashlightInsertedEvent
    Server->>Server: Validate & attach flashlight, update component visuals
    Server->>Shared: SetItemIconStyle(entity, style)
    Server->>Gun: Set Appearance(Attached=true)
    Gun->>Client: AppearanceChanged(Attached=true)
    Client->>Client: Ensure layer, set RSI/state/offset/visible

    Player->>Gun: Toggle flashlight
    Gun->>Server: FlashlightToggledEvent
    Server->>Gun: Set Appearance(LightOn=true/false)
    Gun->>Client: AppearanceChanged(LightOn=...)
    Client->>Client: Update sprite state to flight / flight-on

    Player->>Gun: Remove flashlight
    Gun->>Server: FlashlightRemovedEvent
    Server->>Gun: Set Appearance(Attached=false)
    Gun->>Client: AppearanceChanged(Attached=false)
    Client->>Client: Hide flashlight layer
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

size/XL

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR title is in Ukrainian (підствольні ліхтарики - "underbarrel flashlights") and accurately describes the main feature: adding flashlight attachments to pistols and weapons.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Vareniko
Copy link

Імба. Тепер. Можна косплеїти поліцію з хоррорів

@Vareniko
Copy link

Тільки за дизейберах і енергетичній зброї дивно виглядає. Було б краще певне тільки на звичайні, вогнепальні пістолети то дати

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Fix all issues with AI agents
In
`@Content.Client/_Pirate/Weapons/Ranged/Upgrades/GunFlashlightAttachmentVisualizerSystem.cs`:
- Line 9: Remove the unused import by deleting the "using
Robust.Shared.Serialization;" line from the top of
GunFlashlightAttachmentVisualizerSystem.cs; ensure no types or attributes from
Robust.Shared.Serialization are referenced in the class (e.g., check the
GunFlashlightAttachmentVisualizerSystem class and any methods or attributes) and
run a build/IDE cleanup to verify no remaining references before committing.

In `@Content.Server/_Lavaland/Weapons/Ranged/Upgrades/GunUpgradeSystem.cs`:
- Around line 233-249: GrantUpgradeActionsIfHeld currently passes the gun entity
into _actions.GrantActions but the gun may lack an ActionsContainerComponent so
GrantActions silently returns; fix by ensuring the component exists before
granting actions: call EnsureComp<ActionsContainerComponent>(gun) (or otherwise
add ActionsContainerComponent during weapon initialization) prior to invoking
_actions.GrantActions inside GrantUpgradeActionsIfHeld so the Resolve check
inside GrantActions succeeds and actions are actually granted.
- Around line 179-194: OnFlashlightRemoved currently only clears the ent icon
and visuals but doesn't restore the flashlight's original ItemIconStyle and
UseDelay or revoke the toggle action from a holder; update OnFlashlightRemoved
(GunUpgradeFlashlightComponent handling) to restore the previously saved values
(e.g. fields you add on GunUpgradeFlashlightComponent such as
OriginalItemIconStyle and OriginalUseDelay that were set when inserting the
flashlight) back onto the ActionComponent (found via
handheld.ToggleActionEntity) before nulling the icon, and if the gun is still
held by a player revoke the toggle action from that holder (call the action
system revoke for handheld.ToggleActionEntity.Value on the gun owner) so the
toggle button is removed from the actor's action bar; keep the existing call to
SetGunFlashlightVisuals(attached:false,on:false) and guard all operations by
null-checking ToggleActionEntity and the ActionComponent.

In `@Resources/Prototypes/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml`:
- Around line 428-441: You have repeated the same UpgradeableWeapon + ItemSlots
+ ContainerContainer boilerplate for flashlight slots across multiple battery
weapon defs; create a single abstract mix-in entity (e.g., id
BaseFlashlightUpgradeable, abstract: true) that includes the three components
(UpgradeableWeapon, ItemSlots with the flashlight slot whitelist for
GunUpgradeFlashlight, and ContainerContainer with flashlight container), then
replace the duplicated blocks in each battery weapon by adding that abstract
entity to the weapon's parent list so the weapons inherit the flashlight slot
instead of duplicating the YAML.
- Around line 439-442: The YAML is missing a blank line separator between entity
definitions—after the ContainerContainer block where containers.flashlight is
defined (using !type:ContainerSlot) add a single empty line before the next
entity declaration (e.g., before WeaponTeslaGun) and apply the same fix for the
other occurrences noted (the other places where a
ContainerContainer/ContainerSlot block is immediately followed by a new entity
declaration); ensure each entity block is separated by one blank line so the
file follows the same spacing convention.
- Around line 838-839: WeaponDisabler inherits GunFlashlightAttachment offset
"0.03125, 0.0625" from WeaponDisablerPractice which uses practice_disabler.rsi,
but WeaponDisabler overrides the sprite to disabler.rsi so the flashlight offset
may be wrong; explicitly override the GunFlashlightAttachment component in
WeaponDisabler to set the correct offset for disabler.rsi (adjust the offset
entry on the WeaponDisabler definition for GunFlashlightAttachment) so the
flashlight geometry matches the disabler.rsi sprite.

In
`@Resources/Textures/_Pirate/Objects/Weapons/Guns/Upgrades/gun_flashlight_attachment.rsi/meta.json`:
- Around line 1-17: The file ends without a trailing newline; open
Resources/Textures/_Pirate/Objects/Weapons/Guns/Upgrades/gun_flashlight_attachment.rsi/meta.json
and add a single '\n' at the end of the file so the last JSON token (e.g. the
closing brace for "states"/"flight-on") is followed by a newline, preserving the
existing content including keys like "version", "license", "size", and "states".

@coderabbitai coderabbitai bot added the size/XL label Feb 11, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@Content.Client/_Pirate/Weapons/Ranged/Upgrades/GunFlashlightAttachmentVisualizerSystem.cs`:
- Around line 50-63: EnsureLayer currently recreates a full PrototypeLayerData
each time; instead, when the layer already exists use the sprite API to update
only the necessary fields (set state and visibility) rather than calling
LayerSetData with a new PrototypeLayerData; specifically, in EnsureLayer check
for existing layer via _sprite.LayerMapTryGet and if present call the sprite
methods that update state and visibility for that layer (e.g.,
LayerSetState/LayerSetVisible or the equivalent in your sprite API) and only
reserve+LayerSetData when the layer does not exist; apply the same change to the
UpdateLayer block referenced (lines ~65-77) so it only updates State and Visible
instead of recreating the entire PrototypeLayerData.

@CyberLanos CyberLanos marked this pull request as draft February 12, 2026 16:31
@SpaceCowboyServer
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants