From bd7347378a41a562714ba77c6046bb0e9277f634 Mon Sep 17 00:00:00 2001 From: Kyep <16434066+Kyep@users.noreply.github.com> Date: Sun, 10 Jan 2021 20:12:55 +0000 Subject: [PATCH] Spiderling Pathing Tweaks (#15151) * Spiderling Pathing Tweaks * fixes spiderling/rechargestation interaction the right way * Steel suggestion Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com> Co-authored-by: Kyep Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com> --- code/game/machinery/rechargestation.dm | 3 ++- code/game/objects/effects/spiders.dm | 20 +++++++++++++------ .../hostile/terror_spiders/reproduction.dm | 8 +------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index b6da46a67c8..9b10029e2ad 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -84,7 +84,8 @@ qdel(src) /obj/machinery/recharge_station/Bumped(var/mob/AM) - move_inside(AM) + if(ismob(AM)) + move_inside(AM) /obj/machinery/recharge_station/AllowDrop() return FALSE diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index 71e6d712699..ba7d03d1857 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -156,12 +156,8 @@ //================= else if(prob(33)) - var/list/nearby = oview(10, src) - if(nearby.len) - var/target_atom = pick(nearby) - walk_to(src, target_atom) - if(prob(40)) - visible_message("[src] skitters[pick(" away"," around","")].") + if(random_skitter() && prob(40)) + visible_message("[src] skitters[pick(" away"," around","")].") else if(prob(10)) //ventcrawl! for(var/obj/machinery/atmospherics/unary/vent_pump/v in view(7,src)) @@ -190,6 +186,18 @@ to_chat(S, "You are a spider who is loyal to [S.master_commander], obey [S.master_commander]'s every order and assist [S.master_commander.p_them()] in completing [S.master_commander.p_their()] goals at any cost.") qdel(src) +/obj/structure/spider/spiderling/proc/random_skitter() + var/list/available_turfs = list() + for(var/turf/simulated/S in oview(10, src)) + // no !isspaceturf check needed since /turf/simulated is not a subtype of /turf/space + if(S.density) + continue + available_turfs += S + if(!length(available_turfs)) + return FALSE + walk_to(src, pick(available_turfs)) + return TRUE + /obj/structure/spider/spiderling/decompile_act(obj/item/matter_decompiler/C, mob/user) if(!istype(user, /mob/living/silicon/robot/drone)) user.visible_message("[user] sucks [src] into its decompiler. There's a horrible crunching noise.", \ diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/reproduction.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/reproduction.dm index 691dcd811c0..28e67d9912d 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/reproduction.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/reproduction.dm @@ -35,8 +35,6 @@ /obj/structure/spider/spiderling/terror_spiderling/Bump(obj/O) if(istype(O, /obj/structure/table)) forceMove(O.loc) - else if(istype(O, /obj/machinery/recharge_station)) - qdel(src) . = ..() @@ -160,11 +158,7 @@ if(frustration > 2) entry_vent = null else if(prob(33)) - var/list/nearby = oview(10, src) - if(nearby.len) - var/target_atom = pick(nearby) - if(!istype(get_turf(target_atom),/turf/space)) - walk_to(src, target_atom) + random_skitter() else if(immediate_ventcrawl || prob(ventcrawl_chance)) immediate_ventcrawl = FALSE if(!stillborn && !goto_mother)