mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
87 lines
3.9 KiB
Plaintext
87 lines
3.9 KiB
Plaintext
/***************************************************************
|
|
** Design Datums **
|
|
** All the data for building stuff and tracking reliability. **
|
|
***************************************************************/
|
|
/*
|
|
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:
|
|
|
|
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 Guidlines
|
|
- 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).
|
|
|
|
*/
|
|
//Note: More then one of these can be added to a design.
|
|
|
|
/datum/design //Datum for object designs, used in construction
|
|
var/name = null //Name of the created object. If null it will be 'guessed' from build_path if possible.
|
|
var/desc = null //Description of the created object. If null it will use group_desc and name where applicable.
|
|
var/item_name = null //An item name before it is modified by various name-modifying procs
|
|
var/id = "id" //ID of the created object for easy refernece. Alphanumeric, lower-case, no symbols.
|
|
var/list/req_tech = list() //IDs of that techs the object originated from and the minimum level requirements.
|
|
var/build_type = null //Flag as to what kind machine the design is built in. See defines.
|
|
var/list/materials = list() //List of materials. Format: "id" = amount.
|
|
var/list/chemicals = list() //List of chemicals.
|
|
var/build_path = null //The path of the object that gets created.
|
|
var/time = 10 //How many ticks it requires to build
|
|
var/list/category = list() //Primarily used for Mech Fabricators, but can be used for anything.
|
|
var/sort_string = "ZZZZZ" //Sorting order
|
|
var/search_metadata // Optional string that interfaces can use as part of search filters. See- item/borg/upgrade/ai and the Exosuit Fabs.
|
|
|
|
/datum/design/New()
|
|
..()
|
|
if(!islist(category))
|
|
log_runtime(EXCEPTION("Warning: Design [type] defined a non-list category. Please fix this."))
|
|
category = list(category)
|
|
item_name = name
|
|
AssembleDesignInfo()
|
|
|
|
//These procs are used in subtypes for assigning names and descriptions dynamically
|
|
/datum/design/proc/AssembleDesignInfo()
|
|
AssembleDesignName()
|
|
AssembleDesignDesc()
|
|
return
|
|
|
|
/datum/design/proc/AssembleDesignName()
|
|
if(!name && build_path) //Get name from build path if posible
|
|
var/atom/movable/A = build_path
|
|
name = initial(A.name)
|
|
item_name = name
|
|
return
|
|
|
|
/datum/design/proc/AssembleDesignDesc()
|
|
if(!desc) //Try to make up a nice description if we don't have one
|
|
desc = "Allows for the construction of \a [item_name]."
|
|
return
|
|
|
|
//Returns a new instance of the item for this design
|
|
//This is to allow additional initialization to be performed, including possibly additional contructor arguments.
|
|
/datum/design/proc/Fabricate(var/newloc, var/fabricator)
|
|
return new build_path(newloc)
|
|
|
|
/datum/design/item
|
|
build_type = PROTOLATHE
|
|
|
|
//Make sure items don't get free power, or resources. Also make things be recycled with proper values.
|
|
/datum/design/item/Fabricate()
|
|
var/obj/item/I = ..()
|
|
|
|
if(LAZYLEN(materials))
|
|
if(!LAZYLEN(I.matter))
|
|
I.matter = list()
|
|
else
|
|
I.matter.Cut()
|
|
|
|
for(var/matname in materials)
|
|
I.matter[matname] = materials[matname]
|
|
|
|
var/obj/item/weapon/cell/C = I.get_cell()
|
|
if(C)
|
|
C.charge = 0
|
|
I.update_icon()
|
|
return I |