Merge pull request #5050 from Incoming5643/spiders,man

Updates spiders to have full player functionality
This commit is contained in:
Remie Richards
2014-10-06 14:24:39 +01:00
3 changed files with 121 additions and 61 deletions
+13 -2
View File
@@ -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<num, i++)
new /obj/effect/spider/spiderling(src.loc)
var/obj/effect/spider/spiderling/S = new /obj/effect/spider/spiderling(src.loc)
if(player_spiders)
S.player_spiders = 1
qdel(src)
/obj/effect/spider/spiderling
@@ -101,6 +104,7 @@
var/grow_as = null
var/obj/machinery/atmospherics/unary/vent_pump/entry_vent
var/travelling_in_vent = 0
var/player_spiders = 0
/obj/effect/spider/spiderling/New()
pixel_x = rand(6,-6)
@@ -186,7 +190,14 @@
if(amount_grown >= 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
@@ -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("<span class='notice'>\the [src] begins to secrete a sticky substance.</span>")
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("<span class='notice'>\the [src] begins to lay a cluster of eggs.</span>")
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("<span class='notice'>\the [src] begins to secrete a sticky substance around \the [cocoon_target].</span>")
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("<span class='danger'>\the [src] sticks a proboscis into \the [cocoon_target] and sucks a viscous substance out.</span>")
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("<span class='notice'>\the [src] begins to secrete a sticky substance.</span>")
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("<span class='notice'>\the [src] begins to secrete a sticky substance around \the [cocoon_target].</span>")
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("<span class='danger'>\the [src] sticks a proboscis into \the [L] and sucks a viscous substance out.</span>")
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 << "<span class='notice'>There is already a cluster of eggs here!</span>"
else if(!fed)
src << "<span class='warning'>You are too hungry to do this!</span>"
else if(busy != LAYING_EGGS)
busy = LAYING_EGGS
src.visible_message("<span class='notice'>\the [src] begins to lay a cluster of eggs.</span>")
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
+3 -1
View File
@@ -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)