/
bombspawner.dm
122 lines (95 loc) · 4.26 KB
/
bombspawner.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/**
* 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.temperature = 1413
second_gasmix.temperature = 141.3
first_gasmix.assert_gas(/datum/gas/plasma)
second_gasmix.assert_gas(/datum/gas/oxygen)
first_gasmix.gases[/datum/gas/plasma][MOLES] = calculate_pressure(first_gasmix, TANK_LEAK_PRESSURE - 1)
second_gasmix.gases[/datum/gas/oxygen][MOLES] = 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.temperature = 8000
second_gasmix.temperature = 43
first_gasmix.assert_gas(/datum/gas/plasma)
second_gasmix.assert_gas(/datum/gas/oxygen)
second_gasmix.assert_gas(/datum/gas/tritium)
first_gasmix.gases[/datum/gas/plasma][MOLES] = calculate_pressure(first_gasmix, TANK_LEAK_PRESSURE - 1)
second_gasmix.gases[/datum/gas/oxygen][MOLES] = 0.67 * calculate_pressure(second_gasmix, TANK_LEAK_PRESSURE - 1)
second_gasmix.gases[/datum/gas/tritium][MOLES] = 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.temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST + 1
second_gasmix.temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST + 1
first_gasmix.assert_gas(/datum/gas/hypernoblium)
first_gasmix.assert_gas(/datum/gas/tritium)
second_gasmix.assert_gas(/datum/gas/oxygen)
first_gasmix.gases[/datum/gas/hypernoblium][MOLES] = REACTION_OPPRESSION_THRESHOLD - 0.01
first_gasmix.gases[/datum/gas/tritium][MOLES] = 0.5 * calculate_pressure(first_gasmix, TANK_LEAK_PRESSURE - 1)
second_gasmix.gases[/datum/gas/oxygen][MOLES] = 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.temperature = 2.7
second_gasmix.temperature = 2.7
first_gasmix.assert_gas(/datum/gas/nitrogen)
second_gasmix.assert_gas(/datum/gas/tritium)
first_gasmix.gases[/datum/gas/nitrogen][MOLES] = calculate_pressure(first_gasmix, TANK_LEAK_PRESSURE - 1)
second_gasmix.gases[/datum/gas/tritium][MOLES] = 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.temperature = 20000
second_gasmix.temperature = 2.7
first_gasmix.assert_gas(/datum/gas/hypernoblium)
second_gasmix.assert_gas(/datum/gas/tritium)
first_gasmix.gases[/datum/gas/hypernoblium][MOLES] = calculate_pressure(first_gasmix, TANK_LEAK_PRESSURE - 1)
second_gasmix.gases[/datum/gas/tritium][MOLES] = calculate_pressure(second_gasmix, TANK_LEAK_PRESSURE - 1)