Files
Bubberstation/code/modules/research/designs.dm
TemporalOroboros 976c1fcb8c [READY] Bespoke Datum Mats (#55296)
* Bespoke Material Backend

- Adds support for bespoke materials:
  - Reimplements [/datum/material/var/id]
  - Ports GetIdFromArguments from SSdcs
  - Adds a wrapper define for GetMaterialRef
  - Adds [MATERIAL_INIT_BESPOKE]
  - Adds [/datum/material/proc/Initialize]
- Does not actually add any bespoke materials

- [ ] TODO: Code docs
- [ ] TODO: Actually adding bespoke materials

* Some has_material procs and cleaning up some spaghetti

- Adds a pair of has_material procs for use in checking whether a given atom has a given material

* Adds meat

- Adds bespoke meat variants
  - Does not make them accessible
- Shuts up the linter

* Implements bespoke meat

- Makes the material container preserve bespoke materials
- Makes the sheetifier accept bespoke materials
- Makes the autolathe accept bespoke materials
- Makes the gibber produce bespoke meats

* Makes butchering produce bespoke meats

This is jank and really needs to be folded into a unified butchering and gibbing system

* Material documentation

- Adds, fixes, and touches up some documentation

* Material container insertion callback

- Changes the proc used to expand the material container's material list ot a proc used to check whether a material fits into a material container
- Instantiating new materials is no longer O(n) relative to the number of autolathes in existence.

* Makes processing meat conserve materials

- Makes bespoke meat carry over into meatballs

* Makes preserving custom materials an option

- Implements the ability to turn preserving custom materials _off_ for processor recipes

* Fixes all bespoke materials of the same type using the same singleton

- We use ids now, not just types.

* Makes the fat sucker produce bespoke meats

- Because consistency is good.

* Fixes autolathes merging bespoke stacks into normal stacks.

* Makes the callback to test materials for holdibility optional

- @Floyd

* GetMaterialRef -> GET_MATERIAL_REF

- We capitalize macros.

* Removes an extraneous callback

- Makes the sheetifier use functionality I didn't notice I implemented a few commits ago.

* Makes mob and species meat null compatible

* Fixes the ore silo

- The ore silo had really snowflake material handling that has been brought in line with the rest.
- The materials should show up in the correct order.

* Fixes minor lathe bugs

- Fixes stack_traces caused when lathes tried to fetch materials using reagent typepaths
- Fixed the selective reagent disposal topic. I have no idea how long this has been broken.

* Various documentation fixes

- Clarified a couple comments
- Removes an extraneous ?. operator
- Fixed mat floor tiles having bugged reagent temperatures

* More fixes

-/datum/material/meat/mob -> /datum/material/meat/mob_meat
- Adds atom typecheck to material containers.

* Fixes old typepaths
2021-01-15 23:39:58 -08:00

111 lines
5.3 KiB
Plaintext

/***************************************************************
** Design Datums **
** All the data for building stuff. **
***************************************************************/
/*
For the materials datum, it assumes you need reagents unless specified otherwise. To designate a material that isn't a reagent,
you use one of the material IDs below. These are NOT ids in the usual sense (they aren't defined in the object or part of a datum),
they are simply references used as part of a "has materials?" type proc. They all start with a $ to denote that they aren't reagents.
The currently supporting non-reagent materials. All material amounts are set as the define MINERAL_MATERIAL_AMOUNT, which defaults to 2000
Don't add new keyword/IDs if they are made from an existing one (such as rods which are made from metal). Only add raw materials.
Design Guidelines
- When adding new designs, check rdreadme.dm to see what kind of things have already been made and where new stuff is needed.
- A single sheet of anything is 2000 units of material. Materials besides metal/glass require help from other jobs (mining for
other types of metals and chemistry for reagents).
- Add the AUTOLATHE tag to
*/
//DESIGNS ARE GLOBAL. DO NOT CREATE OR DESTROY THEM AT RUNTIME OUTSIDE OF INIT, JUST REFERENCE THEM TO WHATEVER YOU'RE DOING! //why are you yelling?
//DO NOT REFERENCE OUTSIDE OF SSRESEARCH. USE THE PROCS IN SSRESEARCH TO OBTAIN A REFERENCE.
/datum/design //Datum for object designs, used in construction
/// Name of the created object
var/name = "Name"
/// Description of the created object
var/desc = "Desc"
/// The ID of the design. Used for quick reference. Alphanumeric, lower-case, no symbols
var/id = DESIGN_ID_IGNORE
/// Bitflags indicating what machines this design is compatable with. ([IMPRINTER]|[PROTOLATHE]|[AUTOLATHE]|[CRAFTLATHE]|[MECHFAB]|[BIOGENERATOR]|[LIMBGROWER]|[SMELTER]|[NANITE_COMPILER])
var/build_type = null
/// List of materials required to create one unit of the product. Format is (typepath or caregory) -> amount
var/list/materials = list()
/// The amount of time required to create one unit of the product.
var/construction_time
/// The typepath of the object produced by this design
var/build_path = null
/// List of reagents produced by this design. Currently only supported by the biogenerator.
var/list/make_reagents = list()
/// What category this design falls under. Used for sorting in production machines, mostly the mechfab.
var/list/category = null
/// List of reagents required to create one unit of the product.
var/list/reagents_list = list()
/// The maximum number of units of whatever is produced by this can be produced in one go.
var/maxstack = 1
/// How many times faster than normal is this to build on the protolathe
var/lathe_time_factor = 1
/// If this is [TRUE] the admins get notified whenever anyone prints this. Currently only used by the BoH.
var/dangerous_construction = FALSE
/// Bitflags indicating what departmental lathes should be allowed to process this design.
var/departmental_flags = ALL
/// What techwebs nodes unlock this design. Constructed by SSresearch
var/list/datum/techweb_node/unlocked_by = list()
/// Override for the automatic icon generation used for the research console.
var/research_icon
/// Override for the automatic icon state generation used for the research console.
var/research_icon_state
/// Appears to be unused.
var/icon_cache
/// Optional string that interfaces can use as part of search filters. See- item/borg/upgrade/ai and the Exosuit Fabs.
var/search_metadata
/datum/design/error_design
name = "ERROR"
desc = "This usually means something in the database has corrupted. If this doesn't go away automatically, inform Central Comamnd so their techs can fix this ASAP(tm)"
/datum/design/Destroy()
SSresearch.techweb_designs -= id
return ..()
/datum/design/proc/InitializeMaterials()
var/list/temp_list = list()
for(var/i in materials) //Go through all of our materials, get the subsystem instance, and then replace the list.
var/amount = materials[i]
if(!istext(i)) //Not a category, so get the ref the normal way
var/datum/material/M = GET_MATERIAL_REF(i)
temp_list[M] = amount
else
temp_list[i] = amount
materials = temp_list
/datum/design/proc/icon_html(client/user)
var/datum/asset/spritesheet/sheet = get_asset_datum(/datum/asset/spritesheet/research_designs)
sheet.send(user)
return sheet.icon_tag(id)
////////////////////////////////////////
//Disks for transporting design datums//
////////////////////////////////////////
/obj/item/disk/design_disk
name = "Component Design Disk"
desc = "A disk for storing device design data for construction in lathes."
icon_state = "datadisk1"
custom_materials = list(/datum/material/iron =300, /datum/material/glass =100)
var/list/blueprints = list()
var/max_blueprints = 1
/obj/item/disk/design_disk/Initialize()
. = ..()
pixel_x = base_pixel_x + rand(-5, 5)
pixel_y = base_pixel_y + rand(-5, 5)
for(var/i in 1 to max_blueprints)
blueprints += null
/obj/item/disk/design_disk/adv
name = "Advanced Component Design Disk"
desc = "A disk for storing device design data for construction in lathes. This one has extra storage space."
custom_materials = list(/datum/material/iron =300, /datum/material/glass = 100, /datum/material/silver = 50)
max_blueprints = 5