Merge pull request #11025 from VOREStation/Arokha/crafty

Fix crafting menu, add plant fiber crafting things
This commit is contained in:
Aronai Sieyes
2021-07-11 15:15:34 -04:00
committed by GitHub
12 changed files with 97 additions and 18 deletions
+18 -1
View File
@@ -49,6 +49,7 @@
var/datum/action/innate/crafting/button
var/display_craftable_only = FALSE
var/display_compact = TRUE
var/tgui_category_hint
/* This is what procs do:
get_environment - gets a list of things accessable for crafting by user
@@ -357,7 +358,7 @@
container.close_all()
qdel(DL)
/datum/component/personal_crafting/proc/component_ui_interact(/obj/screen/craft/image, location, control, params, user)
/datum/component/personal_crafting/proc/component_ui_interact(source, location, control, params, user)
// SIGNAL_HANDLER
if(user == parent)
@@ -380,6 +381,18 @@
ui.open()
/datum/component/personal_crafting/tgui_data(mob/user)
// ANNOYING. We won't know what category will be on top (and thus first selected) in the UI
// until we crunch all the resources in tgui_static_data. So it just sets a hint and we
// consume it and set the category on the first UI open
if(tgui_category_hint)
cur_category = tgui_category_hint
tgui_category_hint = null
if(islist(categories[cur_category]))
var/list/subcats = categories[cur_category]
cur_subcategory = subcats[1]
else
cur_subcategory = CAT_NONE
var/list/data = list()
data["busy"] = busy
data["category"] = cur_category
@@ -411,6 +424,7 @@
var/datum/crafting_recipe/R = rec
if(R.name == "") //This is one of the invalid parents that sneaks in
GLOB.crafting_recipes -= rec
continue
if(!R.always_available && !(R.type in user?.mind?.learned_recipes)) //User doesn't actually know how to make this.
@@ -427,6 +441,9 @@
crafting_recipes[R.category]["has_subcats"] = TRUE
crafting_recipes[R.category][R.subcategory] += list(build_recipe_data(R))
if(crafting_recipes.len)
tgui_category_hint = crafting_recipes[1]
data["crafting_recipes"] = crafting_recipes
return data
+4 -11
View File
@@ -5,7 +5,10 @@
/datum/crafting_recipe
var/name = "" //in-game display name
var/list/reqs = list() //type paths of items consumed associated with how many are needed
/// type paths of items consumed associated with how many are needed
/// Note that stacks have special handling: the logic accounts for having '23' available
/// in the case of just having one stack of 23 amount, so stack/steel = 23 is fine
var/list/reqs = list()
var/list/blacklist = list() //type paths of items explicitly not allowed as an ingredient
var/result //type path of item resulting from this craft
/// String defines of items needed but not consumed. Lazy list.
@@ -44,13 +47,3 @@
/datum/crafting_recipe/proc/on_craft_completion(mob/user, atom/result)
return
/datum/crafting_recipe/stunprod
name = "Stunprod"
result = /obj/item/weapon/melee/baton/cattleprod
reqs = list(/obj/item/weapon/handcuffs/cable = 1,
/obj/item/stack/rods = 1,
/obj/item/weapon/tool/wirecutters = 1)
time = 40
category = CAT_WEAPONRY
subcategory = CAT_WEAPON
@@ -0,0 +1,13 @@
/datum/crafting_recipe/cloth
name = "Cloth bolt"
result = /obj/item/stack/material/cloth
reqs = list(/obj/item/stack/material/fiber = 3)
time = 40
category = CAT_PRIMAL
/datum/crafting_recipe/crude_bandage
name = "Crude bandages (x10)"
result = /obj/item/stack/medical/crude_pack
reqs = list(/obj/item/stack/material/cloth = 2)
time = 40
category = CAT_PRIMAL
@@ -0,0 +1,9 @@
/datum/crafting_recipe/stunprod
name = "Stunprod"
result = /obj/item/weapon/melee/baton/cattleprod
reqs = list(/obj/item/weapon/handcuffs/cable = 1,
/obj/item/stack/rods = 1,
/obj/item/weapon/tool/wirecutters = 1)
time = 40
category = CAT_WEAPONRY
subcategory = CAT_WEAPON