Fixes self-sustaining rainbow slime extracts, blue slime extracts' foam activation and refactors foam code into a helper proc (#46259)

* Fixing self sustaining rainbow extracts and fixing foam creation of blue slime extracts

* Refactoring foams to be in a helper function. Resin foam remains untouched

* Improving refactor of create_foam

* Putting helper proc in vent clog event

* create_foam takes a foam type again

* minor type passing change
This commit is contained in:
Dingo-Dongler
2019-09-06 16:54:42 +10:00
committed by AnturK
parent 63f8856a19
commit cb31d23f49
7 changed files with 27 additions and 50 deletions

View File

@@ -72,3 +72,15 @@
if(!GLOB.chemical_reactions_list[primary_reagent])
GLOB.chemical_reactions_list[primary_reagent] = list()
GLOB.chemical_reactions_list[primary_reagent] += R
//Creates foam from the reagent. Metaltype is for metal foam, notification is what to show people in textbox
/datum/reagents/proc/create_foam(foamtype,foam_volume,metaltype = 0,notification = null)
var/location = get_turf(my_atom)
var/datum/effect_system/foam_spread/foam = new foamtype()
foam.set_up(foam_volume, location, src, metaltype)
foam.start()
clear_reagents()
if(!notification)
return
for(var/mob/M in viewers(5, location))
to_chat(M, notification)

View File

@@ -230,7 +230,7 @@
chemholder = null
return ..()
/datum/effect_system/foam_spread/set_up(amt=5, loca, datum/reagents/carry = null)
/datum/effect_system/foam_spread/set_up(amt=5, loca, datum/reagents/carry = null, metaltype = 0)
if(isturf(loca))
location = loca
else
@@ -238,9 +238,7 @@
amount = round(sqrt(amt / 2), 1)
carry.copy_to(chemholder, carry.total_volume)
/datum/effect_system/foam_spread/metal/set_up(amt=5, loca, datum/reagents/carry = null, metaltype)
..()
if(metaltype != 0)
metal = metaltype
/datum/effect_system/foam_spread/start()

View File

@@ -40,9 +40,7 @@
else
R.add_reagent(pick(saferChems), reagentsAmount)
var/datum/effect_system/foam_spread/foam = new
foam.set_up(200, get_turf(vent), R)
foam.start()
R.create_foam(/datum/effect_system/foam_spread,200)
var/cockroaches = prob(33) ? 3 : 0
while(cockroaches)
@@ -97,9 +95,7 @@
R.my_atom = vent
R.add_reagent(/datum/reagent/consumable/ethanol/beer, reagentsAmount)
var/datum/effect_system/foam_spread/foam = new
foam.set_up(200, get_turf(vent), R)
foam.start()
R.create_foam(200)
CHECK_TICK
/datum/round_event/vent_clog/plasma_decon/announce()

View File

@@ -354,15 +354,7 @@
mob_react = FALSE
/datum/chemical_reaction/foam/on_reaction(datum/reagents/holder, created_volume)
var/location = get_turf(holder.my_atom)
for(var/mob/M in viewers(5, location))
to_chat(M, "<span class='danger'>The solution spews out foam!</span>")
var/datum/effect_system/foam_spread/s = new()
s.set_up(created_volume*2, location, holder)
s.start()
holder.clear_reagents()
return
holder.create_foam(/datum/effect_system/foam_spread,2*created_volume,notification="<span class='danger'>The solution spews out foam!</span>")
/datum/chemical_reaction/metalfoam
name = "Metal Foam"
@@ -371,15 +363,7 @@
mob_react = FALSE
/datum/chemical_reaction/metalfoam/on_reaction(datum/reagents/holder, created_volume)
var/location = get_turf(holder.my_atom)
for(var/mob/M in viewers(5, location))
to_chat(M, "<span class='danger'>The solution spews out a metallic foam!</span>")
var/datum/effect_system/foam_spread/metal/s = new()
s.set_up(created_volume*5, location, holder, 1)
s.start()
holder.clear_reagents()
holder.create_foam(/datum/effect_system/foam_spread/metal,5*created_volume,1,"<span class='danger'>The solution spews out a metallic foam!</span>")
/datum/chemical_reaction/smart_foam
name = "Smart Metal Foam"
@@ -388,12 +372,7 @@
mob_react = TRUE
/datum/chemical_reaction/smart_foam/on_reaction(datum/reagents/holder, created_volume)
var/turf/location = get_turf(holder.my_atom)
location.visible_message("<span class='danger'>The solution spews out metallic foam!</span>")
var/datum/effect_system/foam_spread/metal/smart/s = new()
s.set_up(created_volume * 5, location, holder, TRUE)
s.start()
holder.clear_reagents()
holder.create_foam(/datum/effect_system/foam_spread/metal/smart,5*created_volume,1,"<span class='danger'>The solution spews out metallic foam!</span>")
/datum/chemical_reaction/ironfoam
name = "Iron Foam"
@@ -402,13 +381,7 @@
mob_react = FALSE
/datum/chemical_reaction/ironfoam/on_reaction(datum/reagents/holder, created_volume)
var/location = get_turf(holder.my_atom)
for(var/mob/M in viewers(5, location))
to_chat(M, "<span class='danger'>The solution spews out a metallic foam!</span>")
var/datum/effect_system/foam_spread/metal/s = new()
s.set_up(created_volume*5, location, holder, 2)
s.start()
holder.clear_reagents()
holder.create_foam(/datum/effect_system/foam_spread/metal,5*created_volume,2,"<span class='danger'>The solution spews out a metallic foam!</span>")
/datum/chemical_reaction/foaming_agent
name = "Foaming Agent"

View File

@@ -210,11 +210,13 @@
/datum/chemical_reaction/slime/slimefoam
name = "Slime Foam"
id = "m_foam"
results = list(/datum/reagent/fluorosurfactant = 20, /datum/reagent/water = 20)
required_reagents = list(/datum/reagent/water = 5)
required_container = /obj/item/slime_extract/blue
required_other = TRUE
/datum/chemical_reaction/slime/slimefoam/on_reaction(datum/reagents/holder)
holder.create_foam(/datum/effect_system/foam_spread,80, "<span class='danger'>[src] spews out foam!</span>")
//Dark Blue
/datum/chemical_reaction/slime/slimefreeze
name = "Slime Freeze"

View File

@@ -42,10 +42,10 @@ Self-sustaining extracts:
return
if(reagentselect == "lesser plasma")
amount = 4
reagentselect = "plasma"
reagentselect = /datum/reagent/toxin/plasma
if(reagentselect == "holy water and uranium")
reagentselect = /datum/reagent/water/holywater
secondary = "uranium"
secondary = /datum/reagent/uranium
extract.forceMove(user.drop_location())
qdel(src)
user.put_in_active_hand(extract)

View File

@@ -298,11 +298,7 @@
return 250
if(SLIME_ACTIVATE_MAJOR)
var/location = get_turf(user)
var/datum/effect_system/foam_spread/s = new()
s.set_up(20, location, user.reagents)
s.start()
user.reagents.clear_reagents()
user.reagents.create_foam(/datum/effect_system/foam_spread,20)
user.visible_message("<span class='danger'>Foam spews out from [user]'s skin!</span>", "<span class='warning'>You activate [src], and foam bursts out of your skin!</span>")
return 600