/
Chemistry-Reagents-Core.dm
257 lines (222 loc) · 8.17 KB
/
Chemistry-Reagents-Core.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
/datum/reagent/blood
data = list(
"donor" = null,
"species" = SPECIES_HUMAN,
"blood_DNA" = null,
"blood_type" = null,
"blood_colour" = COLOR_BLOOD_HUMAN,
"trace_chem" = null,
"dose_chem" = null,
"has_oxy" = 1
)
name = "Blood"
description = "A red (or blue) liquid commonly found inside animals, most of whom are pretty insistent about it being left where you found it."
reagent_state = LIQUID
metabolism = REM * 5
color = "#c80000"
scannable = 1
taste_description = "iron"
taste_mult = 1.3
glass_name = "tomato juice"
glass_desc = "Are you sure this is tomato juice?"
value = 2
chilling_products = list(/datum/reagent/coagulated_blood)
chilling_point = 249
chilling_message = "coagulates and clumps together."
heating_products = list(/datum/reagent/coagulated_blood)
heating_point = 318
heating_message = "coagulates and clumps together."
/datum/reagent/blood/initialize_data(newdata)
..()
if(data && data["blood_colour"])
color = data["blood_colour"]
return
/datum/reagent/blood/proc/sync_to(mob/living/carbon/C)
data = C.get_blood_data()
color = data["blood_colour"]
/datum/reagent/blood/get_data() // Just in case you have a reagent that handles data differently.
var/t = data.Copy()
return t
/datum/reagent/blood/touch_turf(turf/simulated/T)
if(!istype(T) || volume < 3)
return
var/weakref/W = data["donor"]
if (!W)
blood_splatter(T, src, 1)
return
W = W.resolve()
if(ishuman(W))
blood_splatter(T, src, 1)
else if(isalien(W))
var/obj/decal/cleanable/blood/B = blood_splatter(T, src, 1)
if(B)
B.blood_DNA["UNKNOWN DNA STRUCTURE"] = "X*"
/datum/reagent/blood/affect_ingest(mob/living/carbon/M, removed)
if(M.chem_doses[type] > 5)
M.adjustToxLoss(removed)
if(M.chem_doses[type] > 15)
M.adjustToxLoss(removed)
/datum/reagent/blood/affect_touch(mob/living/carbon/M, removed)
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(H.isSynthetic())
return
/datum/reagent/blood/affect_blood(mob/living/carbon/M, removed)
M.inject_blood(src, volume)
remove_self(volume)
// Water!
#define WATER_LATENT_HEAT 9500 // How much heat is removed when applied to a hot turf, in J/unit (9500 makes 120 u of water roughly equivalent to 2L
/datum/reagent/water
name = "Water"
description = "A ubiquitous chemical substance composed of hydrogen and oxygen."
reagent_state = LIQUID
color = "#3073b6"
alpha = 120
scannable = 1
metabolism = REM * 10
taste_description = "water"
glass_name = "water"
glass_desc = "The father of all refreshments."
chilling_products = list(/datum/reagent/drink/ice)
chilling_point = T0C
heating_products = list(/datum/reagent/water/boiling)
heating_point = T100C
value = 0
/datum/reagent/water/affect_blood(mob/living/carbon/M, removed)
var/malus_level = M.GetTraitLevel(/singleton/trait/malus/water)
if (malus_level)
M.adjustToxLoss(malus_level * removed)
/datum/reagent/water/affect_ingest(mob/living/carbon/M, removed)
var/malus_level = M.GetTraitLevel(/singleton/trait/malus/water)
if (malus_level)
M.adjustToxLoss(malus_level * removed)
M.adjust_hydration(removed * 10)
/datum/reagent/water/touch_turf(turf/simulated/T)
if(!istype(T))
return
var/datum/gas_mixture/environment = T.return_air()
var/min_temperature = T20C + rand(0, 20) // Room temperature + some variance. An actual diminishing return would be better, but this is *like* that. In a way. . This has the potential for weird behavior, but I says fuck it. Water grenades for everyone.
var/hotspot = (locate(/obj/hotspot) in T)
if(hotspot && !istype(T, /turf/space))
var/datum/gas_mixture/lowertemp = T.remove_air(T:air:total_moles)
if (lowertemp)
lowertemp.temperature = max(min(lowertemp.temperature-2000, lowertemp.temperature / 2), 0)
lowertemp.react()
T.assume_air(lowertemp)
qdel(hotspot)
if (environment && environment.temperature > min_temperature) // Abstracted as steam or something
var/removed_heat = clamp(volume * WATER_LATENT_HEAT, 0, -environment.get_thermal_energy_change(min_temperature))
environment.add_thermal_energy(-removed_heat)
if (prob(5) && environment && environment.temperature > T100C)
T.visible_message(SPAN_WARNING("The water sizzles as it lands on \the [T]!"))
else if(volume >= 10)
var/turf/simulated/S = T
S.wet_floor(8, TRUE)
/datum/reagent/water/touch_obj(obj/O)
if(istype(O, /obj/item/reagent_containers/food/snacks/monkeycube))
var/obj/item/reagent_containers/food/snacks/monkeycube/cube = O
if(!cube.wrapped)
cube.Expand()
if(istype(O, /obj/turf_fire))
var/obj/turf_fire/TF = O
TF.AddPower(-volume)
if(TF.fire_power <= 0)
qdel(TF)
/datum/reagent/water/touch_mob(mob/living/L, amount)
var/mob/living/carbon/human/H = L
if(istype(H))
var/obj/item/clothing/mask/smokable/S = H.wear_mask
if (istype(S) && S.lit)
var/obj/item/clothing/C = H.head
if (!istype(C) || !(C.body_parts_covered & FACE))
S.extinguish()
if(istype(L))
var/needed = L.fire_stacks * 10
if(amount > needed)
L.fire_stacks = 0
L.ExtinguishMob()
remove_self(needed)
else
L.adjust_fire_stacks(-(amount / 10))
remove_self(amount)
/datum/reagent/water/affect_touch(mob/living/carbon/M, removed)
var/trait_level = GET_TRAIT_LEVEL(M, /singleton/trait/malus/water)
if (!trait_level)
return
M.adjustToxLoss(trait_level * 5 * removed)
var/mob/living/carbon/slime/S = M
if(!S.client && istype(S))
if(S.Target) // Like cats
S.Target = null
if(S.Victim)
S.Feedstop()
if(M.chem_doses[type] == removed)
M.visible_message(SPAN_WARNING("[S]'s flesh sizzles where the water touches it!"), SPAN_DANGER("Your flesh burns in the water!"))
M.set_confused(2)
/datum/reagent/water/boiling
name = "Boiling water"
chilling_products = list(/datum/reagent/water)
chilling_point = 99 CELSIUS
chilling_message = "stops boiling."
heating_products = list(null)
heating_point = null
// Ice is a drink for some reason.
/datum/reagent/drink/ice
name = "Ice"
description = "Frozen water, your dentist wouldn't like you chewing this."
taste_description = "ice"
taste_mult = 1.5
reagent_state = SOLID
color = "#619494"
adj_temp = -5
hydration = 10
glass_name = "ice"
glass_desc = "Generally, you're supposed to put something else in there too..."
glass_icon = DRINK_ICON_NOISY
heating_message = "cracks and melts."
heating_products = list(/datum/reagent/water)
heating_point = 299 // This is about 26C, higher than the actual melting point of ice but allows drinks to be made properly without weird workarounds.
// Fuel.
/datum/reagent/fuel
name = "Welding fuel"
description = "A stable hydrazine-based compound whose exact manufacturing specifications are a closely-guarded secret. One of the most common fuels in human space. Extremely flammable."
taste_description = "gross metal"
reagent_state = LIQUID
color = "#660000"
touch_met = 5
glass_name = "welder fuel"
glass_desc = "Unless you are an industrial tool, this is probably not safe for consumption."
value = 6.8
accelerant_quality = 10
/datum/reagent/fuel/touch_turf(turf/T)
new /obj/decal/cleanable/liquid_fuel(T, volume)
remove_self(volume)
return
/datum/reagent/fuel/affect_blood(mob/living/carbon/M, removed)
M.adjustToxLoss(2 * removed)
/datum/reagent/fuel/touch_mob(mob/living/L, amount)
if(istype(L))
L.adjust_fire_stacks(amount / 10) // Splashing people with welding fuel to make them easy to ignite!
/datum/reagent/fuel/ex_act(obj/item/reagent_containers/holder, severity)
if(volume <= 50)
return
var/turf/T = get_turf(holder)
var/datum/gas_mixture/products = new(_temperature = 5 * PHORON_FLASHPOINT)
var/gas_moles = 3 * volume
products.adjust_multi(GAS_NO, 0.1 * gas_moles, GAS_NO2, 0.1 * gas_moles, GAS_NITROGEN, 0.6 * gas_moles, GAS_HYDROGEN, 0.02 * gas_moles)
T.assume_air(products)
if(volume > 500)
explosion(T, 7)
else if(volume > 100)
explosion(T, 4, EX_ACT_HEAVY)
else if(volume > 50)
explosion(T, 3, EX_ACT_HEAVY)
remove_self(volume)
/datum/reagent/coagulated_blood
name = "Coagulated Blood"
color = "#aa0000"
taste_description = "chewy iron"
taste_mult = 1.5
description = "When exposed to unsuitable conditions, such as the floor or an oven, blood becomes coagulated and useless for transfusions. It's great for making blood pudding, though."
glass_name = "tomato salsa"
glass_desc = "Are you sure this is tomato salsa?"