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

Lurkers hiding on structures and minor xeno interactions tweaks #54

Merged
merged 6 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions code/modules/mob/living/carbon/xenomorph/ai/movement/lurking.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
max_distance_from_home = 10

#define AI_CHECK_ANNOYANCE_COOLDOWN 2.5 SECONDS
#define AI_NEW_TARGET_COOLDOWN 2 SECONDS

/datum/xeno_ai_movement/linger/lurking/New(mob/living/carbon/xenomorph/parent)
. = ..()
Expand All @@ -30,9 +31,14 @@
RegisterSignal(parent, COMSIG_XENO_USED_POUNCE, PROC_REF(stop_lurking))

addtimer(CALLBACK(src, PROC_REF(check_annoyance)), AI_CHECK_ANNOYANCE_COOLDOWN, TIMER_UNIQUE|TIMER_LOOP|TIMER_DELETE_ME)
addtimer(CALLBACK(src, PROC_REF(get_new_target), parent), AI_NEW_TARGET_COOLDOWN, TIMER_UNIQUE|TIMER_LOOP|TIMER_DELETE_ME)

start_lurking()

/datum/xeno_ai_movement/linger/lurking/proc/get_new_target(mob/living/carbon/xenomorph/parent)
parent.current_target = parent.get_target(parent.ai_range)

#undef AI_NEW_TARGET_COOLDOWN
#undef AI_CHECK_ANNOYANCE_COOLDOWN

/datum/xeno_ai_movement/linger/lurking/ai_move_idle(delta_time)
Expand Down Expand Up @@ -67,7 +73,12 @@
continue

var/blocked = FALSE
for(var/atom/potential_blocker as anything in potential_home)
for(var/obj/structure/potential_blocker in potential_home)
if(potential_blocker.unslashable && (potential_blocker.can_block_movement || potential_blocker.density))
blocked = TRUE
break

for(var/mob/potential_blocker in potential_home)
if(potential_blocker != idle_xeno && (potential_blocker.can_block_movement || potential_blocker.density))
xDanilcusx marked this conversation as resolved.
Show resolved Hide resolved
blocked = TRUE
break
Expand All @@ -76,7 +87,21 @@
continue

var/preferred = FALSE
for(var/obj/structure/structure in potential_home)
if(structure.unslashable && (structure.can_block_movement || structure.density))
continue

preferred = TRUE
break

for(var/turf/closed/touching_turf in orange(1, potential_home))
if(get_dir(idle_xeno, touching_turf) in diagonals)
continue

preferred = TRUE
break

for(var/obj/item/stack/sheet/sheet in potential_home)
preferred = TRUE
break

Expand Down Expand Up @@ -194,12 +219,14 @@
#undef LURKER_BAITS_BEFORE_AMBUSH

/datum/xeno_ai_movement/linger/lurking/proc/interact_random(mob/living/carbon/xenomorph/X)
for(var/obj/potential_interaction in orange(1, X))
if(istype(potential_interaction, /obj/structure/window_frame))
for(var/atom/potential_interaction in orange(1, X))
if(istype(potential_interaction, /obj/structure/shuttle))
continue
if(istype(potential_interaction, /turf/closed/shuttle))
continue
if(istype(potential_interaction, /obj/structure/pipes))
if(istype(potential_interaction, /obj/effect))
continue
if(istype(potential_interaction, /obj/structure/sign))
if(istype(potential_interaction, /turf/open))
continue
if(!potential_interaction.xeno_ai_act(X))
continue
Expand Down
5 changes: 5 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/attack_alien.dm
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@

. = XENO_NO_DELAY_ACTION

if(M.action_busy)
to_chat(M, SPAN_WARNING("You are already doing something!"))
return

if(M.claw_type >= CLAW_TYPE_SHARP)
M.animation_attack_on(src)
playsound(src, 'sound/effects/metalhit.ogg', 25, 1)
Expand Down Expand Up @@ -933,6 +937,7 @@
M.visible_message(SPAN_DANGER("[M] smashes [src] beyond recognition!"), \
SPAN_DANGER("You enter a frenzy and smash [src] apart!"), null, 5, CHAT_TYPE_XENO_COMBAT)
malfunction()
tip_over()
else
M.visible_message(SPAN_DANGER("[M] [M.slashes_verb] [src]!"), \
SPAN_DANGER("You [M.slash_verb] [src]!"), null, 5, CHAT_TYPE_XENO_COMBAT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,19 @@ At bare minimum, make sure the relevant checks from parent types gets copied in
return OBJECT_PENALTY

/obj/structure/xeno_ai_act(mob/living/carbon/xenomorph/X)
if(unslashable)
if(unslashable || indestructible)
if(!X.action_busy)
do_climb(X)
return

return ..()

/obj/structure/machinery/xeno_ai_act(mob/living/carbon/xenomorph/X)
if(stat & TIPPED_OVER)
return

return ..()

// MINERAL DOOR
/obj/structure/mineral_door/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
return DOOR_PENALTY
Expand Down