Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds safety check to bioprinter for resources and already printing #4669

Merged
merged 1 commit into from
Oct 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions code/game/machinery/bioprinter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@

switch(action)
if("print")
if(working)
//If we're already printing something then we're too busy to multi task.
to_chat(usr, SPAN_NOTICE("[src] is busy at the moment."))
return FALSE
var/recipe = params["recipe_id"]
var/valid_recipe = FALSE
for(var/datum/bioprinter_recipe/product_recipes in products)
Expand All @@ -124,6 +128,10 @@
message_admins("[key_name(usr)] attempted to print an invalid recipe on \the [src].")
return FALSE
var/datum/bioprinter_recipe/recipe_datum = new recipe
if(stored_metal < recipe_datum.metal)
to_chat(usr, SPAN_NOTICE("[src] does not have enough stored metal."))
QDEL_NULL(recipe_datum)
return FALSE
stored_metal -= recipe_datum.metal
to_chat(usr, SPAN_NOTICE("\The [src] is now printing the selected organ. Please hold."))
working = TRUE
Expand All @@ -146,6 +154,8 @@

/obj/structure/machinery/bioprinter/proc/print_limb(limb_path)
if(inoperable())
//In case we lose power or anything between the print and the callback we don't want to permenantly break the printer
working = FALSE
return
new limb_path(get_turf(src))
working = FALSE
Expand Down
Loading