mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-23 08:31:57 +00:00
Autolathe Things (#11545)
This commit is contained in:
@@ -604,8 +604,6 @@
|
|||||||
#include "code\game\machinery\alarm.dm"
|
#include "code\game\machinery\alarm.dm"
|
||||||
#include "code\game\machinery\anti_bluespace.dm"
|
#include "code\game\machinery\anti_bluespace.dm"
|
||||||
#include "code\game\machinery\atmo_control.dm"
|
#include "code\game\machinery\atmo_control.dm"
|
||||||
#include "code\game\machinery\autolathe.dm"
|
|
||||||
#include "code\game\machinery\autolathe_datums.dm"
|
|
||||||
#include "code\game\machinery\Beacon.dm"
|
#include "code\game\machinery\Beacon.dm"
|
||||||
#include "code\game\machinery\biogenerator.dm"
|
#include "code\game\machinery\biogenerator.dm"
|
||||||
#include "code\game\machinery\bioprinter.dm"
|
#include "code\game\machinery\bioprinter.dm"
|
||||||
@@ -682,6 +680,8 @@
|
|||||||
#include "code\game\machinery\atmoalter\portable_atmospherics.dm"
|
#include "code\game\machinery\atmoalter\portable_atmospherics.dm"
|
||||||
#include "code\game\machinery\atmoalter\pump.dm"
|
#include "code\game\machinery\atmoalter\pump.dm"
|
||||||
#include "code\game\machinery\atmoalter\scrubber.dm"
|
#include "code\game\machinery\atmoalter\scrubber.dm"
|
||||||
|
#include "code\game\machinery\autolathe\autolathe.dm"
|
||||||
|
#include "code\game\machinery\autolathe\autolathe_datums.dm"
|
||||||
#include "code\game\machinery\bots\bots.dm"
|
#include "code\game\machinery\bots\bots.dm"
|
||||||
#include "code\game\machinery\bots\mulebot.dm"
|
#include "code\game\machinery\bots\mulebot.dm"
|
||||||
#include "code\game\machinery\camera\camera.dm"
|
#include "code\game\machinery\camera\camera.dm"
|
||||||
|
|||||||
@@ -21,9 +21,6 @@
|
|||||||
global_hud.holomap
|
global_hud.holomap
|
||||||
)
|
)
|
||||||
|
|
||||||
// Create autolathe recipes, as above.
|
|
||||||
populate_lathe_recipes()
|
|
||||||
|
|
||||||
// Create robolimbs for chargen.
|
// Create robolimbs for chargen.
|
||||||
populate_robolimb_list()
|
populate_robolimb_list()
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ var/datum/controller/subsystem/materials/SSmaterials
|
|||||||
var/list/materials
|
var/list/materials
|
||||||
var/list/materials_by_name
|
var/list/materials_by_name
|
||||||
|
|
||||||
|
var/list/autolathe_recipes
|
||||||
|
var/list/autolathe_categories
|
||||||
|
|
||||||
/datum/controller/subsystem/materials/New()
|
/datum/controller/subsystem/materials/New()
|
||||||
NEW_SS_GLOBAL(SSmaterials)
|
NEW_SS_GLOBAL(SSmaterials)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
clickvol = 30
|
clickvol = 30
|
||||||
|
|
||||||
var/print_loc
|
var/print_loc
|
||||||
var/list/machine_recipes
|
|
||||||
var/list/stored_material = list(DEFAULT_WALL_MATERIAL = 0, MATERIAL_GLASS = 0)
|
var/list/stored_material = list(DEFAULT_WALL_MATERIAL = 0, MATERIAL_GLASS = 0)
|
||||||
var/list/storage_capacity = list(DEFAULT_WALL_MATERIAL = 0, MATERIAL_GLASS = 0)
|
var/list/storage_capacity = list(DEFAULT_WALL_MATERIAL = 0, MATERIAL_GLASS = 0)
|
||||||
var/show_category = "All"
|
var/show_category = "All"
|
||||||
@@ -46,21 +46,37 @@
|
|||||||
does_flick = FALSE
|
does_flick = FALSE
|
||||||
|
|
||||||
/obj/machinery/autolathe/Initialize()
|
/obj/machinery/autolathe/Initialize()
|
||||||
. = ..()
|
..()
|
||||||
wires = new(src)
|
wires = new(src)
|
||||||
print_loc = src
|
print_loc = src
|
||||||
|
return INITIALIZE_HINT_LATELOAD
|
||||||
|
|
||||||
|
/obj/machinery/autolathe/LateInitialize()
|
||||||
|
populate_lathe_recipes()
|
||||||
|
|
||||||
/obj/machinery/autolathe/Destroy()
|
/obj/machinery/autolathe/Destroy()
|
||||||
QDEL_NULL(wires)
|
QDEL_NULL(wires)
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/obj/machinery/autolathe/proc/update_recipe_list()
|
/obj/machinery/autolathe/proc/populate_lathe_recipes()
|
||||||
if(!machine_recipes)
|
if(SSmaterials.autolathe_recipes && SSmaterials.autolathe_categories)
|
||||||
machine_recipes = autolathe_recipes
|
return
|
||||||
|
|
||||||
|
SSmaterials.autolathe_recipes = list()
|
||||||
|
SSmaterials.autolathe_categories = list()
|
||||||
|
for(var/R in subtypesof(/datum/autolathe/recipe))
|
||||||
|
var/datum/autolathe/recipe/recipe = new R
|
||||||
|
SSmaterials.autolathe_recipes += recipe
|
||||||
|
SSmaterials.autolathe_categories |= recipe.category
|
||||||
|
|
||||||
|
var/obj/item/I = new recipe.path
|
||||||
|
if(I.matter && !recipe.resources) //This can be overidden in the datums.
|
||||||
|
recipe.resources = list()
|
||||||
|
for(var/material in I.matter)
|
||||||
|
recipe.resources[material] = I.matter[material]*1.25 // More expensive to produce than they are to recycle.
|
||||||
|
qdel(I)
|
||||||
|
|
||||||
/obj/machinery/autolathe/interact(mob/user)
|
/obj/machinery/autolathe/interact(mob/user)
|
||||||
update_recipe_list()
|
|
||||||
|
|
||||||
if(..() || (disabled && !panel_open))
|
if(..() || (disabled && !panel_open))
|
||||||
to_chat(user, SPAN_DANGER("\The [src] is disabled!"))
|
to_chat(user, SPAN_DANGER("\The [src] is disabled!"))
|
||||||
return
|
return
|
||||||
@@ -83,7 +99,7 @@
|
|||||||
dat += "<h2>Printable Designs</h2><h3>Showing: <a href='?src=\ref[src];change_category=1'>[show_category]</a></h3></center><table width = '100%'>"
|
dat += "<h2>Printable Designs</h2><h3>Showing: <a href='?src=\ref[src];change_category=1'>[show_category]</a></h3></center><table width = '100%'>"
|
||||||
|
|
||||||
var/index = 0
|
var/index = 0
|
||||||
for(var/recipe in machine_recipes)
|
for(var/recipe in SSmaterials.autolathe_recipes)
|
||||||
var/datum/autolathe/recipe/R = recipe
|
var/datum/autolathe/recipe/R = recipe
|
||||||
index++
|
index++
|
||||||
if(R.hidden && !hacked || (show_category != "All" && show_category != R.category))
|
if(R.hidden && !hacked || (show_category != "All" && show_category != R.category))
|
||||||
@@ -222,23 +238,25 @@
|
|||||||
usr.set_machine(src)
|
usr.set_machine(src)
|
||||||
add_fingerprint(usr)
|
add_fingerprint(usr)
|
||||||
|
|
||||||
|
if(href_list["change_category"])
|
||||||
|
var/choice = input("Which category do you wish to display?") as null|anything in SSmaterials.autolathe_categories+"All"
|
||||||
|
if(!choice)
|
||||||
|
return
|
||||||
|
show_category = choice
|
||||||
|
updateUsrDialog()
|
||||||
|
return
|
||||||
|
|
||||||
if(busy)
|
if(busy)
|
||||||
to_chat(usr, SPAN_WARNING("The autolathe is busy. Please wait for the completion of previous operation."))
|
to_chat(usr, SPAN_WARNING("The autolathe is busy. Please wait for the completion of previous operation."))
|
||||||
return
|
return
|
||||||
|
|
||||||
if(href_list["change_category"])
|
if(href_list["make"] && SSmaterials.autolathe_recipes)
|
||||||
var/choice = input("Which category do you wish to display?") as null|anything in autolathe_categories+"All"
|
|
||||||
if(!choice)
|
|
||||||
return
|
|
||||||
show_category = choice
|
|
||||||
|
|
||||||
if(href_list["make"] && machine_recipes)
|
|
||||||
var/index = text2num(href_list["make"])
|
var/index = text2num(href_list["make"])
|
||||||
var/multiplier = text2num(href_list["multiplier"])
|
var/multiplier = text2num(href_list["multiplier"])
|
||||||
build_item = null
|
build_item = null
|
||||||
|
|
||||||
if(index > 0 && index <= machine_recipes.len)
|
if(index > 0 && index <= length(SSmaterials.autolathe_recipes))
|
||||||
build_item = machine_recipes[index]
|
build_item = SSmaterials.autolathe_recipes[index]
|
||||||
|
|
||||||
//Exploit detection, not sure if necessary after rewrite.
|
//Exploit detection, not sure if necessary after rewrite.
|
||||||
if(!build_item || multiplier < 0 || multiplier > 100)
|
if(!build_item || multiplier < 0 || multiplier > 100)
|
||||||
@@ -1,27 +1,3 @@
|
|||||||
/var/global/list/autolathe_recipes
|
|
||||||
/var/global/list/autolathe_categories
|
|
||||||
|
|
||||||
/proc/populate_lathe_recipes()
|
|
||||||
|
|
||||||
//Create global autolathe recipe list if it hasn't been made already.
|
|
||||||
autolathe_recipes = list()
|
|
||||||
autolathe_categories = list()
|
|
||||||
for(var/R in subtypesof(/datum/autolathe/recipe))
|
|
||||||
var/datum/autolathe/recipe/recipe = new R
|
|
||||||
autolathe_recipes += recipe
|
|
||||||
autolathe_categories |= recipe.category
|
|
||||||
|
|
||||||
var/obj/item/I = new recipe.path
|
|
||||||
// Since this runs before SSatoms runs, we've got to force initialization manually.
|
|
||||||
if (!I.initialized)
|
|
||||||
SSatoms.InitAtom(I, list(TRUE))
|
|
||||||
|
|
||||||
if(I.matter && !recipe.resources) //This can be overidden in the datums.
|
|
||||||
recipe.resources = list()
|
|
||||||
for(var/material in I.matter)
|
|
||||||
recipe.resources[material] = I.matter[material]*1.25 // More expensive to produce than they are to recycle.
|
|
||||||
qdel(I)
|
|
||||||
|
|
||||||
/datum/autolathe/recipe
|
/datum/autolathe/recipe
|
||||||
var/name = "object"
|
var/name = "object"
|
||||||
var/path
|
var/path
|
||||||
7
html/changelogs/geeves-fabricator_things.yml
Normal file
7
html/changelogs/geeves-fabricator_things.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
author: Geeves
|
||||||
|
|
||||||
|
delete-after: True
|
||||||
|
|
||||||
|
changes:
|
||||||
|
- refactor: "Tweaks how autolathes generate their recipe lists, ideally there'd be no player-facing change."
|
||||||
|
- bugfix: "You can now change autolathe categories while it's busy building things."
|
||||||
Reference in New Issue
Block a user