green spider health/egg update, refactor

This commit is contained in:
Kyep
2019-02-08 03:13:09 -08:00
parent 7b540ebca0
commit a1e0ab6d96
@@ -16,8 +16,8 @@
icon_state = "terror_green"
icon_living = "terror_green"
icon_dead = "terror_green_dead"
maxHealth = 120
health = 120
maxHealth = 150
health = 150
melee_damage_lower = 10
melee_damage_upper = 20
var/feedings_to_lay = 2
@@ -33,54 +33,46 @@
var/obj/structure/spider/eggcluster/E = locate() in get_turf(src)
if(E)
to_chat(src, "<span class='notice'>There is already a cluster of eggs here!</span>")
else if(fed < feedings_to_lay)
return
if(fed < feedings_to_lay)
to_chat(src, "<span class='warning'>You must wrap more humanoid prey before you can do this!</span>")
return
var/list/eggtypes = list(TS_DESC_RED, TS_DESC_GRAY, TS_DESC_GREEN)
var/num_brown = CountSpidersType(/mob/living/simple_animal/hostile/poison/terror_spider/brown)
if(num_brown < 2)
eggtypes += TS_DESC_BROWN
var/num_black = CountSpidersType(/mob/living/simple_animal/hostile/poison/terror_spider/black)
if(num_black < 2)
eggtypes += TS_DESC_BLACK
var/eggtype = pick(eggtypes)
if(client)
eggtype = input("What kind of eggs?") as null|anything in eggtypes
if(!(eggtype in eggtypes))
to_chat(src, "<span class='danger'>Unrecognized egg type.</span>")
return 0
visible_message("<span class='notice'>[src] lays a cluster of eggs.</span>")
if(eggtype == TS_DESC_RED)
DoLayTerrorEggs(/mob/living/simple_animal/hostile/poison/terror_spider/red, 1, 1)
else if(eggtype == TS_DESC_GRAY)
DoLayTerrorEggs(/mob/living/simple_animal/hostile/poison/terror_spider/gray, 1, 1)
else if(eggtype == TS_DESC_GREEN)
DoLayTerrorEggs(/mob/living/simple_animal/hostile/poison/terror_spider/green, 1, 1)
else if(eggtype == TS_DESC_BLACK)
DoLayTerrorEggs(/mob/living/simple_animal/hostile/poison/terror_spider/black, 1, 1)
else if(eggtype == TS_DESC_BROWN)
DoLayTerrorEggs(/mob/living/simple_animal/hostile/poison/terror_spider/brown, 1, 1)
else
visible_message("<span class='notice'>[src] begins to lay a cluster of eggs.</span>")
if(prob(33))
DoLayTerrorEggs(/mob/living/simple_animal/hostile/poison/terror_spider/red, 1, 1)
else if(prob(50))
DoLayTerrorEggs(/mob/living/simple_animal/hostile/poison/terror_spider/gray, 1, 1)
else
DoLayTerrorEggs(/mob/living/simple_animal/hostile/poison/terror_spider/green, 1, 1)
fed -= feedings_to_lay
to_chat(src, "<span class='warning'>Unrecognized egg type!</span>")
fed += feedings_to_lay
fed -= feedings_to_lay
/mob/living/simple_animal/hostile/poison/terror_spider/green/spider_special_action()
if(cocoon_target)
if(get_dist(src, cocoon_target) <= 1)
spider_steps_taken = 0
DoWrap()
else
if(spider_steps_taken > spider_max_steps)
spider_steps_taken = 0
cocoon_target = null
busy = 0
stop_automated_movement = 0
else
spider_steps_taken++
CreatePath(cocoon_target)
step_to(src,cocoon_target)
if(spider_debug)
visible_message("<span class='notice'>[src] moves towards [cocoon_target] to cocoon it.</span>")
handle_cocoon_target()
else if(fed >= feedings_to_lay)
DoLayGreenEggs()
else if(world.time > (last_cocoon_object + freq_cocoon_object))
last_cocoon_object = world.time
var/list/can_see = view(src, 10)
for(var/mob/living/C in can_see)
if(C.stat == DEAD && !isterrorspider(C) && !C.anchored)
spider_steps_taken = 0
cocoon_target = C
return
for(var/obj/O in can_see)
if(O.anchored)
continue
if(istype(O, /obj/item) || istype(O, /obj/structure) || istype(O, /obj/machinery))
if(!istype(O, /obj/item/paper))
cocoon_target = O
stop_automated_movement = 1
spider_steps_taken = 0
return
seek_cocoon_target()
/mob/living/simple_animal/hostile/poison/terror_spider/green/spider_specialattack(mob/living/carbon/human/L, poisonable)
if(!poisonable)