Skip to content

Commit

Permalink
Crafting fireaxe cabinets, mech removal cabinets, and mirrors (#72856)
Browse files Browse the repository at this point in the history
## About The Pull Request
Breaking down #72371 because it's... unreasonably large.
So this PR splits the crafting recipe file, and adds 3 new recipes for
fireaxe cabinets, mech removal cabinets, and mirrors.

## Why It's Good For The Game
Wallening compliance, and more of me on my shit breaking down long
files.

## Changelog
:cl: Tattle
qol: fireaxe cabinets, mech removal cabinets, and mirrors can now all be
crafted
/:cl:

Co-authored-by: tattle <article.disaster@gmail.com>
  • Loading branch information
dragomagol and tattle committed Jan 23, 2023
1 parent e408c9a commit 57e88e6
Show file tree
Hide file tree
Showing 21 changed files with 2,153 additions and 1,880 deletions.
82 changes: 82 additions & 0 deletions code/datums/components/crafting/_recipes.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
///If the machine is used/deleted in the crafting process
#define CRAFTING_MACHINERY_CONSUME 1
///If the machine is only "used" i.e. it checks to see if it's nearby and allows crafting, but doesn't delete it
#define CRAFTING_MACHINERY_USE 0

/datum/crafting_recipe
///in-game display name
var/name
///type paths of items consumed associated with how many are needed
var/list/reqs = list()
///type paths of items explicitly not allowed as an ingredient
var/list/blacklist = list()
///type path of item resulting from this craft
var/result
/// String defines of items needed but not consumed. Lazy list.
var/list/tool_behaviors
/// Type paths of items needed but not consumed. Lazy list.
var/list/tool_paths
///time in seconds. Remember to use the SECONDS define!
var/time = 3 SECONDS
///type paths of items that will be placed in the result
var/list/parts = list()
///like tool_behaviors but for reagents
var/list/chem_catalysts = list()
///where it shows up in the crafting UI
var/category
///Set to FALSE if it needs to be learned first.
var/always_available = TRUE
/// Additonal requirements text shown in UI
var/additional_req_text
///Required machines for the craft, set the assigned value of the typepath to CRAFTING_MACHINERY_CONSUME or CRAFTING_MACHINERY_USE. Lazy associative list: type_path key -> flag value.
var/list/machinery
///Should only one object exist on the same turf?
var/one_per_turf = FALSE
/// Steps needed to achieve the result
var/list/steps
/// Whether the result can be crafted with a crafting menu button
var/non_craftable
/// Chemical reaction described in the recipe
var/datum/chemical_reaction/reaction
/// Resulting amount (for stacks only)
var/result_amount

/datum/crafting_recipe/New()
if(!(result in reqs))
blacklist += result
if(tool_behaviors)
tool_behaviors = string_list(tool_behaviors)
if(tool_paths)
tool_paths = string_list(tool_paths)

/datum/crafting_recipe/stack/New(obj/item/stack/material, datum/stack_recipe/stack_recipe)
if(!material || !stack_recipe || !stack_recipe.result_type)
stack_trace("Invalid stack recipe [stack_recipe]")
return
..()

src.name = stack_recipe.title
src.time = stack_recipe.time
src.result = stack_recipe.result_type
src.result_amount = stack_recipe.res_amount
src.reqs[material] = stack_recipe.req_amount
src.category = stack_recipe.category || CAT_MISC

/**
* Run custom pre-craft checks for this recipe, don't add feedback messages in this because it will spam the client
*
* user: The /mob that initiated the crafting
* collected_requirements: A list of lists of /obj/item instances that satisfy reqs. Top level list is keyed by requirement path.
*/
/datum/crafting_recipe/proc/check_requirements(mob/user, list/collected_requirements)
return TRUE

/datum/crafting_recipe/proc/on_craft_completion(mob/user, atom/result)
return

///Check if the pipe used for atmospheric device crafting is the proper one
/datum/crafting_recipe/proc/atmos_pipe_check(mob/user, list/collected_requirements)
var/obj/item/pipe/required_pipe = collected_requirements[/obj/item/pipe][1]
if(ispath(required_pipe.pipe_type, /obj/machinery/atmospherics/pipe/smart))
return TRUE
return FALSE
Loading

0 comments on commit 57e88e6

Please sign in to comment.