From adc010275f55c84a2cf75b8eb603b6cce0680b02 Mon Sep 17 00:00:00 2001 From: Jacquerel Date: Sun, 14 May 2023 20:31:23 +0100 Subject: [PATCH] Spiderlings can cross webs (#75404) ## About The Pull Request Reliable web traversal is now governed by a trait instead of a type check. Spiderlings have that trait. ## Why It's Good For The Game Spiderlings are spiders and shouldn't get stuck in webs. Turning this into a trait means that we can make more things apply the trait in future if we want, without having to expand a list of allowed mobs. ## Changelog :cl: fix: Spiderlings no longer get stuck in webs /:cl: --- code/__DEFINES/traits.dm | 2 ++ code/_globalvars/traits.dm | 1 + code/game/objects/effects/spiderwebs.dm | 8 ++++---- .../basic/space_fauna/spider/giant_spider/giant_spider.dm | 1 + .../basic/space_fauna/spider/spiderlings/spiderling.dm | 4 +--- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 16f1f57fc26..bfd3be65fdc 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -306,6 +306,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_RESEARCH_SCANNER "research_scanner" /// Can weave webs into cloth #define TRAIT_WEB_WEAVER "web_weaver" +/// Can navigate the web without getting stuck +#define TRAIT_WEB_SURFER "web_surfer" #define TRAIT_ABDUCTOR_TRAINING "abductor-training" #define TRAIT_ABDUCTOR_SCIENTIST_TRAINING "abductor-scientist-training" #define TRAIT_SURGEON "surgeon" diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index 6847f9bd28e..d76f61e8473 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -103,6 +103,7 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_NOMOBSWAP" = TRAIT_NOMOBSWAP, "TRAIT_XRAY_VISION" = TRAIT_XRAY_VISION, "TRAIT_WEB_WEAVER" = TRAIT_WEB_WEAVER, + "TRAIT_WEB_SURFER" = TRAIT_WEB_SURFER, "TRAIT_THERMAL_VISION" = TRAIT_THERMAL_VISION, "TRAIT_ABDUCTOR_TRAINING" = TRAIT_ABDUCTOR_TRAINING, "TRAIT_ABDUCTOR_SCIENTIST_TRAINING" = TRAIT_ABDUCTOR_SCIENTIST_TRAINING, diff --git a/code/game/objects/effects/spiderwebs.dm b/code/game/objects/effects/spiderwebs.dm index 7eb4838a542..03e68913d1d 100644 --- a/code/game/objects/effects/spiderwebs.dm +++ b/code/game/objects/effects/spiderwebs.dm @@ -62,10 +62,10 @@ return if(sealed) return FALSE - if(isspider(mover)) - return TRUE - else if(isliving(mover)) - if(istype(mover.pulledby, /mob/living/basic/giant_spider)) + if(isliving(mover)) + if(HAS_TRAIT(mover, TRAIT_WEB_SURFER)) + return TRUE + if(mover.pulledby && HAS_TRAIT(mover.pulledby, TRAIT_WEB_SURFER)) return TRUE if(prob(50)) balloon_alert(mover, "stuck in web!") diff --git a/code/modules/mob/living/basic/space_fauna/spider/giant_spider/giant_spider.dm b/code/modules/mob/living/basic/space_fauna/spider/giant_spider/giant_spider.dm index 5cd75f6433b..1ecc7d3deee 100644 --- a/code/modules/mob/living/basic/space_fauna/spider/giant_spider/giant_spider.dm +++ b/code/modules/mob/living/basic/space_fauna/spider/giant_spider/giant_spider.dm @@ -63,6 +63,7 @@ /mob/living/basic/giant_spider/Initialize(mapload) . = ..() + ADD_TRAIT(src, TRAIT_WEB_SURFER, INNATE_TRAIT) AddElement(/datum/element/footstep, FOOTSTEP_MOB_CLAW) AddElement(/datum/element/nerfed_pulling, GLOB.typecache_general_bad_things_to_easily_move) AddElement(/datum/element/prevent_attacking_of_types, GLOB.typecache_general_bad_hostile_attack_targets, "this tastes awful!") diff --git a/code/modules/mob/living/basic/space_fauna/spider/spiderlings/spiderling.dm b/code/modules/mob/living/basic/space_fauna/spider/spiderlings/spiderling.dm index 0546a44d40b..3efbdb680bd 100644 --- a/code/modules/mob/living/basic/space_fauna/spider/spiderlings/spiderling.dm +++ b/code/modules/mob/living/basic/space_fauna/spider/spiderlings/spiderling.dm @@ -53,9 +53,7 @@ // the proc that handles passtable is nice but we should always be able to pass through table since we're so small so we can eschew adding that here pass_flags |= PASSTABLE - ADD_TRAIT(src, TRAIT_PASSTABLE, INNATE_TRAIT) - - ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) + add_traits(list(TRAIT_PASSTABLE, TRAIT_VENTCRAWLER_ALWAYS, TRAIT_WEB_SURFER), INNATE_TRAIT) AddComponent(/datum/component/swarming) AddElement(/datum/element/footstep, FOOTSTEP_MOB_CLAW, volume = 0.2) // they're small but you can hear 'em