Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes free chemsplosion reagent purging by replacing it with the same thing but dangerous #83195

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions code/modules/reagents/chemistry/recipes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
* * modifier - a flat additive numeric to the size of the explosion - set this if you want a minimum range
* * strengthdiv - the divisional factor of the explosion, a larger number means a smaller range - This is the part that modifies an explosion's range with volume (i.e. it divides it by this number)
*/
/datum/chemical_reaction/proc/default_explode(datum/reagents/holder, created_volume, modifier = 0, strengthdiv = 10)
/datum/chemical_reaction/proc/default_explode(datum/reagents/holder, created_volume, modifier = 0, strengthdiv = 10, clear_mob_reagents)
var/power = modifier + round(created_volume/strengthdiv, 1)
if(power > 0)
var/turf/T = get_turf(holder.my_atom)
Expand All @@ -300,8 +300,29 @@
var/datum/effect_system/reagents_explosion/e = new()
e.set_up(power , T, 0, 0)
e.start(holder.my_atom)
holder.clear_reagents()

if (ismob(holder.my_atom))
if(!clear_mob_reagents)
return
// Only clear reagents if they use a special explosive reaction to do it; it shouldn't apply
// to any explosion inside a person
holder.clear_reagents()
if(iscarbon(holder.my_atom))
var/mob/living/carbon/victim = holder.my_atom
var/vomit_flags = MOB_VOMIT_MESSAGE | MOB_VOMIT_FORCE
// The vomiting here is for effect, not meant to help with purging
victim.vomit(vomit_flags, distance = 5)
Metekillot marked this conversation as resolved.
Show resolved Hide resolved
// Not quite the same if the reaction is in their stomach; they'll throw up
// from any explosion, but it'll only make them puke up everything in their
// stomach
else if (istype(holder.my_atom, /obj/item/organ/internal/stomach))
var/obj/item/organ/internal/stomach/indigestion = holder.my_atom
if(power < 1)
return
indigestion.owner?.vomit(MOB_VOMIT_MESSAGE | MOB_VOMIT_FORCE, lost_nutrition = 150, distance = 5, purge_ratio = 1)
holder.clear_reagents()
return
else
holder.clear_reagents()
/*
*Creates a flash effect only - less expensive than explode()
*
Expand Down
50 changes: 46 additions & 4 deletions code/modules/reagents/chemistry/recipes/pyrotechnics.dm
Original file line number Diff line number Diff line change
@@ -1,13 +1,48 @@
#define PURGING_REAGENTS list( \
/datum/reagent/medicine/c2/multiver, \
/datum/reagent/medicine/pen_acid, \
/datum/reagent/medicine/calomel, \
/datum/reagent/medicine/ammoniated_mercury, \
/datum/reagent/medicine/c2/syriniver, \
/datum/reagent/medicine/c2/musiver \
)

/datum/chemical_reaction/reagent_explosion
var/strengthdiv = 10
var/modifier = 0
reaction_flags = REACTION_INSTANT
reaction_tags = REACTION_TAG_EXPLOSIVE | REACTION_TAG_MODERATE | REACTION_TAG_DANGEROUS
required_temp = 0 //Prevent impromptu RPGs

/datum/chemical_reaction/reagent_explosion/on_reaction(datum/reagents/holder, datum/equilibrium/reaction, created_volume)
default_explode(holder, created_volume, modifier, strengthdiv)

// Only clear mob reagents in special cases
var/clear_mob_reagents = FALSE

/datum/chemical_reaction/reagent_explosion/on_reaction(datum/reagents/holder, datum/equilibrium/reaction, created_volume, clear_mob_reagents)
// If an explosive reaction clears mob reagents, it should always be a minimum power
if(ismob(holder.my_atom) && clear_mob_reagents)
if(round((created_volume / strengthdiv) + modifier, 1) < 1)
modifier += 1 - ((created_volume / strengthdiv) + modifier)
// If this particular explosion doesn't automatically clear mob reagents as an inherent quality,
// then we can still clear mob reagents with some mad science malpractice that shouldn't work but
// does because omnizine is magic and also it's the future or whatever
if(ismob(holder.my_atom) && !clear_mob_reagents)
// The explosion needs to be a minimum power to clear reagents: see above
var/purge_power = round((created_volume / strengthdiv) + modifier, 1)
if(purge_power >= 1)
var/has_purging_chemical = FALSE
// They need one of the purge reagents in them
for(var/purging_chem as anything in PURGING_REAGENTS)
if(holder.has_reagent(purging_chem))
// We have a purging chemical
has_purging_chemical = TRUE
break
// Then we need omnizine! MAGIC!
var/has_omnizine = holder.has_reagent(/datum/reagent/medicine/omnizine)
if(has_purging_chemical && has_omnizine)
// With all this medical "science" combined, we can clear mob reagents
clear_mob_reagents = TRUE
default_explode(holder, created_volume, modifier, strengthdiv, clear_mob_reagents)

#undef PURGING_REAGENTS
/datum/chemical_reaction/reagent_explosion/nitroglycerin
results = list(/datum/reagent/nitroglycerin = 2)
required_reagents = list(/datum/reagent/glycerol = 1, /datum/reagent/toxin/acid/nitracid = 1, /datum/reagent/toxin/acid = 1)
Expand Down Expand Up @@ -104,11 +139,18 @@
/datum/chemical_reaction/reagent_explosion/penthrite_explosion_epinephrine
required_reagents = list(/datum/reagent/medicine/c2/penthrite = 1, /datum/reagent/medicine/epinephrine = 1)
strengthdiv = 5
// Penthrite is rare as hell, so this clears your reagents
// Will most likely be from miners accidentally penstacking
clear_mob_reagents = TRUE


/datum/chemical_reaction/reagent_explosion/penthrite_explosion_atropine
required_reagents = list(/datum/reagent/medicine/c2/penthrite = 1, /datum/reagent/medicine/atropine = 1)
strengthdiv = 5
modifier = 5
// Rare reagents clear your reagents
// Probably not good for you because you'll need healing chems to survive this most likely
clear_mob_reagents = TRUE

/datum/chemical_reaction/reagent_explosion/potassium_explosion
required_reagents = list(/datum/reagent/water = 1, /datum/reagent/potassium = 1)
Expand Down
Loading