Files
Bubberstation/code/datums/components/crafting/robot.dm
MrMelbert 4aa7bae77a Moves tool use back higher in the chain, but makes it so tool acts are only called on non-combat-mode (#84083)
## About The Pull Request

### Dilemma 

So we've been running into a dilemma recently as we move more and more
items over (#84070, #83910)

Some things like modsuits, tables, washing machines, storage items want
to do their tool acts before their item interactions

In the past this was perfectly fine, because it was `tool_act` ->
`attack`, but now it's a problem, because it's `item_interaction` ->
`tool_act` -> `attack`.

Rather than resort to snowflaking, my idea is that we can move tools
back up the chain so deconstruction and other similar effects are
handled first, before anything else like putting the tool onto the
table.

### So why does it require non-combat-mode?

A large amount of tool acts early return if the user's on combat mode to
allow the user to smack the thing instead of using the tool on it. So
I've decided to walk back on what I said like a week ago and make this
standardized behavior.

### Misc

Reintroducing `tool_act` as a proc that exist means that atoms can
easily hook certain interactions that must happen very high in the click
chain, such as doing something that block storage insertion. Moves some
of the behaviors I put on the (admittedly rather hacky) new proc to
that.

(Also cleaned up a bit of lockbox and medbot code)

## Changelog

🆑 Melbert
fix: Fixed modsuit interactions slightly. No longer requires combat mode
to use tools on it, plasma core works as intended as well. (Using combat
mode, however, will make you insert the item)
refactor: Refactored lockboxes
refactor: Refactored medbot skin application
/🆑
2024-06-28 16:18:50 -06:00

204 lines
5.4 KiB
Plaintext

/datum/crafting_recipe/ed209
name = "ED209"
result = /mob/living/simple_animal/bot/secbot/ed209
reqs = list(
/obj/item/robot_suit = 1,
/obj/item/clothing/head/helmet/sec = 1,
/obj/item/clothing/suit/armor/vest = 1,
/obj/item/bodypart/leg/left/robot = 1,
/obj/item/bodypart/leg/right/robot = 1,
/obj/item/stack/sheet/iron = 1,
/obj/item/stack/cable_coil = 1,
/obj/item/gun/energy/disabler = 1,
/obj/item/assembly/prox_sensor = 1,
)
tool_behaviors = list(TOOL_WELDER, TOOL_SCREWDRIVER)
time = 6 SECONDS
category = CAT_ROBOT
/datum/crafting_recipe/secbot
name = "Secbot"
result = /mob/living/simple_animal/bot/secbot
reqs = list(
/obj/item/assembly/signaler = 1,
/obj/item/clothing/head/helmet/sec = 1,
/obj/item/melee/baton/security/ = 1,
/obj/item/assembly/prox_sensor = 1,
/obj/item/bodypart/arm/right/robot = 1,
)
tool_behaviors = list(TOOL_WELDER)
time = 6 SECONDS
category = CAT_ROBOT
/datum/crafting_recipe/cleanbot
name = "Cleanbot"
result = /mob/living/basic/bot/cleanbot
reqs = list(
/obj/item/reagent_containers/cup/bucket = 1,
/obj/item/assembly/prox_sensor = 1,
/obj/item/bodypart/arm/right/robot = 1,
)
parts = list(/obj/item/reagent_containers/cup/bucket = 1)
time = 4 SECONDS
category = CAT_ROBOT
/datum/crafting_recipe/floorbot
name = "Floorbot"
result = /mob/living/simple_animal/bot/floorbot
reqs = list(
/obj/item/storage/toolbox = 1,
/obj/item/stack/tile/iron = 10,
/obj/item/assembly/prox_sensor = 1,
/obj/item/bodypart/arm/right/robot = 1,
)
time = 4 SECONDS
category = CAT_ROBOT
/datum/crafting_recipe/medbot
name = "Medbot"
result = /mob/living/basic/bot/medbot
reqs = list(
/obj/item/healthanalyzer = 1,
/obj/item/storage/medkit = 1,
/obj/item/assembly/prox_sensor = 1,
/obj/item/bodypart/arm/right/robot = 1,
)
parts = list(
/obj/item/storage/medkit = 1,
/obj/item/healthanalyzer = 1,
)
time = 4 SECONDS
category = CAT_ROBOT
/datum/crafting_recipe/medbot/on_craft_completion(mob/user, atom/result)
var/mob/living/basic/bot/medbot/bot = result
var/obj/item/storage/medkit/medkit = bot.contents[3]
bot.medkit_type = medkit
bot.health_analyzer = bot.contents[4]
bot.skin = medkit.get_medbot_skin()
bot.damage_type_healer = initial(medkit.damagetype_healed) ? initial(medkit.damagetype_healed) : BRUTE
bot.update_appearance()
/datum/crafting_recipe/honkbot
name = "Honkbot"
result = /mob/living/basic/bot/honkbot
reqs = list(
/obj/item/storage/box/clown = 1,
/obj/item/bodypart/arm/right/robot = 1,
/obj/item/assembly/prox_sensor = 1,
/obj/item/bikehorn = 1,
)
time = 4 SECONDS
category = CAT_ROBOT
/datum/crafting_recipe/firebot
name = "Firebot"
result = /mob/living/basic/bot/firebot
reqs = list(
/obj/item/extinguisher = 1,
/obj/item/bodypart/arm/right/robot = 1,
/obj/item/assembly/prox_sensor = 1,
/obj/item/clothing/head/utility/hardhat/red = 1,
)
time = 4 SECONDS
category = CAT_ROBOT
/datum/crafting_recipe/vibebot
name = "Vibebot"
result = /mob/living/basic/bot/vibebot
reqs = list(
/obj/item/light/bulb = 2,
/obj/item/bodypart/head/robot = 1,
/obj/item/assembly/prox_sensor = 1,
/obj/item/toy/crayon = 1,
)
time = 4 SECONDS
category = CAT_ROBOT
/datum/crafting_recipe/hygienebot
name = "Hygienebot"
result = /mob/living/basic/bot/hygienebot
reqs = list(
/obj/item/bot_assembly/hygienebot = 1,
/obj/item/stack/ducts = 1,
/obj/item/assembly/prox_sensor = 1,
)
tool_behaviors = list(TOOL_WELDER)
time = 4 SECONDS
category = CAT_ROBOT
/datum/crafting_recipe/vim
name = "Vim"
result = /obj/vehicle/sealed/car/vim
reqs = list(
/obj/item/clothing/head/helmet/space/eva = 1,
/obj/item/bodypart/leg/left/robot = 1,
/obj/item/bodypart/leg/right/robot = 1,
/obj/item/flashlight = 1,
/obj/item/assembly/voice = 1,
)
tool_behaviors = list(TOOL_SCREWDRIVER)
time = 6 SECONDS //Has a four second do_after when building manually
category = CAT_ROBOT
/datum/crafting_recipe/aitater
name = "intelliTater"
result = /obj/item/aicard/aitater
time = 3 SECONDS
tool_behaviors = list(TOOL_WIRECUTTER)
reqs = list(
/obj/item/aicard = 1,
/obj/item/food/grown/potato = 1,
/obj/item/stack/cable_coil = 5,
)
parts = list(/obj/item/aicard = 1)
category = CAT_ROBOT
/datum/crafting_recipe/aitater/aispook
name = "intelliLantern"
result = /obj/item/aicard/aispook
reqs = list(
/obj/item/aicard = 1,
/obj/item/food/grown/pumpkin = 1,
/obj/item/stack/cable_coil = 5,
)
/datum/crafting_recipe/aitater/on_craft_completion(mob/user, atom/result)
var/obj/item/aicard/new_card = result
var/obj/item/aicard/base_card = result.contents[1]
var/mob/living/silicon/ai = base_card.AI
if(ai)
base_card.AI = null
ai.forceMove(new_card)
new_card.AI = ai
new_card.update_appearance()
qdel(base_card)
/datum/crafting_recipe/mod_core_standard
name = "MOD core (Standard)"
result = /obj/item/mod/core/standard
tool_behaviors = list(TOOL_SCREWDRIVER)
time = 10 SECONDS
reqs = list(
/obj/item/stack/cable_coil = 5,
/obj/item/stack/rods = 2,
/obj/item/stack/sheet/glass = 1,
/obj/item/organ/internal/heart/ethereal = 1,
)
category = CAT_ROBOT
/datum/crafting_recipe/mod_core_ethereal
name = "MOD core (Ethereal)"
result = /obj/item/mod/core/ethereal
tool_behaviors = list(TOOL_SCREWDRIVER)
time = 10 SECONDS
reqs = list(
/datum/reagent/consumable/liquidelectricity = 5,
/obj/item/stack/cable_coil = 5,
/obj/item/stack/rods = 2,
/obj/item/stack/sheet/glass = 1,
/obj/item/reagent_containers/syringe = 1,
)
category = CAT_ROBOT