mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-16 10:35:41 +01:00
00ccf0c6b5
# Conflicts: # .github/CODEOWNERS # .github/workflows/compile_changelogs.yml # .github/workflows/stale.yml # SQL/database_changelog.md # _maps/map_files/CatwalkStation/CatwalkStation_2023.dmm # code/__DEFINES/atom_hud.dm # code/__DEFINES/inventory.dm # code/__DEFINES/mobs.dm # code/__DEFINES/species_clothing_paths.dm # code/__DEFINES/subsystems.dm # code/__DEFINES/surgery.dm # code/__HELPERS/global_lists.dm # code/_globalvars/lists/maintenance_loot.dm # code/_globalvars/traits/_traits.dm # code/controllers/subsystem/minor_mapping.dm # code/controllers/subsystem/processing/quirks.dm # code/controllers/subsystem/shuttle.dm # code/datums/components/palette.dm # code/datums/components/surgery_initiator.dm # code/datums/diseases/advance/advance.dm # code/datums/hud.dm # code/datums/mood.dm # code/datums/mutations/chameleon.dm # code/datums/quirks/negative_quirks/nyctophobia.dm # code/datums/status_effects/debuffs/debuffs.dm # code/datums/status_effects/debuffs/drunk.dm # code/datums/status_effects/debuffs/slime/slime_leech.dm # code/datums/weather/weather.dm # code/game/data_huds.dm # code/game/objects/items.dm # code/game/objects/items/devices/scanners/health_analyzer.dm # code/game/objects/items/frog_statue.dm # code/game/objects/items/rcd/RLD.dm # code/game/objects/items/robot/items/hypo.dm # code/game/objects/items/stacks/medical.dm # code/game/objects/items/stacks/wrap.dm # code/game/objects/items/storage/garment.dm # code/game/objects/items/tools/medical/defib.dm # code/game/objects/items/weaponry.dm # code/game/objects/items/weaponry/melee/misc.dm # code/game/objects/structures/crates_lockers/closets/secure/security.dm # code/game/objects/structures/curtains.dm # code/game/objects/structures/dresser.dm # code/game/objects/structures/girders.dm # code/game/objects/structures/maintenance.dm # code/game/objects/structures/mirror.dm # code/modules/admin/greyscale_modify_menu.dm # code/modules/admin/verbs/light_debug.dm # code/modules/antagonists/ashwalker/ashwalker.dm # code/modules/antagonists/heretic/knowledge/starting_lore.dm # code/modules/antagonists/ninja/ninjaDrainAct.dm # code/modules/art/paintings.dm # code/modules/client/preferences.dm # code/modules/client/verbs/ooc.dm # code/modules/clothing/head/wig.dm # code/modules/events/disease_outbreak.dm # code/modules/holodeck/holo_effect.dm # code/modules/jobs/job_types/head_of_security.dm # code/modules/jobs/job_types/security_officer.dm # code/modules/library/skill_learning/generic_skillchips/point.dm # code/modules/mining/lavaland/ash_flora.dm # code/modules/mining/lavaland/mining_loot/megafauna/ash_drake.dm # code/modules/mob/dead/new_player/new_player.dm # code/modules/mob/living/basic/guardian/guardian.dm # code/modules/mob/living/basic/space_fauna/space_dragon/space_dragon.dm # code/modules/mob/living/carbon/carbon.dm # code/modules/mob/living/carbon/human/human.dm # code/modules/mob/living/carbon/human/human_defines.dm # code/modules/mob/living/carbon/life.dm # code/modules/mob/living/living.dm # code/modules/mob/living/living_defines.dm # code/modules/mob/mob.dm # code/modules/mob_spawn/ghost_roles/mining_roles.dm # code/modules/mod/mod_control.dm # code/modules/mod/modules/modules_general.dm # code/modules/modular_computers/computers/item/computer_ui.dm # code/modules/paperwork/paper.dm # code/modules/paperwork/paperbin.dm # code/modules/power/lighting/light.dm # code/modules/projectiles/guns/energy/kinetic_accelerator.dm # code/modules/projectiles/projectile.dm # code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm # code/modules/reagents/chemistry/reagents/food_reagents.dm # code/modules/reagents/chemistry/reagents/other_reagents.dm # code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm # code/modules/research/xenobiology/crossbreeding/_clothing.dm # code/modules/research/xenobiology/crossbreeding/prismatic.dm # code/modules/surgery/advanced/brainwashing.dm # code/modules/surgery/advanced/lobotomy.dm # code/modules/surgery/amputation.dm # code/modules/surgery/blood_filter.dm # code/modules/surgery/bodyparts/_bodyparts.dm # code/modules/surgery/brain_surgery.dm # code/modules/surgery/cavity_implant.dm # code/modules/surgery/coronary_bypass.dm # code/modules/surgery/gastrectomy.dm # code/modules/surgery/healing.dm # code/modules/surgery/limb_augmentation.dm # code/modules/surgery/organ_manipulation.dm # code/modules/surgery/revival.dm # code/modules/surgery/sleeper_protocol.dm # code/modules/surgery/surgery_helpers.dm # code/modules/surgery/surgery_step.dm # code/modules/unit_tests/_unit_tests.dm # code/modules/unit_tests/designs.dm # code/modules/unit_tests/icon_state_worn.dm # code/modules/unit_tests/screenshots/screenshot_antag_icons_cultist.png # code/modules/unit_tests/screenshots/screenshot_antag_icons_headrevolutionary.png # code/modules/unit_tests/screenshots/screenshot_antag_icons_provocateur.png # code/modules/unit_tests/screenshots/screenshot_husk_body.png # code/modules/unit_tests/screenshots/screenshot_husk_body_missing_limbs.png # icons/map_icons/clothing/head/_head.dmi # icons/map_icons/clothing/shoes.dmi # icons/map_icons/items/_item.dmi # icons/mob/huds/hud.dmi # icons/mob/inhands/64x64_lefthand.dmi # icons/mob/inhands/64x64_righthand.dmi # icons/obj/machines/computer.dmi # tgui/packages/tgui/interfaces/OperatingComputer.jsx # tgui/packages/tgui/interfaces/PreferencesMenu/CharacterPreferences/MainPage.tsx # tgui/packages/tgui/interfaces/PreferencesMenu/types.ts # tgui/packages/tgui/interfaces/SurgeryInitiator.tsx # tools/icon_cutter/check.py
117 lines
4.9 KiB
Plaintext
117 lines
4.9 KiB
Plaintext
// Replaces chemgrenade stuff, allowing reagent explosions to be called from anywhere.
|
|
// It should be called using a location, the range, and a list of reagents involved.
|
|
|
|
// Threatscale is a multiplier for the 'threat' of the grenade. If you're increasing the affected range drastically, you might want to improve this.
|
|
// Extra heat affects the temperature of the mixture, and may cause it to react in different ways.
|
|
|
|
/**
|
|
* The basic chemical bomb proc.
|
|
* Combines a set of reagent holders into one holder and reacts it.
|
|
* If there are any reagents left over it spreads them across the surrounding environment.
|
|
* The maximum volume of the holder is temporarily adjusted to allow for reactions which increase total volume to work at full effectiveness.
|
|
* The maximum volume of the holder is then reset to its original value.
|
|
*
|
|
* Arguments:
|
|
* - [epicenter][/turf]: The epicenter of the splash if some of the reagents aren't consumed.
|
|
* - [holder][/datum/reagents]: The holder to combine all of the reagents into. A temporary one is created if this is null.
|
|
* - [reactants][/list/datum/reagents]: The set of reagent holders to combine.
|
|
* - extra_heat: Some amount to heat the combined reagents by before reacting them.
|
|
* - threatscale: A multiplier for the reagent quantities involved.
|
|
* - adminlog: Whether to alert the admins that this has occured.
|
|
*/
|
|
/proc/chem_splash(turf/epicenter, datum/reagents/holder = null, affected_range = 3, list/datum/reagents/reactants = list(), extra_heat = 0, threatscale = 1, adminlog = 1)
|
|
if(!isturf(epicenter) || !reactants.len || threatscale <= 0)
|
|
return
|
|
|
|
var/total_reagents = holder?.total_volume
|
|
var/maximum_reagents = holder?.maximum_volume
|
|
for(var/datum/reagents/reactant in reactants)
|
|
if(reactant.total_volume)
|
|
total_reagents += reactant.total_volume
|
|
maximum_reagents += reactant.maximum_volume
|
|
|
|
if (total_reagents <= 0)
|
|
return FALSE
|
|
|
|
var/tmp_holder = null
|
|
var/original_max_volume = null
|
|
if (isnull(holder))
|
|
tmp_holder = TRUE
|
|
holder = new /datum/reagents(maximum_reagents * threatscale)
|
|
holder.my_atom = epicenter
|
|
else
|
|
tmp_holder = FALSE
|
|
original_max_volume = holder.maximum_volume
|
|
if(threatscale < 1)
|
|
holder.multiply(threatscale)
|
|
holder.maximum_volume = maximum_reagents * threatscale
|
|
else
|
|
holder.maximum_volume = maximum_reagents * threatscale
|
|
holder.multiply(threatscale)
|
|
|
|
for(var/datum/reagents/reactant as anything in reactants)
|
|
reactant.trans_to(holder, reactant.total_volume, threatscale, no_react = TRUE)
|
|
|
|
holder.chem_temp = max(holder.chem_temp + extra_heat, TCMB) // Average temperature of reagents + extra heat.
|
|
holder.handle_reactions() // React them now.
|
|
|
|
if(holder.total_volume)
|
|
if(affected_range >= 0)
|
|
spread_reagents(holder, epicenter, affected_range)
|
|
holder.clear_reagents()
|
|
|
|
if(tmp_holder)
|
|
qdel(holder)
|
|
else
|
|
holder.maximum_volume = original_max_volume
|
|
|
|
return TRUE
|
|
|
|
|
|
/**
|
|
* Exposes all accessible atoms within some distance of an epicenter to some reagents.
|
|
* Does not clear the source reagent holder; that must be done manually if it is desired.
|
|
*
|
|
* Arguments:
|
|
* - [source][/datum/reagents]: The reagents to spread around.
|
|
* - [epicenter][/atom]: The epicenter/source location of the reagent spread.
|
|
* - spread_range: The range in which to spread the reagents. Will not go over 20
|
|
*/
|
|
/proc/spread_reagents(datum/reagents/source, atom/epicenter, spread_range)
|
|
spread_range = min(spread_range, 20) // Fuck off with trying to do more then this
|
|
var/datum/effect_system/basic/steam_spread/steam = new /datum/effect_system/basic/steam_spread(epicenter, 10, FALSE)
|
|
steam.attach(epicenter).start()
|
|
// This is a basic floodfill algorithm of atmos connected tiles
|
|
// Turfs will be stored in the form turf -> TRUE
|
|
var/chem_temp = source.chem_temp
|
|
var/hot_chem = chem_temp >= 300
|
|
var/list/turflist = list()
|
|
var/list/reactable = list()
|
|
turflist[epicenter] = TRUE
|
|
for(var/i = 1; i <= length(turflist); i++)
|
|
var/turf/valid_step = turflist[i]
|
|
if(get_dist(valid_step, epicenter) > spread_range) // We are over threshold, don't add anything new and just keep goin
|
|
turflist.Cut(i, i+1)
|
|
i--
|
|
continue
|
|
|
|
for(var/turf/lad as anything in valid_step.atmos_adjacent_turfs)
|
|
if(turflist[lad])
|
|
continue
|
|
turflist[lad] = TRUE
|
|
|
|
reactable += valid_step.get_all_contents() // Yes this means multitile objects double react. I don't care. skill issue
|
|
if(hot_chem)
|
|
valid_step.hotspot_expose(chem_temp*2, 5)
|
|
|
|
// Remove anything we can't see
|
|
for(var/atom/thing as anything in (dview(spread_range, epicenter) & reactable))
|
|
var/distance = max(1, get_dist(thing, epicenter))
|
|
var/fraction = 0.5 / (2 ** distance) //50/25/12/6... for a 200u splash, 25/12/6/3... for a 100u, 12/6/3/1 for a 50u
|
|
source.expose(thing, TOUCH, fraction)
|
|
// SKYRAT EDIT ADDITION START - Liquids
|
|
if(isturf(epicenter))
|
|
var/turf/center_of_mess = epicenter
|
|
center_of_mess.add_liquid_from_reagents(source)
|
|
// SKYRAT EDIT ADDITION END
|