mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-11 08:06:33 +01:00
e98cb75c57
## About The Pull Request Refactor the majority of the current gasmix mole change use cases into a proc called adjust_gas which simply adds the designated mole count of the species into the gas mix while also handling asserting the gas and garbage_collect() I also added adjust_multiple_gases and convert_gas() for modifying multiple gases and within a gasmix ## Why It's Good For The Game Lemon wanted this to be done as part of the air group refactor ## Changelog 🆑 refactor: refactored majority of gas_mix mole change into adjust_gas() proc /🆑
108 lines
3.7 KiB
Plaintext
108 lines
3.7 KiB
Plaintext
/**
|
|
* Spawns a TTV.
|
|
*
|
|
*/
|
|
/obj/effect/spawner/newbomb
|
|
name = "bomb"
|
|
icon = 'icons/hud/screen_gen.dmi'
|
|
icon_state = "x"
|
|
/* Gasmixes for tank_one and tank_two of the ttv respectively.
|
|
* Populated on /obj/effect/spawner/newbomb/Initialize, depopulated right after by the children procs.
|
|
*/
|
|
var/datum/gas_mixture/first_gasmix
|
|
var/datum/gas_mixture/second_gasmix
|
|
|
|
/**
|
|
* The part of code that actually spawns the bomb. Always call the parent's initialize first for subtypes of these.
|
|
*
|
|
* Arguments:
|
|
* * assembly - An assembly typepath to add to the ttv.
|
|
*/
|
|
/obj/effect/spawner/newbomb/Initialize(mapload, assembly = null)
|
|
. = ..()
|
|
var/obj/item/transfer_valve/ttv = new(loc)
|
|
ttv.tank_one = new /obj/item/tank/internals/plasma (ttv)
|
|
ttv.tank_two = new /obj/item/tank/internals/oxygen (ttv)
|
|
first_gasmix = ttv.tank_one.return_air()
|
|
second_gasmix = ttv.tank_two.return_air()
|
|
first_gasmix.remove_ratio(1)
|
|
second_gasmix.remove_ratio(1)
|
|
if(ispath(assembly, /obj/item/assembly))
|
|
var/obj/item/assembly/newassembly = new assembly (ttv)
|
|
ttv.attached_device = newassembly
|
|
newassembly.on_attach()
|
|
newassembly.holder = ttv
|
|
ttv.update_appearance()
|
|
|
|
/obj/effect/spawner/newbomb/proc/calculate_pressure(datum/gas_mixture/gasmix, pressure)
|
|
return pressure * gasmix.volume/(R_IDEAL_GAS_EQUATION*gasmix.temperature)
|
|
|
|
/obj/effect/spawner/newbomb/plasma
|
|
|
|
/obj/effect/spawner/newbomb/plasma/Initialize(mapload)
|
|
. = ..()
|
|
if(!first_gasmix || !second_gasmix)
|
|
return
|
|
|
|
first_gasmix.set_temperature(1413)
|
|
second_gasmix.set_temperature(141.3)
|
|
|
|
first_gasmix.set_gas(/datum/gas/plasma, calculate_pressure(first_gasmix, TANK_LEAK_PRESSURE - 1))
|
|
second_gasmix.set_gas(/datum/gas/oxygen, calculate_pressure(second_gasmix, TANK_LEAK_PRESSURE - 1))
|
|
|
|
/obj/effect/spawner/newbomb/tritium
|
|
|
|
/obj/effect/spawner/newbomb/tritium/Initialize(mapload, obj/item/assembly)
|
|
. = ..()
|
|
if(!first_gasmix || !second_gasmix)
|
|
return
|
|
|
|
first_gasmix.set_temperature(8000)
|
|
second_gasmix.set_temperature(43)
|
|
|
|
first_gasmix.set_gas(/datum/gas/plasma, calculate_pressure(first_gasmix, TANK_LEAK_PRESSURE - 1))
|
|
|
|
second_gasmix.set_gas(/datum/gas/oxygen, 0.67 * calculate_pressure(second_gasmix, TANK_LEAK_PRESSURE - 1))
|
|
second_gasmix.set_gas(/datum/gas/tritium, 0.33 * calculate_pressure(second_gasmix, TANK_LEAK_PRESSURE - 1))
|
|
|
|
/obj/effect/spawner/newbomb/isolated_tritium
|
|
|
|
/obj/effect/spawner/newbomb/isolated_tritium/Initialize(mapload)
|
|
. = ..()
|
|
if(!first_gasmix || !second_gasmix)
|
|
return
|
|
|
|
first_gasmix.set_temperature(FIRE_MINIMUM_TEMPERATURE_TO_EXIST + 1)
|
|
second_gasmix.set_temperature(FIRE_MINIMUM_TEMPERATURE_TO_EXIST + 1)
|
|
|
|
first_gasmix.set_gas(/datum/gas/hypernoblium, REACTION_OPPRESSION_THRESHOLD - 0.01,)
|
|
first_gasmix.set_gas( /datum/gas/tritium, 0.5 * calculate_pressure(first_gasmix, TANK_LEAK_PRESSURE - 1))
|
|
|
|
second_gasmix.set_gas(/datum/gas/oxygen, calculate_pressure(second_gasmix, TANK_LEAK_PRESSURE-1))
|
|
|
|
/obj/effect/spawner/newbomb/noblium
|
|
|
|
/obj/effect/spawner/newbomb/noblium/Initialize(mapload)
|
|
. = ..()
|
|
if(!first_gasmix || !second_gasmix)
|
|
return
|
|
|
|
first_gasmix.set_temperature(2.7)
|
|
second_gasmix.set_temperature(2.7)
|
|
|
|
first_gasmix.set_gas(/datum/gas/nitrogen, calculate_pressure(first_gasmix, TANK_LEAK_PRESSURE - 1))
|
|
second_gasmix.set_gas(/datum/gas/tritium, calculate_pressure(second_gasmix, TANK_LEAK_PRESSURE - 1))
|
|
|
|
/obj/effect/spawner/newbomb/pressure
|
|
|
|
/obj/effect/spawner/newbomb/pressure/Initialize(mapload)
|
|
. = ..()
|
|
if(!first_gasmix || !second_gasmix)
|
|
return
|
|
|
|
first_gasmix.set_temperature(20000)
|
|
second_gasmix.set_temperature(2.7)
|
|
|
|
first_gasmix.set_gas(/datum/gas/hypernoblium, calculate_pressure(first_gasmix, TANK_LEAK_PRESSURE - 1))
|
|
second_gasmix.set_gas(/datum/gas/tritium, calculate_pressure(second_gasmix, TANK_LEAK_PRESSURE - 1))
|