-
Notifications
You must be signed in to change notification settings - Fork 476
bugfix: Фикс кражи вортекс шотгана #8510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master220
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,6 +99,8 @@ have ways of interacting with a specific mob and control it. | |
| var/pickpocket = FALSE | ||
| for(var/mob/living/carbon/human/human in oview(5, living_pawn)) | ||
| var/obj/item/held_weapon = GetBestWeapon(list(human.get_active_hand(), human.get_inactive_hand()) + weapon, list(living_pawn.get_active_hand(), living_pawn.get_inactive_hand())) | ||
| if(istype(held_weapon, /obj/item/gun/energy/vortex_shotgun)) | ||
| continue | ||
|
Comment on lines
+102
to
+103
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Рекомендация по улучшению поддерживаемости Текущая реализация с Для улучшения расширяемости и поддерживаемости кода предлагаю использовать систему трейтов. Можно создать трейт, например, Это позволит в будущем легко запрещать кражу новых предметов, просто добавив им соответствующий трейт, без изменения логики контроллера обезьян. References
|
||
| if(held_weapon == weapon) // It's just the same one, not a held one | ||
| continue | ||
| pickpocket = TRUE | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Рекомендация по улучшению поддерживаемости
Ваше исправление корректно решает проблему с кражей вортекс-шотгана. Однако, для улучшения поддерживаемости кода в будущем, я бы рекомендовал использовать систему трейтов (traits) вместо прямого сравнения типа (
istype). Это позволит легко добавлять другие предметы, которые обезьяны не должны воровать, не изменяя логику контроллера обезьян.Например, можно добавить трейт
TRAIT_MONKEY_PROOFк вортекс-шотгану и проверять его наличие здесь. Для этого потребуется добавитьADD_TRAIT(src, TRAIT_MONKEY_PROOF, INNATE_TRAIT)вInitialize()для/obj/item/gun/energy/vortex_shotgun.