Skip to content
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

Refactors totalXenos, tweaks some tier 0 things, adds a xeno anti-delay warning #5847

Closed
wants to merge 10 commits into from

Conversation

Vicacrov
Copy link
Contributor

@Vicacrov Vicacrov commented Feb 29, 2024

About the pull request

wow, expanding on xeno code surely doesn't turn into huge refactors

This PR splits the totalXenos list into two separate lists. Currently, the totalXenos list contains every tier, including facehuggers and lessers (tier 0s). A few calculations in the game have to snowflakely exclude them, while at other places, tier 0s should simply not matter, but they do (e.g. currently, if you are the last living xeno, like a drone, you won't get the warning for it, because a facehugger is AFKing somewhere under a desk).

What this PR does is that when you join as a xeno, you get added to two lists:

  • total_living_xenos: Every single xenomorph in the hive, including tier 0s.
  • total_living_xenos_advanced: Every xenomorph excluding tier 0s.

This PR will change a few things:

  • You can no longer join as a facehugger/lesser drone if there is not a single tier 1-4 xeno. Currently, you can join as a tier 0 if the hive had nothing but a facehugger hiding somewhere. Now, you need at least one tier 1-4 xeno to be able to do so. Larvae can still unburrow.
  • "Hive collapse" (>10 minutes being queenless) happens when there are less than 4 tier 1-4 xenos. This means that if there are 3 facehuggers and a drone running around, the hive will still collapse, resulting in a marine major.
  • Queens can no longer hijack if more than half of the tier 1-4 xenos are not onboard. (Previously, it counted tier 0s as well.)
  • Queens can no longer select tier 0s to give evolution points to.
  • When there is only one tier 1-4 xeno left, they get the message of being the last one, and ARES immediately performs a scan. Again, random facehuggers hiding under tables will not stop marines from ending the round.
  • ADDED: When a xeno dies and there are only 3 (=hive collapse number) tier 1-4 xenos left, they get notified about it. This is to avoid round delays when there are 2 runners running around, not knowing whether there are 14 xenos left or only them.

this last thing is what I wanted to add but it ended up being an entire refactor

If this refactor doesn't actually make the code better, feel free to just close it, I'm not married to the idea.

Explain why it's good for the game

Code-wise, I believe it cleans up things a lot, including:

  • Removes the counts_for_slots variable that was solely used for mobs that had tier = 0. Just use tier.
  • Removes a few IS THIS A HUGGER OR A LESSER?? checks, including get_real_total_xeno_count() which was a snowflake check just for tier 0s.
  • Replaces .len with length() at many places, I cannot remember though why we preferred length over len.
  • Fixes some calculations (see above), makes the game saner.

Game-wise, it is a common occurrence that once the Queen dies, xenos scatter; then we end up with a facehugger afking under a table, a drone running around aimlessly, and a runner harassing the FOB. None of these three players know the round is basically over. Let them know it.

Testing Photographs and Procedure

Cannot really screenshot anything, it is mainly a refactor.

Changelog

🆑
refactor: Refactored the living xenomorph list (totalXenos) into two separate ones to iron out some jankiness with facehuggers and lesser drones, leading to the following changes.
add: Xenomorphs are now notified if there are only three tier 1-4s are left (excluding tier 0s) to avoid further delays.
balance: The last xenomorph is now counted as the last one who is tier 1-4. A random facehugger afking under a table will no longer stop ARES from showing marines where the last xenomorph is hiding.
balance: You can no longer join as a facehugger or as a lesser drone when there is not a single tier 1-4 alive.
balance: Hive collapse now happens when there are less than 4 tier 1-4s. Previously, tier 0s also stopped a hive collapse, leading to a possible marine minor instead of a marine major.
balance: Queens can no longer hijack if more than half of her tier 1-4s are not onboard. This was already a thing, but it counted facehuggers and lessers too, who should not matter in this calculation.
balance: Queens can no longer select tier 0s to give evolution to, in exchange for a larva.
/:cl:

@github-actions github-actions bot added Refactor Make the code harder to read Feature Feature coder badge Balance You need to be a professional veteran game maintainer to comprehend what is being done here. labels Feb 29, 2024
@Vicacrov Vicacrov marked this pull request as draft February 29, 2024 15:58
@Vicacrov
Copy link
Contributor Author

Vicacrov commented Feb 29, 2024

Xenos no longer get latejoin larva if there are only tier 0s alive. (this was just silly)

This will mess with early game latejoins, I have to iron this out. The rest should be ready to review
edit: fixed this

@Vicacrov Vicacrov marked this pull request as ready for review February 29, 2024 17:07
if(SSticker.mode && SSticker.current_state != GAME_STATE_FINISHED && hive.hivenumber == XENO_HIVE_NORMAL)
// Notify the hive that we are about to perish
if(LAZYLEN(hive.total_living_xenos_advanced == XENO_HIVE_COLLAPSE_THRESHOLD))
xeno_message(SPAN_XENOANNOUNCE("We can feel our hive's power weakening - only a few of us are left."))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
xeno_message(SPAN_XENOANNOUNCE("We can feel our hive's power weakening - only a few of us are left."))
xeno_message(SPAN_XENOANNOUNCE("We can feel our hive's power weakening - there are only a few of us are left."))

@@ -136,7 +136,7 @@
to_chat(owner, SPAN_ALERT("Hive choice error. Aborting."))
return
var/datum/hive_status/Hive = GLOB.hive_datum[hives[faction]]
var/list/targets = Hive.totalXenos
var/list/targets = Hive.total_living_xenos
Copy link
Member

Choose a reason for hiding this comment

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

completely unrelated to your refactor really but this needs a .Copy() at the end, as otherwise this ends up mutating the actual list

code/modules/mob/dead/observer/observer.dm Outdated Show resolved Hide resolved
Comment on lines +126 to +127
if(LAZYLEN(hive.total_living_xenos_advanced) == 1)
var/mob/living/carbon/xenomorph/X = LAZYACCESS(hive.total_living_xenos_advanced, 1)
Copy link
Member

Choose a reason for hiding this comment

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

this isn't generally treated as a lazy list, why here?

code/modules/mob/living/carbon/xenomorph/hive_status.dm Outdated Show resolved Hide resolved
@harryob harryob marked this pull request as draft March 5, 2024 07:36
Copy link
Contributor

This PR has been inactive for long enough to be automatically marked as stale. This means it is at risk of being auto closed in ~ 7 days, please address any outstanding review items and ensure your PR is finished, if these are all true and you are auto-staled anyway, you need to actively ask maintainers if your PR will be merged. Once you have done any of the previous actions then you should request a maintainer remove the stale label on your PR, to reset the stale timer. If you feel no maintainer will respond in that time, you may wish to close this PR youself, while you seek maintainer comment, as you will then be able to reopen the PR yourself

@github-actions github-actions bot added the Stale beg a maintainer to review your PR label Mar 13, 2024
@Vicacrov
Copy link
Contributor Author

Temporarily closing it as I have no mental capacity to deal with this right now - but I want to get back to it eventually (especially since it already got reviewed.)

@Vicacrov Vicacrov closed this Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Balance You need to be a professional veteran game maintainer to comprehend what is being done here. Feature Feature coder badge Refactor Make the code harder to read Stale beg a maintainer to review your PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants