-
Notifications
You must be signed in to change notification settings - Fork 5k
Refactor some stuff related to quirk processing #89075
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
Conversation
@@ -7,17 +7,13 @@ | |||
hardcore_value = 5 | |||
quirk_flags = QUIRK_HUMAN_ONLY|QUIRK_PROCESSES | |||
mail_goodies = list(/obj/item/reagent_containers/syringe/convermol) // to help breathing | |||
minimum_process_stat = CONSCIOUS | |||
no_process_traits = list(TRAIT_MIND_TEMPORARILY_GONE, TRAIT_FEARLESS, TRAIT_KNOCKEDOUT) |
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.
technically, minimum_process_stat = CONSCIOUS
should handle this just fine, but I added TRAIT_KNOCKEDOUT
here just to be 1:1 with the original code.
code/datums/quirks/_quirk.dm
Outdated
if(no_process_traits) | ||
LAZYINITLIST(process_update_signals) | ||
for(var/trait in no_process_traits) | ||
process_update_signals += list(SIGNAL_ADDTRAIT(trait), SIGNAL_REMOVETRAIT(trait)) |
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.
you only need the for loop.
for(_ in null) is a noop
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.
fair, it was mostly to avoid the unneeded LAZYINITLIST
- but I can just do LAZYADD
, looking back
201e7ac
to
d416226
Compare
)" This reverts commit 8eaa934.
Ports my additional refactors from tgstation/tgstation#89075, and the fix from tgstation/tgstation#89265
Ports my additional refactors from tgstation/tgstation#89075, and the fix from tgstation/tgstation#89265
Ports my additional refactors from tgstation/tgstation#89075, and the fix from tgstation/tgstation#89265
Ports my additional refactors from tgstation/tgstation#89075, and the fix from tgstation/tgstation#89265
About The Pull Request
Several quirks that process have some common checks and patterns: only processing if the mob's stat is conscious or not dead, or not processing if they have certain traits.
This refactors quirk processing so those checks are a part of
/datum/quirk
itself, and the quirk will automatically be start/stop being processed bySSquirks
based on those conditions, by registering signals to re-check if the quirk should be processing or not.This ports said refactor from my downstream PR, Monkestation/Monkestation2.0#4642 (and is unaffected by the bug that Monkestation/Monkestation2.0#4836 fixes, due to additional refactors regarding trait handling)
Why It's Good For The Game
Less repetitive code is always better, and leaves less room for errors. Also, completely stopping the quirk from being processed by
SSquirks
can save a minuscule amount of CPU time.Changelog
🆑
refactor: Refactored how quirks handle starting/stopping processing.
/:cl: