diff --git a/code/__defines/materials.dm b/code/__defines/materials.dm index 38a84e71697..12a671b4640 100644 --- a/code/__defines/materials.dm +++ b/code/__defines/materials.dm @@ -34,6 +34,7 @@ #define MAT_CHITIN "chitin" #define MAT_CLOTH "cloth" #define MAT_SYNCLOTH "syncloth" +#define MAT_FIBERS "fibers" #define MAT_COPPER "copper" #define MAT_QUARTZ "quartz" #define MAT_TIN "tin" diff --git a/code/datums/components/crafting/crafting.dm b/code/datums/components/crafting/crafting.dm index db22dda2961..cc6bb53a972 100644 --- a/code/datums/components/crafting/crafting.dm +++ b/code/datums/components/crafting/crafting.dm @@ -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 diff --git a/code/datums/components/crafting/recipes.dm b/code/datums/components/crafting/recipes.dm index 5d4cd12c613..bd5aec33954 100644 --- a/code/datums/components/crafting/recipes.dm +++ b/code/datums/components/crafting/recipes.dm @@ -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 \ No newline at end of file diff --git a/code/datums/components/crafting/recipes/primitive.dm b/code/datums/components/crafting/recipes/primitive.dm new file mode 100644 index 00000000000..064fd63020b --- /dev/null +++ b/code/datums/components/crafting/recipes/primitive.dm @@ -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 diff --git a/code/datums/components/crafting/recipes/weapons.dm b/code/datums/components/crafting/recipes/weapons.dm new file mode 100644 index 00000000000..32a8b2cc4e6 --- /dev/null +++ b/code/datums/components/crafting/recipes/weapons.dm @@ -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 \ No newline at end of file diff --git a/code/game/objects/structures/flora/flora.dm b/code/game/objects/structures/flora/flora.dm index ccb3106886f..6f7963509e4 100644 --- a/code/game/objects/structures/flora/flora.dm +++ b/code/game/objects/structures/flora/flora.dm @@ -15,6 +15,7 @@ var/harvest_tool = null // The type of item used to harvest the plant. var/harvest_count = 0 + var/destroy_on_harvest = FALSE var/randomize_harvest_count = TRUE var/max_harvests = 0 @@ -53,6 +54,8 @@ else to_chat(user, "You harvest \the [AM] from \the [src].") + if(harvest_count >= max_harvests && destroy_on_harvest) + qdel(src) return ..(W, user) @@ -66,11 +69,12 @@ /obj/structure/flora/proc/spawn_harvest(var/path = null, var/mob/user = null) if(!ispath(path)) return 0 - var/turf/Target = get_turf(src) + + var/atom/movable/AM = new path() if(user) - Target = get_turf(user) - - var/atom/movable/AM = new path(Target) + user.put_in_hands(AM) + else + AM.forceMove(drop_location()) harvest_count++ return AM @@ -80,6 +84,12 @@ name = "bush" icon = 'icons/obj/flora/snowflora.dmi' icon_state = "snowbush1" + + destroy_on_harvest = TRUE + harvest_tool = /obj/item/weapon/material/knife + randomize_harvest_count = FALSE + harvest_loot = list(/obj/item/stack/material/fiber = 1) + max_harvests = 1 /obj/structure/flora/bush/New() ..() @@ -99,6 +109,12 @@ name = "bush" icon = 'icons/obj/flora/ausflora.dmi' icon_state = "firstbush_1" + + destroy_on_harvest = TRUE + harvest_tool = /obj/item/weapon/material/knife + randomize_harvest_count = FALSE + harvest_loot = list(/obj/item/stack/material/fiber = 1) + max_harvests = 1 /obj/structure/flora/ausbushes/New() ..() diff --git a/code/modules/materials/fifty_spawner_mats.dm b/code/modules/materials/fifty_spawner_mats.dm index af2e3703e8f..24f3985c4a7 100644 --- a/code/modules/materials/fifty_spawner_mats.dm +++ b/code/modules/materials/fifty_spawner_mats.dm @@ -104,6 +104,10 @@ name = "stack of cloth" type_to_spawn = /obj/item/stack/material/cloth +/obj/fiftyspawner/fiber + name = "stack of plant fibers" + type_to_spawn = /obj/item/stack/material/fiber + /obj/fiftyspawner/cardboard name = "stack of cardboard" type_to_spawn = /obj/item/stack/material/cardboard diff --git a/code/modules/materials/materials/organic/cloth.dm b/code/modules/materials/materials/organic/cloth.dm index 260c47f5b0c..1908597d32d 100644 --- a/code/modules/materials/materials/organic/cloth.dm +++ b/code/modules/materials/materials/organic/cloth.dm @@ -123,4 +123,17 @@ ignition_point = T0C+232 melting_point = T0C+300 protectiveness = 1 // 4% - conductive = 0 \ No newline at end of file + conductive = 0 + +/datum/material/fibers + name = MAT_FIBERS + display_name = "plant" + sheet_singular_name = "fiber" + sheet_singular_name = "fibers" + icon_colour = "#006b0e" + flags = MATERIAL_PADDING + ignition_point = T0C+232 + melting_point = T0C+300 + protectiveness = 1 // 4% + conductive = 0 + pass_stack_colors = TRUE diff --git a/code/modules/materials/sheets/organic/textiles.dm b/code/modules/materials/sheets/organic/textiles.dm index a534ee19b1c..8e5594eaa04 100644 --- a/code/modules/materials/sheets/organic/textiles.dm +++ b/code/modules/materials/sheets/organic/textiles.dm @@ -11,6 +11,7 @@ /obj/item/stack/material/cloth name = "cloth" + desc = "Individual fibers woven into a cloth." icon_state = "sheet-cloth" default_type = "cloth" no_variants = FALSE @@ -21,3 +22,13 @@ /obj/item/stack/material/cloth/diyaab color = "#c6ccf0" + +/obj/item/stack/material/fiber + name = "plant fiber" + desc = "Some all-natural plant fibers." + icon_state = "sheet-fiber" + default_type = MAT_FIBERS + pass_color = TRUE + apply_colour = TRUE + drop_sound = 'sound/items/drop/clothing.ogg' + pickup_sound = 'sound/items/pickup/clothing.ogg' diff --git a/code/modules/nifsoft/nif_tgui.dm b/code/modules/nifsoft/nif_tgui.dm index f24f475baf7..7be13ceff68 100644 --- a/code/modules/nifsoft/nif_tgui.dm +++ b/code/modules/nifsoft/nif_tgui.dm @@ -60,7 +60,7 @@ user.verbs |= /mob/living/carbon/human/proc/nif_menu -/datum/component/nif_menu/proc/nif_menu_click(obj/screen/nif/image, location, control, params, user) +/datum/component/nif_menu/proc/nif_menu_click(source, location, control, params, user) var/mob/living/carbon/human/H = user if(istype(H) && H.nif) INVOKE_ASYNC(H.nif, .proc/tgui_interact, user) diff --git a/icons/obj/stacks.dmi b/icons/obj/stacks.dmi index 1e8faff31f1..430314b223f 100644 Binary files a/icons/obj/stacks.dmi and b/icons/obj/stacks.dmi differ diff --git a/vorestation.dme b/vorestation.dme index 6ff4fb50850..2229a80cbd1 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -356,6 +356,8 @@ #include "code\datums\components\crafting\crafting_external.dm" #include "code\datums\components\crafting\recipes.dm" #include "code\datums\components\crafting\tool_quality.dm" +#include "code\datums\components\crafting\recipes\primitive.dm" +#include "code\datums\components\crafting\recipes\weapons.dm" #include "code\datums\elements\_element.dm" #include "code\datums\elements\light_blocking.dm" #include "code\datums\elements\turf_transparency.dm"