Simple Animal Spawn Refactor

This commit is contained in:
Fox-McCloud
2016-04-04 00:30:10 -04:00
parent 49f8ab674c
commit 3bd37ec757
35 changed files with 141 additions and 126 deletions
-28
View File
@@ -681,34 +681,6 @@ datum/reagent/life
/datum/chemical_reaction/life/on_reaction(var/datum/reagents/holder, var/created_volume)
chemical_mob_spawn(holder, 1, "Life")
proc/chemical_mob_spawn(var/datum/reagents/holder, var/amount_to_spawn, var/reaction_name, var/mob_faction = "chemicalsummon")
if(holder && holder.my_atom)
var/blocked = blocked_mobs //global variable for blocked mobs
var/list/critters = typesof(/mob/living/simple_animal/hostile) - blocked // list of possible hostile mobs
var/atom/A = holder.my_atom
var/turf/T = get_turf(A)
var/area/my_area = get_area(T)
var/message = "A [reaction_name] reaction has occured in (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[T.x];Y=[T.y];Z=[T.z]'>[my_area.name]</A>)"
var/mob/M = get(A, /mob)
if(M)
message += " - carried by: [key_name_admin(M)]"
else
message += " - last fingerprint: [(A.fingerprintslast ? A.fingerprintslast : "N/A")]"
message_admins(message, 0, 1)
playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
for(var/i = 1, i <= amount_to_spawn, i++)
var/chosen = pick(critters)
var/mob/living/simple_animal/hostile/C = new chosen
C.faction |= mob_faction
C.loc = get_turf(holder.my_atom)
if(prob(50))
for(var/j = 1, j <= rand(1, 3), j++)
step(C, pick(NORTH,SOUTH,EAST,WEST))
/datum/reagent/mannitol/on_mob_life(mob/living/M as mob)
M.adjustBrainLoss(-3)
..()
@@ -166,4 +166,47 @@
/datum/reagent/proc/reagent_deleted()
return
var/list/chemical_mob_spawn_meancritters = list() // list of possible hostile mobs
var/list/chemical_mob_spawn_nicecritters = list() // and possible friendly mobs
/datum/chemical_reaction/proc/chemical_mob_spawn(datum/reagents/holder, amount_to_spawn, reaction_name, mob_faction = "chemicalsummon")
if(holder && holder.my_atom)
if(chemical_mob_spawn_meancritters.len <= 0 || chemical_mob_spawn_nicecritters.len <= 0)
for(var/T in typesof(/mob/living/simple_animal))
var/mob/living/simple_animal/SA = T
switch(initial(SA.gold_core_spawnable))
if(1)
chemical_mob_spawn_meancritters += T
if(2)
chemical_mob_spawn_nicecritters += T
var/atom/A = holder.my_atom
var/turf/T = get_turf(A)
var/area/my_area = get_area(T)
var/message = "A [reaction_name] reaction has occured in [my_area.name]. (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[T.x];Y=[T.y];Z=[T.z]'>JMP</A>)"
message += " (<A HREF='?_src_=vars;Vars=\ref[A]'>VV</A>)"
var/mob/M = get(A, /mob)
if(M)
message += " - Carried By: [key_name_admin(M)](<A HREF='?_src_=holder;adminmoreinfo=\ref[M]'>?</A>) (<A HREF='?_src_=holder;adminplayerobservefollow=\ref[M]'>FLW</A>)"
else
message += " - Last Fingerprint: [(A.fingerprintslast ? A.fingerprintslast : "N/A")]"
message_admins(message, 0, 1)
playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
for(var/mob/living/carbon/C in viewers(get_turf(holder.my_atom), null))
C.flash_eyes()
for(var/i = 1, i <= amount_to_spawn, i++)
var/chosen
if(reaction_name == "Friendly Gold Slime")
chosen = pick(chemical_mob_spawn_nicecritters)
else
chosen = pick(chemical_mob_spawn_meancritters)
var/mob/living/simple_animal/C = new chosen
C.faction |= mob_faction
C.forceMove(get_turf(holder.my_atom))
if(prob(50))
for(var/j = 1, j <= rand(1, 3), j++)
step(C, pick(NORTH,SOUTH,EAST,WEST))
#undef ADDICTION_TIME
@@ -77,31 +77,16 @@
name = "Slime Crit"
id = "m_tele"
result = null
required_reagents = list("plasma" = 5)
required_reagents = list("plasma" = 1)
result_amount = 1
required_container = /obj/item/slime_extract/gold
required_other = 1
on_reaction(var/datum/reagents/holder)
var/blocked = blocked_mobs //global variable of blocked mobs
var/list/critters = typesof(/mob/living/simple_animal/hostile) - blocked // list of possible hostile mobs
playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
for(var/mob/living/carbon/C in viewers(get_turf(holder.my_atom), null))
C.flash_eyes()
for(var/i = 1, i <= 5, i++)
var/chosen = pick(critters)
var/mob/living/simple_animal/hostile/C = new chosen
C.faction |= "slimesummon"
C.loc = get_turf(holder.my_atom)
if(prob(50))
for(var/j = 1, j <= rand(1, 3), j++)
step(C, pick(NORTH,SOUTH,EAST,WEST))
// for(var/mob/O in viewers(get_turf(holder.my_atom), null))
// O.show_message(text("\red The slime core fizzles disappointingly,"), 1)
feedback_add_details("slime_cores_used","[type]")
var/turf/T = get_turf(holder.my_atom)
T.visible_message("<span class='danger'>The slime extract begins to vibrate violently !</span>")
spawn(50)
chemical_mob_spawn(holder, 5, "Gold Slime")
slimecritlesser
@@ -113,26 +98,28 @@
required_container = /obj/item/slime_extract/gold
required_other = 1
on_reaction(var/datum/reagents/holder)
feedback_add_details("slime_cores_used","[replacetext(name," ","_")]")
for(var/mob/O in viewers(get_turf(holder.my_atom), null))
O.show_message(text("<span class='danger'>The slime extract begins to vibrate violently!</span>"), 1)
feedback_add_details("slime_cores_used","[type]")
var/turf/T = get_turf(holder.my_atom)
T.visible_message("<span class='danger'>The slime extract begins to vibrate violently !</span>")
spawn(50)
chemical_mob_spawn(holder, 3, "Lesser Gold Slime", "neutral")
if(holder && holder.my_atom)
var/blocked = blocked_mobs
slimecritfriendly
name = "Slime Crit Friendly"
id = "m_tele5"
result = null
required_reagents = list("water" = 1)
result_amount = 1
required_container = /obj/item/slime_extract/gold
required_other = 1
on_reaction(datum/reagents/holder)
feedback_add_details("slime_cores_used","[type]")
var/turf/T = get_turf(holder.my_atom)
T.visible_message("<span class='danger'>The slime extract begins to vibrate adorably !</span>")
spawn(50)
chemical_mob_spawn(holder, 1, "Friendly Gold Slime", "neutral")
var/list/critters = typesof(/mob/living/simple_animal/hostile) - blocked // list of possible hostile mobs
playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
for(var/mob/living/carbon/C in viewers(get_turf(holder.my_atom), null))
C.flash_eyes()
var/chosen = pick(critters)
var/mob/living/simple_animal/hostile/C = new chosen
C.faction |= "neutral"
C.loc = get_turf(holder.my_atom)
//Silver
slimebork