Skip to content

Commit

Permalink
Refactor scuttle to combine larva and hugger scuttle
Browse files Browse the repository at this point in the history
  • Loading branch information
TeDGamer committed Jul 17, 2023
1 parent 823c9ce commit a48637d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 38 deletions.
12 changes: 7 additions & 5 deletions code/modules/cm_aliens/XenoStructures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
17 changes: 0 additions & 17 deletions code/modules/mob/living/carbon/xenomorph/Embryo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
20 changes: 20 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/Xenomorph.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 0 additions & 16 deletions code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit a48637d

Please sign in to comment.