Skip to content

Слизнекоты. #3281

Open
nopeingeneer wants to merge 9 commits into
BlueMoon-Labs:masterfrom
nopeingeneer:slugcat
Open

Слизнекоты. #3281
nopeingeneer wants to merge 9 commits into
BlueMoon-Labs:masterfrom
nopeingeneer:slugcat

Conversation

@nopeingeneer

@nopeingeneer nopeingeneer commented May 29, 2026

Copy link
Copy Markdown

Переношу слизнекотов с 1984. ПР не доделан - не мерджить.

Summary by CodeRabbit

Обновления

  • New Features
    • Добавлен новый дружелюбный питомец — слизнекот с тремя вариантами: монах, охотник, золотой.
    • Слизнекот получил режимы поведения (включая возможность лечь) и улучшенную видимость в темноте.
    • Реализовано экипирование: предметы на голову (с визуальным оверлеем) и копьё в лапах, с переключением стойки и боевых параметров.
    • Инвентарь управляется через диалоговое окно; при смерти надетые предметы сбрасываются.
    • Добавлена поддержка вент-кроулинга.

@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@nopeingeneer, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 3 minutes and 24 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4365bbec-ca9e-4221-9143-87a3f09eb3ec

📥 Commits

Reviewing files that changed from the base of the PR and between aca9f48 and 7b7fd31.

📒 Files selected for processing (1)
  • modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm

Walkthrough

Добавлен новый файл slugcat.dm, определяющий дружелюбного питомца /mob/living/simple_animal/pet/slugcat с тремя подтипами (monk, hunter, gold), инвентарными слотами для шляпы и копья, HTML-диалогом для управления предметами, визуальными оверлеями и боевой логикой копья. Файл подключён в tgstation.dme.

Changes

Slugcat friendly pet mob

Layer / File(s) Summary
Объявление типа, переменные, подтипы и инициализация
modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm
Базовый тип /mob/living/simple_animal/pet/slugcat с переменными для инвентарных слотов головы и руки, флагами is_pacifist и is_reduce_damage, параметрами оверлея; подтипы monk (пацифист, низкий HP), hunter (враждебный) и gold (высокий HP, без спавна); две реализации Initialize подключают verb lay_down, элемент ventcrawling и синхронизируют иконки.
Обработчики взаимодействий: attackby, death, Topic
modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm
attackby() маршрутизирует предметы по намерению игрока (HELP — надевание шляпы, !HARM — приём копья, прочее — базовая логика); death() сбрасывает оба слота перед смертью; Topic() реализует HTML-диалог управления инвентарём с валидацией дистанции, смерти и типа пользователя.
Визуализация: оверлеи, мобильность, режим копья
modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm
regenerate_icons() синхронизирует overlay шляпы; update_mobility() переключает icon_state на rest при невозможности стоять и сбрасывает копьё; speared()/unspeared() переключают icon_state, звук атаки, границы урона и пробитие брони; get_hat_overlay() строит image-объект для оверлея.
Управление головным убором
modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm
show_inv() формирует HTML-страницу диалога слотов; place_on_head() валидирует тип и переносит предмет с уведомлением; remove_from_head() снимает в руки пользователя; drop_hat() и null_hat() сбрасывают и обнуляют параметры оверлея.
Управление копьём и боевой режим
modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm
place_to_hand() валидирует тип копья, проверяет resting-статус и флаг пацифизма, переносит предмет с уведомлением и активирует режим копья; move_item_to_hand() переносит в слот; remove_from_hand() и drop_hand() снимают/сбрасывают; null_hand() деактивирует боевой режим.
Подключение модуля
tgstation.dme
#include директива добавляет файл slugcat.dm в сборку проекта.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive Заголовок связан с изменениями, но слишком общий и не отражает суть конкретной доработки. Уточните заголовок, например: «Добавлены модульные слизнекоты с экипировкой и UI инвентаря».
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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


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.

@XaeshkaVD

Copy link
Copy Markdown

Слизнекотики
мраф~~

@nopeingeneer nopeingeneer marked this pull request as ready for review June 23, 2026 12:44
@nopeingeneer nopeingeneer changed the title Слизнекоты. WIP Слизнекоты. Jun 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm (1)

45-45: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Используйте grant_action вместо устаревшего add_verb.

Паттерн add_verb() устарел. Для добавления действий (verbs) предпочтительно использовать систему actions через grant_action().

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm` at
line 45, The add_verb() call in the slugcat initialization is using a deprecated
pattern for adding verbs to mobs. Replace the add_verb(src,
/mob/living/proc/lay_down) call with the grant_action() function instead, which
is the preferred modern approach for adding actions to mobs. Ensure you pass the
appropriate action object or reference to grant_action() that corresponds to the
lay_down action you want to grant.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm`:
- Around line 216-220: The show_inv() method displays UI elements for collar
interactions with href links for remove_inv=collar and add_inv=collar actions,
but the Topic() method does not have any code to handle these actions. Add
handling in the Topic() method for both remove_inv=collar and add_inv=collar
cases similar to how other inventory actions are handled in that method (check
for these parameters in the href and implement the corresponding logic).
Alternatively, if collar functionality is not intended to be implemented, remove
the collar-related href lines from the show_inv() method to avoid showing UI
elements that do nothing when clicked.
- Around line 84-86: The slugcat mob has initialization logic in the New()
method that conflicts with the existing Initialize() method. Move the
regenerate_icons() call from the New() method to the end of the existing
Initialize() method, then delete the entire New() method. This ensures all atom
initialization follows the proper pattern by using Initialize() instead of
New().
- Around line 107-110: The logical condition in the if statement at slugcat.dm
uses incorrect negation that reverses the intended access control logic. The
condition `!(iscarbon(usr) || usr.incapacitated() || !Adjacent(usr))` currently
denies access only to non-carbon mobs that are capable and adjacent, while
allowing carbon mobs unrestricted access. Remove the outer negation operator
from the condition so that it reads without the leading exclamation mark, which
will correctly close the browser window when the user is not carbon, is
incapacitated, or is not adjacent to the slugcat.

---

Nitpick comments:
In `@modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm`:
- Line 45: The add_verb() call in the slugcat initialization is using a
deprecated pattern for adding verbs to mobs. Replace the add_verb(src,
/mob/living/proc/lay_down) call with the grant_action() function instead, which
is the preferred modern approach for adding actions to mobs. Ensure you pass the
appropriate action object or reference to grant_action() that corresponds to the
lay_down action you want to grant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c677bac4-d63b-4b4a-9329-bb76691db1d3

📥 Commits

Reviewing files that changed from the base of the PR and between dfba011 and f8d3f08.

📒 Files selected for processing (3)
  • modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm
  • modular_sand/icons/mob/animal.dmi
  • tgstation.dme

Comment thread modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm Outdated
Comment thread modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm Outdated
Comment thread modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm (5)

28-29: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Добавьте Destroy() для очистки ссылок на предметы.

inventory_head и inventory_hand держат сильные ссылки на datums/items, но тип не очищает их при qdel slugcat'а вне death(). Это оставляет риск зависших contents/ref cycles при удалении моба напрямую.

🧹 Возможное исправление
+/mob/living/simple_animal/pet/slugcat/Destroy()
+	if(inventory_head)
+		inventory_head.forceMove(get_turf(src))
+		inventory_head.dropped(src)
+		null_hat()
+	if(inventory_hand)
+		inventory_hand.forceMove(get_turf(src))
+		inventory_hand.dropped(src)
+		null_hand()
+	return ..()
+
 /mob/living/simple_animal/pet/slugcat/proc/null_hand()
 	unspeared()
 	inventory_hand = null

As per path instructions: «Destroy() must call parent and return a QDEL_HINT» и «Destroy() must null out all references to other datums to allow GC».

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm`
around lines 28 - 29, The slugcat type declares strong references to items via
the variables inventory_head and inventory_hand, but does not clean up these
references when the object is deleted outside the death() function, creating
potential garbage collection issues and reference cycles. Implement a Destroy()
method in the slugcat type that nulls out both inventory_head and inventory_hand
references to break any lingering references to datum objects, then call the
parent Destroy() method and return an appropriate QDEL_HINT to allow proper
garbage collection.

Source: Path instructions


158-170: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Сбрасывайте offset шляпы независимо от наличия шляпы.

Если slugcat лёг, затем шляпу сняли, а потом он встал, hat_offset_y останется hat_offset_y_rest, потому что строка 167 сбрасывает offset только при inventory_head. Следующая надетая шляпа будет отрисована как для лежачего состояния.

🐛 Предлагаемое исправление
 /mob/living/simple_animal/pet/slugcat/update_mobility()
 	. = ..()
 	if(stat != DEAD)
 		if(!CHECK_MOBILITY(src, MOBILITY_STAND))
-			if(inventory_head || inventory_hand)
-				hat_offset_y = hat_offset_y_rest
+			hat_offset_y = hat_offset_y_rest
+			if(inventory_hand)
 				drop_hand()
 			icon_state = "[icon_living]_rest"
 		else
-			if(inventory_head)
-				hat_offset_y = initial(hat_offset_y)
+			hat_offset_y = initial(hat_offset_y)
 			icon_state = "[icon_living]"
 		regenerate_icons()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm`
around lines 158 - 170, In the update_mobility() function for the slugcat pet,
the hat offset is only being reset to its initial value when the creature is
standing AND has a hat in inventory. However, the offset should be reset
whenever the creature stands up, regardless of whether a hat is currently
equipped. Move the hat_offset_y assignment that sets it to initial(hat_offset_y)
outside of the inventory_head conditional check so that it executes for all
standing creatures, not just those with a hat equipped.

210-220: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Локализуйте UI labels в popup.

Nothing, Inventory of, Head и Hand — пользовательские labels в browser UI, а не технические identifiers. Сейчас они выбиваются из русскоязычных сообщений этого же интерфейса.

🌐 Предлагаемое исправление
-		head_href = "<A href='?src=\[UID()\];add_inv=head'>Nothing</A>"
+		head_href = "<A href='?src=\[UID()\];add_inv=head'>Пусто</A>"
@@
-		hand_href = "<A href='?src=\[UID()\];add_inv=hand'>Nothing</A>"
+		hand_href = "<A href='?src=\[UID()\];add_inv=hand'>Пусто</A>"
@@
-	var/dat = {"<meta charset="UTF-8"><div align='center'><b>Inventory of \[name\]</b></div><p>"}
-	dat += "<br><B>Head:</B> [head_href]"
-	dat += "<br><B>Hand:</B> [hand_href]"
+	var/dat = {"<meta charset="UTF-8"><div align='center'><b>Инвентарь \[name\]</b></div><p>"}
+	dat += "<br><B>Голова:</B> [head_href]"
+	dat += "<br><B>Лапы:</B> [hand_href]"

As per path instructions: English is fine for name/desc and mechanic identifiers, but user-facing chat/UI labels should be localized.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm`
around lines 210 - 220, The UI labels displayed in the browser popup (Nothing,
Inventory of, Head, and Hand) are hardcoded in English and should be localized
to match the interface language. Replace the hardcoded English strings in the
head_href and hand_href variable assignments and in the dat string construction
with appropriate localization function calls. Specifically, update the "Nothing"
text in both href assignments, the "Inventory of" text in the meta charset
section, and the "Head:" and "Hand:" labels in the dat concatenation lines to
use your localization system instead of hardcoded English strings.

Source: Path instructions


298-304: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Проверяйте is_pacifist до сброса предмета из рук.

Для monk/pacifist slugcat строка 298 уже роняет копьё на землю, а строки 302-304 потом отказывают в экипировке. В итоге отклонённое действие всё равно меняет инвентарь пользователя.

🐛 Предлагаемое исправление
-	if(user && !user.dropItemToGround(item_to_add))
-		to_chat(user, span_warning("Предмет застрял в ваших руках!"))
-		return FALSE
-
 	if(is_pacifist)
 		to_chat(user, span_warning("Этот слизнекот - пацифист и не пользуется оружием!"))
 		return FALSE
+
+	if(user && !user.dropItemToGround(item_to_add))
+		to_chat(user, span_warning("Предмет застрял в ваших руках!"))
+		return FALSE
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm`
around lines 298 - 304, The `is_pacifist` check is performed after the
`dropItemToGround` operation, which means a pacifist slugcat will still drop the
item even though the action is subsequently rejected. Move the `is_pacifist`
condition check before the user.dropItemToGround call so that the function
returns FALSE without modifying the user's inventory when the slugcat is a
pacifist. This ensures rejected actions do not have side effects on inventory
state.

206-221: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Экранируйте динамические значения перед вставкой в browser HTML.

name, [inventory_head], [inventory_hand] и [src] попадают в HTML без html_encode(). Если имя предмета/моба содержит HTML, popup можно сломать или внедрить лишние ссылки/разметку.

🛡️ Предлагаемое исправление
 	var/head_href
 	if(inventory_head)
-		head_href = "<A href='?src=\[UID()\];remove_inv=head'>\[inventory_head\]</A>"
+		var/head_name = html_encode("[inventory_head]")
+		head_href = "<A href='?src=\[UID()\];remove_inv=head'>[head_name]</A>"
 	else
 		head_href = "<A href='?src=\[UID()\];add_inv=head'>Nothing</A>"
 
 	var/hand_href
 	if(inventory_hand)
-		hand_href = "<A href='?src=\[UID()\];remove_inv=hand'>\[inventory_hand\]</A>"
+		var/hand_name = html_encode("[inventory_hand]")
+		hand_href = "<A href='?src=\[UID()\];remove_inv=hand'>[hand_name]</A>"
 	else
 		hand_href = "<A href='?src=\[UID()\];add_inv=hand'>Nothing</A>"
 
-	var/dat = {"<meta charset="UTF-8"><div align='center'><b>Inventory of \[name\]</b></div><p>"}
+	var/slugcat_name = html_encode("[name]")
+	var/dat = {"<meta charset="UTF-8"><div align='center'><b>Inventory of [slugcat_name]</b></div><p>"}
 	dat += "<br><B>Head:</B> [head_href]"
 	dat += "<br><B>Hand:</B> [hand_href]"
-	var/datum/browser/popup = new(user, "mob\[UID()\]", "\[src\]", 440, 250)
+	var/datum/browser/popup = new(user, "mob\[UID()\]", html_encode("[src]"), 440, 250)

Based on learnings: html_encode() безопасен для Unicode/Cyrillic и не ломает русские строки.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm`
around lines 206 - 221, The code constructs HTML content with dynamic values
from name, inventory_head, inventory_hand, and src without properly escaping
them using html_encode(). This allows potentially malicious or malformed HTML in
these values to break the popup layout or inject unwanted markup. Wrap all
dynamic values being inserted into the dat HTML string with html_encode() to
safely escape any HTML special characters. Specifically, apply html_encode() to
the name variable when inserted into the dat string, to inventory_head and
inventory_hand when used as text content in the anchor tags, and to src when
inserted as the window title in the browser datum creation.

Source: Learnings

🧹 Nitpick comments (1)
modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm (1)

32-33: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Вынесите неочевидные числовые значения в #define.

Смещения шляпы и делитель урона копья являются gameplay/icon tuning constants; сейчас их смысл теряется в -8, -19 и 2.

♻️ Предлагаемое исправление
+#define SLUGCAT_HAT_OFFSET_Y -8
+#define SLUGCAT_HAT_OFFSET_Y_REST -19
+#define SLUGCAT_REDUCED_SPEAR_DAMAGE_DIVISOR 2
+
 /mob/living/simple_animal/pet/slugcat
@@
-	var/hat_offset_y = -8
-	var/hat_offset_y_rest = -19
+	var/hat_offset_y = SLUGCAT_HAT_OFFSET_Y
+	var/hat_offset_y_rest = SLUGCAT_HAT_OFFSET_Y_REST
@@
-	melee_damage_lower = round(spear_weapon.force / (is_reduce_damage ? 2 : 1))
-	melee_damage_upper = round(spear_weapon.force / (is_reduce_damage ? 2 : 1))
+	melee_damage_lower = round(spear_weapon.force / (is_reduce_damage ? SLUGCAT_REDUCED_SPEAR_DAMAGE_DIVISOR : 1))
+	melee_damage_upper = round(spear_weapon.force / (is_reduce_damage ? SLUGCAT_REDUCED_SPEAR_DAMAGE_DIVISOR : 1))

As per path instructions: «No magic numbers — use #define constants».

Also applies to: 179-180

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm`
around lines 32 - 33, The hardcoded numeric values -8, -19, and 2 used for hat
offset adjustments and spear damage calculations are magic numbers that reduce
code clarity. Create `#define` constants with descriptive names for each of these
values (the hat_offset_y value of -8, the hat_offset_y_rest value of -19, and
the spear damage divisor of 2) at the top of the file, then replace all
instances of these magic numbers throughout the slugcat.dm file with references
to the corresponding `#define` constants to make the gameplay tuning values
self-documenting.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm`:
- Around line 28-29: The slugcat type declares strong references to items via
the variables inventory_head and inventory_hand, but does not clean up these
references when the object is deleted outside the death() function, creating
potential garbage collection issues and reference cycles. Implement a Destroy()
method in the slugcat type that nulls out both inventory_head and inventory_hand
references to break any lingering references to datum objects, then call the
parent Destroy() method and return an appropriate QDEL_HINT to allow proper
garbage collection.
- Around line 158-170: In the update_mobility() function for the slugcat pet,
the hat offset is only being reset to its initial value when the creature is
standing AND has a hat in inventory. However, the offset should be reset
whenever the creature stands up, regardless of whether a hat is currently
equipped. Move the hat_offset_y assignment that sets it to initial(hat_offset_y)
outside of the inventory_head conditional check so that it executes for all
standing creatures, not just those with a hat equipped.
- Around line 210-220: The UI labels displayed in the browser popup (Nothing,
Inventory of, Head, and Hand) are hardcoded in English and should be localized
to match the interface language. Replace the hardcoded English strings in the
head_href and hand_href variable assignments and in the dat string construction
with appropriate localization function calls. Specifically, update the "Nothing"
text in both href assignments, the "Inventory of" text in the meta charset
section, and the "Head:" and "Hand:" labels in the dat concatenation lines to
use your localization system instead of hardcoded English strings.
- Around line 298-304: The `is_pacifist` check is performed after the
`dropItemToGround` operation, which means a pacifist slugcat will still drop the
item even though the action is subsequently rejected. Move the `is_pacifist`
condition check before the user.dropItemToGround call so that the function
returns FALSE without modifying the user's inventory when the slugcat is a
pacifist. This ensures rejected actions do not have side effects on inventory
state.
- Around line 206-221: The code constructs HTML content with dynamic values from
name, inventory_head, inventory_hand, and src without properly escaping them
using html_encode(). This allows potentially malicious or malformed HTML in
these values to break the popup layout or inject unwanted markup. Wrap all
dynamic values being inserted into the dat HTML string with html_encode() to
safely escape any HTML special characters. Specifically, apply html_encode() to
the name variable when inserted into the dat string, to inventory_head and
inventory_hand when used as text content in the anchor tags, and to src when
inserted as the window title in the browser datum creation.

---

Nitpick comments:
In `@modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm`:
- Around line 32-33: The hardcoded numeric values -8, -19, and 2 used for hat
offset adjustments and spear damage calculations are magic numbers that reduce
code clarity. Create `#define` constants with descriptive names for each of these
values (the hat_offset_y value of -8, the hat_offset_y_rest value of -19, and
the spear damage divisor of 2) at the top of the file, then replace all
instances of these magic numbers throughout the slugcat.dm file with references
to the corresponding `#define` constants to make the gameplay tuning values
self-documenting.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ad110c46-181a-438b-835a-c3397d337970

📥 Commits

Reviewing files that changed from the base of the PR and between f8d3f08 and aca9f48.

📒 Files selected for processing (1)
  • modular_bluemoon/code/modules/living/simple_animal/friendly/slugcat.dm

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.

2 participants