Personal Crafting & Dependencies

This commit is contained in:
ShadowLarkens
2021-05-02 13:55:59 -07:00
parent 6608393d7c
commit 0198ff3fbf
37 changed files with 973 additions and 110 deletions

View File

@@ -64,4 +64,23 @@
return b_score - a_score
/proc/cmp_typepaths_asc(A, B)
return sorttext("[B]","[A]")
return sorttext("[B]","[A]")
/**
* Sorts crafting recipe requirements before the crafting recipe is inserted into GLOB.crafting_recipes
*
* Prioritises [/datum/reagent] to ensure reagent requirements are always processed first when crafting.
* This prevents any reagent_containers from being consumed before the reagents they contain, which can
* lead to runtimes and item duplication when it happens.
*/
/proc/cmp_crafting_req_priority(A, B)
var/lhs
var/rhs
lhs = ispath(A, /datum/reagent) ? 0 : 1
rhs = ispath(B, /datum/reagent) ? 0 : 1
return lhs - rhs
/proc/cmp_text_asc(a,b)
return sorttext(b,a)