From b0f6dcfabf48bbc9b03e0423d529877331dbc7b2 Mon Sep 17 00:00:00 2001 From: TeDGamer <107966994+TeDGamer@users.noreply.github.com> Date: Wed, 19 Jul 2023 05:14:53 -0400 Subject: [PATCH 1/2] [Fix] Xenos scuttle + Allied Xenos Using Doors (#3915) # About the pull request Reviving https://github.com/cmss13-devs/cmss13/pull/3128 since I finally have time to work on these again Fixing scuttle code and incidentally, allied xenos opening doors # Explain why it's good for the game Playable facehuggers were intended to scuttle but the code wasn't updated to handle them. This refactors the code so that all small xenos ( larva, facehugger, future small castes?) can scuttle properly and removes duplicate code from both the updated facehugger code and old larva scuttle code that wasn't up to date in code style ( one letter var names for example ) Incidentally, I fix allied xenos using hive's doors. So allied xenos can toggle hive doors and allied small xenos can scuttle hive's doors # Changelog :cl: fix: Xenos allied to the hive can now open hive's doors fix: Huggers can now scuttle doors code: Combined hugger + larva code to allow for any small castes to scuttle /:cl: Co-authored-by: harryob --- code/modules/cm_aliens/XenoStructures.dm | 12 ++++++----- .../mob/living/carbon/xenomorph/Embryo.dm | 17 ---------------- .../mob/living/carbon/xenomorph/Xenomorph.dm | 20 +++++++++++++++++++ .../carbon/xenomorph/castes/Facehugger.dm | 16 --------------- 4 files changed, 27 insertions(+), 38 deletions(-) diff --git a/code/modules/cm_aliens/XenoStructures.dm b/code/modules/cm_aliens/XenoStructures.dm index 594c2e98695c..08e451407989 100644 --- a/code/modules/cm_aliens/XenoStructures.dm +++ b/code/modules/cm_aliens/XenoStructures.dm @@ -394,11 +394,13 @@ return attack_hand(user) /obj/structure/mineral_door/resin/TryToSwitchState(atom/user) - if(islarva(user)) - var/mob/living/carbon/xenomorph/larva/L = user - if (L.hivenumber == hivenumber) - L.scuttle(src) - return + if(isxeno(user)) + var/mob/living/carbon/xenomorph/xeno_user = user + if (xeno_user.hivenumber != hivenumber && !xeno_user.ally_of_hivenumber(hivenumber)) + return + if(xeno_user.scuttle(src)) + return + return ..() if(iscarbon(user)) var/mob/living/carbon/C = user if (C.ally_of_hivenumber(hivenumber)) diff --git a/code/modules/mob/living/carbon/xenomorph/Embryo.dm b/code/modules/mob/living/carbon/xenomorph/Embryo.dm index 3ba42650e49c..e8966bdf4d02 100644 --- a/code/modules/mob/living/carbon/xenomorph/Embryo.dm +++ b/code/modules/mob/living/carbon/xenomorph/Embryo.dm @@ -314,20 +314,3 @@ victim.death(cause) // Certain species were still surviving bursting (predators), DEFINITELY kill them this time. victim.chestburst = 2 victim.update_burst() - -// Squeeze thru dense objects as a larva, as airlocks -/mob/living/carbon/xenomorph/larva/proc/scuttle(obj/structure/target) - var/move_dir = get_dir(src, loc) - for(var/atom/movable/AM in get_turf(target)) - if(AM != target && AM.density && AM.BlockedPassDirs(src, move_dir)) - to_chat(src, SPAN_WARNING("\The [AM] prevents you from squeezing under \the [target]!")) - return - // Is it an airlock? - if(istype(target, /obj/structure/machinery/door/airlock)) - var/obj/structure/machinery/door/airlock/selected_airlock = target - if(selected_airlock.locked || selected_airlock.welded) //Can't pass through airlocks that have been bolted down or welded - to_chat(src, SPAN_WARNING("\The [selected_airlock] is locked down tight. You can't squeeze underneath!")) - return - visible_message(SPAN_WARNING("\The [src] scuttles underneath \the [target]!"), \ - SPAN_WARNING("You squeeze and scuttle underneath \the [target]."), null, 5) - forceMove(target.loc) diff --git a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm index 83ceeac68b2d..5586da3765dc 100644 --- a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm +++ b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm @@ -1092,3 +1092,23 @@ . = ..() if(behavior_delegate) behavior_delegate.on_collide(movable_atom) + +/mob/living/carbon/xenomorph/proc/scuttle(obj/structure/current_structure) + if (mob_size != MOB_SIZE_SMALL) + return FALSE + + var/move_dir = get_dir(src, loc) + for(var/atom/movable/atom in get_turf(current_structure)) + if(atom != current_structure && atom.density && atom.BlockedPassDirs(src, move_dir)) + to_chat(src, SPAN_WARNING("[atom] prevents you from squeezing under [current_structure]!")) + return FALSE + // Is it an airlock? + if(istype(current_structure, /obj/structure/machinery/door/airlock)) + var/obj/structure/machinery/door/airlock/current_airlock = current_structure + if(current_airlock.locked || current_airlock.welded) //Can't pass through airlocks that have been bolted down or welded + to_chat(src, SPAN_WARNING("[current_airlock] is locked down tight. You can't squeeze underneath!")) + return FALSE + visible_message(SPAN_WARNING("[src] scuttles underneath [current_structure]!"), \ + SPAN_WARNING("You squeeze and scuttle underneath [current_structure]."), max_distance = 5) + forceMove(current_structure.loc) + return TRUE diff --git a/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm b/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm index 08566a6e9af3..df9572df2628 100644 --- a/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm +++ b/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm @@ -221,22 +221,6 @@ /mob/living/carbon/xenomorph/facehugger/add_xeno_shield(added_amount, shield_source, type = /datum/xeno_shield, duration = -1, decay_amount_per_second = 1, add_shield_on = FALSE, max_shield = 200) return -/mob/living/carbon/xenomorph/facehugger/proc/scuttle(obj/structure/current_structure) - var/move_dir = get_dir(src, loc) - for(var/atom/movable/atom in get_turf(current_structure)) - if(atom != current_structure && atom.density && atom.BlockedPassDirs(src, move_dir)) - to_chat(src, SPAN_WARNING("\The [atom] prevents you from squeezing under \the [current_structure]!")) - return - // Is it an airlock? - if(istype(current_structure, /obj/structure/machinery/door/airlock)) - var/obj/structure/machinery/door/airlock/current_airlock = current_structure - if(current_airlock.locked || current_airlock.welded) //Can't pass through airlocks that have been bolted down or welded - to_chat(src, SPAN_WARNING("\The [current_airlock] is locked down tight. You can't squeeze underneath!")) - return - visible_message(SPAN_WARNING("\The [src] scuttles underneath \the [current_structure]!"), \ - SPAN_WARNING("You squeeze and scuttle underneath \the [current_structure]."), null, 5) - forceMove(current_structure.loc) - /mob/living/carbon/xenomorph/facehugger/emote(act, m_type, message, intentional, force_silence) playsound(loc, "alien_roar_larva", 15) From d0e7558d7a469e47107d0c73d5aa0b616351b2d3 Mon Sep 17 00:00:00 2001 From: cm13-github <128137806+cm13-github@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:23:38 +0100 Subject: [PATCH 2/2] Automatic changelog for PR #3915 [ci skip] --- html/changelogs/AutoChangeLog-pr-3915.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 html/changelogs/AutoChangeLog-pr-3915.yml diff --git a/html/changelogs/AutoChangeLog-pr-3915.yml b/html/changelogs/AutoChangeLog-pr-3915.yml new file mode 100644 index 000000000000..c40b5c92f907 --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-3915.yml @@ -0,0 +1,6 @@ +author: "TeDGamer" +delete-after: True +changes: + - bugfix: "Xenos allied to the hive can now open hive's doors" + - bugfix: "Huggers can now scuttle doors" + - code_imp: "Combined hugger + larva code to allow for any small castes to scuttle" \ No newline at end of file