Conversation
WalkthroughДодає клієнтський візуалізатор ліхтарика для зброї, серверну логіку вставлення/видалення/перемикання ліхтарика, спільний метод для стилізації іконок дій, новий компонент конфігурації ліхтарика та мережеві візуали; а також оновлює прототипи та метадані текстур для підтримки апгрейду ліхтарика. Changes
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
|
Імба. Тепер. Можна косплеїти поліцію з хоррорів |
|
Тільки за дизейберах і енергетичній зброї дивно виглядає. Було б краще певне тільки на звичайні, вогнепальні пістолети то дати |
There was a problem hiding this comment.
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".
Content.Client/_Pirate/Weapons/Ranged/Upgrades/GunFlashlightAttachmentVisualizerSystem.cs
Outdated
Show resolved
Hide resolved
Resources/Prototypes/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml
Show resolved
Hide resolved
Resources/Prototypes/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml
Show resolved
Hide resolved
Resources/Prototypes/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml
Show resolved
Hide resolved
...urces/Textures/_Pirate/Objects/Weapons/Guns/Upgrades/gun_flashlight_attachment.rsi/meta.json
Show resolved
Hide resolved
There was a problem hiding this comment.
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.
Content.Client/_Pirate/Weapons/Ranged/Upgrades/GunFlashlightAttachmentVisualizerSystem.cs
Show resolved
Hide resolved
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |


About the PR
украв код з модифікаціями у шахтарських PKA, прикрутив можливість вішати ліхтарики на пістолети. в планах було прикрутити це взагалі на ВСЮ зброю, але мене розчарувало скільки там виходить повторюваного бойлеплейту, який особливо нікуди не заховаєш.
якщо якийсь провтикав - пишіть
можна повісити на:
це не фінальний список, хай поки повисить, може ще щось додам або приберу, якщо виглядатиме дуже всрато
Media
compressed-video.1.mp4
Changelog
🆑
Summary by CodeRabbit
Примітки до випуску