mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-23 15:38:08 +00:00
spawns have a high overhead. I only went for easy targets, almost every spawn could be removed with a few subsystems in place to handle delays or cooldowns
91 lines
3.5 KiB
Plaintext
91 lines
3.5 KiB
Plaintext
/datum/chemical_reaction
|
|
var/name = null
|
|
var/id = null
|
|
var/result = null
|
|
var/list/required_reagents = new/list()
|
|
var/list/required_catalysts = new/list()
|
|
|
|
// Both of these variables are mostly going to be used with slime cores - but if you want to, you can use them for other things
|
|
var/atom/required_container = null // the container required for the reaction to happen
|
|
var/required_other = 0 // an integer required for the reaction to happen
|
|
|
|
var/result_amount = 0
|
|
var/secondary = 0 // set to nonzero if secondary reaction
|
|
var/mob_react = 0 //Determines if a chemical reaction can occur inside a mob
|
|
|
|
var/required_temp = 0
|
|
var/mix_message = "The solution begins to bubble."
|
|
|
|
/datum/chemical_reaction/proc/on_reaction(datum/reagents/holder, created_volume)
|
|
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)
|
|
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.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/chemical_reaction/proc/goonchem_vortex(turf/simulated/T, setting_type, range)
|
|
for(var/atom/movable/X in orange(range, T))
|
|
if(istype(X, /obj/effect))
|
|
continue
|
|
if(!X.anchored)
|
|
var/distance = get_dist(X, T)
|
|
var/moving_power = max(range - distance, 1)
|
|
if(moving_power > 2) //if the vortex is powerful and we're close, we get thrown
|
|
if(setting_type)
|
|
var/atom/throw_target = get_edge_target_turf(X, get_dir(X, get_step_away(X, T)))
|
|
X.throw_at_fast(throw_target, moving_power, 1)
|
|
else
|
|
X.throw_at_fast(T, moving_power, 1)
|
|
else
|
|
spawn(0) //so everything moves at the same time.
|
|
if(setting_type)
|
|
for(var/i = 0, i < moving_power, i++)
|
|
sleep(2)
|
|
if(!step_away(X, T))
|
|
break
|
|
else
|
|
for(var/i = 0, i < moving_power, i++)
|
|
sleep(2)
|
|
if(!step_towards(X, T))
|
|
break
|