From 8e99152226f16dcb4a4ab60383cbb20cfbf8eba6 Mon Sep 17 00:00:00 2001 From: Incoming Date: Wed, 1 Oct 2014 18:58:07 -0400 Subject: [PATCH] Updates spiders to have full player functionality *All spiders can now web turf (but AI controlled non-nurses won't choose to), only nurse spiders can wrap items and lay eggs. *Eggs laid by a player controlled nurse spider will eventually grow into player controlled spiders, while AI lain eggs will only result in AI spiders *Adds non nurse spiders to the staff of change as they pass my rules for inclusion (Leaves a corpse, can do everything as a player the NPC can do, can't dominate a round by reproduction) I take no responsibility for spidercode, it's a bit iffy but as far as I can tell it all works for players now. --- code/game/objects/effects/spiders.dm | 15 +- .../simple_animal/hostile/giant_spider.dm | 163 +++++++++++------- code/modules/projectiles/projectile/magic.dm | 4 +- 3 files changed, 121 insertions(+), 61 deletions(-) diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index 26c12f5f8da..4b55a1e75f4 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -76,6 +76,7 @@ desc = "They seem to pulse slightly with an inner life" icon_state = "eggs" var/amount_grown = 0 + var/player_spiders = 0 /obj/effect/spider/eggcluster/New() pixel_x = rand(3,-3) @@ -87,7 +88,9 @@ if(amount_grown >= 100) var/num = rand(3,12) for(var/i=0, i= 100) if(!grow_as) grow_as = pick(typesof(/mob/living/simple_animal/hostile/giant_spider)) - new grow_as(src.loc) + var/mob/living/simple_animal/hostile/giant_spider/S = new grow_as(src.loc) + if(player_spiders) + var/list/candidates = get_candidates(BE_ALIEN, ALIEN_AFK_BRACKET) + var/client/C = null + + if(candidates.len) + C = pick(candidates) + S.key = C.key qdel(src) /obj/effect/spider/cocoon diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index 6273f455aa7..f4ffc2f8eae 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -79,7 +79,7 @@ /mob/living/simple_animal/hostile/giant_spider/Life() ..() - if(!stat) + if(!stat && !ckey) if(stance == HOSTILE_STANCE_IDLE) //1% chance to skitter madly away if(!busy && prob(1)) @@ -115,7 +115,7 @@ /mob/living/simple_animal/hostile/giant_spider/nurse/Life() ..() - if(!stat) + if(!stat && !ckey) if(stance == HOSTILE_STANCE_IDLE) var/list/can_see = view(src, 10) //30% chance to stop wandering and do something @@ -133,29 +133,11 @@ //second, spin a sticky spiderweb on this tile var/obj/effect/spider/stickyweb/W = locate() in get_turf(src) if(!W) - busy = SPINNING_WEB - src.visible_message("\the [src] begins to secrete a sticky substance.") - stop_automated_movement = 1 - spawn(40) - if(busy == SPINNING_WEB) - new /obj/effect/spider/stickyweb(src.loc) - busy = 0 - stop_automated_movement = 0 + Web() else //third, lay an egg cluster there - var/obj/effect/spider/eggcluster/E = locate() in get_turf(src) - if(!E && fed > 0) - busy = LAYING_EGGS - src.visible_message("\the [src] begins to lay a cluster of eggs.") - stop_automated_movement = 1 - spawn(50) - if(busy == LAYING_EGGS) - E = locate() in get_turf(src) - if(!E) - new /obj/effect/spider/eggcluster(src.loc) - fed-- - busy = 0 - stop_automated_movement = 0 + if(fed) + LayEggs() else //fourthly, cocoon any nearby items so those pesky pinkskins can't use them for(var/obj/O in can_see) @@ -173,46 +155,111 @@ else if(busy == MOVING_TO_TARGET && cocoon_target) if(get_dist(src, cocoon_target) <= 1) - busy = SPINNING_COCOON - src.visible_message("\the [src] begins to secrete a sticky substance around \the [cocoon_target].") - stop_automated_movement = 1 - walk(src,0) - spawn(50) - if(busy == SPINNING_COCOON) - if(cocoon_target && istype(cocoon_target.loc, /turf) && get_dist(src,cocoon_target) <= 1) - var/obj/effect/spider/cocoon/C = new(cocoon_target.loc) - var/large_cocoon = 0 - C.pixel_x = cocoon_target.pixel_x - C.pixel_y = cocoon_target.pixel_y - for(var/mob/living/M in C.loc) - if(istype(M, /mob/living/simple_animal/hostile/giant_spider)) - continue - large_cocoon = 1 - fed++ - src.visible_message("\the [src] sticks a proboscis into \the [cocoon_target] and sucks a viscous substance out.") - M.loc = C - C.pixel_x = M.pixel_x - C.pixel_y = M.pixel_y - break - for(var/obj/item/I in C.loc) - I.loc = C - for(var/obj/structure/S in C.loc) - if(!S.anchored) - S.loc = C - large_cocoon = 1 - for(var/obj/machinery/M in C.loc) - if(!M.anchored) - M.loc = C - large_cocoon = 1 - if(large_cocoon) - C.icon_state = pick("cocoon_large1","cocoon_large2","cocoon_large3") - busy = 0 - stop_automated_movement = 0 + Wrap() else busy = 0 stop_automated_movement = 0 +/mob/living/simple_animal/hostile/giant_spider/verb/Web() + set name = "Lay Web" + set category = "Spider" + set desc = "Spread a sticky web to slow down prey." + + var/T = src.loc + + if(busy != SPINNING_WEB) + busy = SPINNING_WEB + src.visible_message("\the [src] begins to secrete a sticky substance.") + stop_automated_movement = 1 + spawn(40) + if(busy == SPINNING_WEB && src.loc == T) + new /obj/effect/spider/stickyweb(T) + busy = 0 + stop_automated_movement = 0 + + +/mob/living/simple_animal/hostile/giant_spider/nurse/verb/Wrap() + set name = "Wrap" + set category = "Spider" + set desc = "Wrap up prey to feast upon and objects for safe keeping." + + if(!cocoon_target) + var/list/choices = list() + for(var/mob/living/L in view(1,src)) + if(L == src) + continue + if(Adjacent(L)) + choices += L + for(var/obj/O in src.loc) + if(Adjacent(O)) + choices += O + cocoon_target = input(src,"What do you wish to cocoon?") in null|choices + + if(cocoon_target && busy != SPINNING_COCOON) + busy = SPINNING_COCOON + src.visible_message("\the [src] begins to secrete a sticky substance around \the [cocoon_target].") + stop_automated_movement = 1 + walk(src,0) + spawn(50) + if(busy == SPINNING_COCOON) + if(cocoon_target && istype(cocoon_target.loc, /turf) && get_dist(src,cocoon_target) <= 1) + var/obj/effect/spider/cocoon/C = new(cocoon_target.loc) + var/large_cocoon = 0 + C.pixel_x = cocoon_target.pixel_x + C.pixel_y = cocoon_target.pixel_y + for(var/obj/item/I in C.loc) + I.loc = C + for(var/obj/structure/S in C.loc) + if(!S.anchored) + S.loc = C + large_cocoon = 1 + for(var/obj/machinery/M in C.loc) + if(!M.anchored) + M.loc = C + large_cocoon = 1 + for(var/mob/living/L in C.loc) + if(istype(L, /mob/living/simple_animal/hostile/giant_spider)) + continue + large_cocoon = 1 + L.loc = C + C.pixel_x = L.pixel_x + C.pixel_y = L.pixel_y + fed++ + visible_message("\the [src] sticks a proboscis into \the [L] and sucks a viscous substance out.") + + break + if(large_cocoon) + C.icon_state = pick("cocoon_large1","cocoon_large2","cocoon_large3") + cocoon_target = null + busy = 0 + stop_automated_movement = 0 + +/mob/living/simple_animal/hostile/giant_spider/nurse/verb/LayEggs() + set name = "Lay Eggs" + set category = "Spider" + set desc = "Lay a clutch of eggs, but you must wrap a creature for feeding first." + + var/obj/effect/spider/eggcluster/E = locate() in get_turf(src) + if(E) + src << "There is already a cluster of eggs here!" + else if(!fed) + src << "You are too hungry to do this!" + else if(busy != LAYING_EGGS) + busy = LAYING_EGGS + src.visible_message("\the [src] begins to lay a cluster of eggs.") + stop_automated_movement = 1 + spawn(50) + if(busy == LAYING_EGGS) + E = locate() in get_turf(src) + if(!E) + var/obj/effect/spider/eggcluster/C = new /obj/effect/spider/eggcluster(src.loc) + if(ckey) + C.player_spiders = 1 + fed-- + busy = 0 + stop_automated_movement = 0 + #undef SPINNING_WEB #undef LAYING_EGGS #undef MOVING_TO_TARGET diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index c11469e8e12..55b9aa1147e 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -177,7 +177,7 @@ proc/wabbajack(mob/living/M) new_mob.languages |= HUMAN*/ if("animal") if(prob(50)) - var/beast = pick("carp","bear","mushroom","statue", "bat", "goat","killertomato") + var/beast = pick("carp","bear","mushroom","statue", "bat", "goat","killertomato", "spiderbase", "spiderhunter") switch(beast) if("carp") new_mob = new /mob/living/simple_animal/hostile/carp(M.loc) if("bear") new_mob = new /mob/living/simple_animal/hostile/bear(M.loc) @@ -186,6 +186,8 @@ proc/wabbajack(mob/living/M) if("bat") new_mob = new /mob/living/simple_animal/hostile/retaliate/bat(M.loc) if("goat") new_mob = new /mob/living/simple_animal/hostile/retaliate/goat(M.loc) if("killertomato") new_mob = new /mob/living/simple_animal/hostile/killertomato(M.loc) + if("spiderbase") new_mob = new /mob/living/simple_animal/hostile/giant_spider(M.loc) + if("spiderhunter") new_mob = new /mob/living/simple_animal/hostile/giant_spider/hunter(M.loc) else var/animal = pick("parrot","corgi","crab","pug","cat","mouse","chicken","cow","lizard","chick") switch(animal)