Files
Bubberstation/code/modules/research/designs.dm
Mothblocks 3d319f6157 Autowiki - Generate wiki pages through code (#64417)
Adds a /datum/autowiki template which can be derived in order to create wiki pages and queue file uploads. This is then kickstarted by the new tgs target autowiki (using the AUTOWIKI define) in order to upload these pages.

The pages generated are, in a best case scenario, raw data. This means that wiki editors can decide what the actual theme is without ever having to touch the repository. In the future, MSO will hopefully sandbox the wiki and install Scribunto to let us separate data and style even more.

These will, when done, upload to templates, such as Template:Autowiki/VendingMachines. The actual pages (in this case "Vending Machines") will include this, and thus can write down their own prose and whatnot without ever having to touch repo.

This will also be run on a daily GitHub action, with some secrets setup to link to the account. Currently this is on a bot password (my forum account will not be leaked in the event of a collapse), but at some point I would like to create a dedicated bot account.

This PR adds a Techweb and Vending Machine autowiki. You can look at the Vending Machines one here and the Techweb one here.

I have absolutely no idea what to label this PR (other than note the unit tests I've added). Feel free to add whatever gives GBP 😉
2022-01-28 00:30:15 +00:00

120 lines
5.6 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 iron). 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 iron/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 = null
/// 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]|[AWAY_IMPRINTER]|[PROTOLATHE]|[AWAY_LATHE]|[AUTOLATHE]|[MECHFAB]|[BIOGENERATOR]|[LIMBGROWER]|[SMELTER])
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
/// For protolathe designs that don't require reagents: If they can be exported to autolathes with a design disk or not.
var/autolathe_exportable = TRUE
/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)
/// Returns the description of the design
/datum/design/proc/get_description()
var/obj/object_build_item_path = build_path
return isnull(desc) ? initial(object_build_item_path.desc) : desc
////////////////////////////////////////
//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(mapload)
. = ..()
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