Fix salvage cyborg ore bag#4058
Conversation
📝 WalkthroughWalkthroughВ файл прототипа сущности BorgOreBag добавлен компонент MagnetPickup с радиусом 3,75. Изменение расширяет функциональность сумки руды borgом, добавляя поведение магнитного подхвата к существующим компонентам без модификации остальной части конфигурации. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip CodeRabbit can generate a title for your PR based on the changes.Add |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml`:
- Around line 40-41: BorgOreBag already inherits MagnetPickup from OreBag so
duplicating the component has no effect; the real issue is that MagnetPickup
only activates when the container is in an inventory slot because
MagnetPickupSystem uses TryGetContainingSlot(); to fix, either place BorgOreBag
into an inventory slot (BELT) where the borg equips modules
(ItemBorgModule.hands) or update MagnetPickupSystem to treat “holding_container”
style containers as valid holders by extending TryGetContainingSlot() (or adding
a complementary check) to return true / treat those containers as a slot for
MagnetPickup activation; reference BorgOreBag, MagnetPickup, MagnetPickupSystem,
TryGetContainingSlot, holding_container, ItemBorgModule.hands, BELT when making
the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 174c3f4d-30af-4077-9d9e-e3f80fe68e0f
📒 Files selected for processing (1)
Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml
| - type: MagnetPickup # Sunrise-add | ||
| range: 3.75 # Sunrise-add No newline at end of file |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Где и как используется BorgOreBag
rg -nP --type=yaml -C4 '\bBorgOreBag\b|\bOreBag\b'
# 2) Логика активации MagnetPickup и дефолтные SlotFlags
rg -nP --type=cs -C4 'TryGetContainingSlot|slotDef\.SlotFlags|MagnetPickupComponent|SlotFlags\s*=\s*SlotFlags\.BELT'
# 3) Какие SlotFlags вообще доступны
rg -nP --type=cs -C3 'enum\s+SlotFlags|BELT|SUITSTORAGE|POCKET|PANTS'
# 4) Определения инвентарных слотов боргов/модулей (ищем slotFlags в YAML)
rg -nP --type=yaml -C4 'slotFlags:|slots:|borg|module'Repository: space-sunrise/sunrise-station
Length of output: 50387
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Найти определение borg_types.yml, где обычно определяются базовые параметры боргов
fd -t f 'borg' -e yml | head -20
# 2) Посмотреть, как именно используется BorgOreBag в borg_modules.yml
rg -n -A10 -B5 'item: BorgOreBag' Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml
# 3) Посмотреть определение Storage компонента в BorgOreBag (строка 36-41)
rg -n -A15 'id: BorgOreBag' Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml
# 4) Посмотреть определение слотов в borg inventory (где может быть ModuleSlot, HandSlot и т.д.)
rg -n 'ModuleSlot|HandSlot|slotFlags' Resources/Prototypes/_Sunrise/Entities/Structures/Closets/borg.yml 2>/dev/null || echo "File not found, searching for borg definitions..."
# 5) Найти все файлы с borg definitions
fd -t f 'borg.*yml' Resources/Prototypes/_Sunrise/ 2>/dev/null | head -10Repository: space-sunrise/sunrise-station
Length of output: 2973
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Полное содержимое OreBag с проверкой наследования
echo "=== OreBag full definition ==="
rg -n -A50 'id: OreBag' Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml | head -60
# 2) Полное определение BorgOreBag
echo -e "\n=== BorgOreBag full definition ==="
rg -n -A30 'id: BorgOreBag' Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml
# 3) Посмотреть borg_chassis.yml для определения слотов
echo -e "\n=== Borg chassis slots definition ==="
cat Resources/Prototypes/_Sunrise/Entities/Mobs/Cyborgs/borg_chassis.yml | head -150
# 4) Поиск HandSlot, ModuleSlot, слотов с SlotFlags
echo -e "\n=== Searching for hand/module slot definitions ==="
rg -n 'hands:|hand.*slot|ModuleSlot|SlotFlags' Resources/Prototypes/_Sunrise/Entities/Mobs/Cyborgs/borg_chassis.ymlRepository: space-sunrise/sunrise-station
Length of output: 4956
🏁 Script executed:
#!/bin/bash
set -euoripefail
# 1) Найти inventory template для borg (templateId: reaper показан в borg_chassis.yml)
echo "=== Searching for inventory templates ==="
fd -t f 'inventory' -e yml | xargs rg -l 'templateId|hands.*slot' | head -10
# 2) Поиск определения "hands" слота в borg inventory
echo -e "\n=== Searching for hands slot in borg inventory ==="
rg -n -B5 -A10 'hands.*:' Resources/Prototypes/_Sunrise/Entities/Mobs/Cyborgs/borg_chassis.yml
# 3) Найти InventoryTemplate definitions с "hands"
echo -e "\n=== Searching for InventoryTemplate with hands ==="
fd -t f -e yml Resources/Prototypes | xargs rg -l 'InventoryTemplate|templateId' | head -5
# 4) Поиск SlotFlags для "hands" слота
echo -e "\n=== Searching for hands slotFlags ==="
rg -n -B3 -A3 'hands.*SlotFlags|hands.*flags' Resources/Prototypes --type yaml
# 5) Поиск файла с определением slots/hands для borg
echo -e "\n=== Finding borg inventory slots ==="
rg -n -C5 '"hands"' Resources/Prototypes/_Sunrise/Entities/Mobs/Cyborgs/Repository: space-sunrise/sunrise-station
Length of output: 747
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Найти определение inventory templates (обычно в Inventory или SlotDefinitions)
echo "=== Searching for inventory template files ==="
fd -t f 'inventory' -e yml Resources/Prototypes | head -20
# 2) Поиск файлов с SlotDefinition
echo -e "\n=== Searching for SlotDefinition files ==="
rg -l 'SlotDefinition|InventoryTemplate' Resources/Prototypes --type yaml | head -10
# 3) Поиск "hands" в контексте borg
echo -e "\n=== Searching for hands in borg context ==="
rg -n 'hands' Resources/Prototypes/_Sunrise/Entities/Mobs/Cyborgs/ --type yaml
# 4) Поиск "hands" slot definition с SlotFlags
echo -e "\n=== Searching for hands slot with SlotFlags ==="
rg -n -B2 -A5 '"hands".*SlotFlags|hands.*:.*SlotFlags' Resources/Prototypes --type yamlRepository: space-sunrise/sunrise-station
Length of output: 1660
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Найти borg inventory templates
echo "=== Searching for borg inventory templates ==="
fd -t f 'borg' -e yml Resources/Prototypes/_Sunrise/InventoryTemplates/ 2>/dev/null || echo "No borg templates in _Sunrise"
# 2) Список всех borg inventory templates
echo -e "\n=== All inventory templates in _Sunrise ==="
ls -la Resources/Prototypes/_Sunrise/InventoryTemplates/ 2>/dev/null || echo "Directory not found"
# 3) Поиск "reaper" inventory (так как borg_chassis.yml указывает templateId: reaper)
echo -e "\n=== Searching for reaper inventory template ==="
rg -n 'reaper' Resources/Prototypes/InventoryTemplates/ --type yaml
# 4) Поиск всех inventory templates, содержащих "hands"
echo -e "\n=== Inventory templates with hands slot ==="
rg -l 'hands' Resources/Prototypes/InventoryTemplates/ --type yaml
# 5) Посмотреть содержимое drone_inventory_template.yml (возможно, похож на borg)
echo -e "\n=== Drone inventory template (reference) ==="
cat Resources/Prototypes/InventoryTemplates/drone_inventory_template.ymlRepository: space-sunrise/sunrise-station
Length of output: 738
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Прочитать reaper_inventory_template.yml
echo "=== Reaper inventory template ==="
cat Resources/Prototypes/_Sunrise/InventoryTemplates/reaper_inventory_template.yml
# Проверить, есть ли другие borg templates
echo -e "\n=== All borg-related inventory templates ==="
rg -n 'hands' Resources/Prototypes/_Sunrise/InventoryTemplates/ --type yaml -B2 -A2
# Для сравнения: посмотреть human inventory template (может быть использован как базовый)
echo -e "\n=== Human inventory template (for comparison) ==="
head -80 Resources/Prototypes/InventoryTemplates/human_inventory_template.ymlRepository: space-sunrise/sunrise-station
Length of output: 1707
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Посмотреть полное определение borg mining module
echo "=== Mining borg module definition ==="
rg -n -B5 -A30 'id: BorgModuleMining' Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml
# 2) Посмотреть определение ItemBorgModule компонента
echo -e "\n=== ItemBorgModule component definition ==="
fd -t f 'ItemBorgModule' Resources/Prototypes --type yaml -o | xargs rg -l 'ItemBorgModule' 2>/dev/null || echo "Searching in C# source..."
# 3) Посмотреть, как BorgOreBag может быть встроен в borg
echo -e "\n=== BorgOreBag usage context ==="
rg -n -B10 -A10 'BorgOreBag' Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml
# 4) Посмотреть базовый BorgChassisBase
echo -e "\n=== BaseBorgChassis definition ==="
rg -n -A50 'id: BaseBorgChassis' Resources/Prototypes/_Sunrise/Entities/Mobs/Cyborgs/borg_chassis.yml | head -80Repository: space-sunrise/sunrise-station
Length of output: 1781
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Посмотреть полное определение BorgModuleMining
echo "=== Complete BorgModuleMining definition ==="
rg -n -B10 -A50 'id: BorgModuleMining$' Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml
# 2) Посмотреть ItemBorgModuleComponent определение
echo -e "\n=== ItemBorgModuleComponent.cs ==="
head -100 Content.Shared/Silicons/Borgs/Components/ItemBorgModuleComponent.cs
# 3) Поиск BorgOreBag в borg modules
echo -e "\n=== All uses of BorgOreBag ==="
rg -n 'BorgOreBag' Resources/Prototypes/
# 4) Посмотреть ItemBorgModule раздел в mining module
echo -e "\n=== ItemBorgModule in mining module ==="
rg -n -B2 -A15 'ItemBorgModule' Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml | grep -A15 'BorgModuleMining\|ItemBorgModule'Repository: space-sunrise/sunrise-station
Length of output: 117
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Найти BorgModuleMining с более гибким поиском
echo "=== Search for BorgModuleMining ==="
rg -n 'BorgModuleMining' Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml | head -20
# 2) Показать контекст вокруг BorgModuleMining
echo -e "\n=== Context around BorgModuleMining ==="
rg -n -B5 -A20 'BorgModuleMining' Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml | head -100
# 3) Посмотреть ItemBorgModuleComponent
echo -e "\n=== ItemBorgModuleComponent ==="
cat Content.Shared/Silicons/Borgs/Components/ItemBorgModuleComponent.cs
# 4) Поиск MagnetPickupSystem и как он проверяет слоты
echo -e "\n=== MagnetPickupSystem slot check logic ==="
rg -n -B5 -A10 'TryGetContainingSlot' Content.Shared/Storage/EntitySystems/MagnetPickupSystem.csRepository: space-sunrise/sunrise-station
Length of output: 3417
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Найти все модули, которые содержат BorgOreBag
echo "=== Find all borg modules with BorgOreBag ==="
rg -n -B20 'BorgOreBag' Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml | head -150
# 2) Посмотреть базовый borg module
echo -e "\n=== BaseBorgModuleCargo definition ==="
rg -n -A30 'id: BaseBorgModuleCargo' Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml
# 3) Поиск "holding_container" в коде
echo -e "\n=== References to holding_container ==="
rg -n 'holding_container\|HoldingContainer' Content.Shared/Silicons/Borgs/ -t cs
# 4) Посмотреть SharedBorgSystem для понимания работы модулей
echo -e "\n=== SharedBorgSystem module handling ==="
rg -n -A20 'ItemBorgModule\|holding_container' Content.Shared/Silicons/Borgs/SharedBorgSystem.Module.cs | head -80Repository: space-sunrise/sunrise-station
Length of output: 118
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Просто посмотреть строку 616 в borg_modules.yml
echo "=== Line 616 in borg_modules.yml ==="
sed -n '610,625p' Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml
# 2) Посмотреть контекст вокруг BorgOreBag
echo -e "\n=== Context around line 616 ==="
sed -n '590,640p' Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml
# 3) Поиск полного определения mining module с BorgOreBag
echo -e "\n=== Full mining module definition ==="
rg -n 'mining-module\|BorgOreBag' Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml
# 4) Поиск с grep
echo -e "\n=== Grep for BorgOreBag ==="
grep -n 'BorgOreBag' Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.ymlRepository: space-sunrise/sunrise-station
Length of output: 181
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Просто посмотреть весь файл borg_modules.yml
echo "=== Total lines in borg_modules.yml ==="
wc -l Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml
# 2) Посмотреть последние 100 строк
echo -e "\n=== Last 100 lines ==="
tail -100 Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml
# 3) Поиск всех ItemBorgModule в файле
echo -e "\n=== All ItemBorgModule entries ==="
rg 'ItemBorgModule' Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.yml -B10 | head -150
# 4) Найти module ID, который использует BorgOreBag
echo -e "\n=== Finding module with BorgOreBag ==="
awk '/id:.*Borg.*Mining/{id=$0} /BorgOreBag/{print id}' Resources/Prototypes/_Sunrise/Entities/Objects/Specific/Robotics/borg_modules.ymlRepository: space-sunrise/sunrise-station
Length of output: 6313
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Посмотреть полное содержимое ore_bag.yml
echo "=== Complete ore_bag.yml ==="
cat Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml
# 2) Проверить, какие файлы ссылаются на BorgOreBag
echo -e "\n=== All references to BorgOreBag ==="
grep -rn 'BorgOreBag' Resources/Prototypes --include='*.yml'
# 3) Посмотреть mobpirate_lodout.yml context
echo -e "\n=== mobpirate_lodout.yml BorgOreBag context ==="
grep -n -B10 -A5 'BorgOreBag' Resources/Prototypes/_Sunrise/NPCs/PirateNPC/mobpirate_lodout.ymlRepository: space-sunrise/sunrise-station
Length of output: 2093
Добавление MagnetPickup в BorgOreBag не решит проблему с магнитом у борга.
На строке 40–41 добавлен компонент MagnetPickup, но это дублирование: BorgOreBag наследует MagnetPickup от родителя OreBag (строка 7–8) с тем же range: 3.75. Согласно механике наследования прототипов, переопределение компонента с идентичными параметрами не меняет поведение.
Главная проблема в другом: BorgOreBag используется в двух контекстах:
- В
borg_modules.yml:616— как предмет вItemBorgModule.hands(находится в контейнереholding_containerмодуля, вне инвентаря) - В
mobpirate_lodout.yml:489— какbeltв equipment (находится в инвентарном слотеBELT)
MagnetPickupSystem проверяет, находится ли контейнер в инвентарном слоте через TryGetContainingSlot(). Если результат false, магнит не активируется. Поскольку BorgOreBag в borg модуле хранится в holding_container (вне инвентаря), а не в слоте BELT, магнит не будет работать независимо от наличия компонента.
Для корректной работы требуется либо переместить BorgOreBag в инвентарный слот borg'а, либо изменить логику MagnetPickupSystem для поддержки встроенных контейнеров.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml` around
lines 40 - 41, BorgOreBag already inherits MagnetPickup from OreBag so
duplicating the component has no effect; the real issue is that MagnetPickup
only activates when the container is in an inventory slot because
MagnetPickupSystem uses TryGetContainingSlot(); to fix, either place BorgOreBag
into an inventory slot (BELT) where the borg equips modules
(ItemBorgModule.hands) or update MagnetPickupSystem to treat “holding_container”
style containers as valid holders by extending TryGetContainingSlot() (or adding
a complementary check) to return true / treat those containers as a slot for
MagnetPickup activation; reference BorgOreBag, MagnetPickup, MagnetPickupSystem,
TryGetContainingSlot, holding_container, ItemBorgModule.hands, BELT when making
the change.
|
Гляну на практике позже (и если что изменю логику MagnetPickupSystem) |
Кратное описание
Исправлен недочёт в сумках для руды шахтёрских киборгов.
По какой причине
Сумки для руды у шахтёрских киборгов не подбирали автоматически добытую руду с пола, в связи с этим приходилось вручную подбирать руду.
Changelog
🆑 Wardex
Summary by CodeRabbit
Новые функции