Adds the Chemistry Smoke Machine (#30920)
* Smoke Machine * Tweak * More responsive smoke timing * Antur Review and Admin Logs * Cboss review * More logging * Removes analyze, streamlines logs * r-e-a * no s in reagents_list * Cyberboss Review * woops * Cboss nitpicking
This commit is contained in:
committed by
CitadelStationBot
parent
f8d0646b09
commit
a570ec8610
@@ -393,4 +393,4 @@
|
||||
"cryoxadone",
|
||||
"ammonia",
|
||||
"ash",
|
||||
"diethylamine")
|
||||
"diethylamine")
|
||||
@@ -0,0 +1,113 @@
|
||||
/obj/machinery/smoke_machine
|
||||
name = "Smoke Machine"
|
||||
icon = 'icons/obj/chemical.dmi'
|
||||
icon_state = "smoke0"
|
||||
density = TRUE
|
||||
anchored = TRUE
|
||||
circuit = /obj/item/circuitboard/machine/smoke_machine
|
||||
var/efficiency = 10
|
||||
var/on = FALSE
|
||||
var/cooldown = 0
|
||||
var/screen = "home"
|
||||
var/useramount = 30 // Last used amount
|
||||
var/volume = 1000
|
||||
var/setting = 3
|
||||
var/list/possible_settings = list(3,6,9,12,15)
|
||||
|
||||
/datum/effect_system/smoke_spread/chem/smoke_machine/set_up(datum/reagents/carry, setting = 3, efficiency = 10, loc)
|
||||
amount = setting
|
||||
carry.copy_to(chemholder, 20)
|
||||
carry.remove_any(setting * 16 / efficiency)
|
||||
location = loc
|
||||
|
||||
/obj/machinery/smoke_machine/Initialize()
|
||||
. = ..()
|
||||
create_reagents(volume)
|
||||
|
||||
/obj/machinery/smoke_machine/update_icon()
|
||||
if((!is_operational()) || (!on) || (reagents.total_volume == 0))
|
||||
icon_state = "smoke0"
|
||||
else
|
||||
icon_state = "smoke1"
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/smoke_machine/RefreshParts()
|
||||
efficiency = 6
|
||||
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
|
||||
efficiency += B.rating
|
||||
for(var/obj/item/stock_parts/capacitor/C in component_parts)
|
||||
efficiency += C.rating
|
||||
for(var/obj/item/stock_parts/manipulator/M in component_parts)
|
||||
efficiency += M.rating
|
||||
|
||||
/obj/machinery/smoke_machine/process()
|
||||
..()
|
||||
update_icon()
|
||||
if(!is_operational())
|
||||
return
|
||||
if(reagents.total_volume == 0)
|
||||
on = FALSE
|
||||
return
|
||||
var/turf/T = get_turf(src)
|
||||
var/smoke_test = locate(/obj/effect/particle_effect/smoke) in T
|
||||
if(on && !smoke_test)
|
||||
var/datum/effect_system/smoke_spread/chem/smoke_machine/smoke = new()
|
||||
smoke.set_up(reagents, setting, efficiency, T)
|
||||
smoke.start()
|
||||
|
||||
/obj/machinery/smoke_machine/attackby(obj/item/I, mob/user, params)
|
||||
add_fingerprint(user)
|
||||
if(istype(I, /obj/item/reagent_containers))
|
||||
var/obj/item/reagent_containers/RC = I
|
||||
var/units = RC.reagents.trans_to(src, RC.amount_per_transfer_from_this)
|
||||
if(units)
|
||||
to_chat(user, "<span class='notice'>You transfer [units] units of the solution to [src].</span>")
|
||||
add_logs(usr, src, "has added [english_list(RC.reagents.reagent_list)] to [src]")
|
||||
return
|
||||
if(default_unfasten_wrench(user, I))
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/machinery/smoke_machine/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "smoke_machine", name, 450, 350, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/smoke_machine/ui_data(mob/user)
|
||||
var/data = list()
|
||||
var/TankContents[0]
|
||||
var/TankCurrentVolume = 0
|
||||
for(var/datum/reagent/R in reagents.reagent_list)
|
||||
TankContents.Add(list(list("name" = R.name, "volume" = R.volume))) // list in a list because Byond merges the first list...
|
||||
TankCurrentVolume += R.volume
|
||||
data["TankContents"] = TankContents
|
||||
data["isTankLoaded"] = reagents.total_volume ? TRUE : FALSE
|
||||
data["TankCurrentVolume"] = reagents.total_volume ? reagents.total_volume : null
|
||||
data["TankMaxVolume"] = reagents.maximum_volume
|
||||
data["active"] = on
|
||||
data["setting"] = setting
|
||||
data["screen"] = screen
|
||||
return data
|
||||
|
||||
/obj/machinery/smoke_machine/ui_act(action, params)
|
||||
if(..() || !anchored)
|
||||
return
|
||||
switch(action)
|
||||
if("purge")
|
||||
reagents.clear_reagents()
|
||||
. = TRUE
|
||||
if("setting")
|
||||
var/amount = text2num(params["amount"])
|
||||
if (locate(amount) in possible_settings)
|
||||
setting = amount
|
||||
. = TRUE
|
||||
if("power")
|
||||
on = !on
|
||||
if(on)
|
||||
log_admin("[key_name(usr)] activated a smoke machine that contains [english_list(reagents.reagent_list)] at [COORD(src)].")
|
||||
add_logs(usr, src, "has activated [src] which contains [english_list(reagents.reagent_list)].")
|
||||
if("goScreen")
|
||||
screen = params["screen"]
|
||||
. = TRUE
|
||||
@@ -154,6 +154,14 @@
|
||||
build_path = /obj/item/circuitboard/machine/chem_heater
|
||||
category = list ("Medical Machinery")
|
||||
|
||||
/datum/design/board/smoke_machine
|
||||
name = "Machine Design (Smoke Machine)"
|
||||
desc = "The circuit board for a smoke machine."
|
||||
id = "smoke_machine"
|
||||
req_tech = list("materials" = 4, "biotech" = 3, "engineering" = 3)
|
||||
build_path = /obj/item/circuitboard/machine/smoke_machine
|
||||
category = list ("Medical Machinery")
|
||||
|
||||
/datum/design/board/clonecontrol
|
||||
name = "Computer Design (Cloning Machine Console)"
|
||||
desc = "Allows for the construction of circuit boards used to build a new Cloning Machine console."
|
||||
|
||||
Reference in New Issue
Block a user