Merge branch 'master' into NeuroFix

This commit is contained in:
Thalpy
2019-09-11 16:24:00 +01:00
committed by GitHub
1022 changed files with 6302 additions and 2988 deletions
+14 -13
View File
@@ -1,3 +1,5 @@
#define CHEMICAL_QUANTISATION_LEVEL 0.001
/proc/build_chemical_reagent_list()
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
@@ -94,7 +96,7 @@
var/list/data = list()
for(var/r in reagent_list) //no reagents will be left behind
var/datum/reagent/R = r
data += "[R.id] ([round(R.volume, 0.1)]u)"
data += "[R.id] ([round(R.volume, CHEMICAL_QUANTISATION_LEVEL)]u)"
//Using IDs because SOME chemicals (I'm looking at you, chlorhydrate-beer) have the same names as other chemicals.
return english_list(data)
@@ -471,7 +473,7 @@
return 0
for(var/B in cached_required_reagents)
multiplier = min(multiplier, round((get_reagent_amount(B) / cached_required_reagents[B]), 0.01))
multiplier = min(multiplier, round((get_reagent_amount(B) / cached_required_reagents[B]), CHEMICAL_QUANTISATION_LEVEL))
for(var/P in selected_reaction.results)
targetVol = cached_results[P]*multiplier
@@ -498,7 +500,7 @@
return 0
for(var/B in cached_required_reagents) //
multiplier = min(multiplier, round((get_reagent_amount(B) / cached_required_reagents[B]), 0.01))
multiplier = min(multiplier, round((get_reagent_amount(B) / cached_required_reagents[B]), CHEMICAL_QUANTISATION_LEVEL))
for(var/B in cached_required_reagents)
remove_reagent(B, (multiplier * cached_required_reagents[B]), safety = 1, ignore_pH = TRUE)
@@ -646,8 +648,8 @@
addChemAmmount = deltaT * stepChemAmmount
if (addChemAmmount >= (targetVol - reactedVol))
addChemAmmount = (targetVol - reactedVol)
if (addChemAmmount < 0.01)
addChemAmmount = 0.01
if (addChemAmmount < CHEMICAL_QUANTISATION_LEVEL)
addChemAmmount = CHEMICAL_QUANTISATION_LEVEL
removeChemAmmount = (addChemAmmount/cached_results[P])
//This is kept for future bugtesters.
//message_admins("Reaction vars: PreReacted: [reactedVol] of [targetVol]. deltaT [deltaT], multiplier [multiplier], Step [stepChemAmmount], uncapped Step [deltaT*(multiplier*cached_results[P])], addChemAmmount [addChemAmmount], removeFactor [removeChemAmmount] Pfactor [cached_results[P]], adding [addChemAmmount]")
@@ -693,7 +695,7 @@
//Make sure things are limited.
pH = CLAMP(pH, 0, 14)
//return said amount to compare for next step.
return (reactedVol)
@@ -739,11 +741,10 @@
total_volume = 0
for(var/reagent in cached_reagents)
var/datum/reagent/R = reagent
if(R.volume < 0.1)
if(R.volume < CHEMICAL_QUANTISATION_LEVEL)
del_reagent(R.id)
else
total_volume += R.volume
return 0
/datum/reagents/proc/clear_reagents()
@@ -808,7 +809,7 @@
if(!isnum(amount) || !amount)
return FALSE
if(amount <= 0.00)
if(amount <= CHEMICAL_QUANTISATION_LEVEL)//To prevent small ammount problems.
return FALSE
var/datum/reagent/D = GLOB.chemical_reagents_list[reagent]
@@ -872,7 +873,7 @@
var/datum/reagent/R = A
if (R.id == reagent) //IF MERGING
//Add amount and equalize purity
R.volume += amount
R.volume += round(amount, CHEMICAL_QUANTISATION_LEVEL)
R.purity = ((R.purity * R.volume) + (other_purity * amount)) /((R.volume + amount)) //This should add the purity to the product
update_total()
@@ -894,7 +895,7 @@
var/datum/reagent/R = new D.type(data)
cached_reagents += R
R.holder = src
R.volume = amount
R.volume = round(amount, CHEMICAL_QUANTISATION_LEVEL)
R.purity = other_purity
R.loc = get_turf(my_atom)
if(data)
@@ -967,7 +968,7 @@
if(!amount)
return R
else
if(R.volume >= amount)
if(round(R.volume, CHEMICAL_QUANTISATION_LEVEL) >= amount)
return R
else
return 0
@@ -979,7 +980,7 @@
for(var/_reagent in cached_reagents)
var/datum/reagent/R = _reagent
if (R.id == reagent)
return R.volume
return round(R.volume, CHEMICAL_QUANTISATION_LEVEL)
return 0
@@ -139,12 +139,14 @@
/obj/machinery/chem_dispenser/emag_act(mob/user)
. = ..()
if(obj_flags & EMAGGED)
to_chat(user, "<span class='warning'>[src] has no functional safeties to emag.</span>")
return
to_chat(user, "<span class='notice'>You short out [src]'s safeties.</span>")
dispensable_reagents |= emagged_reagents//add the emagged reagents to the dispensable ones
obj_flags |= EMAGGED
return TRUE
/obj/machinery/chem_dispenser/ex_act(severity, target)
if(severity < 3)
@@ -332,7 +332,7 @@
var/vol_part = min(reagents.total_volume, 30)
if(text2num(many))
amount_full = round(reagents.total_volume / 30)
vol_part = reagents.total_volume % 30
vol_part = ((reagents.total_volume*1000) % 30000) / 1000 //% operator doesn't support decimals.
var/name = stripped_input(usr, "Name:","Name your bottle!", (reagents.total_volume ? reagents.get_master_reagent_name() : " "), MAX_NAME_LEN)
if(!name || !reagents.total_volume || !src || QDELETED(src) || !usr.canUseTopic(src, !issilicon(usr)))
return
@@ -2146,6 +2146,29 @@ All effects don't start immediately, but rather get worse over time; the rate is
glass_name = "Planet Cracker"
glass_desc = "Although historians believe the drink was originally created to commemorate the end of an important conflict in man's past, its origins have largely been forgotten and it is today seen more as a general symbol of human supremacy."
/datum/reagent/consumable/ethanol/commander_and_chief
name = "Commander and Chief"
id = "commander_and_chief"
description = "A cocktail for the captain on the go."
color = "#ffffc9"
boozepwr = 50
quality = DRINK_FANTASTIC
taste_description = "Tastes like...duty and responsibility?"
glass_icon_state = "commander_and_chief"
glass_name = "Commander and Chief"
glass_desc = "The gems of this majestic chalice represent the departments and their Heads."
/datum/reagent/consumable/ethanol/commander_and_chief/on_mob_life(mob/living/carbon/M)
if(M.mind && HAS_TRAIT(M.mind, TRAIT_CAPTAIN_METABOLISM))
M.heal_bodypart_damage(2,2,2)
M.adjustBruteLoss(-3.5,0)
M.adjustOxyLoss(-3.5,0)
M.adjustFireLoss(-3.5,0)
M.adjustToxLoss(-3.5,0)
M.radiation = max(M.radiation - 25, 0)
. = 1
return ..()
/datum/reagent/consumable/ethanol/fruit_wine
name = "Fruit Wine"
id = "fruit_wine"
@@ -1177,7 +1177,7 @@
M.adjustToxLoss(-3 * REM, 0, TRUE) //Heals TOXINLOVERS
M.adjustBrainLoss(2 * REM, 150) //This does, after all, come from ambrosia, and the most powerful ambrosia in existence, at that!
M.adjustCloneLoss(-1 * REM, 0)
M.adjustStaminaLoss(-30 * REM, 0)
M.adjustStaminaLoss(-13 * REM, 0)
M.jitteriness = min(max(0, M.jitteriness + 3), 30)
M.druggy = min(max(0, M.druggy + 10), 15) //See above
..()