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
🆑 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
/🆑
This commit is contained in:
Fikou
2023-07-09 15:17:39 +02:00
committed by GitHub
parent 69775ea1fe
commit 8ca2a0bb35
11 changed files with 155 additions and 64 deletions
+4 -6
View File
@@ -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
@@ -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)
@@ -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 ..()
@@ -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(
@@ -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
+3 -2
View File
@@ -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)
@@ -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()
@@ -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
@@ -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"
@@ -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)