Cleans up gold slime moblist code.

It will only generate the mob list once, and it won't use :  (thanks RR)
This commit is contained in:
Kyle Spier-Swenson
2015-08-30 21:45:31 -07:00
parent 53a1485bf1
commit cfe1aba809
+12 -11
View File
@@ -21,17 +21,18 @@
return
//I recommend you set the result amount to the total volume of all components.
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)
var/list/meancritters = list() // list of possible hostile mobs
var/list/nicecritters = list() // and possible friendly mobs
for(var/T in typesof(/mob/living/simple_animal))
switch(initial(T:gold_core_spawnable))
if(1)
meancritters += T
if(2)
nicecritters += T
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)
@@ -53,9 +54,9 @@
for(var/i = 1, i <= amount_to_spawn, i++)
var/chosen
if (reaction_name == "Friendly Gold Slime")
chosen = pick(nicecritters)
chosen = pick(chemical_mob_spawn_nicecritters)
else
chosen = pick(meancritters)
chosen = pick(chemical_mob_spawn_meancritters)
var/mob/living/simple_animal/C = new chosen
C.faction |= mob_faction
C.loc = get_turf(holder.my_atom)