Skip to content

Commit

Permalink
AI door interactions fixed (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
xDanilcusx authored Aug 17, 2024
1 parent 10952f0 commit 5ce0752
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/xeno_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#define FIRE_PENALTY 25
#define SENTRY_PENALTY 25
#define VEHICLE_PENALTY 25
#define LOCKED_DOOR_PENALTY 25
#define WINDOW_FRAME_PENALTY 25
#define BARRICADE_PENALTY 50
#define WALL_PENALTY 100
Expand Down
14 changes: 7 additions & 7 deletions code/game/machinery/doors/shutters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@
/obj/structure/machinery/door/poddoor/shutters/finish_close()
operating = FALSE

/obj/structure/machinery/door/poddoor/shutters/attack_alien(mob/living/carbon/xenomorph/M)
if(density && !operating)
INVOKE_ASYNC(src, PROC_REF(pry_open), M)
return XENO_ATTACK_ACTION
else
. = ..(M)

/obj/structure/machinery/door/poddoor/shutters/almayer
icon = 'icons/obj/structures/doors/blastdoors_shutters.dmi'
openspeed = 4 //shorter open animation.
Expand Down Expand Up @@ -101,13 +108,6 @@
/obj/structure/machinery/door/poddoor/shutters/almayer/containment
unacidable = TRUE

/obj/structure/machinery/door/poddoor/shutters/almayer/containment/attack_alien(mob/living/carbon/xenomorph/M)
if(isqueen(M) && density && !operating)
INVOKE_ASYNC(src, PROC_REF(pry_open), M)
return XENO_ATTACK_ACTION
else
. = ..(M)

/obj/structure/machinery/door/poddoor/shutters/almayer/containment/pry_open(mob/living/carbon/xenomorph/X, time = 4 SECONDS)
. = ..()
if(. && !(stat & BROKEN))
Expand Down
25 changes: 18 additions & 7 deletions code/modules/mob/living/carbon/xenomorph/xeno_ai_interaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,32 @@ At bare minimum, make sure the relevant checks from parent types gets copied in


/////////////////////////////
// Poddoors/shutters //
// PODDDOORS //
/////////////////////////////
/obj/structure/machinery/door/poddoor/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
. = ..()
if(!.)
return
return INFINITY

if(unacidable)
return INFINITY

if(!(stat & NOPOWER))
return
return INFINITY

return DOOR_PENALTY

if(operating)
return

/////////////////////////////
// SHUTTERS //
/////////////////////////////
/obj/structure/machinery/door/poddoor/shutters/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
. = ..()
if(!.)
return INFINITY

if(unacidable)
return
return INFINITY

return DOOR_PENALTY

Expand All @@ -104,7 +115,7 @@ At bare minimum, make sure the relevant checks from parent types gets copied in
return

if(locked || welded || isElectrified())
return INFINITY
return LOCKED_DOOR_PENALTY

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

0 comments on commit 5ce0752

Please sign in to comment.