From 02596205c0daf413e0d8a356ce875cea181f254f Mon Sep 17 00:00:00 2001 From: MistakeNot4892 Date: Mon, 10 Feb 2025 01:24:13 +1100 Subject: [PATCH] Swapping robot modules out for grippers. --- code/_onclick/cyborg.dm | 5 - code/_onclick/hud/hud_elements/hud_robot.dm | 1 + code/_onclick/hud/hud_types/_hud.dm | 41 ++- code/_onclick/hud/hud_types/robot.dm | 36 +-- .../hud/screen/robot/screen_robot_module.dm | 6 + .../hud/screen/robot/screen_robot_modules.dm | 30 -- .../hud/screen/robot/screen_robot_store.dm | 14 +- .../inventory_slots/inventory_gripper.dm | 20 +- .../inventory_gripper_robot.dm | 18 ++ code/datums/mind/mind.dm | 33 +-- code/datums/storage/_storage.dm | 2 +- code/game/antagonist/antagonist_equip.dm | 2 +- .../machine_construction/frame.dm | 2 +- .../machine_construction/wall_frame.dm | 2 +- .../_machines_base/machinery_components.dm | 2 +- code/game/objects/items/__item.dm | 4 +- code/modules/food/assembled.dm | 2 +- .../integrated_electronics/core/assemblies.dm | 2 +- code/modules/keybindings/_defines.dm | 1 - code/modules/keybindings/robot.dm | 71 ----- code/modules/mechs/components/frame.dm | 2 +- code/modules/mob/inventory.dm | 10 +- code/modules/mob/living/human/examine.dm | 2 +- code/modules/mob/living/living.dm | 3 - .../living/silicon/robot/drone/drone_items.dm | 16 +- .../mob/living/silicon/robot/inventory.dm | 264 +----------------- code/modules/mob/living/silicon/robot/life.dm | 35 +-- .../living/silicon/robot/modules/_module.dm | 18 +- .../modules/mob/living/silicon/robot/robot.dm | 91 ++---- .../mob/living/silicon/robot/robot_damage.dm | 10 +- .../living/silicon/robot/robot_movement.dm | 3 +- .../retaliate/giant_parrot/giant_parrot.dm | 2 +- code/modules/mob/mob_movement.dm | 5 - code/modules/nano/interaction/hands.dm | 2 +- code/modules/paperwork/paper.dm | 4 +- code/modules/recycling/package_wrapper.dm | 2 +- code/modules/xenoarcheaology/boulder.dm | 17 +- nebula.dme | 2 +- 38 files changed, 166 insertions(+), 616 deletions(-) create mode 100644 code/datums/inventory_slots/inventory_gripper_robot.dm delete mode 100644 code/modules/keybindings/robot.dm diff --git a/code/_onclick/cyborg.dm b/code/_onclick/cyborg.dm index 2ad7f9d7c98..9b621ba801e 100644 --- a/code/_onclick/cyborg.dm +++ b/code/_onclick/cyborg.dm @@ -86,11 +86,6 @@ holding.afterattack(A, src, 0, params) return -//Middle click cycles through selected modules. -/mob/living/silicon/robot/MiddleClickOn(var/atom/A) - cycle_modules() - return - //Give cyborgs hotkey clicks without breaking existing uses of hotkey clicks // for non-doors/apcs /mob/living/silicon/robot/CtrlShiftClickOn(var/atom/A) diff --git a/code/_onclick/hud/hud_elements/hud_robot.dm b/code/_onclick/hud/hud_elements/hud_robot.dm index a47c9c7866f..afbb72a7b04 100644 --- a/code/_onclick/hud/hud_elements/hud_robot.dm +++ b/code/_onclick/hud/hud_elements/hud_robot.dm @@ -1,4 +1,5 @@ /datum/hud/robot + offset_hands_vertically = FALSE gun_mode_toggle_type = /obj/screen/gun/mode omit_hud_elements = list( /decl/hud_element/health, diff --git a/code/_onclick/hud/hud_types/_hud.dm b/code/_onclick/hud/hud_types/_hud.dm index d0a95fe197f..d61948a5ac5 100644 --- a/code/_onclick/hud/hud_types/_hud.dm +++ b/code/_onclick/hud/hud_types/_hud.dm @@ -99,6 +99,7 @@ VAR_PRIVATE/obj/screen/gun/item/gun_item_use_toggle VAR_PRIVATE/obj/screen/gun/radio/gun_radio_use_toggle + var/offset_hands_vertically = TRUE /datum/hud/New(mob/owner) mymob = owner @@ -315,20 +316,28 @@ // Rebuild offsets for the hand elements. var/hand_y_offset = 21 var/list/elements = hud_elements_hands?.Copy() - while(length(elements)) - var/copy_index = min(length(elements), 2)+1 - var/list/sublist = elements.Copy(1, copy_index) - elements.Cut(1, copy_index) - var/obj/screen/inventory/inv_box - if(length(sublist) == 1) - inv_box = sublist[1] - inv_box.screen_loc = "CENTER,BOTTOM:[hand_y_offset]" + if(length(elements)) + if(offset_hands_vertically) + while(length(elements)) + var/copy_index = min(length(elements), 2)+1 + var/list/sublist = elements.Copy(1, copy_index) + elements.Cut(1, copy_index) + var/obj/screen/inventory/inv_box + if(length(sublist) == 1) + inv_box = sublist[1] + inv_box.screen_loc = "CENTER,BOTTOM:[hand_y_offset]" + else + inv_box = sublist[1] + inv_box.screen_loc = "CENTER:-[world.icon_size/2],BOTTOM:[hand_y_offset]" + inv_box = sublist[2] + inv_box.screen_loc = "CENTER:[world.icon_size/2],BOTTOM:[hand_y_offset]" + hand_y_offset += world.icon_size else - inv_box = sublist[1] - inv_box.screen_loc = "CENTER:-[world.icon_size/2],BOTTOM:[hand_y_offset]" - inv_box = sublist[2] - inv_box.screen_loc = "CENTER:[world.icon_size/2],BOTTOM:[hand_y_offset]" - hand_y_offset += world.icon_size + var/hand_x_offset = -((length(elements) * world.icon_size) / 2) + (world.icon_size/2) + for(var/obj/screen/inventory/inv_box in elements) + inv_box.screen_loc = "CENTER:[hand_x_offset],BOTTOM:[hand_y_offset]" + hand_x_offset += world.icon_size + hand_y_offset += world.icon_size if(mymob.client && islist(hud_elements_hands) && length(hud_elements_hands)) mymob.client.screen |= hud_elements_hands @@ -437,9 +446,11 @@ mymob?.client?.screen -= hud_elements_hotkeys if(!full) if(LAZYLEN(hud_elements_hands)) - mymob?.client?.screen += hud_elements_hands // we want the hands to be visible + // we want the hands to be visible + mymob?.client?.screen += hud_elements_hands if(LAZYLEN(hud_elements_swap)) - mymob?.client?.screen += hud_elements_swap // we want the hands swap thingy to be visible + // we want the hands swap thingy to be visible + mymob?.client?.screen += hud_elements_swap else hud_shown = TRUE if(LAZYLEN(hud_elements_auxilliary)) diff --git a/code/_onclick/hud/hud_types/robot.dm b/code/_onclick/hud/hud_types/robot.dm index 9dd085ffe9c..0572f762cc2 100644 --- a/code/_onclick/hud/hud_types/robot.dm +++ b/code/_onclick/hud/hud_types/robot.dm @@ -10,20 +10,6 @@ /datum/hud/robot/get_ui_alpha() return 255 -// TODO: Convert robots to use inventory slots. -/datum/hud/robot/finalize_instantiation() - var/mob/living/silicon/robot/R = mymob - if(!istype(R)) - return ..() - R.inv1 = new(null, mymob) - R.inv2 = new(null, mymob) - R.inv3 = new(null, mymob) - LAZYINITLIST(hud_elements_auxilliary) - hud_elements_auxilliary += R.inv1 - hud_elements_auxilliary += R.inv2 - hud_elements_auxilliary += R.inv3 - ..() - /datum/hud/proc/toggle_show_robot_modules() if(!isrobot(mymob)) return @@ -56,9 +42,6 @@ R.robot_modules_background.screen_loc = "CENTER-4:16,BOTTOM+1:7 to CENTER+3:16,BOTTOM+[display_rows]:7" R.client.screen += R.robot_modules_background - var/x = -4 //Start at CENTER-4,SOUTH+1 - var/y = 1 - //Unfortunately adding the emag module to the list of modules has to be here. This is because a borg can //be emagged before they actually select a module. - or some situation can cause them to get a new module // - or some situation might cause them to get de-emagged or something. @@ -69,26 +52,11 @@ if(R.module.emag in R.module.equipment) R.module.equipment.Remove(R.module.emag) - for(var/atom/movable/A in R.module.equipment) - if( (A != R.module_state_1) && (A != R.module_state_2) && (A != R.module_state_3) ) - //Module is not currently active - R.client.screen += A - if(x < 0) - A.screen_loc = "CENTER[x]:[WORLD_ICON_SIZE/2],BOTTOM+[y]:7" - else - A.screen_loc = "CENTER+[x]:[WORLD_ICON_SIZE/2],BOTTOM+[y]:7" - A.hud_layerise() - - x++ - if(x == 4) - x = -4 - y++ - else //Modules display is hidden + var/list/held_items = R.get_held_items() for(var/atom/A in R.module.equipment) - if( (A != R.module_state_1) && (A != R.module_state_2) && (A != R.module_state_3) ) - //Module is not currently active + if(!(A in held_items)) R.client.screen -= A R.shown_robot_modules = 0 R.client.screen -= R.robot_modules_background diff --git a/code/_onclick/hud/screen/robot/screen_robot_module.dm b/code/_onclick/hud/screen/robot/screen_robot_module.dm index 95e662167ec..e6bba3f9270 100644 --- a/code/_onclick/hud/screen/robot/screen_robot_module.dm +++ b/code/_onclick/hud/screen/robot/screen_robot_module.dm @@ -1,3 +1,9 @@ + +/obj/screen/robot/module + dir = SOUTHWEST + icon = 'icons/mob/screen/styles/robot/modules_inventory.dmi' + abstract_type = /obj/screen/robot/module + /obj/screen/robot/module/select name = "module" icon = 'icons/mob/screen/styles/robot/module.dmi' diff --git a/code/_onclick/hud/screen/robot/screen_robot_modules.dm b/code/_onclick/hud/screen/robot/screen_robot_modules.dm index 0e82b4fe44f..09029a035fd 100644 --- a/code/_onclick/hud/screen/robot/screen_robot_modules.dm +++ b/code/_onclick/hud/screen/robot/screen_robot_modules.dm @@ -2,33 +2,3 @@ name = "module" icon_state = "block" icon = 'icons/mob/screen/styles/robot/modules_background.dmi' - -/obj/screen/robot/module - dir = SOUTHWEST - icon = 'icons/mob/screen/styles/robot/modules_inventory.dmi' - var/module_index - -/obj/screen/robot/module/handle_click(mob/user, params) - if(isrobot(user) && !isnull(module_index)) - var/mob/living/silicon/robot/robot = user - robot.toggle_module(module_index) - return TRUE - return ..() - -/obj/screen/robot/module/one - name = "module1" - icon_state = "inv1" - screen_loc = ui_inv1 - module_index = 1 - -/obj/screen/robot/module/two - name = "module2" - icon_state = "inv2" - screen_loc = ui_inv2 - module_index = 2 - -/obj/screen/robot/module/three - name = "module3" - icon_state = "inv3" - screen_loc = ui_inv3 - module_index = 3 diff --git a/code/_onclick/hud/screen/robot/screen_robot_store.dm b/code/_onclick/hud/screen/robot/screen_robot_store.dm index 93f1a652b96..ed42de741a8 100644 --- a/code/_onclick/hud/screen/robot/screen_robot_store.dm +++ b/code/_onclick/hud/screen/robot/screen_robot_store.dm @@ -4,10 +4,10 @@ screen_loc = ui_borg_store /obj/screen/robot/store/handle_click(mob/user, params) - if(isrobot(user)) - var/mob/living/silicon/robot/R = user - if(R.module) - R.uneq_active() - R.hud_used.update_robot_modules_display() - else - to_chat(R, "You haven't selected a module yet.") + var/mob/living/silicon/robot/robot = user + if(istype(robot) && robot.module) + var/obj/item/active_item = robot.get_active_held_item() + if(active_item) + user.try_unequip(active_item) + else + to_chat(user, "You haven't selected a module yet.") diff --git a/code/datums/inventory_slots/inventory_gripper.dm b/code/datums/inventory_slots/inventory_gripper.dm index 08d90f5bd49..2f87394ca74 100644 --- a/code/datums/inventory_slots/inventory_gripper.dm +++ b/code/datums/inventory_slots/inventory_gripper.dm @@ -1,13 +1,12 @@ /datum/inventory_slot/gripper + // For reference, grippers do not use ui_loc, they have it set dynamically during /datum/hud/proc/rebuild_hands() + quick_equip_priority = null // you quick-equip stuff by holding it in a gripper, so this ought to be skipped + fluid_height = (FLUID_SHALLOW + FLUID_OVER_MOB_HEAD) / 2 // halfway between waist and top of head, so roughly chest level, reasoning that you can just hold it up out of the water var/hand_sort_priority = 1 var/dexterity = DEXTERITY_FULL var/covering_slot_flags /// If set, use this icon_state for the hand slot overlay; otherwise, use slot_id. var/hand_overlay - quick_equip_priority = null // you quick-equip stuff by holding it in a gripper, so this ought to be skipped - fluid_height = (FLUID_SHALLOW + FLUID_OVER_MOB_HEAD) / 2 // halfway between waist and top of head, so roughly chest level, reasoning that you can just hold it up out of the water - - // For reference, grippers do not use ui_loc, they have it set dynamically during /datum/hud/proc/rebuild_hands() /datum/inventory_slot/gripper/proc/get_dexterity(var/silent) return dexterity @@ -32,16 +31,3 @@ /datum/inventory_slot/gripper/can_equip_to_slot(var/mob/user, var/obj/item/prop, var/disable_warning) return ..() && user.check_dexterity(DEXTERITY_EQUIP_ITEM, silent = disable_warning) - -// Stub definitions for future work and to pass CI. -/datum/inventory_slot/gripper/robot - abstract_type = /datum/inventory_slot/gripper/robot - -/datum/inventory_slot/gripper/robot/one - ui_label = "1" - -/datum/inventory_slot/gripper/robot/two - ui_label = "2" - -/datum/inventory_slot/gripper/robot/three - ui_label = "3" diff --git a/code/datums/inventory_slots/inventory_gripper_robot.dm b/code/datums/inventory_slots/inventory_gripper_robot.dm new file mode 100644 index 00000000000..2e7e6efe87f --- /dev/null +++ b/code/datums/inventory_slots/inventory_gripper_robot.dm @@ -0,0 +1,18 @@ +// Stub definitions for future work and to pass CI. +/datum/inventory_slot/gripper/robot + abstract_type = /datum/inventory_slot/gripper/robot + +/datum/inventory_slot/gripper/robot/one + slot_name = "Module One" + slot_id = "slot_robot_one" + ui_label = "1" + +/datum/inventory_slot/gripper/robot/two + slot_name = "Module Two" + slot_id = "slot_robot_two" + ui_label = "2" + +/datum/inventory_slot/gripper/robot/three + slot_name = "Module Three" + slot_id = "slot_robot_three" + ui_label = "3" diff --git a/code/datums/mind/mind.dm b/code/datums/mind/mind.dm index 1db34888001..63869415753 100644 --- a/code/datums/mind/mind.dm +++ b/code/datums/mind/mind.dm @@ -396,37 +396,20 @@ if("unemag") var/mob/living/silicon/robot/R = current if (istype(R)) - R.emagged = 0 - if (R.activated(R.module.emag)) - R.module_active = null - if(R.module_state_1 == R.module.emag) - R.module_state_1 = null - R.module.emag.forceMove(null) - else if(R.module_state_2 == R.module.emag) - R.module_state_2 = null - R.module.emag.forceMove(null) - else if(R.module_state_3 == R.module.emag) - R.module_state_3 = null - R.module.emag.forceMove(null) + if(R.module?.emag) + R.drop_from_inventory(R.module.emag) + R.module.emag.forceMove(null) + R.emagged = FALSE log_admin("[key_name_admin(usr)] has unemag'ed [R].") if("unemagcyborgs") if (isAI(current)) var/mob/living/silicon/ai/ai = current for (var/mob/living/silicon/robot/R in ai.connected_robots) - R.emagged = 0 - if (R.module) - if (R.activated(R.module.emag)) - R.module_active = null - if(R.module_state_1 == R.module.emag) - R.module_state_1 = null - R.module.emag.forceMove(null) - else if(R.module_state_2 == R.module.emag) - R.module_state_2 = null - R.module.emag.forceMove(null) - else if(R.module_state_3 == R.module.emag) - R.module_state_3 = null - R.module.emag.forceMove(null) + R.emagged = FALSE + if(R.module?.emag) + R.drop_from_inventory(R.module.emag) + log_admin("[key_name_admin(usr)] has unemag'ed [ai]'s Cyborgs.") else if (href_list["common"]) diff --git a/code/datums/storage/_storage.dm b/code/datums/storage/_storage.dm index 07d0d087152..30639ef3279 100644 --- a/code/datums/storage/_storage.dm +++ b/code/datums/storage/_storage.dm @@ -124,7 +124,7 @@ var/global/list/_test_storage_items = list() /datum/storage/proc/can_be_inserted(obj/item/W, mob/user, stop_messages = 0, click_params = null) if(!istype(W)) return //Not an item - if(user && !user.canUnEquip(W)) + if(user && !user.can_unequip_item(W)) return 0 if(!holder || holder.loc == W) diff --git a/code/game/antagonist/antagonist_equip.dm b/code/game/antagonist/antagonist_equip.dm index 358f49da1a4..022bb8c57d0 100644 --- a/code/game/antagonist/antagonist_equip.dm +++ b/code/game/antagonist/antagonist_equip.dm @@ -12,7 +12,7 @@ // This could use work. if(flags & ANTAG_CLEAR_EQUIPMENT) for(var/obj/item/thing in player.contents) - if(player.canUnEquip(thing)) + if(player.can_unequip_item(thing)) qdel(thing) //mainly for nonhuman antag compatibility. Should not effect item spawning. player.species.equip_survival_gear(player) diff --git a/code/game/machinery/_machines_base/machine_construction/frame.dm b/code/game/machinery/_machines_base/machine_construction/frame.dm index 1913c959fbe..dab27fd5333 100644 --- a/code/game/machinery/_machines_base/machine_construction/frame.dm +++ b/code/game/machinery/_machines_base/machine_construction/frame.dm @@ -89,7 +89,7 @@ if(istype(I, /obj/item/stock_parts/circuitboard)) var/obj/item/stock_parts/circuitboard/circuit = I if(circuit.board_type == machine.expected_machine_type) - if(user.canUnEquip(I)) + if(user.can_unequip_item(I)) TRANSFER_STATE(/decl/machine_construction/frame/awaiting_parts) user.try_unequip(I, machine) playsound(machine.loc, 'sound/items/Deconstruct.ogg', 50, 1) diff --git a/code/game/machinery/_machines_base/machine_construction/wall_frame.dm b/code/game/machinery/_machines_base/machine_construction/wall_frame.dm index 9c01dcc5db7..656aa76a1ff 100644 --- a/code/game/machinery/_machines_base/machine_construction/wall_frame.dm +++ b/code/game/machinery/_machines_base/machine_construction/wall_frame.dm @@ -192,7 +192,7 @@ if(board.build_path != (machine.base_type || machine.type)) to_chat(user, SPAN_WARNING("This circuitboard does not fit inside \the [machine]!")) return TRUE - if(!user.canUnEquip(board)) + if(!user.can_unequip_item(board)) return TRUE machine.set_broken(TRUE, MACHINE_BROKEN_CONSTRUCT) TRANSFER_STATE(diconnected_state) diff --git a/code/game/machinery/_machines_base/machinery_components.dm b/code/game/machinery/_machines_base/machinery_components.dm index d775b0e8070..e3dff866d7b 100644 --- a/code/game/machinery/_machines_base/machinery_components.dm +++ b/code/game/machinery/_machines_base/machinery_components.dm @@ -301,7 +301,7 @@ Standard helpers for users interacting with machinery parts. return TRUE /obj/machinery/proc/part_insertion(mob/user, obj/item/stock_parts/part) // Second argument may actually be an arbitrary item. - if(!user.canUnEquip(part) && !isstack(part)) + if(!user.can_unequip_item(part) && !isstack(part)) return FALSE var/number = can_add_component(part, user) if(!number) diff --git a/code/game/objects/items/__item.dm b/code/game/objects/items/__item.dm index 83baef59cca..cf1b1b36f0c 100644 --- a/code/game/objects/items/__item.dm +++ b/code/game/objects/items/__item.dm @@ -587,7 +587,7 @@ if(!isrobot(user)) return var/mob/living/silicon/robot/R = user - R.activate_module(src) + R.put_in_hands(src) if(R.hud_used) R.hud_used.update_robot_modules_display() @@ -748,7 +748,7 @@ return inv_slot?.is_accessible(user, src, disable_warning) /obj/item/proc/can_be_dropped_by_client(mob/M) - return M.canUnEquip(src) + return M.can_unequip_item(src) /obj/item/verb/verb_pickup() set src in oview(1) diff --git a/code/modules/food/assembled.dm b/code/modules/food/assembled.dm index 9df85094417..3412ae7a80f 100644 --- a/code/modules/food/assembled.dm +++ b/code/modules/food/assembled.dm @@ -64,7 +64,7 @@ create_type = names[create_type] // TODO: move reagents/matter into produced food object. - if(ispath(create_type) && user.canUnEquip(src)) + if(ispath(create_type) && user.can_unequip_item(src)) var/obj/item/food/result if(ispath(create_type, /obj/item/food)) diff --git a/code/modules/integrated_electronics/core/assemblies.dm b/code/modules/integrated_electronics/core/assemblies.dm index e8637643e08..38c34bde655 100644 --- a/code/modules/integrated_electronics/core/assemblies.dm +++ b/code/modules/integrated_electronics/core/assemblies.dm @@ -408,7 +408,7 @@ /obj/item/electronic_assembly/attackby(obj/item/I, mob/user) if(istype(I, /obj/item/integrated_circuit)) - if(!user.canUnEquip(I)) + if(!user.can_unequip_item(I)) return FALSE if(try_add_component(I, user)) return TRUE diff --git a/code/modules/keybindings/_defines.dm b/code/modules/keybindings/_defines.dm index 469a4f57fc2..f80cbd168bd 100644 --- a/code/modules/keybindings/_defines.dm +++ b/code/modules/keybindings/_defines.dm @@ -3,7 +3,6 @@ #define CATEGORY_MOB "MOB" #define CATEGORY_LIVING "LIVING" #define CATEGORY_HUMAN "HUMAN" -#define CATEGORY_ROBOT "ROBOT" #define CATEGORY_MISC "MISC" #define CATEGORY_MOVEMENT "MOVEMENT" #define CATEGORY_COMMUNICATION "COMMUNICATION" diff --git a/code/modules/keybindings/robot.dm b/code/modules/keybindings/robot.dm deleted file mode 100644 index e01ab94ae71..00000000000 --- a/code/modules/keybindings/robot.dm +++ /dev/null @@ -1,71 +0,0 @@ -/datum/keybinding/robot - category = CATEGORY_ROBOT - -/datum/keybinding/robot/can_use(client/user) - return isrobot(user.mob) - -/datum/keybinding/robot/moduleone - hotkey_keys = list("1") - name = "module_one" - full_name = "Toggle Module 1" - description = "Equips or unequips the first module" - -/datum/keybinding/robot/moduleone/down(client/user) - var/mob/living/silicon/robot/R = user.mob - R.toggle_module(1) - return TRUE - -/datum/keybinding/robot/moduletwo - hotkey_keys = list("2") - name = "module_two" - full_name = "Toggle Module 2" - description = "Equips or unequips the second module" - -/datum/keybinding/robot/moduletwo/down(client/user) - var/mob/living/silicon/robot/R = user.mob - R.toggle_module(2) - return TRUE - -/datum/keybinding/robot/modulethree - hotkey_keys = list("3") - name = "module_three" - full_name = "Toggle Module 3" - description = "Equips or unequips the third module" - -/datum/keybinding/robot/modulethree/down(client/user) - var/mob/living/silicon/robot/R = user.mob - R.toggle_module(3) - return TRUE - -/datum/keybinding/robot/intent_cycle - hotkey_keys = list("4") - name = "cycle_intent" - full_name = "Cycle Intent Left" - description = "Cycles the intent left" - -/datum/keybinding/robot/intent_cycle/down(client/user) - user.mob.cycle_intent(INTENT_HOTKEY_LEFT) - return TRUE - -/datum/keybinding/robot/module_cycle - hotkey_keys = list("X") - name = "cycle_modules" - full_name = "Cycle Modules" - description = "Cycles your modules" - -/datum/keybinding/robot/module_cycle/down(client/user) - var/mob/living/silicon/robot/R = user.mob - R.cycle_modules() - return TRUE - -/datum/keybinding/robot/unequip_module - hotkey_keys = list("Q") - name = "unequip_module" - full_name = "Unequip Module" - description = "Unequips the active module" - -/datum/keybinding/robot/unequip_module/down(client/user) - var/mob/living/silicon/robot/R = user.mob - if(R.module) - R.uneq_active() - return TRUE diff --git a/code/modules/mechs/components/frame.dm b/code/modules/mechs/components/frame.dm index 16a24e639de..bd146077c5b 100644 --- a/code/modules/mechs/components/frame.dm +++ b/code/modules/mechs/components/frame.dm @@ -301,7 +301,7 @@ return 0 if(user) visible_message(SPAN_NOTICE("\The [user] begins installing \the [thing] into \the [src].")) - if(!user.canUnEquip(thing) || !user.do_skilled(3 SECONDS, SKILL_DEVICES, src) || user.get_active_held_item() != thing) + if(!user.can_unequip_item(thing) || !user.do_skilled(3 SECONDS, SKILL_DEVICES, src) || user.get_active_held_item() != thing) return if(!user.try_unequip(thing)) return diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index a1f9db81bd9..0013e1d3360 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -18,7 +18,7 @@ /mob/proc/equip_to_slot_if_possible(obj/item/W, slot, del_on_fail = 0, disable_warning = 0, redraw_mob = 1, force = FALSE, delete_old_item = TRUE, ignore_equipped = FALSE) if(!istype(W) || !slot) return FALSE - . = (canUnEquip(W) && can_equip_anything_to_slot(slot) && has_organ_for_slot(slot) && W.mob_can_equip(src, slot, disable_warning, force, ignore_equipped = ignore_equipped)) + . = (can_unequip_item(W) && can_equip_anything_to_slot(slot) && has_organ_for_slot(slot) && W.mob_can_equip(src, slot, disable_warning, force, ignore_equipped = ignore_equipped)) if(.) equip_to_slot(W, slot, redraw_mob, delete_old_item = delete_old_item) //This proc should not ever fail. else if(del_on_fail) @@ -263,12 +263,14 @@ return FALSE return !!get_equipped_slot_for_item(I) -/mob/proc/canUnEquip(obj/item/I) +/mob/proc/can_unequip_item(obj/item/I) if(!I) //If there's nothing to drop, the drop is automatically successful. return TRUE + if(I in get_organs()) + return FALSE var/slot = get_equipped_slot_for_item(I) if(!slot && !istype(I.loc, /obj/item/rig_module)) - return 1 //already unequipped, so success + return TRUE //already unequipped, so success return I.mob_can_unequip(src, slot) /// Gets the inventory slot string ID for the mob whose contents we're in, if any. @@ -343,7 +345,7 @@ //This differs from remove_from_mob() in that it checks if the item can be unequipped first. Use drop_from_inventory if you don't want to check. /mob/proc/try_unequip(obj/item/I, var/atom/target, var/play_dropsound = TRUE) - if(!canUnEquip(I)) + if(!can_unequip_item(I)) return FALSE drop_from_inventory(I, target, play_dropsound) return TRUE diff --git a/code/modules/mob/living/human/examine.dm b/code/modules/mob/living/human/examine.dm index 1c3dabe2914..7632b29149c 100644 --- a/code/modules/mob/living/human/examine.dm +++ b/code/modules/mob/living/human/examine.dm @@ -281,7 +281,7 @@ return glasses.hud /mob/living/silicon/robot/getHUDsource(hudtype) - for(var/obj/item/borg/sight/sight in list(module_state_1, module_state_2, module_state_3)) + for(var/obj/item/borg/sight/sight in get_held_items()) if(istype(sight) && (sight.glasses_hud_type & hudtype)) return sight diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index a2bb5d26fa2..d2ae2e8e40a 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -708,9 +708,6 @@ default behaviour is: return TRUE return FALSE -/mob/living/human/canUnEquip(obj/item/I) - . = ..() && !(I in get_organs()) - /mob/proc/can_be_possessed_by(var/mob/observer/ghost/possessor) return istype(possessor) && possessor.client diff --git a/code/modules/mob/living/silicon/robot/drone/drone_items.dm b/code/modules/mob/living/silicon/robot/drone/drone_items.dm index ff180bd1016..25809cf17a6 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_items.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_items.dm @@ -415,27 +415,31 @@ if(!module) module = new /obj/item/robot_module/drone(src) + var/list/module_strings = list() + var/list/held_slots = get_held_item_slots() + for(var/i = 1 to length(held_slots)) + var/atom/equipped = get_equipped_item(held_slots[1]) + module_strings += "Module [i]: [istype(equipped) ? "[equipped]" : "No Module"]" + var/dat = "Drone modules\n" dat += {" Activated Modules
- Module 1: [module_state_1 ? "
[module_state_1]" : "No Module"]
- Module 2: [module_state_2 ? "
[module_state_2]" : "No Module"]
- Module 3: [module_state_3 ? "
[module_state_3]" : "No Module"]
+ [jointext(module_strings, "
")]
Installed Modules

"} - var/tools = "Tools and devices
" var/resources = "
Resources
" + var/list/held_items = get_held_items() for (var/O in module.equipment) var/module_string = "" if (!O) module_string += text("Resource depleted
") - else if(activated(O)) + else if(O in held_items) module_string += text("[O]: Activated
") else module_string += text("[O]:
Activate
") @@ -450,7 +454,7 @@ if (emagged) if (!module.emag) dat += text("Resource depleted
") - else if(activated(module.emag)) + else if(module.emag in held_items) dat += text("[module.emag]: Activated
") else dat += text("[module.emag]: Activate
") diff --git a/code/modules/mob/living/silicon/robot/inventory.dm b/code/modules/mob/living/silicon/robot/inventory.dm index da4adc553fd..46b5dd80ad5 100644 --- a/code/modules/mob/living/silicon/robot/inventory.dm +++ b/code/modules/mob/living/silicon/robot/inventory.dm @@ -1,260 +1,4 @@ -//These procs handle putting s tuff in your hand. It's probably best to use these rather than setting stuff manually -//as they handle all relevant stuff like adding it to the player's screen and such - -//Returns the thing in our active hand (whatever is in our active module-slot, in this case) or any active grab -/mob/living/silicon/robot/get_active_held_item() - return module_active || (locate(/obj/item/grab) in contents) - -/*-------TODOOOOOOOOOO--------*/ - -//Verbs used by hotkeys. -/mob/living/silicon/robot/verb/cmd_unequip_module() - set name = "unequip-module" - set hidden = 1 - uneq_active() - -/mob/living/silicon/robot/verb/cmd_toggle_module(module as num) - set name = "toggle-module" - set hidden = 1 - toggle_module(module) - -/mob/living/silicon/robot/proc/uneq_active() - if(isnull(module_active)) - return - var/obj/item/borg/sight/borg_sight - if(module_state_1 == module_active) - if(istype(module_state_1,/obj/item/borg/sight)) - borg_sight = module_state_1 - sight_mode &= ~borg_sight.sight_mode - if (client) - client.screen -= module_state_1 - module_state_1.forceMove(module) - module_active = null - module_state_1 = null - inv1.icon_state = "inv1" - else if(module_state_2 == module_active) - if(istype(module_state_2,/obj/item/borg/sight)) - borg_sight = module_state_2 - sight_mode &= ~borg_sight.sight_mode - if (client) - client.screen -= module_state_2 - module_state_2.forceMove(module) - module_active = null - module_state_2 = null - inv2.icon_state = "inv2" - else if(module_state_3 == module_active) - if(istype(module_state_3,/obj/item/borg/sight)) - borg_sight = module_state_3 - sight_mode &= ~borg_sight.sight_mode - if (client) - client.screen -= module_state_3 - module_state_3.forceMove(module) - module_active = null - module_state_3 = null - inv3.icon_state = "inv3" - update_icon() - if(istype(hud_used)) - hud_used.update_robot_modules_display() - -/mob/living/silicon/robot/proc/uneq_all() - module_active = null - - if(module_state_1) - if(istype(module_state_1,/obj/item/borg/sight)) - sight_mode &= ~module_state_1:sight_mode - if (client) - client.screen -= module_state_1 - module_state_1.forceMove(module) - module_state_1 = null - inv1.icon_state = "inv1" - if(module_state_2) - if(istype(module_state_2,/obj/item/borg/sight)) - sight_mode &= ~module_state_2:sight_mode - if (client) - client.screen -= module_state_2 - module_state_2.forceMove(module) - module_state_2 = null - inv2.icon_state = "inv2" - if(module_state_3) - if(istype(module_state_3,/obj/item/borg/sight)) - sight_mode &= ~module_state_3:sight_mode - if (client) - client.screen -= module_state_3 - module_state_3.forceMove(module) - module_state_3 = null - inv3.icon_state = "inv3" - update_icon() - if(istype(hud_used)) - hud_used.update_robot_modules_display() - -/mob/living/silicon/robot/proc/activated(obj/item/O) - if(module_state_1 == O) - return 1 - else if(module_state_2 == O) - return 1 - else if(module_state_3 == O) - return 1 - else - return 0 - -//Helper procs for cyborg modules on the UI. -//These are hackish but they help clean up code elsewhere. - -//module_selected(module) - Checks whether the module slot specified by "module" is currently selected. -/mob/living/silicon/robot/proc/module_selected(var/module) //Module is 1-3 - return module == get_selected_module() - -//module_active(module) - Checks whether there is a module active in the slot specified by "module". -/mob/living/silicon/robot/proc/module_active(var/module) //Module is 1-3 - if(module < 1 || module > 3) return 0 - - switch(module) - if(1) - if(module_state_1) - return 1 - if(2) - if(module_state_2) - return 1 - if(3) - if(module_state_3) - return 1 - return 0 - -//get_selected_module() - Returns the slot number of the currently selected module. Returns 0 if no modules are selected. -/mob/living/silicon/robot/proc/get_selected_module() - if(module_state_1 && module_active == module_state_1) - return 1 - else if(module_state_2 && module_active == module_state_2) - return 2 - else if(module_state_3 && module_active == module_state_3) - return 3 - - return 0 - -//select_module(module) - Selects the module slot specified by "module" -/mob/living/silicon/robot/proc/select_module(var/module) //Module is 1-3 - if(module < 1 || module > 3) return - - if(!module_active(module)) return - - switch(module) - if(1) - if(module_active != module_state_1) - inv1.icon_state = "inv1 +a" - inv2.icon_state = "inv2" - inv3.icon_state = "inv3" - module_active = module_state_1 - return - if(2) - if(module_active != module_state_2) - inv1.icon_state = "inv1" - inv2.icon_state = "inv2 +a" - inv3.icon_state = "inv3" - module_active = module_state_2 - return - if(3) - if(module_active != module_state_3) - inv1.icon_state = "inv1" - inv2.icon_state = "inv2" - inv3.icon_state = "inv3 +a" - module_active = module_state_3 - return - return - -//deselect_module(module) - Deselects the module slot specified by "module" -/mob/living/silicon/robot/proc/deselect_module(var/module) //Module is 1-3 - if(module < 1 || module > 3) return - - switch(module) - if(1) - if(module_active == module_state_1) - inv1.icon_state = "inv1" - module_active = null - return - if(2) - if(module_active == module_state_2) - inv2.icon_state = "inv2" - module_active = null - return - if(3) - if(module_active == module_state_3) - inv3.icon_state = "inv3" - module_active = null - return - return - -//toggle_module(module) - Toggles the selection of the module slot specified by "module". -/mob/living/silicon/robot/proc/toggle_module(var/module) //Module is 1-3 - if(module < 1 || module > 3) return - - if(module_selected(module)) - deselect_module(module) - else - if(module_active(module)) - select_module(module) - else - deselect_module(get_selected_module()) //If we can't do select anything, at least deselect the current module. - return - -//cycle_modules() - Cycles through the list of selected modules. -/mob/living/silicon/robot/proc/cycle_modules() - var/slot_start = get_selected_module() - if(slot_start) deselect_module(slot_start) //Only deselect if we have a selected slot. - - var/slot_num - if(slot_start == 0) - slot_num = 1 - slot_start = 2 - else - slot_num = slot_start + 1 - - while(slot_start != slot_num) //If we wrap around without finding any free slots, just give up. - if(module_active(slot_num)) - select_module(slot_num) - return - slot_num++ - if(slot_num > 3) slot_num = 1 //Wrap around. - - return - -/mob/living/silicon/robot/proc/activate_module(var/obj/item/O) - if(!(locate(O) in module.equipment) && O != src.module.emag) - return - if(activated(O)) - to_chat(src, SPAN_NOTICE("\The [O] is already active.")) - return - if(!module_state_1) - module_state_1 = O - O.hud_layerise() - O.screen_loc = inv1.screen_loc - O.forceMove(src) - if(istype(module_state_1,/obj/item/borg/sight)) - sight_mode |= module_state_1:sight_mode - else if(!module_state_2) - module_state_2 = O - O.hud_layerise() - O.screen_loc = inv2.screen_loc - O.forceMove(src) - if(istype(module_state_2,/obj/item/borg/sight)) - sight_mode |= module_state_2:sight_mode - else if(!module_state_3) - module_state_3 = O - O.hud_layerise() - O.screen_loc = inv3.screen_loc - O.forceMove(src) - if(istype(module_state_3,/obj/item/borg/sight)) - sight_mode |= module_state_3:sight_mode - else - to_chat(src, SPAN_NOTICE("You need to disable a module first!")) - -/mob/living/silicon/robot/put_in_hands(var/obj/item/W) // No hands. - W.forceMove(get_turf(src)) - return 1 - -//Robots don't use inventory slots, so we need to override this. -/mob/living/silicon/robot/canUnEquip(obj/item/I) - if(!I) - return 1 - if((I in module) || (I in src)) //Includes all modules and installed components. - return I.canremove //Will be 0 for modules, but items held by grippers will also be checked here. - return 1 \ No newline at end of file +/mob/living/silicon/robot/can_unequip_item(obj/item/I) + if(istype(I) && !(I in module) && !(I in src)) + return FALSE + return ..() diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index ea41b012d30..7171f1eefe6 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -15,12 +15,10 @@ C.update_power_state() if ( cell && is_component_functioning("power cell") && src.cell.charge > 0 ) - if(src.module_state_1) - cell_use_power(50) // 50W load for every enabled tool TODO: tool-specific loads - if(src.module_state_2) - cell_use_power(50) - if(src.module_state_3) - cell_use_power(50) + // 50W load for every enabled tool TODO: tool-specific loads + var/use_power = 50 * length(get_held_items()) + if(use_power) + cell_use_power(use_power) if(lights_on) if(intenselight) @@ -72,7 +70,7 @@ //update the state of modules and components here if (stat != CONSCIOUS) - uneq_all() + drop_held_items() if(silicon_radio) if(!is_component_functioning("radio")) @@ -91,7 +89,7 @@ if(!.) return var/obj/item/borg/sight/hud/hud = (locate(/obj/item/borg/sight/hud) in src) - if(hud && hud.hud) + if(hud?.hud) hud.hud.process_hud(src) else switch(src.sensor_mode) @@ -109,9 +107,6 @@ set_fullscreen(GET_STATUS(src, STAT_BLURRY), "blurry", /obj/screen/fullscreen/blurry) set_fullscreen(GET_STATUS(src, STAT_DRUGGY), "high", /obj/screen/fullscreen/high) - update_items() - return 1 - /mob/living/silicon/robot/handle_vision() ..() @@ -140,21 +135,6 @@ set_see_invisible(SEE_INVISIBLE_LIVING) // This is normal vision (25), setting it lower for normal vision means you don't "see" things like darkness since darkness // has a "invisible" value of 15 - -/mob/living/silicon/robot/proc/update_items() - if (src.client) - src.client.screen -= src.contents - for(var/obj/I in src.contents) - if(I && !(istype(I,/obj/item/cell) || istype(I,/obj/item/radio) || istype(I,/obj/machinery/camera) || istype(I,/obj/item/organ/internal/brain_interface))) - src.client.screen += I - if(src.module_state_1) - src.module_state_1:screen_loc = ui_inv1 - if(src.module_state_2) - src.module_state_2:screen_loc = ui_inv2 - if(src.module_state_3) - src.module_state_3:screen_loc = ui_inv3 - update_icon() - /mob/living/silicon/robot/proc/process_killswitch() if(killswitch) killswitch_time -- @@ -163,10 +143,9 @@ killswitch = 0 spawn(5) gib() - /mob/living/silicon/robot/proc/process_locks() if(weapon_lock) - uneq_all() + drop_held_items() weaponlock_time -- if(weaponlock_time <= 0) to_chat(src, SPAN_DANGER("Weapon lock timed out!")) diff --git a/code/modules/mob/living/silicon/robot/modules/_module.dm b/code/modules/mob/living/silicon/robot/modules/_module.dm index 7bd571e00d4..9af5eeb0924 100644 --- a/code/modules/mob/living/silicon/robot/modules/_module.dm +++ b/code/modules/mob/living/silicon/robot/modules/_module.dm @@ -1,9 +1,25 @@ +/datum/storage/robot_module + storage_slots = 24 + // No real limits since mobs generally won't be able to freely interact with this storage. + max_w_class = ITEM_SIZE_GARGANTUAN + +/datum/storage/robot_module/can_be_inserted(obj/item/W, mob/user, stop_messages, click_params) + var/mob/living/silicon/robot/robot = user + return istype(robot) && (W in robot.module?.equipment) + +/obj/item/robot_module/get_stored_inventory() + . = ..() + var/mob/living/silicon/robot/robot = loc + if(LAZYLEN(.) && emag && (!istype(robot) || !robot.emagged)) + LAZYREMOVE(., emag) + /obj/item/robot_module name = "robot module" icon = 'icons/obj/modules/module_standard.dmi' icon_state = ICON_STATE_WORLD obj_flags = OBJ_FLAG_CONDUCTIBLE | OBJ_FLAG_NO_STORAGE is_spawnable_type = FALSE + storage = /datum/storage/robot_module var/associated_department var/hide_on_manifest = 0 @@ -13,7 +29,7 @@ /decl/language/human/common = TRUE, /decl/language/legal = TRUE, /decl/language/sign = FALSE - ) + ) var/list/module_sprites = list() var/can_be_pushed = 1 // Equivalent to shoes with ITEM_FLAG_NOSLIP diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 2a481872bb6..80986e0aa18 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -34,20 +34,11 @@ var/dismantle_type = /obj/item/robot_parts/robot_suit /// If icon selection has been completed yet var/icon_selected = TRUE - /// Hud stuff - var/obj/screen/robot/module/one/inv1 - var/obj/screen/robot/module/two/inv2 - var/obj/screen/robot/module/three/inv3 /// Used to determine whether they have the module menu shown or not var/shown_robot_modules = 0 var/obj/screen/robot/modules_background/robot_modules_background - /// 3 Modules can be activated at any one time. var/obj/item/robot_module/module = null - var/obj/item/module_active - var/obj/item/module_state_1 - var/obj/item/module_state_2 - var/obj/item/module_state_3 var/mob/living/silicon/ai/connected_ai = null var/obj/item/cell/cell = /obj/item/cell/high var/cell_emp_mult = 2.5 @@ -89,6 +80,10 @@ /mob/living/silicon/robot/Initialize() + add_held_item_slot(new /datum/inventory_slot/gripper/robot/one) + add_held_item_slot(new /datum/inventory_slot/gripper/robot/two) + add_held_item_slot(new /datum/inventory_slot/gripper/robot/three) + reset_hud_overlays() . = ..() @@ -195,7 +190,7 @@ /mob/living/silicon/robot/proc/reset_module(var/suppress_alert = null) // Clear hands and module icon. - uneq_all() + drop_held_items() if(shown_robot_modules) hud_used.toggle_show_robot_modules() modtype = initial(modtype) @@ -688,7 +683,7 @@ else add_overlay(image(panel_icon, "ov-openpanel -c")) - if(module_active && istype(module_active, /obj/item/borg/combat/shield)) + if(istype(get_active_held_item(), /obj/item/borg/combat/shield)) add_overlay("[icon_state]-shield") /mob/living/silicon/robot/proc/installed_modules() @@ -699,26 +694,31 @@ if(!module) pick_module() return + + var/list/module_strings = list() + var/list/held_slots = get_held_item_slots() + for(var/i = 1 to length(held_slots)) + var/atom/equipped = get_equipped_item(held_slots[1]) + module_strings += "Module [i]: [istype(equipped) ? "[equipped]" : "No Module"]" + var/dat = "Modules\n" dat += {" Activated Modules
- Module 1: [module_state_1 ? "
[module_state_1]" : "No Module"]
- Module 2: [module_state_2 ? "
[module_state_2]" : "No Module"]
- Module 3: [module_state_3 ? "
[module_state_3]" : "No Module"]
+ [jointext(module_strings, "
")]
Installed Modules

"} - + var/list/held_items = get_held_items() for (var/obj in module.equipment) if (!obj) dat += text("Resource depleted
") - else if(activated(obj)) + else if(obj in held_items) dat += text("[obj]: Activated
") else dat += text("[obj]:
Activate
") if (emagged && module.emag) - if(activated(module.emag)) + if(module.emag in held_items) dat += text("[module.emag]: Activated
") else dat += text("[module.emag]: Activate
") @@ -742,61 +742,6 @@ O.attack_self(src) return TOPIC_HANDLED - if (href_list["act"]) - var/obj/item/O = locate(href_list["act"]) - if (!istype(O)) - return TOPIC_HANDLED - - if(!((O in module.equipment) || (O == src.module.emag))) - return TOPIC_HANDLED - - if(activated(O)) - to_chat(src, "Already activated.") - return TOPIC_HANDLED - if(!module_state_1) - module_state_1 = O - O.hud_layerise() - O.forceMove(src) - O.equipped_robot() - if(istype(module_state_1,/obj/item/borg/sight)) - sight_mode |= module_state_1:sight_mode - else if(!module_state_2) - module_state_2 = O - O.hud_layerise() - O.forceMove(src) - O.equipped_robot() - if(istype(module_state_2,/obj/item/borg/sight)) - sight_mode |= module_state_2:sight_mode - else if(!module_state_3) - module_state_3 = O - O.hud_layerise() - O.forceMove(src) - O.equipped_robot() - if(istype(module_state_3,/obj/item/borg/sight)) - sight_mode |= module_state_3:sight_mode - else - to_chat(src, "You need to disable a module first!") - installed_modules() - return TOPIC_HANDLED - - if (href_list["deact"]) - var/obj/item/O = locate(href_list["deact"]) - if(activated(O)) - if(module_state_1 == O) - module_state_1 = null - O.forceMove(null) - else if(module_state_2 == O) - module_state_2 = null - O.forceMove(null) - else if(module_state_3 == O) - module_state_3 = null - O.forceMove(null) - else - to_chat(src, "Module isn't activated.") - else - to_chat(src, "Module isn't activated.") - installed_modules() - return TOPIC_HANDLED return ..() /mob/living/silicon/robot/proc/radio_menu() @@ -805,7 +750,7 @@ /mob/living/silicon/robot/Move(a, b, flag) . = ..() if(. && module && isturf(loc)) - var/obj/item/ore/orebag = locate() in list(module_state_1, module_state_2, module_state_3) + var/obj/item/ore/orebag = locate() in get_held_items() if(orebag) loc.attackby(orebag, src) module.handle_turf(loc, src) diff --git a/code/modules/mob/living/silicon/robot/robot_damage.dm b/code/modules/mob/living/silicon/robot/robot_damage.dm index 6723fd88775..7e43ee35c77 100644 --- a/code/modules/mob/living/silicon/robot/robot_damage.dm +++ b/code/modules/mob/living/silicon/robot/robot_damage.dm @@ -61,8 +61,8 @@ return //Combat shielding absorbs a percentage of damage directly into the cell. - if(module_active && istype(module_active,/obj/item/borg/combat/shield)) - var/obj/item/borg/combat/shield/shield = module_active + var/obj/item/borg/combat/shield/shield = get_active_held_item() + if(istype(shield)) //Shields absorb a certain percentage of damage based on their power setting. var/absorb_brute = brute*shield.shield_level var/absorb_burn = burn*shield.shield_level @@ -107,8 +107,8 @@ var/list/datum/robot_component/parts = get_damageable_components() //Combat shielding absorbs a percentage of damage directly into the cell. - if(module_active && istype(module_active,/obj/item/borg/combat/shield)) - var/obj/item/borg/combat/shield/shield = module_active + var/obj/item/borg/combat/shield/shield = get_active_held_item() + if(istype(shield)) //Shields absorb a certain percentage of damage based on their power setting. var/absorb_brute = brute*shield.shield_level var/absorb_burn = burn*shield.shield_level @@ -138,5 +138,5 @@ update_health() /mob/living/silicon/robot/emp_act(severity) - uneq_all() + drop_held_items() ..() //Damage is handled at /silicon/ level. diff --git a/code/modules/mob/living/silicon/robot/robot_movement.dm b/code/modules/mob/living/silicon/robot/robot_movement.dm index 55cfd875336..e38f7b95deb 100644 --- a/code/modules/mob/living/silicon/robot/robot_movement.dm +++ b/code/modules/mob/living/silicon/robot/robot_movement.dm @@ -13,7 +13,8 @@ tally += speed - if(module_active && istype(module_active,/obj/item/borg/combat/mobility)) + // Gross, todo slowdown for robots + if(istype(get_active_held_item(), /obj/item/borg/combat/mobility)) tally-=3 return tally+get_config_value(/decl/config/num/movement_robot) diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/giant_parrot/giant_parrot.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/giant_parrot/giant_parrot.dm index 2ae451ec636..7f328aa9c33 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/giant_parrot/giant_parrot.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/giant_parrot/giant_parrot.dm @@ -52,7 +52,7 @@ else if(H.get_equipped_item(slot_head_str)) var/obj/item/clothing/head/HAT = H.get_equipped_item(slot_head_str) - if(H.canUnEquip(HAT)) + if(H.can_unequip_item(HAT)) visible_message(SPAN_MFAUNA("\The [src] rips \the [H]'s [HAT] off!")) set_special_ability_cooldown(ability_cooldown) H.try_unequip(HAT, get_turf(src)) diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 99f0b0fe161..dac76423f54 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -64,16 +64,11 @@ if(ismob(mob)) var/mob/M = mob M.swap_hand() - if(isrobot(mob)) - var/mob/living/silicon/robot/R = mob - R.cycle_modules() - return /client/verb/attack_self() set hidden = 1 if(mob) mob.mode() - return /client/verb/toggle_throw_mode_verb() set hidden = TRUE diff --git a/code/modules/nano/interaction/hands.dm b/code/modules/nano/interaction/hands.dm index 3122925e2cc..819adeb820c 100644 --- a/code/modules/nano/interaction/hands.dm +++ b/code/modules/nano/interaction/hands.dm @@ -18,7 +18,7 @@ var/global/datum/topic_state/hands/hands_topic_state = new return STATUS_CLOSE /mob/living/silicon/robot/hands_can_use_topic(src_object) - for(var/obj/item/gripper/active_gripper in list(module_state_1, module_state_2, module_state_3)) + for(var/obj/item/gripper/active_gripper in get_held_items()) if(active_gripper.contains(src_object)) return STATUS_INTERACTIVE return STATUS_CLOSE diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index c0dd0d85862..33fbf2512f3 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -427,10 +427,10 @@ var/obj/item/paper_bundle/B = new(loc) if(user) - if(!user.canUnEquip(src)) + if(!user.can_unequip_item(src)) to_chat(user, SPAN_WARNING("You can't unequip \the [src]!")) return - if(!user.canUnEquip(other)) + if(!user.can_unequip_item(other)) to_chat(user, SPAN_WARNING("You can't unequip \the [other]!")) return user.try_unequip(src, B) diff --git a/code/modules/recycling/package_wrapper.dm b/code/modules/recycling/package_wrapper.dm index 631ebef3e86..ba8b75246be 100644 --- a/code/modules/recycling/package_wrapper.dm +++ b/code/modules/recycling/package_wrapper.dm @@ -108,7 +108,7 @@ to_chat(user, SPAN_WARNING("\The [target] moving around too much. Restrain or incapacitate them first.")) /obj/item/stack/package_wrap/afterattack(var/obj/target, mob/user, proximity_flag, click_parameters) - if(!proximity_flag || !can_wrap(target) || (user.isEquipped(target) && !user.canUnEquip(target))) + if(!proximity_flag || !can_wrap(target) || (user.isEquipped(target) && !user.can_unequip_item(target))) return user.setClickCooldown(attack_cooldown) return wrap(target, user) || ..() diff --git a/code/modules/xenoarcheaology/boulder.dm b/code/modules/xenoarcheaology/boulder.dm index ba7a38c2f3d..bc65b55c6a7 100644 --- a/code/modules/xenoarcheaology/boulder.dm +++ b/code/modules/xenoarcheaology/boulder.dm @@ -88,13 +88,14 @@ /obj/structure/boulder/Bumped(AM) . = ..() - if(ishuman(AM)) - var/mob/living/human/H = AM - for(var/obj/item/P in H.get_inactive_held_items()) - if(IS_PICK(P)) - attackby(P, H) + if(isliving(AM)) + var/mob/living/user = AM + for(var/obj/item/equipped_item in user.get_inactive_held_items()) + if(IS_PICK(equipped_item)) + attackby(equipped_item, user) return else if(isrobot(AM)) - var/mob/living/silicon/robot/R = AM - if(IS_PICK(R.module_active)) - attackby(R.module_active,R) + var/mob/living/silicon/robot/robot = AM + var/obj/item/equipped_item = robot.get_active_held_item() + if(istype(equipped_item) && IS_PICK(equipped_item)) + attackby(equipped_item, robot) diff --git a/nebula.dme b/nebula.dme index 9c2daf6c635..96261b6e6e6 100644 --- a/nebula.dme +++ b/nebula.dme @@ -497,6 +497,7 @@ #include "code\datums\hostility\hostility.dm" #include "code\datums\inventory_slots\_inventory_slot.dm" #include "code\datums\inventory_slots\inventory_gripper.dm" +#include "code\datums\inventory_slots\inventory_gripper_robot.dm" #include "code\datums\inventory_slots\inventory_gripper_subtypes.dm" #include "code\datums\inventory_slots\slots\slot_back.dm" #include "code\datums\inventory_slots\slots\slot_belt.dm" @@ -2679,7 +2680,6 @@ #include "code\modules\keybindings\living.dm" #include "code\modules\keybindings\mob.dm" #include "code\modules\keybindings\movement.dm" -#include "code\modules\keybindings\robot.dm" #include "code\modules\keybindings\setup.dm" #include "code\modules\lighting\_lighting_defs.dm" #include "code\modules\lighting\lighting_area.dm"