From 8ca2a0bb35d688780ea16bd0afcd880378f9da66 Mon Sep 17 00:00:00 2001 From: Fikou <23585223+Fikou@users.noreply.github.com> Date: Sun, 9 Jul 2023 15:17:39 +0200 Subject: [PATCH] service borg cookin fixin update (#76590) ## About The Pull Request PR done for bounty: https://tgstation13.org/phpBB/viewtopic.php?f=5&t=33988 borgs can now turn on stoves and griddles borg click code has been reworked a bit to be closer to base mob, you are now able to click on stuff within reach rather than just Adjacent (might be buggy to introduce this? hopefully not. if anything we can testmerge this), which lets us make the apparatus work to pick up stoves on the range and such Adds the Codex Cibus Mechanicus as an upgrade you can research in RnD with the other service borg ones. When you use it it shows you the cooking menu! ![image](https://github.com/tgstation/tgstation/assets/23585223/5f881387-e0ba-4bb8-a9d6-ddc9d8fa9272) ## Why It's Good For The Game The service borg has the tools to prepare ingredients, but it can't actually do anything with them, which severely limits it, only being able to do slapcrafted foods. The apparatus not working on items that are on top of stoves/griddles seems to be just a bug with how cyborg click code is handled. ## Changelog :cl: Fikou fix: service borg apparatus now works on stoves and griddles and ovens qol: borgs can now activate stoves and griddles add: rnd can research a cookbook for service borgs /:cl: --- code/_onclick/cyborg.dm | 10 +- code/datums/components/crafting/crafting.dm | 4 + code/game/objects/items/robot/items/food.dm | 26 +++++ .../game/objects/items/robot/items/storage.dm | 6 +- .../objects/items/robot/robot_upgrades.dm | 28 +++++ code/modules/admin/verbs/borgpanel.dm | 5 +- .../food_and_drinks/machinery/griddle.dm | 7 ++ .../machinery/stove_component.dm | 17 ++- .../designs/mechfabricator_designs.dm | 15 ++- code/modules/research/techweb/all_nodes.dm | 1 + .../tgui/interfaces/PersonalCrafting.tsx | 100 +++++++++--------- 11 files changed, 155 insertions(+), 64 deletions(-) diff --git a/code/_onclick/cyborg.dm b/code/_onclick/cyborg.dm index 3664a4169b1..d77923f9c94 100644 --- a/code/_onclick/cyborg.dm +++ b/code/_onclick/cyborg.dm @@ -85,13 +85,11 @@ return // cyborgs are prohibited from using storage items so we can I think safely remove (A.loc && isturf(A.loc.loc)) + if(CanReach(A,W)) + W.melee_attack_chain(src, A, params) + return if(isturf(A) || isturf(A.loc)) - if(A.Adjacent(src)) // see adjacent.dm - W.melee_attack_chain(src, A, params) - return - else - W.afterattack(A, src, 0, params) - return + W.afterattack(A, src, 0, params) //Give cyborgs hotkey clicks without breaking existing uses of hotkey clicks // for non-doors/apcs diff --git a/code/datums/components/crafting/crafting.dm b/code/datums/components/crafting/crafting.dm index 428f6c5e881..5df3899244b 100644 --- a/code/datums/components/crafting/crafting.dm +++ b/code/datums/components/crafting/crafting.dm @@ -20,6 +20,7 @@ var/mode = CRAFTING var/display_craftable_only = FALSE var/display_compact = FALSE + var/forced_mode = FALSE /* This is what procs do: get_environment - gets a list of things accessable for crafting by user @@ -399,6 +400,7 @@ var/list/data = list() var/list/material_occurences = list() + data["forced_mode"] = forced_mode data["recipes"] = list() data["categories"] = list() data["foodtypes"] = FOOD_FLAGS @@ -473,6 +475,8 @@ display_compact = !display_compact . = TRUE if("toggle_mode") + if(forced_mode) + return mode = !mode var/mob/user = usr update_static_data(user) diff --git a/code/game/objects/items/robot/items/food.dm b/code/game/objects/items/robot/items/food.dm index 3b2a16f071c..7b66e1a313a 100644 --- a/code/game/objects/items/robot/items/food.dm +++ b/code/game/objects/items/robot/items/food.dm @@ -233,3 +233,29 @@ #undef THROW_LOLLIPOP_MODE #undef THROW_GUMBALL_MODE #undef DISPENSE_ICECREAM_MODE + +/obj/item/borg/cookbook + name = "Codex Cibus Mechanicus" + desc = "It's a robot cookbook!" + icon = 'icons/obj/library.dmi' + icon_state = "cooked_book" + item_flags = NOBLUDGEON + var/datum/component/personal_crafting/cooking + +/obj/item/borg/cookbook/Initialize(mapload) + . = ..() + cooking = AddComponent(/datum/component/personal_crafting) + cooking.forced_mode = TRUE + cooking.mode = TRUE + +/obj/item/borg/cookbook/attack_self(mob/user, modifiers) + . = ..() + cooking.ui_interact(user) + +/obj/item/borg/cookbook/dropped(mob/user, silent) + SStgui.close_uis(cooking) + return ..() + +/obj/item/borg/cookbook/cyborg_unequip(mob/user) + SStgui.close_uis(cooking) + return ..() diff --git a/code/game/objects/items/robot/items/storage.dm b/code/game/objects/items/robot/items/storage.dm index 958058de05e..ed98ac2c418 100644 --- a/code/game/objects/items/robot/items/storage.dm +++ b/code/game/objects/items/robot/items/storage.dm @@ -68,10 +68,10 @@ stored = item RegisterSignal(stored, COMSIG_ATOM_UPDATED_ICON, PROC_REF(on_stored_updated_icon)) update_appearance() - return + return TRUE else stored.melee_attack_chain(user, atom, params) - return + return TRUE return ..() /** @@ -307,7 +307,7 @@ return ..() /obj/item/borg/apparatus/service - name = "Service apparatus" + name = "service apparatus" desc = "A special apparatus for carrying food, bowls, plates, oven trays, soup pots and paper." icon_state = "borg_service_apparatus" storable = list( diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index de2b6006124..0c2ea01dca0 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -861,6 +861,34 @@ if (rtable) install.model.remove_module(rtable, TRUE) +/obj/item/borg/upgrade/service_cookbook + name = "Service Cyborg Cookbook" + desc = "An upgrade to the service model cyborg, that lets them create more foods." + icon_state = "cyborg_upgrade3" + require_model = TRUE + model_type = list(/obj/item/robot_model/service) + model_flags = BORG_MODEL_SERVICE + +/obj/item/borg/upgrade/service_cookbook/action(mob/living/silicon/robot/install, user = usr) + . = ..() + if(!.) + return FALSE + var/obj/item/borg/cookbook/book = locate() in install.model.modules + if(book) + install.balloon_alert_to_viewers("already installed!") + return FALSE + book = new(install.model) + install.model.basic_modules += book + install.model.add_module(book, FALSE, TRUE) + +/obj/item/borg/upgrade/service_cookbook/deactivate(mob/living/silicon/robot/install, user = usr) + . = ..() + if (!.) + return FALSE + var/obj/item/borg/cookbook/book = locate() in install.model.modules + if(book) + install.model.remove_module(book, TRUE) + ///This isn't an upgrade or part of the same path, but I'm gonna just stick it here because it's a tool used on cyborgs. //A reusable tool that can bring borgs back to life. They gotta be repaired first, though. /obj/item/borg_restart_board diff --git a/code/modules/admin/verbs/borgpanel.dm b/code/modules/admin/verbs/borgpanel.dm index 95948525229..b8fd3698a56 100644 --- a/code/modules/admin/verbs/borgpanel.dm +++ b/code/modules/admin/verbs/borgpanel.dm @@ -51,9 +51,10 @@ "scrambledcodes" = borg.scrambledcodes ) .["upgrades"] = list() - for (var/upgradetype in subtypesof(/obj/item/borg/upgrade)-/obj/item/borg/upgrade/hypospray) //hypospray is a dummy parent for hypospray upgrades + var/static/list/not_shown_upgrades = list(/obj/item/borg/upgrade/hypospray) + for (var/upgradetype in subtypesof(/obj/item/borg/upgrade)-not_shown_upgrades) //hypospray is a dummy parent for hypospray upgrades var/obj/item/borg/upgrade/upgrade = upgradetype - if (initial(upgrade.model_type) && !is_type_in_list(borg.model, initial(upgrade.model_type))) // Upgrade requires a different model + if (initial(upgrade.model_type) && !is_type_in_list(borg.model, initial(upgrade.model_type))) // Upgrade requires a different model //HEY ASSHOLE, INITIAL DOESNT WORK WITH LISTS continue var/installed = FALSE if (locate(upgradetype) in borg) diff --git a/code/modules/food_and_drinks/machinery/griddle.dm b/code/modules/food_and_drinks/machinery/griddle.dm index 93f80a8a241..63ff9a7df0d 100644 --- a/code/modules/food_and_drinks/machinery/griddle.dm +++ b/code/modules/food_and_drinks/machinery/griddle.dm @@ -83,6 +83,13 @@ /obj/machinery/griddle/attack_hand(mob/user, list/modifiers) . = ..() + toggle_mode() + +/obj/machinery/griddle/attack_robot(mob/user) + . = ..() + toggle_mode() + +/obj/machinery/griddle/proc/toggle_mode() on = !on if(on) begin_processing() diff --git a/code/modules/food_and_drinks/machinery/stove_component.dm b/code/modules/food_and_drinks/machinery/stove_component.dm index 898cd7e3513..7335edcb3ab 100644 --- a/code/modules/food_and_drinks/machinery/stove_component.dm +++ b/code/modules/food_and_drinks/machinery/stove_component.dm @@ -39,6 +39,7 @@ /datum/component/stove/RegisterWithParent() RegisterSignal(parent, COMSIG_ATOM_ATTACKBY, PROC_REF(on_attackby)) RegisterSignal(parent, COMSIG_ATOM_ATTACK_HAND_SECONDARY, PROC_REF(on_attack_hand_secondary)) + RegisterSignal(parent, COMSIG_ATOM_ATTACK_ROBOT_SECONDARY, PROC_REF(on_attack_robot_secondary)) RegisterSignal(parent, COMSIG_ATOM_EXITED, PROC_REF(on_exited)) RegisterSignal(parent, COMSIG_ATOM_UPDATE_OVERLAYS, PROC_REF(on_overlay_update)) RegisterSignal(parent, COMSIG_OBJ_DECONSTRUCT, PROC_REF(on_deconstructed)) @@ -97,13 +98,25 @@ /datum/component/stove/proc/on_attack_hand_secondary(obj/machinery/source) SIGNAL_HANDLER + toggle_mode() + + return COMPONENT_SECONDARY_CANCEL_ATTACK_CHAIN + +/datum/component/stove/proc/on_attack_robot_secondary(obj/machinery/source) + SIGNAL_HANDLER + + toggle_mode() + + return COMPONENT_SECONDARY_CANCEL_ATTACK_CHAIN + +/datum/component/stove/proc/toggle_mode() var/obj/machinery/real_parent = parent if(on) turn_off() else if(real_parent.machine_stat & (BROKEN|NOPOWER)) real_parent.balloon_alert_to_viewers("no power!") - return COMPONENT_SECONDARY_CANCEL_ATTACK_CHAIN + return else turn_on() @@ -112,8 +125,6 @@ playsound(real_parent, 'sound/machines/click.ogg', 30, TRUE) playsound(real_parent, on ? 'sound/items/welderactivate.ogg' : 'sound/items/welderdeactivate.ogg', 15, TRUE) - return COMPONENT_SECONDARY_CANCEL_ATTACK_CHAIN - /datum/component/stove/proc/on_attackby(obj/machinery/source, obj/item/attacking_item, mob/user, params) SIGNAL_HANDLER diff --git a/code/modules/research/designs/mechfabricator_designs.dm b/code/modules/research/designs/mechfabricator_designs.dm index de2930aa8dc..95be942d1f2 100644 --- a/code/modules/research/designs/mechfabricator_designs.dm +++ b/code/modules/research/designs/mechfabricator_designs.dm @@ -1171,7 +1171,7 @@ ) /datum/design/borg_upgrade_silicon_knife - name = "Kitchen toolset" + name = "Kitchen Toolset" id = "borg_upgrade_silicon_knife" build_type = MECHFAB build_path = /obj/item/borg/upgrade/silicon_knife @@ -1182,7 +1182,7 @@ ) /datum/design/borg_upgrade_service_apparatus - name = "Service apparatus" + name = "Service Apparatus" id = "borg_upgrade_service_apparatus" build_type = MECHFAB build_path = /obj/item/borg/upgrade/service_apparatus @@ -1192,6 +1192,17 @@ RND_CATEGORY_MECHFAB_CYBORG_MODULES + RND_SUBCATEGORY_MECHFAB_CYBORG_MODULES_SERVICE ) +/datum/design/borg_upgrade_service_cookbook + name = "Service Cookbook" + id = "borg_upgrade_service_cookbook" + build_type = MECHFAB + build_path = /obj/item/borg/upgrade/service_cookbook + materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT*7.5, /datum/material/diamond = HALF_SHEET_MATERIAL_AMOUNT) + construction_time = 4 SECONDS + category = list( + RND_CATEGORY_MECHFAB_CYBORG_MODULES + RND_SUBCATEGORY_MECHFAB_CYBORG_MODULES_SERVICE + ) + /datum/design/borg_upgrade_expand name = "Expand Module" id = "borg_upgrade_expand" diff --git a/code/modules/research/techweb/all_nodes.dm b/code/modules/research/techweb/all_nodes.dm index 2c86e6866ed..9724200ac68 100644 --- a/code/modules/research/techweb/all_nodes.dm +++ b/code/modules/research/techweb/all_nodes.dm @@ -960,6 +960,7 @@ "borg_upgrade_condiment_synthesizer", "borg_upgrade_silicon_knife", "borg_upgrade_service_apparatus", + "borg_upgrade_service_cookbook", ) research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2000) diff --git a/tgui/packages/tgui/interfaces/PersonalCrafting.tsx b/tgui/packages/tgui/interfaces/PersonalCrafting.tsx index 5b1662fcb01..746ee378684 100644 --- a/tgui/packages/tgui/interfaces/PersonalCrafting.tsx +++ b/tgui/packages/tgui/interfaces/PersonalCrafting.tsx @@ -131,6 +131,7 @@ type Data = { // Dynamic busy: BooleanLike; mode: BooleanLike; + forced_mode: BooleanLike; display_compact: BooleanLike; display_craftable_only: BooleanLike; craftability: Record; @@ -149,6 +150,7 @@ export const PersonalCrafting = (props, context) => { const { mode, busy, + forced_mode, display_compact, display_craftable_only, craftability, @@ -417,54 +419,56 @@ export const PersonalCrafting = (props, context) => { onClick={() => act('toggle_compact')} /> - - - - { - if (mode === MODE.crafting) { - return; - } - setTabMode(TABS.category); - setCategory(DEFAULT_CAT_CRAFTING); - act('toggle_mode'); - }} - /> - - - { - if (mode === MODE.cooking) { - return; - } - setTabMode(TABS.category); - setCategory(DEFAULT_CAT_COOKING); - act('toggle_mode'); - }} - /> - - - + {!forced_mode && ( + + + + { + if (mode === MODE.crafting) { + return; + } + setTabMode(TABS.category); + setCategory(DEFAULT_CAT_CRAFTING); + act('toggle_mode'); + }} + /> + + + { + if (mode === MODE.cooking) { + return; + } + setTabMode(TABS.category); + setCategory(DEFAULT_CAT_COOKING); + act('toggle_mode'); + }} + /> + + + + )}