Skip to content

Commit

Permalink
[TM] Tougher Airlocks + Airlock Assemblies on Destruction (#508)
Browse files Browse the repository at this point in the history
Co-authored-by: Doubleumc <[email protected]>
  • Loading branch information
GriffinMan4455 and Doubleumc authored Oct 30, 2024
1 parent d958e2b commit 58ec7e3
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 5 deletions.
3 changes: 2 additions & 1 deletion code/__DEFINES/conflict.dm
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@
#define HEALTH_WALL_XENO_REFLECTIVE 300
#define HEALTH_WALL_XENO_MEMBRANE_THICK 600

#define HEALTH_DOOR 1200
#define HEALTH_DOOR 2400
#define HEALTH_ASSEMBLY 400
#define HEALTH_DOOR_XENO 600
#define HEALTH_DOOR_XENO_THICK 900

Expand Down
5 changes: 3 additions & 2 deletions code/__DEFINES/xeno.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
#define XENO_HITS_TO_DESTROY_WINDOW_FRAME 3
#define XENO_HITS_TO_DESTROY_R_WINDOW_FRAME 5
#define XENO_HITS_TO_DESTROY_BOLTED_DOOR 10
#define XENO_HITS_TO_DESTROY_DOOR 10
#define XENO_HITS_TO_DESTROY_WELDED_DOOR 15
#define XENO_HITS_TO_DESTROY_DOOR 12
#define XENO_HITS_TO_DESTROY_WELDED_DOOR 20
#define XENO_HITS_TO_DESTROY_AIRLOCK_ASSEMBLY 2
#define XENO_HITS_TO_EXPOSE_WIRES_MIN 3
#define XENO_HITS_TO_EXPOSE_WIRES_MAX 4
#define XENO_HITS_TO_CUT_WIRES 10
Expand Down
2 changes: 2 additions & 0 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,14 @@ GLOBAL_LIST_INIT(airlock_wire_descriptions, list(
/obj/structure/machinery/door/airlock/deconstruct(disassembled = TRUE)
if(!disassembled)
if(width == 1)
new /obj/structure/airlock_assembly(loc)
new /obj/item/stack/rods(loc)
new /obj/item/stack/cable_coil/cut(loc)
new /obj/effect/spawner/gibspawner/robot(loc)
new /obj/effect/decal/cleanable/blood/oil(loc)
else // big airlock, big debris
for(var/turf/DT in locs) // locs = covered by airlock bounding box
new /obj/structure/airlock_assembly(DT)
new /obj/item/stack/rods(DT)
new /obj/item/stack/cable_coil/cut(DT)
new /obj/effect/spawner/gibspawner/robot(DT)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/multi_tile.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//Terribly sorry for the code doubling, but things go derpy otherwise.
/obj/structure/machinery/door/airlock/multi_tile
width = 2
damage_cap = 650 // Bigger = more endurable
damage_cap = 2600 // Bigger = more endurable
assembly_type = /obj/structure/airlock_assembly/multi_tile

/obj/structure/machinery/door/airlock/multi_tile/close() //Nasty as hell O(n^2) code but unfortunately necessary
Expand Down
56 changes: 55 additions & 1 deletion code/game/objects/structures/airlock_assembly.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
name = "airlock assembly"
icon = 'icons/obj/structures/doors/airlock_assembly.dmi'
icon_state = "door_as_0"
anchored = FALSE
anchored = TRUE
density = TRUE
var/state = STATE_STANDARD
var/base_icon_state = ""
Expand All @@ -22,9 +22,63 @@
var/airlock_type = "generic" //the type path of the airlock once completed
var/glass = AIRLOCK_NOGLASS // see defines
var/created_name = null

var/damage = 0 //This should let marines destroy Assemblies spawned by destroyed airlocks now
var/damage_cap = HEALTH_ASSEMBLY // Assembly gets destroyed
/// Used for multitile assemblies
var/width = 1

/obj/structure/airlock_assembly/proc/take_damage(dam, mob/M)
if(!dam || unacidable)
return FALSE

damage = max(0, damage + dam)

if(damage >= damage_cap)
if(M && istype(M))
SEND_SIGNAL(M, COMSIG_MOB_DESTROY_AIRLOCK, src)
to_chat(loc, SPAN_DANGER("[src] blows apart!"))
deconstruct(FALSE)
playsound(src, 'sound/effects/metal_crash.ogg', 25, 1)
return TRUE

/obj/structure/airlock_assembly/ex_act(severity, explosion_direction, datum/cause_data/cause_data)
var/exp_damage = severity * EXPLOSION_DAMAGE_MULTIPLIER_DOOR
var/location = get_turf(src)
if(!density)
exp_damage *= EXPLOSION_DAMAGE_MODIFIER_DOOR_OPEN
if(take_damage(exp_damage)) // destroyed by explosion, shards go flying
create_shrapnel(location, rand(2,5), explosion_direction, , /datum/ammo/bullet/shrapnel/light, cause_data)

/obj/structure/airlock_assembly/get_explosion_resistance()
if(density)
if(unacidable)
return 1000000
else
return (damage_cap-damage)/EXPLOSION_DAMAGE_MULTIPLIER_DOOR //this should exactly match the amount of damage needed to destroy the door
else
return FALSE

/obj/structure/airlock_assembly/bullet_act(obj/projectile/P)
bullet_ping(P)
if(P.damage)
if(P.ammo.flags_ammo_behavior & AMMO_ROCKET)
take_damage(P.damage * 4, P.firer) // rockets wreck airlocks
return TRUE
else
take_damage(P.damage, P.firer)
return TRUE
return FALSE

/obj/structure/airlock_assembly/handle_tail_stab(mob/living/carbon/xenomorph/xeno)

playsound(src, 'sound/effects/metalhit.ogg', 50, TRUE)
xeno.visible_message(SPAN_XENOWARNING("\The [xeno] strikes \the [src] with its tail!"), SPAN_XENOWARNING("You strike \the [src] with your tail!"))
xeno.emote("tail")
var/damage = xeno.melee_damage_upper * TAILSTAB_AIRLOCK_DAMAGE_MULTIPLIER
take_damage(damage, xeno)
return TAILSTAB_COOLDOWN_NORMAL

/obj/structure/airlock_assembly/Initialize(mapload, ...)
. = ..()
update_icon()
Expand Down
19 changes: 19 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/attack_alien.dm
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,25 @@
SPAN_DANGER("We [M.slash_verb] \the [src]!"), null, 5, CHAT_TYPE_XENO_COMBAT)
return XENO_ATTACK_ACTION

//This SHOULD, if I did it right, have xenos target assemblies finally please god let me have done it right
/obj/structure/airlock_assembly/attack_alien(mob/living/carbon/xenomorph/M)
if(unslashable || health <= 0 && !HAS_TRAIT(usr, TRAIT_OPPOSABLE_THUMBS))
to_chat(M, SPAN_WARNING("We stare at \the [src] cluelessly."))
return XENO_NO_DELAY_ACTION

M.animation_attack_on(src)
playsound(src, 'sound/effects/metalhit.ogg', 25, 1)
update_health(rand(M.melee_damage_lower, M.melee_damage_upper) * M.melee_sentry_damage_multiplier)
if(health <= 0)
M.visible_message(SPAN_DANGER("[M] slices \the [src] apart!"), \
SPAN_DANGER("We slice \the [src] apart!"), null, 5, CHAT_TYPE_XENO_COMBAT)
if(!unacidable)
qdel(src)
else
M.visible_message(SPAN_DANGER("[M] [M.slashes_verb] \the [src]!"), \
SPAN_DANGER("We [M.slash_verb] \the [src]!"), null, 5, CHAT_TYPE_XENO_COMBAT)
return XENO_ATTACK_ACTION

// Destroying reagent dispensers
/obj/structure/reagent_dispensers/attack_alien(mob/living/carbon/xenomorph/M)
if(unslashable || health <= 0 && !HAS_TRAIT(usr, TRAIT_OPPOSABLE_THUMBS))
Expand Down
13 changes: 13 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/xeno_ai_interaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,19 @@ At bare minimum, make sure the relevant checks from parent types gets copied in

return DOOR_PENALTY

////////////////////////////////////////
// AIRLOCK ASSEMBLIES //
////////////////////////////////////////

/obj/structure/airlock_assembly/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
. = ..()
if(!.)
return

if(isfacehugger(X))
return -1 // We LOVE going under doors!

return DOOR_PENALTY

/////////////////////////////
// TABLES //
Expand Down

0 comments on commit 58ec7e3

Please sign in to comment.