mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 11:43:31 +00:00
Merge branch 'dev' into ofBeesAndHoney
Conflicts: baystation12.dme
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
..()
|
||||
maximum_volume = max
|
||||
my_atom = A
|
||||
|
||||
|
||||
//I dislike having these here but map-objects are initialised before world/New() is called. >_>
|
||||
if(!chemical_reagents_list)
|
||||
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
|
||||
@@ -257,7 +257,7 @@
|
||||
if(!target || !istype(target))
|
||||
return
|
||||
|
||||
amount = min(amount, total_volume, target.get_free_space() / multiplier)
|
||||
amount = max(0, min(amount, total_volume, target.get_free_space() / multiplier))
|
||||
|
||||
if(!amount)
|
||||
return
|
||||
@@ -277,9 +277,9 @@
|
||||
|
||||
/* Holder-to-atom and similar procs */
|
||||
|
||||
//The general proc for applying reagents to things. This proc assumes the reagents are being applied externally,
|
||||
//The general proc for applying reagents to things. This proc assumes the reagents are being applied externally,
|
||||
//not directly injected into the contents. It first calls touch, then the appropriate trans_to_*() or splash_mob().
|
||||
//If for some reason touch effects are bypassed (e.g. injecting stuff directly into a reagent container or person),
|
||||
//If for some reason touch effects are bypassed (e.g. injecting stuff directly into a reagent container or person),
|
||||
//call the appropriate trans_to_*() proc.
|
||||
/datum/reagents/proc/trans_to(var/atom/target, var/amount = 1, var/multiplier = 1, var/copy = 0)
|
||||
touch(target) //First, handle mere touch effects
|
||||
|
||||
28
code/modules/reagents/Chemistry-Logging.dm
Normal file
28
code/modules/reagents/Chemistry-Logging.dm
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
/var/list/chemical_reaction_logs = list()
|
||||
|
||||
/proc/log_chemical_reaction(atom/A, datum/chemical_reaction/R, multiplier)
|
||||
if(!A || !R)
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(A)
|
||||
var/logstr = "[usr ? key_name(usr) : "EVENT"] mixed [R.name] ([R.result]) (x[multiplier]) in \the [A] at [T ? "[T.x],[T.y],[T.z]" : "*null*"]"
|
||||
|
||||
chemical_reaction_logs += "\[[time_stamp()]\] [logstr]"
|
||||
|
||||
if(R.log_is_important)
|
||||
message_admins(logstr)
|
||||
log_admin(logstr)
|
||||
|
||||
/client/proc/view_chemical_reaction_logs()
|
||||
set name = "Show Chemical Reactions"
|
||||
set category = "Admin"
|
||||
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
var/html = ""
|
||||
for(var/entry in chemical_reaction_logs)
|
||||
html += "[entry]<br>"
|
||||
|
||||
usr << browse(html, "window=chemlogs")
|
||||
@@ -119,7 +119,7 @@
|
||||
|
||||
if(href_list["amount"])
|
||||
var/id = href_list["add"]
|
||||
var/amount = text2num(href_list["amount"])
|
||||
var/amount = isgoodnumber(text2num(href_list["amount"]))
|
||||
R.trans_id_to(src, id, amount)
|
||||
|
||||
else if (href_list["addcustom"])
|
||||
@@ -133,7 +133,7 @@
|
||||
|
||||
if(href_list["amount"])
|
||||
var/id = href_list["remove"]
|
||||
var/amount = text2num(href_list["amount"])
|
||||
var/amount = isgoodnumber(text2num(href_list["amount"]))
|
||||
if(mode)
|
||||
reagents.trans_id_to(beaker, id, amount)
|
||||
else
|
||||
@@ -297,18 +297,10 @@
|
||||
|
||||
/obj/machinery/chem_master/proc/isgoodnumber(var/num)
|
||||
if(isnum(num))
|
||||
if(num > 200)
|
||||
num = 200
|
||||
else if(num < 0)
|
||||
num = 1
|
||||
else
|
||||
num = round(num)
|
||||
return num
|
||||
return Clamp(round(num), 0, 200)
|
||||
else
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
/obj/machinery/chem_master/condimaster
|
||||
name = "CondiMaster 3000"
|
||||
condi = 1
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
var/mix_message = "The solution begins to bubble."
|
||||
var/reaction_sound = 'sound/effects/bubbles.ogg'
|
||||
|
||||
var/log_is_important = 0 // If this reaction should be considered important for logging. Important recipes message admins when mixed, non-important ones just log to file.
|
||||
/datum/chemical_reaction/proc/can_happen(var/datum/reagents/holder)
|
||||
//check that all the required reagents are present
|
||||
if(!holder.has_all_reagents(required_reagents))
|
||||
@@ -264,6 +265,7 @@
|
||||
result = "kelotane"
|
||||
required_reagents = list("silicon" = 1, "carbon" = 1)
|
||||
result_amount = 2
|
||||
log_is_important = 1
|
||||
|
||||
/datum/chemical_reaction/peridaxon
|
||||
name = "Peridaxon"
|
||||
@@ -503,6 +505,7 @@
|
||||
result = "coolant"
|
||||
required_reagents = list("tungsten" = 1, "acetone" = 1, "water" = 1)
|
||||
result_amount = 3
|
||||
log_is_important = 1
|
||||
|
||||
/datum/chemical_reaction/rezadone
|
||||
name = "Rezadone"
|
||||
@@ -638,6 +641,7 @@
|
||||
result = "nitroglycerin"
|
||||
required_reagents = list("glycerol" = 1, "pacid" = 1, "sacid" = 1)
|
||||
result_amount = 2
|
||||
log_is_important = 1
|
||||
|
||||
/datum/chemical_reaction/nitroglycerin/on_reaction(var/datum/reagents/holder, var/created_volume)
|
||||
var/datum/effect/effect/system/reagents_explosion/e = new()
|
||||
@@ -1570,10 +1574,10 @@
|
||||
required_reagents = list("rum" = 2, "cola" = 1)
|
||||
result_amount = 3
|
||||
|
||||
/datum/chemical_reaction/classicmartini
|
||||
/datum/chemical_reaction/martini
|
||||
name = "Classic Martini"
|
||||
id = "classicmartini"
|
||||
result = "classicmartini"
|
||||
id = "martini"
|
||||
result = "martini"
|
||||
required_reagents = list("gin" = 2, "vermouth" = 1)
|
||||
result_amount = 3
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/obj/item/weapon/reagent_containers/borghypo
|
||||
name = "Cyborg Hypospray"
|
||||
name = "cyborg hypospray"
|
||||
desc = "An advanced chemical synthesizer and injection system, designed for heavy-duty medical equipment."
|
||||
icon = 'icons/obj/syringe.dmi'
|
||||
item_state = "hypo"
|
||||
@@ -7,13 +7,15 @@
|
||||
amount_per_transfer_from_this = 5
|
||||
volume = 30
|
||||
possible_transfer_amounts = null
|
||||
|
||||
var/mode = 1
|
||||
var/charge_cost = 50
|
||||
var/charge_tick = 0
|
||||
var/recharge_time = 5 //Time it takes for shots to recharge (in seconds)
|
||||
|
||||
var/list/datum/reagents/reagent_list = list()
|
||||
var/list/reagent_ids = list("tricordrazine", "inaprovaline", "spaceacillin")
|
||||
var/list/reagent_volumes = list()
|
||||
var/list/reagent_names = list()
|
||||
|
||||
/obj/item/weapon/reagent_containers/borghypo/surgeon
|
||||
reagent_ids = list("bicaridine", "inaprovaline", "dexalin")
|
||||
@@ -23,46 +25,38 @@
|
||||
|
||||
/obj/item/weapon/reagent_containers/borghypo/New()
|
||||
..()
|
||||
for(var/R in reagent_ids)
|
||||
add_reagent(R)
|
||||
|
||||
for(var/T in reagent_ids)
|
||||
reagent_volumes[T] = volume
|
||||
var/datum/reagent/R = chemical_reagents_list[T]
|
||||
reagent_names += R.name
|
||||
|
||||
processing_objects.Add(src)
|
||||
|
||||
|
||||
/obj/item/weapon/reagent_containers/borghypo/Destroy()
|
||||
processing_objects.Remove(src)
|
||||
..()
|
||||
|
||||
/obj/item/weapon/reagent_containers/borghypo/process() //Every [recharge_time] seconds, recharge some reagents for the cyborg
|
||||
charge_tick++
|
||||
if(charge_tick < recharge_time) return 0
|
||||
/obj/item/weapon/reagent_containers/borghypo/process() //Every [recharge_time] seconds, recharge some reagents for the cyborg+
|
||||
if(++charge_tick < recharge_time)
|
||||
return 0
|
||||
charge_tick = 0
|
||||
|
||||
if(isrobot(loc))
|
||||
var/mob/living/silicon/robot/R = loc
|
||||
if(R && R.cell)
|
||||
var/datum/reagents/RG = reagent_list[mode]
|
||||
if(RG.total_volume < RG.maximum_volume) //Don't recharge reagents and drain power if the storage is full.
|
||||
R.cell.use(charge_cost) //Take power from borg...
|
||||
RG.add_reagent(reagent_ids[mode], 5) //And fill hypo with reagent.
|
||||
for(var/T in reagent_ids)
|
||||
if(reagent_volumes[T] < volume)
|
||||
R.cell.use(charge_cost)
|
||||
reagent_volumes[T] = min(reagent_volumes[T] + 5, volume)
|
||||
return 1
|
||||
|
||||
// Use this to add more chemicals for the borghypo to produce.
|
||||
/obj/item/weapon/reagent_containers/borghypo/proc/add_reagent(var/reagent)
|
||||
reagent_ids |= reagent
|
||||
var/datum/reagents/RG = new(30)
|
||||
RG.my_atom = src
|
||||
reagent_list += RG
|
||||
|
||||
var/datum/reagents/R = reagent_list[reagent_list.len]
|
||||
R.add_reagent(reagent, 30)
|
||||
|
||||
/obj/item/weapon/reagent_containers/borghypo/attack(mob/living/M as mob, mob/user as mob)
|
||||
var/datum/reagents/R = reagent_list[mode]
|
||||
if(!R.total_volume)
|
||||
user << "<span class='warning'>The injector is empty.</span>"
|
||||
/obj/item/weapon/reagent_containers/borghypo/attack(var/mob/living/M, var/mob/user)
|
||||
if(!istype(M))
|
||||
return
|
||||
if (!istype(M))
|
||||
|
||||
if(!reagent_volumes[reagent_ids[mode]])
|
||||
user << "<span class='warning'>The injector is empty.</span>"
|
||||
return
|
||||
|
||||
var/mob/living/carbon/human/H = M
|
||||
@@ -75,37 +69,80 @@
|
||||
user << "<span class='danger'>You cannot inject a robotic limb.</span>"
|
||||
return
|
||||
|
||||
if (R.total_volume && M.can_inject(user, 1))
|
||||
if (M.can_inject(user, 1))
|
||||
user << "<span class='notice'>You inject [M] with the injector.</span>"
|
||||
M << "<span class='notice'>You feel a tiny prick!</span>"
|
||||
|
||||
if(M.reagents)
|
||||
var/trans = R.trans_to_mob(M, amount_per_transfer_from_this, CHEM_BLOOD)
|
||||
user << "<span class='notice'>[trans] units injected. [R.total_volume] units remaining.</span>"
|
||||
var/t = min(amount_per_transfer_from_this, reagent_volumes[reagent_ids[mode]])
|
||||
M.reagents.add_reagent(reagent_ids[mode], t)
|
||||
reagent_volumes[reagent_ids[mode]] -= t
|
||||
admin_inject_log(user, M, src, reagent_ids[mode], t)
|
||||
user << "<span class='notice'>[t] units injected. [reagent_volumes[reagent_ids[mode]]] units remaining.</span>"
|
||||
return
|
||||
|
||||
/obj/item/weapon/reagent_containers/borghypo/attack_self(mob/user as mob)
|
||||
playsound(src.loc, 'sound/effects/pop.ogg', 50, 0) //Change the mode
|
||||
mode++
|
||||
if(mode > reagent_list.len)
|
||||
mode = 1
|
||||
/obj/item/weapon/reagent_containers/borghypo/attack_self(mob/user as mob) //Change the mode
|
||||
var/t = ""
|
||||
for(var/i = 1 to reagent_ids.len)
|
||||
if(t)
|
||||
t += ", "
|
||||
if(mode == i)
|
||||
t += "<b>[reagent_names[i]]</b>"
|
||||
else
|
||||
t += "<a href='?src=\ref[src];reagent=[reagent_ids[i]]'>[reagent_names[i]]</a>"
|
||||
t = "Available reagents: [t]."
|
||||
user << t
|
||||
|
||||
charge_tick = 0 //Prevents wasted chems/cell charge if you're cycling through modes.
|
||||
var/datum/reagent/R = chemical_reagents_list[reagent_ids[mode]]
|
||||
user << "<span class='notice'>Synthesizer is now producing '[R.name]'.</span>"
|
||||
return
|
||||
|
||||
/obj/item/weapon/reagent_containers/borghypo/Topic(var/href, var/list/href_list)
|
||||
if(href_list["reagent"])
|
||||
var/t = reagent_ids.Find(href_list["reagent"])
|
||||
if(t)
|
||||
playsound(loc, 'sound/effects/pop.ogg', 50, 0)
|
||||
mode = t
|
||||
var/datum/reagent/R = chemical_reagents_list[reagent_ids[mode]]
|
||||
usr << "<span class='notice'>Synthesizer is now producing '[R.name]'.</span>"
|
||||
|
||||
/obj/item/weapon/reagent_containers/borghypo/examine(mob/user)
|
||||
if(!..(user, 2))
|
||||
return
|
||||
|
||||
var/empty = 1
|
||||
var/datum/reagent/R = chemical_reagents_list[reagent_ids[mode]]
|
||||
|
||||
for(var/datum/reagents/RS in reagent_list)
|
||||
var/datum/reagent/R = locate() in RS.reagent_list
|
||||
if(R)
|
||||
user << "<span class='notice'>It currently has [R.volume] units of [R.name] stored.</span>"
|
||||
empty = 0
|
||||
user << "<span class='notice'>It is currently producing [R.name] and has [reagent_volumes[reagent_ids[mode]]] out of [volume] units left.</span>"
|
||||
|
||||
if(empty)
|
||||
user << "<span class='notice'>It is currently empty. Allow some time for the internal syntheszier to produce more.</span>"
|
||||
/obj/item/weapon/reagent_containers/borghypo/service
|
||||
name = "cyborg drink synthesizer"
|
||||
desc = "A portable drink dispencer."
|
||||
icon = 'icons/obj/drinks.dmi'
|
||||
icon_state = "shaker"
|
||||
charge_cost = 20
|
||||
recharge_time = 3
|
||||
volume = 60
|
||||
possible_transfer_amounts = list(5, 10, 20, 30)
|
||||
reagent_ids = list("beer", "kahlua", "whiskey", "wine", "vodka", "gin", "rum", "tequilla", "vermouth", "cognac", "ale", "mead", "water", "sugar", "ice", "tea", "icetea", "cola", "spacemountainwind", "dr_gibb", "space_up", "tonic", "sodawater", "lemon_lime", "orangejuice", "limejuice", "watermelonjuice")
|
||||
|
||||
/obj/item/weapon/reagent_containers/borghypo/service/attack(var/mob/M, var/mob/user)
|
||||
return
|
||||
|
||||
/obj/item/weapon/reagent_containers/borghypo/service/afterattack(var/obj/target, var/mob/user, var/proximity)
|
||||
if(!proximity)
|
||||
return
|
||||
|
||||
if(!target.is_open_container() || !target.reagents)
|
||||
return
|
||||
|
||||
if(!reagent_volumes[reagent_ids[mode]])
|
||||
user << "<span class='notice'>[src] is out of this reagent, give it some time to refill.</span>"
|
||||
return
|
||||
|
||||
if(!target.reagents.get_free_space())
|
||||
user << "<span class='notice'>[target] is full.</span>"
|
||||
return
|
||||
|
||||
var/t = min(amount_per_transfer_from_this, reagent_volumes[reagent_ids[mode]])
|
||||
target.reagents.add_reagent(reagent_ids[mode], t)
|
||||
reagent_volumes[reagent_ids[mode]] -= t
|
||||
user << "<span class='notice'>You transfer [t] units of the solution to [target].</span>"
|
||||
return
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
attack(mob/M as mob, mob/user as mob, def_zone)
|
||||
if(standard_feed_mob(user, M))
|
||||
robot_refill(user)
|
||||
return
|
||||
|
||||
return 0
|
||||
@@ -29,22 +28,10 @@
|
||||
if(standard_dispenser_refill(user, target))
|
||||
return
|
||||
if(standard_pour_into(user, target))
|
||||
robot_refill(user)
|
||||
return
|
||||
|
||||
return ..()
|
||||
|
||||
proc/robot_refill(var/mob/living/silicon/robot/user)
|
||||
if(!istype(user))
|
||||
return 0
|
||||
|
||||
user.cell.use(30)
|
||||
var/refill = reagents.get_master_reagent_id()
|
||||
user << "Now synthesizing [amount_per_transfer_from_this] units of [refill]..."
|
||||
spawn(300)
|
||||
reagents.add_reagent(refill, amount_per_transfer_from_this)
|
||||
user << "Cyborg [src] refilled."
|
||||
|
||||
self_feed_message(var/mob/user)
|
||||
user << "<span class='notice'>You swallow a gulp from \the [src].</span>"
|
||||
|
||||
|
||||
@@ -1525,11 +1525,13 @@
|
||||
..()
|
||||
reagents.add_reagent("protein", 10)
|
||||
|
||||
afterattack(obj/O as obj, mob/user as mob, proximity)
|
||||
afterattack(obj/O as obj, var/mob/living/carbon/human/user as mob, proximity)
|
||||
if(!proximity) return
|
||||
if(istype(O,/obj/structure/sink) && !wrapped)
|
||||
user << "You place \the [name] under a stream of water..."
|
||||
loc = get_turf(O)
|
||||
if(istype(user))
|
||||
user.unEquip(src)
|
||||
src.loc = get_turf(src)
|
||||
return Expand()
|
||||
..()
|
||||
|
||||
@@ -1574,11 +1576,14 @@
|
||||
*/
|
||||
|
||||
proc/Expand()
|
||||
for(var/mob/M in viewers(src,7))
|
||||
M << "\red \The [src] expands!"
|
||||
var/mob/living/carbon/human/H = new (src)
|
||||
src.visible_message("<span class='notice'>\The [src] expands!</span>")
|
||||
var/mob/living/carbon/human/H = new(src.loc)
|
||||
H.set_species(monkey_type)
|
||||
H.real_name = H.species.get_random_name()
|
||||
H.name = H.real_name
|
||||
src.loc = null
|
||||
qdel(src)
|
||||
return 1
|
||||
|
||||
proc/Unwrap(mob/user as mob)
|
||||
icon_state = "monkeycube"
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
/obj/machinery/smartfridge/,
|
||||
/obj/machinery/biogenerator,
|
||||
/obj/machinery/constructable_frame,
|
||||
/obj/machinery/bunsen_burner,
|
||||
/obj/machinery/radiocarbon_spectrometer
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user