diff --git a/monkestation/code/modules/bloodsuckers/structures/bloodsucker_recipes.dm b/monkestation/code/modules/bloodsuckers/structures/bloodsucker_recipes.dm index e065a7d2ebd3..0b0aa55a2ab5 100644 --- a/monkestation/code/modules/bloodsuckers/structures/bloodsucker_recipes.dm +++ b/monkestation/code/modules/bloodsuckers/structures/bloodsucker_recipes.dm @@ -112,12 +112,3 @@ time = 8 SECONDS category = CAT_WEAPON_MELEE always_available = FALSE - -/datum/crafting_recipe/coffin - name = "Coffin" - result = /obj/structure/closet/crate/coffin - reqs = list( - /obj/item/stack/sheet/mineral/wood = 5, - ) - time = 15 SECONDS - category = CAT_STRUCTURE diff --git a/monkestation/code/modules/factory_type_beat/machinery/assembler.dm b/monkestation/code/modules/factory_type_beat/machinery/assembler.dm index b350951a2427..64a3d75a61cb 100644 --- a/monkestation/code/modules/factory_type_beat/machinery/assembler.dm +++ b/monkestation/code/modules/factory_type_beat/machinery/assembler.dm @@ -7,13 +7,12 @@ var/datum/crafting_recipe/chosen_recipe var/crafting = FALSE - var/static/list/crafting_recipes = list() + var/static/list/legal_crafting_recipes = list() var/list/crafting_inventory = list() icon = 'monkestation/code/modules/factory_type_beat/icons/mining_machines.dmi' icon_state = "assembler" - /obj/machinery/assembler/Initialize(mapload) . = ..() @@ -24,7 +23,7 @@ AddComponent(/datum/component/hovering_information, /datum/hover_data/assembler) register_context() - if(!length(crafting_recipes)) + if(!length(legal_crafting_recipes)) create_recipes() /obj/machinery/assembler/RefreshParts() @@ -61,14 +60,14 @@ . += span_notice("[initial(atom.name)]: [chosen_recipe.reqs[atom]]") /obj/machinery/assembler/proc/create_recipes() - for(var/datum/crafting_recipe/recipe as anything in subtypesof(/datum/crafting_recipe) - /datum/crafting_recipe/stack) + for(var/datum/crafting_recipe/recipe as anything in GLOB.crafting_recipes) if(initial(recipe.non_craftable) || !initial(recipe.always_available)) continue - crafting_recipes += new recipe + legal_crafting_recipes += recipe /obj/machinery/assembler/attack_hand(mob/living/user, list/modifiers) . = ..() - var/datum/crafting_recipe/choice = tgui_input_list(user, "Choose a recipe", name, crafting_recipes) + var/datum/crafting_recipe/choice = tgui_input_list(user, "Choose a recipe", name, legal_crafting_recipes) if(!choice) return chosen_recipe = choice @@ -77,10 +76,9 @@ crafting_inventory -= listed /obj/machinery/assembler/CanAllowThrough(atom/movable/mover, border_dir) - if(!anchored) - return FALSE - if(!chosen_recipe) + if(!anchored || !chosen_recipe) return FALSE + var/failed = TRUE for(var/atom/movable/movable as anything in chosen_recipe.reqs) if(istype(mover, movable)) @@ -88,8 +86,10 @@ break if(failed) return FALSE + if(!check_item(mover)) return FALSE + return ..() /obj/machinery/assembler/proc/on_entered(datum/source, atom/movable/atom_movable) diff --git a/monkestation/code/modules/mech_comp/objects/_object.dm b/monkestation/code/modules/mech_comp/objects/_object.dm index 8c380d181cda..24eec2524615 100644 --- a/monkestation/code/modules/mech_comp/objects/_object.dm +++ b/monkestation/code/modules/mech_comp/objects/_object.dm @@ -15,15 +15,32 @@ configs = list() inputs = list() update_icon_state() + register_context() - MC_ADD_CONFIG(MC_CFG_UNLINK_ALL, unlink_all) - MC_ADD_CONFIG(MC_CFG_UNLINK, unlink) MC_ADD_CONFIG(MC_CFG_LINK, add_linker) + MC_ADD_CONFIG(MC_CFG_UNLINK, unlink) + MC_ADD_CONFIG(MC_CFG_UNLINK_ALL, unlink_all) /obj/item/mcobject/Destroy(force) QDEL_NULL(interface) return ..() +/obj/item/mcobject/examine(mob/user) + . = ..() + . += span_notice("You can left-click with a multitool to put up a list of options available for linking.") + . += span_notice("You can right-click with a multitool to quickly start linking the device as an output.") + +/obj/item/mcobject/add_context(atom/source, list/context, obj/item/held_item, mob/user) + . = ..() + if(isnull(held_item) || held_item.tool_behaviour != TOOL_MULTITOOL) + return NONE + + context[SCREENTIP_CONTEXT_LMB] = "View available operations" + if(anchored) + context[SCREENTIP_CONTEXT_RMB] = "Start linking" + + return CONTEXTUAL_SCREENTIP_SET + /obj/item/mcobject/update_icon_state() . = ..() icon_state = anchored ? "u[base_icon_state]" : base_icon_state @@ -64,6 +81,14 @@ call(src, configs[action])(user, tool) +/obj/item/mcobject/multitool_act_secondary(mob/living/user, obj/item/tool) + var/datum/component/mclinker/link = tool.GetComponent(/datum/component/mclinker) + if(link) + to_chat(user, span_warning("Previous link deleted.")) + qdel(link) + + add_linker(user, tool) + /obj/item/mcobject/proc/unlink(mob/user, obj/item/tool) var/list/options = list() diff --git a/monkestation/code/modules/mech_comp/objects/interactor.dm b/monkestation/code/modules/mech_comp/objects/interactor.dm index 4af0794c9607..4603bc55547d 100644 --- a/monkestation/code/modules/mech_comp/objects/interactor.dm +++ b/monkestation/code/modules/mech_comp/objects/interactor.dm @@ -12,6 +12,8 @@ var/mob/living/carbon/human/dummy/dummy_human ///image of the held item displayed over the component to see whats going on var/obj/item/held_item + ///The object we specifically look for when clicking + var/atom/desired_path = null ///the connected storage component to act as an inventory to grab from var/obj/item/mcobject/messaging/storage/connected_storage ///the current stored direction used for interaction @@ -24,6 +26,7 @@ MC_ADD_CONFIG("Swap Click", swap_click) MC_ADD_CONFIG("Swap Range", set_range) MC_ADD_CONFIG("Change Direction", change_dir) + MC_ADD_CONFIG("Reset Desired Object", reset_desired_path) MC_ADD_INPUT("swap click", swap_click_input) MC_ADD_INPUT("replace", replace_from_storage) MC_ADD_INPUT("drop", drop) @@ -43,15 +46,33 @@ QDEL_NULL(dummy_human) return ..() +/obj/item/mcobject/examine(mob/user) + . = ..() + . += span_notice("You can right-click with a multitool whilst having a storage component in your buffer to link it.") + . += span_notice("You can drag [src] over an object whilst you're adjacent to both [src] and the object to make it only click objects of the same type as it.") + /obj/item/mcobject/interactor/multitool_act_secondary(mob/living/user, obj/item/tool) var/obj/item/multitool/multitool = tool if(!multitool.component_buffer) - return + return ..() if(!istype(multitool.component_buffer, /obj/item/mcobject/messaging/storage)) - return + return ..() connected_storage = multitool.component_buffer say("Successfully linked to storage component") +/obj/item/mcobject/interactor/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params) + . = ..() + if(!over || !istype(over) || over == src) + return + + var/mob/living/carbon/human/user = usr + if(!istype(user)) + return + + if(Adjacent(user, src) && Adjacent(over, user)) + say("Desired object set to [over]") + desired_path = over.type + /obj/item/mcobject/interactor/proc/drop(datum/mcmessage/input) if(!input) return @@ -110,6 +131,11 @@ stored_dir = directions_listed[direction_choice] return TRUE +/obj/item/mcobject/interactor/proc/reset_desired_path(mob/user, obj/item/tool) + say("Desired object [desired_path ? "reset" : "not set"]!") + desired_path = null + return TRUE + /obj/item/mcobject/interactor/proc/swap_click_input(datum/mcmessage/input) if(!input) return @@ -127,6 +153,9 @@ selected_turf = get_step(src, stored_dir) for(var/atom/movable/listed_atom in selected_turf) + if(desired_path && (desired_path != listed_atom.type)) + continue + if(dummy_human == listed_atom || src == listed_atom) continue