diff --git a/code/__DEFINES/clothing.dm b/code/__DEFINES/clothing.dm index f5efa04ea62..6fbb8e5d7d1 100644 --- a/code/__DEFINES/clothing.dm +++ b/code/__DEFINES/clothing.dm @@ -17,25 +17,25 @@ #define slot_back 1 #define slot_wear_mask 2 #define slot_handcuffed 3 -#define slot_l_hand 4 -#define slot_r_hand 5 -#define slot_belt 6 -#define slot_wear_id 7 -#define slot_ears 8 -#define slot_glasses 9 -#define slot_gloves 10 -#define slot_head 11 -#define slot_shoes 12 -#define slot_wear_suit 13 -#define slot_w_uniform 14 -#define slot_l_store 15 -#define slot_r_store 16 -#define slot_s_store 17 -#define slot_in_backpack 18 -#define slot_legcuffed 19 -#define slot_generic_dextrous_storage 20 +#define slot_hands 4 //wherever you provide a slot for hands you provide slot_hands AND a hand index (1 to held_items.len) + //there are various helper procs to find an appropriate index +#define slot_belt 5 +#define slot_wear_id 6 +#define slot_ears 7 +#define slot_glasses 8 +#define slot_gloves 9 +#define slot_head 10 +#define slot_shoes 11 +#define slot_wear_suit 12 +#define slot_w_uniform 13 +#define slot_l_store 14 +#define slot_r_store 15 +#define slot_s_store 16 +#define slot_in_backpack 17 +#define slot_legcuffed 18 +#define slot_generic_dextrous_storage 19 -#define slots_amt 20 // Keep this up to date! +#define slots_amt 19 // Keep this up to date! //I hate that this has to exist /proc/slotdefine2slotbit(slotdefine) //Keep this up to date with the value of SLOT BITMASKS and SLOTS (the two define sections above) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index f7fb200c757..c859696ccb4 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -30,33 +30,32 @@ #define FRIDAY_13TH "Friday the 13th" //Human Overlays Indexes///////// -#define MUTATIONS_LAYER 26 //mutations. Tk headglows, cold resistance glow, etc -#define BODY_BEHIND_LAYER 25 //certain mutantrace features (tail when looking south) that must appear behind the body parts -#define BODYPARTS_LAYER 24 //Initially "AUGMENTS", this was repurposed to be a catch-all bodyparts flag -#define BODY_ADJ_LAYER 23 //certain mutantrace features (snout, body markings) that must appear above the body parts -#define BODY_LAYER 22 //underwear, undershirts, socks, eyes, lips(makeup) -#define FRONT_MUTATIONS_LAYER 21 //mutations that should appear above body, body_adj and bodyparts layer (e.g. laser eyes) -#define DAMAGE_LAYER 20 //damage indicators (cuts and burns) -#define UNIFORM_LAYER 19 -#define ID_LAYER 18 -#define SHOES_LAYER 17 -#define GLOVES_LAYER 16 -#define EARS_LAYER 15 -#define SUIT_LAYER 14 -#define GLASSES_LAYER 13 -#define BELT_LAYER 12 //Possible make this an overlay of somethign required to wear a belt? -#define SUIT_STORE_LAYER 11 -#define BACK_LAYER 10 -#define HAIR_LAYER 9 //TODO: make part of head layer? -#define FACEMASK_LAYER 8 -#define HEAD_LAYER 7 -#define HANDCUFF_LAYER 6 -#define LEGCUFF_LAYER 5 -#define L_HAND_LAYER 4 -#define R_HAND_LAYER 3 //Having the two hands seperate seems rather silly, merge them together? It'll allow for code to be reused on mobs with arbitarily many hands +#define MUTATIONS_LAYER 25 //mutations. Tk headglows, cold resistance glow, etc +#define BODY_BEHIND_LAYER 24 //certain mutantrace features (tail when looking south) that must appear behind the body parts +#define BODYPARTS_LAYER 23 //Initially "AUGMENTS", this was repurposed to be a catch-all bodyparts flag +#define BODY_ADJ_LAYER 22 //certain mutantrace features (snout, body markings) that must appear above the body parts +#define BODY_LAYER 21 //underwear, undershirts, socks, eyes, lips(makeup) +#define FRONT_MUTATIONS_LAYER 20 //mutations that should appear above body, body_adj and bodyparts layer (e.g. laser eyes) +#define DAMAGE_LAYER 19 //damage indicators (cuts and burns) +#define UNIFORM_LAYER 18 +#define ID_LAYER 17 +#define SHOES_LAYER 16 +#define GLOVES_LAYER 15 +#define EARS_LAYER 14 +#define SUIT_LAYER 13 +#define GLASSES_LAYER 12 +#define BELT_LAYER 11 //Possible make this an overlay of somethign required to wear a belt? +#define SUIT_STORE_LAYER 10 +#define BACK_LAYER 9 +#define HAIR_LAYER 8 //TODO: make part of head layer? +#define FACEMASK_LAYER 7 +#define HEAD_LAYER 6 +#define HANDCUFF_LAYER 5 +#define LEGCUFF_LAYER 4 +#define HANDS_LAYER 3 #define BODY_FRONT_LAYER 2 #define FIRE_LAYER 1 //If you're on fire -#define TOTAL_LAYERS 26 //KEEP THIS UP-TO-DATE OR SHIT WILL BREAK ;_; +#define TOTAL_LAYERS 25 //KEEP THIS UP-TO-DATE OR SHIT WILL BREAK ;_; //Human Overlay Index Shortcuts for alternate_worn_layer, layers //Because I *KNOW* somebody will think layer+1 means "above" @@ -82,8 +81,7 @@ #define UNDER_HEAD_LAYER HEAD_LAYER+1 #define UNDER_HANDCUFF_LAYER HANDCUFF_LAYER+1 #define UNDER_LEGCUFF_LAYER LEGCUFF_LAYER+1 -#define UNDER_L_HAND_LAYER L_HAND_LAYER+1 -#define UNDER_R_HAND_LAYER R_HAND_LAYER+1 +#define UNDER_HANDS_LAYER HANDS_LAYER+1 #define UNDER_BODY_FRONT_LAYER BODY_FRONT_LAYER+1 #define UNDER_FIRE_LAYER FIRE_LAYER+1 @@ -109,8 +107,7 @@ #define ABOVE_HEAD_LAYER HEAD_LAYER-1 #define ABOVE_HANDCUFF_LAYER HANDCUFF_LAYER-1 #define ABOVE_LEGCUFF_LAYER LEGCUFF_LAYER-1 -#define ABOVE_L_HAND_LAYER L_HAND_LAYER-1 -#define ABOVE_R_HAND_LAYER R_HAND_LAYER-1 +#define ABOVE_HANDS_LAYER HANDS_LAYER-1 #define ABOVE_BODY_FRONT_LAYER BODY_FRONT_LAYER-1 #define ABOVE_FIRE_LAYER FIRE_LAYER-1 diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 8de02bd774c..0fcbb30ef6e 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -191,7 +191,7 @@ Proc for attack log creation, because really why not var/target_loc = target.loc - var/holding = user.get_active_hand() + var/holding = user.get_active_held_item() var/datum/progressbar/progbar if (progress) progbar = new(user, time, target) @@ -213,7 +213,7 @@ Proc for attack log creation, because really why not drifting = 0 user_loc = user.loc - if((!drifting && user.loc != user_loc) || target.loc != target_loc || user.get_active_hand() != holding || user.incapacitated() || user.lying ) + if((!drifting && user.loc != user_loc) || target.loc != target_loc || user.get_active_held_item() != holding || user.incapacitated() || user.lying ) . = 0 break if (progress) @@ -233,7 +233,7 @@ Proc for attack log creation, because really why not if(!user.Process_Spacemove(0) && user.inertia_dir) drifting = 1 - var/holding = user.get_active_hand() + var/holding = user.get_active_held_item() var/holdingnull = 1 //User's hand started out empty, check for an empty hand if(holding) @@ -270,7 +270,7 @@ Proc for attack log creation, because really why not if(!holding) . = 0 break - if(user.get_active_hand() != holding) + if(user.get_active_held_item() != holding) . = 0 break if (progress) @@ -291,7 +291,7 @@ Proc for attack log creation, because really why not for(var/atom/target in targets) originalloc[target] = target.loc - var/holding = user.get_active_hand() + var/holding = user.get_active_held_item() var/datum/progressbar/progbar if(progress) progbar = new(user, time, targets[1]) @@ -315,7 +315,7 @@ Proc for attack log creation, because really why not user_loc = user.loc for(var/atom/target in targets) - if((!drifting && user_loc != user.loc) || originalloc[target] != target.loc || user.get_active_hand() != holding || user.incapacitated() || user.lying ) + if((!drifting && user_loc != user.loc) || originalloc[target] != target.loc || user.get_active_held_item() != holding || user.incapacitated() || user.lying ) . = 0 break mainloop if(progbar) diff --git a/code/_onclick/autoclick.dm b/code/_onclick/autoclick.dm index 3fe84195b6c..1ceeb182ed7 100644 --- a/code/_onclick/autoclick.dm +++ b/code/_onclick/autoclick.dm @@ -23,7 +23,7 @@ /mob/living/carbon/CanMobAutoclick(atom/object, location, params) if(!object.IsAutoclickable()) return - var/obj/item/h = get_active_hand() + var/obj/item/h = get_active_held_item() if(h) . = h.CanItemAutoclick(object, location, params) diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index b029eb69863..dc21aa4185a 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -98,16 +98,12 @@ throw_item(A) return - var/obj/item/W = get_active_hand() + var/obj/item/W = get_active_held_item() if(W == A) W.attack_self(src) - if(hand) - update_inv_l_hand(0) - else - update_inv_r_hand(0) - return + update_inv_hands() // operate three levels deep here (item in backpack in src; item in box in backpack in src, not any deeper) if(A.ClickAccessible(src, depth=INVENTORY_DEPTH)) diff --git a/code/_onclick/cyborg.dm b/code/_onclick/cyborg.dm index a3d084afe17..b0c110cddc5 100644 --- a/code/_onclick/cyborg.dm +++ b/code/_onclick/cyborg.dm @@ -51,7 +51,7 @@ aicamera.captureimage(A, usr) return - var/obj/item/W = get_active_hand() + var/obj/item/W = get_active_held_item() // Cyborgs have no range-checking unless there is item use if(!W) diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm index 0480bd43814..ad0ea23e9da 100644 --- a/code/_onclick/hud/_defines.dm +++ b/code/_onclick/hud/_defines.dm @@ -33,11 +33,21 @@ #define ui_id "CENTER-4:12,SOUTH:5" #define ui_belt "CENTER-3:14,SOUTH:5" #define ui_back "CENTER-2:14,SOUTH:5" -#define ui_rhand "CENTER:-16,SOUTH:5" -#define ui_lhand "CENTER: 16,SOUTH:5" -#define ui_equip "CENTER:-16,SOUTH+1:5" -#define ui_swaphand1 "CENTER:-16,SOUTH+1:5" -#define ui_swaphand2 "CENTER: 16,SOUTH+1:5" + +/proc/ui_hand_position(i) //values based on old hand ui positions (CENTER:-/+16,SOUTH:5) + var/x_off = -(!(i % 2)) + var/y_off = round((i-1) / 2) + return"CENTER+[x_off]:16,SOUTH+[y_off]:5" + +/proc/ui_equip_position(mob/M) + var/y_off = round((M.held_items.len-1) / 2) //values based on old equip ui position (CENTER: +/-16,SOUTH+1:5) + return "CENTER:-16,SOUTH+[y_off+1]:5" + +/proc/ui_swaphand_position(mob/M, which = 1) //values based on old swaphand ui positions (CENTER: +/-16,SOUTH+1:5) + var/x_off = which == 1 ? -1 : 0 + var/y_off = round((M.held_items.len-1) / 2) + return "CENTER+[x_off]:16,SOUTH+[y_off+1]:5" + #define ui_storage1 "CENTER+1:18,SOUTH:5" #define ui_storage2 "CENTER+2:20,SOUTH:5" @@ -141,3 +151,4 @@ #define ui_deityhealth "EAST-1:28,CENTER-2:13" #define ui_deitypower "EAST-1:28,CENTER-1:15" #define ui_deityfollowers "EAST-1:28,CENTER:17" + diff --git a/code/_onclick/hud/alien.dm b/code/_onclick/hud/alien.dm index 8ea573ad34a..2cd637f9653 100644 --- a/code/_onclick/hud/alien.dm +++ b/code/_onclick/hud/alien.dm @@ -39,39 +39,24 @@ ..() var/obj/screen/using - var/obj/screen/inventory/inv_box //equippable shit //hands - inv_box = new /obj/screen/inventory/hand() - inv_box.name = "right hand" - inv_box.icon = 'icons/mob/screen_alien.dmi' - inv_box.icon_state = "hand_r" - inv_box.screen_loc = ui_rhand - inv_box.slot_id = slot_r_hand - static_inventory += inv_box - - inv_box = new /obj/screen/inventory/hand() - inv_box.name = "left hand" - inv_box.icon = 'icons/mob/screen_alien.dmi' - inv_box.icon_state = "hand_l" - inv_box.screen_loc = ui_lhand - inv_box.slot_id = slot_l_hand - static_inventory += inv_box + build_hand_slots('icons/mob/screen_alien.dmi') //begin buttons using = new /obj/screen/swap_hand() using.icon = 'icons/mob/screen_alien.dmi' using.icon_state = "swap_1" - using.screen_loc = ui_swaphand1 + using.screen_loc = ui_swaphand_position(owner,1) static_inventory += using using = new /obj/screen/swap_hand() using.icon = 'icons/mob/screen_alien.dmi' using.icon_state = "swap_2" - using.screen_loc = ui_swaphand2 + using.screen_loc = ui_swaphand_position(owner,2) static_inventory += using using = new /obj/screen/act_intent/alien() @@ -136,17 +121,13 @@ return var/mob/living/carbon/alien/humanoid/H = mymob if(hud_version != HUD_STYLE_NOHUD) - if(H.r_hand) - H.r_hand.screen_loc = ui_rhand - H.client.screen += H.r_hand - if(H.l_hand) - H.l_hand.screen_loc = ui_lhand - H.client.screen += H.l_hand + for(var/obj/item/I in H.held_items) + I.screen_loc = ui_hand_position(H.get_held_index_of_item(I)) + H.client.screen += I else - if(H.r_hand) - H.r_hand.screen_loc = null - if(H.l_hand) - H.l_hand.screen_loc = null + for(var/obj/item/I in H.held_items) + I.screen_loc = null + H.client.screen -= I /mob/living/carbon/alien/humanoid/create_mob_hud() if(client && !hud_used) diff --git a/code/_onclick/hud/blob_overmind.dm b/code/_onclick/hud/blob_overmind.dm index 566132808b4..a375374ba22 100644 --- a/code/_onclick/hud/blob_overmind.dm +++ b/code/_onclick/hud/blob_overmind.dm @@ -159,11 +159,11 @@ static_inventory += using using = new /obj/screen/blob/NodeBlob() - using.screen_loc = ui_rhand + using.screen_loc = ui_hand_position(2) static_inventory += using using = new /obj/screen/blob/FactoryBlob() - using.screen_loc = ui_lhand + using.screen_loc = ui_hand_position(1) static_inventory += using using = new /obj/screen/blob/ReadaptChemical() diff --git a/code/_onclick/hud/devil.dm b/code/_onclick/hud/devil.dm index 0ddaeccd238..ec2597b1975 100644 --- a/code/_onclick/hud/devil.dm +++ b/code/_onclick/hud/devil.dm @@ -5,7 +5,6 @@ /datum/hud/devil/New(mob/owner, ui_style = 'icons/mob/screen_midnight.dmi') ..() var/obj/screen/using - var/obj/screen/inventory/inv_box using = new /obj/screen/drop() using.icon = ui_style @@ -18,27 +17,13 @@ pull_icon.screen_loc = ui_drone_pull static_inventory += pull_icon - inv_box = new /obj/screen/inventory/hand() - inv_box.name = "right hand" - inv_box.icon = ui_style - inv_box.icon_state = "hand_r" - inv_box.screen_loc = ui_rhand - inv_box.slot_id = slot_r_hand - static_inventory += inv_box - - inv_box = new /obj/screen/inventory/hand() - inv_box.name = "left hand" - inv_box.icon = ui_style - inv_box.icon_state = "hand_l" - inv_box.screen_loc = ui_lhand - inv_box.slot_id = slot_l_hand - static_inventory += inv_box + build_hand_slots(ui_style) using = new /obj/screen/inventory() using.name = "hand" using.icon = ui_style using.icon_state = "swap_1_m" - using.screen_loc = ui_swaphand1 + using.screen_loc = ui_swaphand_position(owner,1) using.layer = HUD_LAYER static_inventory += using @@ -46,7 +31,7 @@ using.name = "hand" using.icon = ui_style using.icon_state = "swap_2" - using.screen_loc = ui_swaphand2 + using.screen_loc = ui_swaphand_position(owner,2) using.layer = HUD_LAYER static_inventory += using @@ -65,17 +50,13 @@ var/mob/living/carbon/true_devil/D = mymob if(hud_version != HUD_STYLE_NOHUD) - if(D.r_hand) - D.r_hand.screen_loc = ui_rhand - D.client.screen += D.r_hand - if(D.l_hand) - D.l_hand.screen_loc = ui_lhand - D.client.screen += D.l_hand + for(var/obj/item/I in D.held_items) + I.screen_loc = ui_hand_position(D.get_held_index_of_item(I)) + D.client.screen += I else - if(D.r_hand) - D.r_hand.screen_loc = null - if(D.l_hand) - D.l_hand.screen_loc = null + for(var/obj/item/I in D.held_items) + I.screen_loc = null + D.client.screen -= I /mob/living/carbon/true_devil/create_mob_hud() if(client && !hud_used) diff --git a/code/_onclick/hud/generic_dextrous.dm b/code/_onclick/hud/generic_dextrous.dm index 8ecfed99627..509af712b90 100644 --- a/code/_onclick/hud/generic_dextrous.dm +++ b/code/_onclick/hud/generic_dextrous.dm @@ -2,7 +2,6 @@ /datum/hud/dextrous/New(mob/living/owner, ui_style = 'icons/mob/screen_midnight.dmi') ..() var/obj/screen/using - var/obj/screen/inventory/inv_box using = new /obj/screen/drop() using.icon = ui_style @@ -15,32 +14,18 @@ pull_icon.screen_loc = ui_drone_pull static_inventory += pull_icon - inv_box = new /obj/screen/inventory/hand() - inv_box.name = "right hand" - inv_box.icon = ui_style - inv_box.icon_state = "hand_r" - inv_box.screen_loc = ui_rhand - inv_box.slot_id = slot_r_hand - static_inventory += inv_box - - inv_box = new /obj/screen/inventory/hand() - inv_box.name = "left hand" - inv_box.icon = ui_style - inv_box.icon_state = "hand_l" - inv_box.screen_loc = ui_lhand - inv_box.slot_id = slot_l_hand - static_inventory += inv_box + build_hand_slots(ui_style) using = new /obj/screen/swap_hand() using.icon = ui_style using.icon_state = "swap_1_m" - using.screen_loc = ui_swaphand1 + using.screen_loc = ui_swaphand_position(owner,1) static_inventory += using using = new /obj/screen/swap_hand() using.icon = ui_style using.icon_state = "swap_2" - using.screen_loc = ui_swaphand2 + using.screen_loc = ui_swaphand_position(owner,2) static_inventory += using zone_select = new /obj/screen/zone_sel() @@ -68,14 +53,10 @@ return var/mob/living/D = mymob if(hud_version != HUD_STYLE_NOHUD) - if(D.r_hand) - D.r_hand.screen_loc = ui_rhand - D.client.screen += D.r_hand - if(D.l_hand) - D.l_hand.screen_loc = ui_lhand - D.client.screen += D.l_hand + for(var/obj/item/I in D.held_items) + I.screen_loc = ui_hand_position(D.get_held_index_of_item(I)) + D.client.screen += I else - if(D.r_hand) - D.r_hand.screen_loc = null - if(D.l_hand) - D.l_hand.screen_loc = null + for(var/obj/item/I in D.held_items) + I.screen_loc = null + D.client.screen -= I diff --git a/code/_onclick/hud/guardian.dm b/code/_onclick/hud/guardian.dm index d8b92fba713..aa50ca3712e 100644 --- a/code/_onclick/hud/guardian.dm +++ b/code/_onclick/hud/guardian.dm @@ -7,11 +7,11 @@ infodisplay += healths using = new /obj/screen/guardian/Manifest() - using.screen_loc = ui_rhand + using.screen_loc = ui_hand_position(2) static_inventory += using using = new /obj/screen/guardian/Recall() - using.screen_loc = ui_lhand + using.screen_loc = ui_hand_position(1) static_inventory += using using = new owner.toggle_button_type() diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index d55eb8db92f..a7930dc8c2c 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -39,6 +39,7 @@ var/list/infodisplay = list() //the screen objects that display mob info (health, alien plasma, etc...) var/list/screenoverlays = list() //the screen objects used as whole screen overlays (flash, damageoverlay, etc...) var/list/inv_slots[slots_amt] // /obj/screen/inventory objects, ordered by their slot ID. + var/list/hand_slots // /obj/screen/inventory/hand objects, assoc list of "[held_index]" = object var/obj/screen/movable/action_button/hide_toggle/hide_actions_toggle var/action_buttons_hidden = 0 @@ -51,6 +52,7 @@ mymob = owner hide_actions_toggle = new hide_actions_toggle.InitialiseIcon(mymob) + hand_slots = list() /datum/hud/Destroy() if(mymob.hud_used == src) @@ -159,10 +161,10 @@ screenmob.client.screen += infodisplay //These ones are a part of 'static_inventory', 'toggleable_inventory' or 'hotkeybuttons' but we want them to stay - if(inv_slots[slot_l_hand]) - screenmob.client.screen += inv_slots[slot_l_hand] //we want the hands to be visible - if(inv_slots[slot_r_hand]) - screenmob.client.screen += inv_slots[slot_r_hand] //we want the hands to be visible + for(var/h in hand_slots) + var/obj/screen/hand = hand_slots[h] + if(hand) + screenmob.client.screen += hand if(action_intent) screenmob.client.screen += action_intent //we want the intent switcher visible action_intent.screen_loc = ui_acti_alt //move this to the alternative position, where zone_select usually is. @@ -210,3 +212,34 @@ else usr << "This mob type does not use a HUD." + +//(re)builds the hand ui slots, throwing away old ones +//not really worth jugglying existing ones so we just scrap+rebuild +//9/10 this is only called once per mob and only for 2 hands +/datum/hud/proc/build_hand_slots(ui_style = 'icons/mob/screen_midnight.dmi') + for(var/h in hand_slots) + var/obj/screen/inventory/hand/H = hand_slots[h] + if(H) + static_inventory -= H + hand_slots = list() + var/obj/screen/inventory/hand/hand_box + for(var/i in 1 to mymob.held_items.len) + hand_box = new /obj/screen/inventory/hand() + hand_box.name = mymob.get_held_index_name(i) + hand_box.icon = ui_style + hand_box.icon_state = "hand_[mymob.held_index_to_dir(i)]" + hand_box.screen_loc = ui_hand_position(i) + hand_box.held_index = i + hand_slots["[i]"] = hand_box + hand_box.hud = src + static_inventory += hand_box + hand_box.update_icon() + + var/i = 1 + for(var/obj/screen/swap_hand/SH in static_inventory) + SH.screen_loc = ui_swaphand_position(mymob,!(i % 2) ? 2: 1) + i++ + for(var/obj/screen/human/equip/E in static_inventory) + E.screen_loc = ui_equip_position(mymob) + + show_hud(HUD_STYLE_STANDARD,mymob) \ No newline at end of file diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 33cac0a4d28..53b7ce8a0c9 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -133,32 +133,18 @@ inv_box.screen_loc = ui_oclothing toggleable_inventory += inv_box - inv_box = new /obj/screen/inventory/hand() - inv_box.name = "right hand" - inv_box.icon = ui_style - inv_box.icon_state = "hand_r" - inv_box.screen_loc = ui_rhand - inv_box.slot_id = slot_r_hand - static_inventory += inv_box - - inv_box = new /obj/screen/inventory/hand() - inv_box.name = "left hand" - inv_box.icon = ui_style - inv_box.icon_state = "hand_l" - inv_box.screen_loc = ui_lhand - inv_box.slot_id = slot_l_hand - static_inventory += inv_box + build_hand_slots(ui_style) using = new /obj/screen/swap_hand() using.icon = ui_style using.icon_state = "swap_1" - using.screen_loc = ui_swaphand1 + using.screen_loc = ui_swaphand_position(owner,1) static_inventory += using using = new /obj/screen/swap_hand() using.icon = ui_style using.icon_state = "swap_2" - using.screen_loc = ui_swaphand2 + using.screen_loc = ui_swaphand_position(owner,2) static_inventory += using inv_box = new /obj/screen/inventory() @@ -227,7 +213,7 @@ using = new /obj/screen/human/equip() using.icon = ui_style - using.screen_loc = ui_equip + using.screen_loc = ui_equip_position(mymob) static_inventory += using inv_box = new /obj/screen/inventory() @@ -407,17 +393,13 @@ screenmob.client.screen -= H.r_store if(hud_version != HUD_STYLE_NOHUD) - if(H.r_hand) - H.r_hand.screen_loc = ui_rhand - screenmob.client.screen += H.r_hand - if(H.l_hand) - H.l_hand.screen_loc = ui_lhand - screenmob.client.screen += H.l_hand + for(var/obj/item/I in H.held_items) + I.screen_loc = ui_hand_position(H.get_held_index_of_item(I)) + H.client.screen += I else - if(H.r_hand) - screenmob.client.screen -= H.r_hand - if(H.l_hand) - screenmob.client.screen -= H.l_hand + for(var/obj/item/I in H.held_items) + I.screen_loc = null + H.client.screen -= I /mob/living/carbon/human/verb/toggle_hotkey_verbs() set category = "OOC" diff --git a/code/_onclick/hud/monkey.dm b/code/_onclick/hud/monkey.dm index b7d8437e02a..dd6ec4bef44 100644 --- a/code/_onclick/hud/monkey.dm +++ b/code/_onclick/hud/monkey.dm @@ -21,32 +21,18 @@ using.screen_loc = ui_drop_throw static_inventory += using - inv_box = new /obj/screen/inventory/hand() - inv_box.name = "right hand" - inv_box.icon = ui_style - inv_box.icon_state = "hand_r" - inv_box.screen_loc = ui_rhand - inv_box.slot_id = slot_r_hand - static_inventory += inv_box - - inv_box = new /obj/screen/inventory/hand() - inv_box.name = "left hand" - inv_box.icon = ui_style - inv_box.icon_state = "hand_l" - inv_box.screen_loc = ui_lhand - inv_box.slot_id = slot_l_hand - static_inventory += inv_box + build_hand_slots(ui_style) using = new /obj/screen/swap_hand() using.icon = ui_style using.icon_state = "swap_1_m" //extra wide! - using.screen_loc = ui_swaphand1 + using.screen_loc = ui_swaphand_position(owner,1) static_inventory += using using = new /obj/screen/swap_hand() using.icon = ui_style using.icon_state = "swap_2" - using.screen_loc = ui_swaphand2 + using.screen_loc = ui_swaphand_position(owner,2) static_inventory += using inv_box = new /obj/screen/inventory() @@ -142,17 +128,13 @@ M.head.screen_loc = null if(hud_version != HUD_STYLE_NOHUD) - if(M.r_hand) - M.r_hand.screen_loc = ui_rhand - M.client.screen += M.r_hand - if(M.l_hand) - M.l_hand.screen_loc = ui_lhand - M.client.screen += M.l_hand + for(var/obj/item/I in M.held_items) + I.screen_loc = ui_hand_position(M.get_held_index_of_item(I)) + M.client.screen += I else - if(M.r_hand) - M.r_hand.screen_loc = null - if(M.l_hand) - M.l_hand.screen_loc = null + for(var/obj/item/I in M.held_items) + I.screen_loc = null + M.client.screen -= I /mob/living/carbon/monkey/create_mob_hud() if(client && !hud_used) diff --git a/code/_onclick/hud/robot.dm b/code/_onclick/hud/robot.dm index f572172bb60..aaf740f479e 100644 --- a/code/_onclick/hud/robot.dm +++ b/code/_onclick/hud/robot.dm @@ -153,9 +153,9 @@ infodisplay += healths //Installed Module - mymob.hands = new /obj/screen/robot/module() - mymob.hands.screen_loc = ui_borg_module - static_inventory += mymob.hands + mymobR.hands = new /obj/screen/robot/module() + mymobR.hands.screen_loc = ui_borg_module + static_inventory += mymobR.hands //Store module_store_icon = new /obj/screen/robot/store() diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 529a5c11ad1..cb9c698efaf 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -90,8 +90,7 @@ if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech return 1 if(usr.attack_ui(slot_id)) - usr.update_inv_l_hand(0) - usr.update_inv_r_hand(0) + usr.update_inv_hands() return 1 /obj/screen/inventory/update_icon() @@ -108,13 +107,15 @@ var/image/active_overlay var/image/handcuff_overlay var/image/blocked_overlay + var/held_index = 0 /obj/screen/inventory/hand/update_icon() ..() + if(!active_overlay) active_overlay = image("icon"=icon, "icon_state"="hand_active") if(!handcuff_overlay) - var/state = (slot_id == slot_r_hand) ? "markus" : "gabrielle" + var/state = (!(held_index % 2)) ? "markus" : "gabrielle" handcuff_overlay = image("icon"='icons/mob/screen_gen.dmi', "icon_state"=state) if(!blocked_overlay) blocked_overlay = image("icon"='icons/mob/screen_gen.dmi', "icon_state"="blocked") @@ -126,18 +127,15 @@ var/mob/living/carbon/C = hud.mymob if(C.handcuffed) add_overlay(handcuff_overlay) - if(slot_id == slot_r_hand) - if(!C.has_right_hand()) - add_overlay(blocked_overlay) - else if(slot_id == slot_l_hand) - if(!C.has_left_hand()) + + if(held_index) + if(!C.has_hand_for_held_index(held_index)) add_overlay(blocked_overlay) - if(slot_id == slot_l_hand && hud.mymob.hand) - add_overlay(active_overlay) - else if(slot_id == slot_r_hand && !hud.mymob.hand) + if(held_index == hud.mymob.active_hand_index) add_overlay(active_overlay) + /obj/screen/inventory/hand/Click() // At this point in client Click() code we have passed the 1/10 sec check and little else // We don't even know if it's a middle click @@ -150,11 +148,7 @@ if(ismob(usr)) var/mob/M = usr - switch(name) - if("right hand", "r_hand") - M.activate_hand("r") - if("left hand", "l_hand") - M.activate_hand("l") + M.swap_hand(held_index) return 1 /obj/screen/close @@ -239,12 +233,10 @@ C << "You are not wearing an internals mask!" return - if(istype(C.l_hand, /obj/item/weapon/tank)) - C << "You are now running on internals from the [C.l_hand] on your left hand." - C.internal = C.l_hand - else if(istype(C.r_hand, /obj/item/weapon/tank)) - C << "You are now running on internals from the [C.r_hand] on your right hand." - C.internal = C.r_hand + var/obj/item/I = C.is_holding_item_of_type(/obj/item/weapon/tank) + if(I) + C << "You are now running on internals from the [I] on your [C.get_held_index_name(C.get_held_index_of_item(I))]." + C.internal = I else if(ishuman(C)) var/mob/living/carbon/human/H = C if(istype(H.s_store, /obj/item/weapon/tank)) @@ -328,7 +320,7 @@ if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech return 1 if(master) - var/obj/item/I = usr.get_active_hand() + var/obj/item/I = usr.get_active_held_item() if(I) master.attackby(I, usr, params) return 1 diff --git a/code/_onclick/hud/swarmer.dm b/code/_onclick/hud/swarmer.dm index 85ee9c4977f..92a98e14c67 100644 --- a/code/_onclick/hud/swarmer.dm +++ b/code/_onclick/hud/swarmer.dm @@ -68,11 +68,11 @@ var/obj/screen/using using = new /obj/screen/swarmer/FabricateTrap() - using.screen_loc = ui_rhand + using.screen_loc = ui_hand_position(2) static_inventory += using using = new /obj/screen/swarmer/Barricade() - using.screen_loc = ui_lhand + using.screen_loc = ui_hand_position(1) static_inventory += using using = new /obj/screen/swarmer/Replicate() diff --git a/code/_onclick/telekinesis.dm b/code/_onclick/telekinesis.dm index 9c783dc19ef..dcd14ee9663 100644 --- a/code/_onclick/telekinesis.dm +++ b/code/_onclick/telekinesis.dm @@ -86,7 +86,7 @@ var/const/tk_maxrange = 15 //stops TK grabs being equipped anywhere but into hands /obj/item/tk_grab/equipped(mob/user, slot) - if( (slot == slot_l_hand) || (slot== slot_r_hand) ) + if(slot == slot_hands) return qdel(src) return diff --git a/code/datums/diseases/advance/symptoms/cough.dm b/code/datums/diseases/advance/symptoms/cough.dm index d8bbc5e5ae9..09dd6bf8dc0 100644 --- a/code/datums/diseases/advance/symptoms/cough.dm +++ b/code/datums/diseases/advance/symptoms/cough.dm @@ -34,7 +34,7 @@ BONUS M << "[pick("You swallow excess mucus.", "You lightly cough.")]" else M.emote("cough") - var/obj/item/I = M.get_active_hand() + var/obj/item/I = M.get_active_held_item() if(I && I.w_class == 1) M.drop_item() return \ No newline at end of file diff --git a/code/datums/diseases/wizarditis.dm b/code/datums/diseases/wizarditis.dm index bc9d70fc63c..2e6d2a52cce 100644 --- a/code/datums/diseases/wizarditis.dm +++ b/code/datums/diseases/wizarditis.dm @@ -78,12 +78,9 @@ STI KALY - blind else var/mob/living/carbon/H = affected_mob if(prob(chance)) - if(!istype(H.r_hand, /obj/item/weapon/staff)) - H.drop_r_hand() - H.put_in_r_hand( new /obj/item/weapon/staff(H) ) - return - return - + var/obj/item/weapon/staff/S = new(H) + if(!H.put_in_hands(S)) + qdel(S) /datum/disease/wizarditis/proc/teleport() diff --git a/code/datums/martial.dm b/code/datums/martial.dm index ea41a804136..0a93341a63d 100644 --- a/code/datums/martial.dm +++ b/code/datums/martial.dm @@ -333,8 +333,7 @@ else A.start_pulling(D, 1) if(A.pulling) - D.drop_r_hand() - D.drop_l_hand() + D.drop_all_held_items() D.stop_pulling() add_logs(A, D, "grabbed", addition="aggressively") A.grab_state = GRAB_AGGRESSIVE //Instant aggressive grab diff --git a/code/datums/martial/krav_maga.dm b/code/datums/martial/krav_maga.dm index 1da9d820a76..330ca40d1c5 100644 --- a/code/datums/martial/krav_maga.dm +++ b/code/datums/martial/krav_maga.dm @@ -130,16 +130,10 @@ datum/martial_art/krav_maga/grab_act(var/mob/living/carbon/human/A, var/mob/livi if(check_streak(A,D)) return 1 if(prob(60)) - if(D.hand) - if(istype(D.l_hand, /obj/item)) - var/obj/item/I = D.l_hand - D.drop_item() - A.put_in_hands(I) - else - if(istype(D.r_hand, /obj/item)) - var/obj/item/I = D.r_hand - D.drop_item() - A.put_in_hands(I) + var/obj/item/I = D.get_active_held_item() + if(I) + D.drop_item() + A.put_in_hands(I) D.visible_message("[A] has disarmed [D]!", \ "[A] has disarmed [D]!") playsound(D, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index c161690b2b8..bf749e18e5f 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -310,7 +310,7 @@ var/list/wire_color_directory = list() return var/target_wire = params["wire"] var/mob/living/L = usr - var/obj/item/I = L.get_active_hand() + var/obj/item/I = L.get_active_held_item() switch(action) if("cut") if(istype(I, /obj/item/weapon/wirecutters) || IsAdminGhost(usr)) diff --git a/code/game/gamemodes/antag_spawner.dm b/code/game/gamemodes/antag_spawner.dm index a1d1a7b8551..59cbfc05095 100644 --- a/code/game/gamemodes/antag_spawner.dm +++ b/code/game/gamemodes/antag_spawner.dm @@ -84,7 +84,7 @@ if("healing") M.mind.AddSpell(new /obj/effect/proc_holder/spell/targeted/charge(null)) M.mind.AddSpell(new /obj/effect/proc_holder/spell/aoe_turf/conjure/forcewall(null)) - M.equip_to_slot_or_del(new /obj/item/weapon/gun/magic/staff/healing(M), slot_r_hand) + M.put_in_hands_or_del(new /obj/item/weapon/gun/magic/staff/healing(M)) M << "Your service has not gone unrewarded, however. Studying under [usr.real_name], you have learned livesaving survival spells. You are able to cast charge and forcewall." if("robeless") M.mind.AddSpell(new /obj/effect/proc_holder/spell/aoe_turf/knock(null)) diff --git a/code/game/gamemodes/changeling/powers/mutations.dm b/code/game/gamemodes/changeling/powers/mutations.dm index 8bb2bf50540..08efd29bbf4 100644 --- a/code/game/gamemodes/changeling/powers/mutations.dm +++ b/code/game/gamemodes/changeling/powers/mutations.dm @@ -21,32 +21,28 @@ var/weapon_name_simple /obj/effect/proc_holder/changeling/weapon/try_to_sting(mob/user, mob/target) - if(check_weapon(user, user.r_hand, 1)) - return - if(check_weapon(user, user.l_hand, 0)) - return + for(var/obj/item/I in user.held_items) + if(check_weapon(user, I)) + return ..(user, target) -/obj/effect/proc_holder/changeling/weapon/proc/check_weapon(mob/user, obj/item/hand_item, right_hand=1) +/obj/effect/proc_holder/changeling/weapon/proc/check_weapon(mob/user, obj/item/hand_item) if(istype(hand_item, weapon_type)) playsound(user, 'sound/effects/blobattack.ogg', 30, 1) qdel(hand_item) user.visible_message("With a sickening crunch, [user] reforms their [weapon_name_simple] into an arm!", "We assimilate the [weapon_name_simple] back into our body.", "The [user.get_active_hand()] is stuck to your hand, you cannot grow a [weapon_name_simple] over it!" + user << "The [user.get_active_held_item()] is stuck to your hand, you cannot grow a [weapon_name_simple] over it!" return var/limb_regen = 0 - if(user.hand) //we regen the arm before changing it into the weapon - limb_regen = user.regenerate_limb("l_arm", 1) - else + if(user.active_hand_index % 2 == 0) //we regen the arm before changing it into the weapon limb_regen = user.regenerate_limb("r_arm", 1) + else + limb_regen = user.regenerate_limb("l_arm", 1) if(limb_regen) user.visible_message("[user]'s missing arm reforms, making a loud, grotesque sound!", "Your arm regrows, making a loud, crunchy sound and giving you great pain!", "You hear organic matter ripping and tearing!") user.emote("scream") @@ -56,8 +52,9 @@ return W /obj/effect/proc_holder/changeling/weapon/on_refund(mob/user) - check_weapon(user, user.r_hand, 1) - check_weapon(user, user.l_hand, 0) + for(var/obj/item/I in user.held_items) + check_weapon(user, I) + //Parent to space suits and armor. /obj/effect/proc_holder/changeling/suit diff --git a/code/game/gamemodes/changeling/powers/tiny_prick.dm b/code/game/gamemodes/changeling/powers/tiny_prick.dm index 5deadd09cbf..ea792abe4b3 100644 --- a/code/game/gamemodes/changeling/powers/tiny_prick.dm +++ b/code/game/gamemodes/changeling/powers/tiny_prick.dm @@ -138,7 +138,7 @@ add_logs(user, target, "stung", object="falso armblade sting") if(!target.drop_item()) - user << "The [target.get_active_hand()] is stuck to their hand, you cannot grow a false armblade over it!" + user << "The [target.get_active_held_item()] is stuck to their hand, you cannot grow a false armblade over it!" return if(ismonkey(target)) @@ -162,8 +162,7 @@ "You need to hold the slab in your active hand to recite scripture!" return recite_scripture(user) @@ -236,7 +236,7 @@ var/datum/clockwork_scripture/C = S if("[initial(C.name)] ([initial(C.descname)])" == chosen_scripture) scripture_to_recite = new C - if(!scripture_to_recite || user.get_active_hand() != src) + if(!scripture_to_recite || user.get_active_held_item() != src) return 0 tiers_of_scripture = scripture_unlock_check() if(!ratvar_awakens && !no_cost && !tiers_of_scripture[scripture_to_recite.tier]) @@ -517,7 +517,7 @@ user << "[src] is still gathering power!" return 0 var/mob/living/carbon/C = user - if(C.l_hand && C.r_hand) + if(!user.get_empty_held_indexes()) C << "You require a free hand to utilize [src]'s power!" return 0 C.visible_message("[C]'s hand is enveloped in violet flames!", "You harness [src]'s power. Direct it at a tile at any range to unleash it, or use the action button again to dispel it.") diff --git a/code/game/gamemodes/clock_cult/clock_mobs.dm b/code/game/gamemodes/clock_cult/clock_mobs.dm index 3c9f29bd46a..d8d3025e088 100644 --- a/code/game/gamemodes/clock_cult/clock_mobs.dm +++ b/code/game/gamemodes/clock_cult/clock_mobs.dm @@ -261,7 +261,7 @@ if(amount > 0) combattimer = world.time + initial(combattimer) for(var/mob/living/L in view(2, src)) - if(istype(L.l_hand, /obj/item/weapon/nullrod) || istype(L.r_hand, /obj/item/weapon/nullrod)) //hand-held holy weapons increase the damage it takes + if(L.is_holding_item_of_type(/obj/item/weapon/nullrod)) src << "The presence of a brandished holy artifact weakens your armor!" amount *= 4 //if a wielded null rod is nearby, it takes four times the health damage break diff --git a/code/game/gamemodes/clock_cult/clock_unsorted.dm b/code/game/gamemodes/clock_cult/clock_unsorted.dm index 30a8577dda5..fbc532f2ddc 100644 --- a/code/game/gamemodes/clock_cult/clock_unsorted.dm +++ b/code/game/gamemodes/clock_cult/clock_unsorted.dm @@ -61,7 +61,7 @@ return ..() /datum/action/innate/function_call/Activate() - if(owner.l_hand && owner.r_hand) + if(!owner.get_empty_held_indexes()) usr << "You need an empty to hand to call forth your spear!" return 0 owner.visible_message("A strange spear materializes in [owner]'s hands!", "You call forth your spear!") @@ -114,7 +114,7 @@ return 0 var/input_target_key = input(invoker, "Choose a target to form a rift to.", "Spatial Gateway") as null|anything in possible_targets var/atom/movable/target = possible_targets[input_target_key] - if(!src || !target || !invoker || !invoker.canUseTopic(src, BE_CLOSE) || !is_servant_of_ratvar(invoker) || (istype(src, /obj/item) && invoker.get_active_hand() != src)) + if(!src || !target || !invoker || !invoker.canUseTopic(src, BE_CLOSE) || !is_servant_of_ratvar(invoker) || (istype(src, /obj/item) && invoker.get_active_held_item() != src)) return 0 //if any of the involved things no longer exist, the invoker is stunned, too far away to use the object, or does not serve ratvar, or if the object is an item and not in the mob's active hand, fail var/istargetobelisk = istype(target, /obj/structure/clockwork/powered/clockwork_obelisk) if(istargetobelisk) diff --git a/code/game/gamemodes/cult/cult.dm b/code/game/gamemodes/cult/cult.dm index 6847906410c..2676bc21aea 100644 --- a/code/game/gamemodes/cult/cult.dm +++ b/code/game/gamemodes/cult/cult.dm @@ -139,9 +139,7 @@ var/list/slots = list( "backpack" = slot_in_backpack, "left pocket" = slot_l_store, - "right pocket" = slot_r_store, - "left hand" = slot_l_hand, - "right hand" = slot_r_hand, + "right pocket" = slot_r_store ) var/T = new item_path(mob) diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm index 2081eaae4ad..7abb19384ef 100644 --- a/code/game/gamemodes/cult/runes.dm +++ b/code/game/gamemodes/cult/runes.dm @@ -177,7 +177,7 @@ structure_check() searches for nearby cultist structures required for the invoca /mob/proc/bible_check() //The bible, if held, might protect against certain things var/obj/item/weapon/storage/book/bible/B = locate() in src - if(B && (l_hand == B || r_hand == B)) + if(is_holding(B)) return B return 0 diff --git a/code/game/gamemodes/devil/true_devil/_true_devil.dm b/code/game/gamemodes/devil/true_devil/_true_devil.dm index a99c95801d1..8e91c964dab 100644 --- a/code/game/gamemodes/devil/true_devil/_true_devil.dm +++ b/code/game/gamemodes/devil/true_devil/_true_devil.dm @@ -51,8 +51,7 @@ /mob/living/carbon/true_devil/death(gibbed) stat = DEAD ..(gibbed) - drop_l_hand() - drop_r_hand() + drop_all_held_items() spawn (0) mind.devilinfo.beginResurrectionCheck(src) @@ -61,18 +60,12 @@ var/msg = "*---------*\nThis is \icon[src] [src]!\n" //Left hand items - if(l_hand && !(l_hand.flags&ABSTRACT)) - if(l_hand.blood_DNA) - msg += "It is holding \icon[l_hand] [l_hand.gender==PLURAL?"some":"a"] blood-stained [l_hand.name] in its left hand!\n" - else - msg += "It is holding \icon[l_hand] \a [l_hand] in its left hand.\n" - - //Right hand items - if(r_hand && !(r_hand.flags&ABSTRACT)) - if(r_hand.blood_DNA) - msg += "It is holding \icon[r_hand] [r_hand.gender==PLURAL?"some":"a"] blood-stained [r_hand.name] in its right hand!\n" - else - msg += "It is holding \icon[r_hand] \a [r_hand] in its right hand.\n" + for(var/obj/item/I in held_items) + if(!(I.flags & ABSTRACT)) + if(I.blood_DNA) + msg += "It is holding \icon[I] [I.gender==PLURAL?"some":"a"] blood-stained [I.name] in its [get_held_index_name(get_held_index_of_item(I))]!\n" + else + msg += "It is holding \icon[I] \a [I] in its [get_held_index_name(get_held_index_of_item(I))].\n" //Braindead if(!client && stat != DEAD) diff --git a/code/game/gamemodes/devil/true_devil/inventory.dm b/code/game/gamemodes/devil/true_devil/inventory.dm index 020d48c98de..ca417e09fbf 100644 --- a/code/game/gamemodes/devil/true_devil/inventory.dm +++ b/code/game/gamemodes/devil/true_devil/inventory.dm @@ -4,10 +4,12 @@ return 1 return 0 -/mob/living/carbon/true_devil/proc/update_inv_hands() +/mob/living/carbon/true_devil/update_inv_hands() //TODO LORDPIDEY: Figure out how to make the hands line up properly. the l/r_hand_image should use the down sprite when facing down, left, or right, and the up sprite when facing up. remove_overlay(DEVIL_HANDS_LAYER) var/list/hands_overlays = list() + var/obj/item/l_hand = get_item_for_held_index(1) //hardcoded 2-hands only, for now. + var/obj/item/r_hand = get_item_for_held_index(2) if(r_hand) @@ -21,7 +23,7 @@ if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD) r_hand.layer = ABOVE_HUD_LAYER - r_hand.screen_loc = ui_rhand + r_hand.screen_loc = ui_hand_position(get_held_index_of_item(r_hand)) client.screen |= r_hand if(l_hand) @@ -36,19 +38,12 @@ if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD) l_hand.layer = ABOVE_HUD_LAYER - l_hand.screen_loc = ui_lhand + l_hand.screen_loc = ui_hand_position(get_held_index_of_item(l_hand)) client.screen |= l_hand if(hands_overlays.len) devil_overlays[DEVIL_HANDS_LAYER] = hands_overlays apply_overlay(DEVIL_HANDS_LAYER) -/mob/living/carbon/true_devil/update_inv_l_hand() - update_inv_hands() - - -/mob/living/carbon/true_devil/update_inv_r_hand() - update_inv_hands() - /mob/living/carbon/true_devil/remove_overlay(cache_index) if(devil_overlays[cache_index]) overlays -= devil_overlays[cache_index] diff --git a/code/game/gamemodes/gang/gang.dm b/code/game/gamemodes/gang/gang.dm index 64f0ef08d70..241c16bf56e 100644 --- a/code/game/gamemodes/gang/gang.dm +++ b/code/game/gamemodes/gang/gang.dm @@ -115,9 +115,7 @@ var/list/gang_colors_pool = list("red","orange","yellow","green","blue","purple" var/list/slots = list ( "backpack" = slot_in_backpack, "left pocket" = slot_l_store, - "right pocket" = slot_r_store, - "left hand" = slot_l_hand, - "right hand" = slot_r_hand, + "right pocket" = slot_r_store ) . = 0 diff --git a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm index 20f9b61d014..c2a7423ef01 100644 --- a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm +++ b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm @@ -59,8 +59,7 @@ M.icon = disguise.icon M.icon_state = disguise.icon_state M.overlays = disguise.overlays - M.update_inv_r_hand() - M.update_inv_l_hand() + M.update_inv_hands() /obj/item/clothing/suit/armor/abductor/vest/proc/DeactivateStealth() if(!stealth_active) diff --git a/code/game/gamemodes/miniantags/abduction/machinery/console.dm b/code/game/gamemodes/miniantags/abduction/machinery/console.dm index 55802fa7e17..2aaacb4565f 100644 --- a/code/game/gamemodes/miniantags/abduction/machinery/console.dm +++ b/code/game/gamemodes/miniantags/abduction/machinery/console.dm @@ -173,7 +173,7 @@ entry.name = target.name entry.icon = target.icon entry.icon_state = target.icon_state - entry.overlays = target.get_overlays_copy(list(L_HAND_LAYER,R_HAND_LAYER)) + entry.overlays = target.get_overlays_copy(list(HANDS_LAYER,HANDS_LAYER)) for(var/i=1,i<=disguises.len,i++) var/datum/icon_snapshot/temp = disguises[i] if(temp.name == entry.name) diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index 1aded1d6205..0270d153573 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -110,7 +110,7 @@ synd_mind.current << "In your hand you will find a special item capable of triggering a greater challenge for your team. Examine it carefully and consult with your fellow operatives before activating it." var/obj/item/device/nuclear_challenge/challenge = new /obj/item/device/nuclear_challenge - synd_mind.current.equip_to_slot_or_del(challenge, slot_r_hand) + synd_mind.current.put_in_hands_or_del(challenge) var/list/foundIDs = synd_mind.current.search_contents_for(/obj/item/weapon/card/id) if(foundIDs.len) @@ -130,7 +130,7 @@ P.name = "nuclear bomb code" var/mob/living/carbon/human/H = synd_mind.current P.loc = H.loc - H.equip_to_slot_or_del(P, slot_r_hand, 0) + H.put_in_hands_or_del(P) H.update_icons() else nuke_code = "code will be provided later" diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm index 88aed68a67e..98d0f963433 100644 --- a/code/game/gamemodes/nuclear/nuclearbomb.dm +++ b/code/game/gamemodes/nuclear/nuclearbomb.dm @@ -291,7 +291,7 @@ var/bomb_set . = TRUE if("insert_disk") if(!auth) - var/obj/item/I = usr.get_active_hand() + var/obj/item/I = usr.get_active_held_item() if(istype(I, /obj/item/weapon/disk/nuclear)) usr.drop_item() I.forceMove(src) diff --git a/code/game/gamemodes/revolution/revolution.dm b/code/game/gamemodes/revolution/revolution.dm index a30b1c2f281..9027a95c1ff 100644 --- a/code/game/gamemodes/revolution/revolution.dm +++ b/code/game/gamemodes/revolution/revolution.dm @@ -137,9 +137,7 @@ var/list/slots = list ( "backpack" = slot_in_backpack, "left pocket" = slot_l_store, - "right pocket" = slot_r_store, - "left hand" = slot_l_hand, - "right hand" = slot_r_hand, + "right pocket" = slot_r_store ) var/where = mob.equip_in_one_of_slots(T, slots) var/where2 = mob.equip_in_one_of_slots(C, slots) diff --git a/code/game/gamemodes/traitor/traitor.dm b/code/game/gamemodes/traitor/traitor.dm index a88b2735153..b77bc2894ad 100644 --- a/code/game/gamemodes/traitor/traitor.dm +++ b/code/game/gamemodes/traitor/traitor.dm @@ -367,9 +367,7 @@ var/list/slots = list ( "backpack" = slot_in_backpack, "left pocket" = slot_l_store, - "right pocket" = slot_r_store, - "left hand" = slot_l_hand, - "right hand" = slot_r_hand, + "right pocket" = slot_r_store ) var/where = "At your feet" diff --git a/code/game/gamemodes/wizard/artefact.dm b/code/game/gamemodes/wizard/artefact.dm index 1a41e73ef7c..6d0d742c00e 100644 --- a/code/game/gamemodes/wizard/artefact.dm +++ b/code/game/gamemodes/wizard/artefact.dm @@ -191,8 +191,8 @@ H.equip_to_slot_or_del(new hat(H), slot_head) H.equip_to_slot_or_del(new /obj/item/clothing/under/roman(H), slot_w_uniform) H.equip_to_slot_or_del(new /obj/item/clothing/shoes/roman(H), slot_shoes) - H.equip_to_slot_or_del(new /obj/item/weapon/shield/riot/roman(H), slot_l_hand) - H.equip_to_slot_or_del(new /obj/item/weapon/claymore(H), slot_r_hand) + H.put_in_hands_or_del(new /obj/item/weapon/shield/riot/roman(H)) + H.put_in_hands_or_del(new /obj/item/weapon/claymore(H)) H.equip_to_slot_or_del(new /obj/item/weapon/twohanded/spear(H), slot_back) @@ -337,15 +337,15 @@ var/global/list/multiverse = list() M.equip_to_slot_or_del(new /obj/item/device/radio/headset(M), slot_ears) M.equip_to_slot_or_del(new /obj/item/clothing/glasses/sunglasses(M), slot_glasses) M.equip_to_slot_or_del(new /obj/item/clothing/under/suit_jacket/really_black(M), slot_w_uniform) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(sword) if("roman") var/hat = pick(/obj/item/clothing/head/helmet/roman, /obj/item/clothing/head/helmet/roman/legionaire) M.equip_to_slot_or_del(new hat(M), slot_head) M.equip_to_slot_or_del(new /obj/item/clothing/under/roman(M), slot_w_uniform) M.equip_to_slot_or_del(new /obj/item/clothing/shoes/roman(M), slot_shoes) - M.equip_to_slot_or_del(new /obj/item/weapon/shield/riot/roman(M), slot_l_hand) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(new /obj/item/weapon/shield/riot/roman(M)) + M.put_in_hands_or_del(sword) if("wizard") M.equip_to_slot_or_del(new /obj/item/clothing/under/color/lightpurple(M), slot_w_uniform) @@ -353,13 +353,13 @@ var/global/list/multiverse = list() M.equip_to_slot_or_del(new /obj/item/clothing/shoes/sandal(M), slot_shoes) M.equip_to_slot_or_del(new /obj/item/device/radio/headset(M), slot_ears) M.equip_to_slot_or_del(new /obj/item/clothing/head/wizard/red(M), slot_head) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(sword) if("cyborg") for(var/X in M.bodyparts) var/obj/item/bodypart/affecting = X affecting.change_bodypart_status(ORGAN_ROBOTIC) M.equip_to_slot_or_del(new /obj/item/clothing/glasses/thermal/eyepatch(M), slot_glasses) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(sword) if("syndicate") M.equip_to_slot_or_del(new /obj/item/clothing/under/syndicate(M), slot_w_uniform) @@ -369,34 +369,34 @@ var/global/list/multiverse = list() M.equip_to_slot_or_del(new /obj/item/device/radio/headset(M), slot_ears) M.equip_to_slot_or_del(new /obj/item/clothing/suit/armor/vest(M), slot_wear_suit) M.equip_to_slot_or_del(new /obj/item/clothing/mask/gas(M),slot_wear_mask) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(sword) if("assistant") M.equip_to_slot_or_del(new /obj/item/clothing/under/color/grey(M), slot_w_uniform) M.equip_to_slot_or_del(new /obj/item/device/radio/headset(M), slot_ears) M.equip_to_slot_or_del(new /obj/item/clothing/shoes/sneakers/black(M), slot_shoes) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(sword) if("animu") M.equip_to_slot_or_del(new /obj/item/clothing/shoes/sandal(M), slot_shoes) M.equip_to_slot_or_del(new /obj/item/device/radio/headset(M), slot_ears) M.equip_to_slot_or_del(new /obj/item/clothing/head/kitty(M), slot_head) M.equip_to_slot_or_del(new /obj/item/clothing/under/schoolgirl/red(M), slot_w_uniform) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(sword) if("cultist") M.equip_to_slot_or_del(new /obj/item/clothing/head/culthood/alt(M), slot_head) M.equip_to_slot_or_del(new /obj/item/clothing/suit/cultrobes/alt(M), slot_wear_suit) M.equip_to_slot_or_del(new /obj/item/clothing/shoes/cult(M), slot_shoes) M.equip_to_slot_or_del(new /obj/item/device/radio/headset(M), slot_ears) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(sword) if("highlander") M.equip_to_slot_or_del(new /obj/item/clothing/under/kilt(M), slot_w_uniform) M.equip_to_slot_or_del(new /obj/item/device/radio/headset(M), slot_ears) M.equip_to_slot_or_del(new /obj/item/clothing/head/beret(M), slot_head) M.equip_to_slot_or_del(new /obj/item/clothing/shoes/combat(M), slot_shoes) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(sword) if("clown") M.equip_to_slot_or_del(new /obj/item/clothing/under/rank/clown(M), slot_w_uniform) @@ -404,7 +404,7 @@ var/global/list/multiverse = list() M.equip_to_slot_or_del(new /obj/item/clothing/shoes/clown_shoes(M), slot_shoes) M.equip_to_slot_or_del(new /obj/item/clothing/mask/gas/clown_hat(M), slot_wear_mask) M.equip_to_slot_or_del(new /obj/item/weapon/bikehorn(M), slot_l_store) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(sword) if("killer") M.equip_to_slot_or_del(new /obj/item/clothing/under/overalls(M), slot_w_uniform) @@ -416,7 +416,7 @@ var/global/list/multiverse = list() M.equip_to_slot_or_del(new /obj/item/clothing/suit/apron(M), slot_wear_suit) M.equip_to_slot_or_del(new /obj/item/weapon/kitchen/knife(M), slot_l_store) M.equip_to_slot_or_del(new /obj/item/weapon/scalpel(M), slot_r_store) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(sword) for(var/obj/item/carried_item in M.contents) if(!istype(carried_item, /obj/item/weapon/implant)) carried_item.add_mob_blood(M) @@ -427,7 +427,7 @@ var/global/list/multiverse = list() M.equip_to_slot_or_del(new /obj/item/clothing/head/bandana(M), slot_head) M.equip_to_slot_or_del(new /obj/item/clothing/glasses/eyepatch(M), slot_glasses) M.equip_to_slot_or_del(new /obj/item/device/radio/headset(M), slot_ears) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(sword) if("soviet") M.equip_to_slot_or_del(new /obj/item/clothing/head/pirate/captain(M), slot_head) @@ -436,7 +436,7 @@ var/global/list/multiverse = list() M.equip_to_slot_or_del(new /obj/item/device/radio/headset(M), slot_ears) M.equip_to_slot_or_del(new /obj/item/clothing/suit/pirate/captain(M), slot_wear_suit) M.equip_to_slot_or_del(new /obj/item/clothing/under/soviet(M), slot_w_uniform) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(sword) if("officer") M.equip_to_slot_or_del(new /obj/item/clothing/head/helmet/space/beret(M), slot_head) @@ -447,14 +447,14 @@ var/global/list/multiverse = list() M.equip_to_slot_or_del(new /obj/item/clothing/suit/jacket/miljacket(M), slot_wear_suit) M.equip_to_slot_or_del(new /obj/item/clothing/under/syndicate(M), slot_w_uniform) M.equip_to_slot_or_del(new /obj/item/clothing/glasses/eyepatch(M), slot_glasses) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(sword) if("gladiator") M.equip_to_slot_or_del(new /obj/item/clothing/head/helmet/gladiator(M), slot_head) M.equip_to_slot_or_del(new /obj/item/clothing/under/gladiator(M), slot_w_uniform) M.equip_to_slot_or_del(new /obj/item/device/radio/headset(M), slot_ears) M.equip_to_slot_or_del(new /obj/item/clothing/shoes/sandal(M), slot_shoes) - M.equip_to_slot_or_del(sword, slot_r_hand) + M.put_in_hands_or_del(sword) else diff --git a/code/game/gamemodes/wizard/wizard.dm b/code/game/gamemodes/wizard/wizard.dm index c5d4cba9a86..82ad4e67cc8 100644 --- a/code/game/gamemodes/wizard/wizard.dm +++ b/code/game/gamemodes/wizard/wizard.dm @@ -137,7 +137,9 @@ qdel(wizard_mob.wear_suit) qdel(wizard_mob.head) qdel(wizard_mob.shoes) - qdel(wizard_mob.r_hand) + for(var/obj/item/I in wizard_mob.held_items) + wizard_mob.unEquip(I) + qdel(I) qdel(wizard_mob.r_store) qdel(wizard_mob.l_store) @@ -152,7 +154,7 @@ wizard_mob.equip_to_slot_or_del(new /obj/item/weapon/teleportation_scroll(wizard_mob), slot_r_store) var/obj/item/weapon/spellbook/spellbook = new /obj/item/weapon/spellbook(wizard_mob) spellbook.owner = wizard_mob - wizard_mob.equip_to_slot_or_del(spellbook, slot_r_hand) + wizard_mob.put_in_hands_or_del(spellbook) wizard_mob << "You will find a list of available spells in your spell book. Choose your magic arsenal carefully." wizard_mob << "The spellbook is bound to you, and others cannot use it." diff --git a/code/game/machinery/PDApainter.dm b/code/game/machinery/PDApainter.dm index 1de445383b1..fd21d4a3826 100644 --- a/code/game/machinery/PDApainter.dm +++ b/code/game/machinery/PDApainter.dm @@ -51,7 +51,7 @@ user << "There is already a PDA inside!" return else - var/obj/item/device/pda/P = user.get_active_hand() + var/obj/item/device/pda/P = user.get_active_held_item() if(istype(P)) if(!user.drop_item()) return diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm index 3413b500502..ba4fbd860ee 100644 --- a/code/game/machinery/computer/card.dm +++ b/code/game/machinery/computer/card.dm @@ -315,7 +315,7 @@ var/time_last_changed_position = 0 region_access = null head_subordinates = null else - var/obj/item/I = usr.get_active_hand() + var/obj/item/I = usr.get_active_held_item() if (istype(I, /obj/item/weapon/card/id)) if(!usr.drop_item()) return @@ -329,7 +329,7 @@ var/time_last_changed_position = 0 scan.verb_pickup() scan = null else - var/obj/item/I = usr.get_active_hand() + var/obj/item/I = usr.get_active_held_item() if (istype(I, /obj/item/weapon/card/id)) if(!usr.drop_item()) return diff --git a/code/game/machinery/computer/cloning.dm b/code/game/machinery/computer/cloning.dm index 4641811b75a..0ad5c1ef21e 100644 --- a/code/game/machinery/computer/cloning.dm +++ b/code/game/machinery/computer/cloning.dm @@ -270,7 +270,7 @@ src.menu = 4 else if (src.menu == 4) - var/obj/item/weapon/card/id/C = usr.get_active_hand() + var/obj/item/weapon/card/id/C = usr.get_active_held_item() if (istype(C)||istype(C, /obj/item/device/pda)) if(src.check_access(C)) src.temp = "[src.active_record.fields["name"]] => Record deleted." diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index e55635d45e2..8713750077a 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -64,7 +64,7 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12 src.state = STATE_DEFAULT if("login") var/mob/M = usr - var/obj/item/weapon/card/id/I = M.get_active_hand() + var/obj/item/weapon/card/id/I = M.get_active_held_item() if (istype(I, /obj/item/device/pda)) var/obj/item/device/pda/pda = I I = pda.id @@ -82,7 +82,7 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12 if("swipeidseclevel") var/mob/M = usr - var/obj/item/weapon/card/id/I = M.get_active_hand() + var/obj/item/weapon/card/id/I = M.get_active_held_item() if (istype(I, /obj/item/device/pda)) var/obj/item/device/pda/pda = I I = pda.id diff --git a/code/game/machinery/computer/gulag_teleporter.dm b/code/game/machinery/computer/gulag_teleporter.dm index 62e3bf6e75e..6f2e6b0d56b 100644 --- a/code/game/machinery/computer/gulag_teleporter.dm +++ b/code/game/machinery/computer/gulag_teleporter.dm @@ -91,14 +91,14 @@ beacon = findbeacon() if("handle_id") if(id) - if(!usr.get_active_hand()) + if(!usr.get_active_held_item()) usr.put_in_hands(id) id = null else id.forceMove(get_turf(src)) id = null else - var/obj/item/I = usr.get_active_hand() + var/obj/item/I = usr.get_active_held_item() if(istype(I, /obj/item/weapon/card/id/prisoner)) if(!usr.drop_item()) return diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 9b816e672f2..62c7230851b 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -212,13 +212,13 @@ src.temp = null if(href_list["scan"]) if(src.scan) - if(istype(usr,/mob/living/carbon/human) && !usr.get_active_hand()) + if(istype(usr,/mob/living/carbon/human) && !usr.get_active_held_item()) usr.put_in_hands(scan) else scan.loc = get_turf(src) src.scan = null else - var/obj/item/I = usr.get_active_hand() + var/obj/item/I = usr.get_active_held_item() if(istype(I, /obj/item/weapon/card/id)) if(!usr.drop_item()) return diff --git a/code/game/machinery/computer/prisoner.dm b/code/game/machinery/computer/prisoner.dm index 8a837a5af5a..8502e90f4f5 100644 --- a/code/game/machinery/computer/prisoner.dm +++ b/code/game/machinery/computer/prisoner.dm @@ -93,7 +93,7 @@ if(href_list["id"]) if(href_list["id"] =="insert" && !inserted_id) - var/obj/item/weapon/card/id/prisoner/I = usr.get_active_hand() + var/obj/item/weapon/card/id/prisoner/I = usr.get_active_held_item() if(istype(I)) if(!usr.drop_item()) return diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index eaebcd0ac80..d1b5a3e5baa 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -295,13 +295,13 @@ What a mess.*/ if("Confirm Identity") if(scan) - if(istype(usr,/mob/living/carbon/human) && !usr.get_active_hand()) + if(istype(usr,/mob/living/carbon/human) && !usr.get_active_held_item()) usr.put_in_hands(scan) else scan.loc = get_turf(src) scan = null else - var/obj/item/I = usr.get_active_hand() + var/obj/item/I = usr.get_active_held_item() if(istype(I, /obj/item/weapon/card/id)) if(!usr.drop_item()) return @@ -740,8 +740,8 @@ What a mess.*/ if(selection) P = new() P.photocreate(selection.fields["icon"], selection.fields["img"], selection.fields["desc"]) - else if(istype(user.get_active_hand(), /obj/item/weapon/photo)) - P = user.get_active_hand() + else if(istype(user.get_active_held_item(), /obj/item/weapon/photo)) + P = user.get_active_held_item() return P /obj/machinery/computer/secure_data/emp_act(severity) diff --git a/code/game/machinery/computer/telecrystalconsoles.dm b/code/game/machinery/computer/telecrystalconsoles.dm index dd535921ff4..abba2eb90ce 100644 --- a/code/game/machinery/computer/telecrystalconsoles.dm +++ b/code/game/machinery/computer/telecrystalconsoles.dm @@ -34,7 +34,7 @@ var/list/possible_uplinker_IDs = list("Alfa","Bravo","Charlie","Delta","Echo","F user << "The [src] already has an uplink in it." return if(O.hidden_uplink) - var/obj/item/I = user.get_active_hand() + var/obj/item/I = user.get_active_held_item() if(!user.drop_item()) return uplinkholder = I diff --git a/code/game/machinery/gulag_item_reclaimer.dm b/code/game/machinery/gulag_item_reclaimer.dm index 47dbfd4e80b..cedab21e73e 100644 --- a/code/game/machinery/gulag_item_reclaimer.dm +++ b/code/game/machinery/gulag_item_reclaimer.dm @@ -81,14 +81,14 @@ switch(action) if("handle_id") if(inserted_id) - if(!usr.get_active_hand()) + if(!usr.get_active_held_item()) usr.put_in_hands(inserted_id) inserted_id = null else inserted_id.forceMove(get_turf(src)) inserted_id = null else - var/obj/item/I = usr.get_active_hand() + var/obj/item/I = usr.get_active_held_item() if(istype(I, /obj/item/weapon/card/id/prisoner)) if(!usr.drop_item()) return diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index 359893bdbb6..bf6a43b8d6c 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -791,8 +791,8 @@ var/list/obj/machinery/newscaster/allCasters = list() else qdel(photo) photo = null - if(istype(user.get_active_hand(), /obj/item/weapon/photo)) - photo = user.get_active_hand() + if(istype(user.get_active_held_item(), /obj/item/weapon/photo)) + photo = user.get_active_held_item() if(!user.drop_item()) return photo.loc = src diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index c76ef4b40ef..e482fa45c3f 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -548,10 +548,7 @@ if(allowed(perp) && !lasercolor) //if the perp has security access, return 0 return 0 - if((istype(perp.l_hand, /obj/item/weapon/gun) && !istype(perp.l_hand, /obj/item/weapon/gun/projectile/revolver/doublebarrel)) || istype(perp.l_hand, /obj/item/weapon/melee/baton)) - threatcount += 4 - - if((istype(perp.r_hand, /obj/item/weapon/gun) && !istype(perp.r_hand, /obj/item/weapon/gun/projectile/revolver/doublebarrel)) || istype(perp.r_hand, /obj/item/weapon/melee/baton)) + if(perp.is_holding_item_of_type(/obj/item/weapon/gun) || perp.is_holding_item_of_type(/obj/item/weapon/melee/baton)) threatcount += 4 if(istype(perp.belt, /obj/item/weapon/gun) || istype(perp.belt, /obj/item/weapon/melee/baton)) @@ -561,7 +558,7 @@ threatcount = 0 //But does not target anyone else if(istype(perp.wear_suit, /obj/item/clothing/suit/redtag)) threatcount += 4 - if(istype(perp.r_hand,/obj/item/weapon/gun/energy/laser/redtag) || istype(perp.l_hand,/obj/item/weapon/gun/energy/laser/redtag)) + if(perp.is_holding_item_of_type(/obj/item/weapon/gun/energy/laser/redtag)) threatcount += 4 if(istype(perp.belt, /obj/item/weapon/gun/energy/laser/redtag)) threatcount += 2 @@ -570,7 +567,7 @@ threatcount = 0 if(istype(perp.wear_suit, /obj/item/clothing/suit/bluetag)) threatcount += 4 - if((istype(perp.r_hand,/obj/item/weapon/gun/energy/laser/bluetag)) || (istype(perp.l_hand,/obj/item/weapon/gun/energy/laser/bluetag))) + if(perp.is_holding_item_of_type(/obj/item/weapon/gun/energy/laser/bluetag)) threatcount += 4 if(istype(perp.belt, /obj/item/weapon/gun/energy/laser/bluetag)) threatcount += 2 diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index 4c930c8326a..4f2ab34d4cb 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -147,7 +147,7 @@ return else // insert cell - var/obj/item/weapon/stock_parts/cell/C = usr.get_active_hand() + var/obj/item/weapon/stock_parts/cell/C = usr.get_active_held_item() if(istype(C)) if(!user.drop_item()) return diff --git a/code/game/machinery/telecomms/machine_interactions.dm b/code/game/machinery/telecomms/machine_interactions.dm index fcc819ba72a..90986ffcdff 100644 --- a/code/game/machinery/telecomms/machine_interactions.dm +++ b/code/game/machinery/telecomms/machine_interactions.dm @@ -44,7 +44,7 @@ // You need a multitool to use this, or be silicon if(!issilicon(user)) // istype returns false if the value is null - if(!istype(user.get_active_hand(), /obj/item/device/multitool)) + if(!istype(user.get_active_held_item(), /obj/item/device/multitool)) return if(stat & (BROKEN|NOPOWER)) @@ -133,14 +133,14 @@ var/obj/item/device/multitool/P = null // Let's double check - if(!issilicon(user) && istype(user.get_active_hand(), /obj/item/device/multitool)) - P = user.get_active_hand() + if(!issilicon(user) && istype(user.get_active_held_item(), /obj/item/device/multitool)) + P = user.get_active_held_item() else if(isAI(user)) var/mob/living/silicon/ai/U = user P = U.aiMulti else if(isrobot(user) && in_range(user, src)) - if(istype(user.get_active_hand(), /obj/item/device/multitool)) - P = user.get_active_hand() + if(istype(user.get_active_held_item(), /obj/item/device/multitool)) + P = user.get_active_held_item() return P // Additional Options for certain machines. Use this when you want to add an option to a specific machine. @@ -209,7 +209,7 @@ return if(!issilicon(usr)) - if(!istype(usr.get_active_hand(), /obj/item/device/multitool)) + if(!istype(usr.get_active_held_item(), /obj/item/device/multitool)) return var/obj/item/device/multitool/P = get_multitool(usr) diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index cbe9df81329..95e8c2d397c 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -426,7 +426,7 @@ return coin.loc = loc - if(!usr.get_active_hand()) + if(!usr.get_active_held_item()) usr.put_in_hands(coin) usr << "You remove [coin] from [src]." coin = null diff --git a/code/game/objects/effects/mines.dm b/code/game/objects/effects/mines.dm index 9c69cce7fbe..eef512c6f04 100644 --- a/code/game/objects/effects/mines.dm +++ b/code/game/objects/effects/mines.dm @@ -130,8 +130,7 @@ var/obj/item/weapon/twohanded/required/chainsaw/doomslayer/chainsaw = new(victim.loc) chainsaw.flags |= NODROP - victim.drop_r_hand() - victim.drop_l_hand() + victim.drop_all_held_items() victim.put_in_hands(chainsaw) chainsaw.attack_self(victim) chainsaw.wield(victim) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 13e9444175c..a4b4e625832 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -229,7 +229,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s user << "You put out the fire on [src]." else user << "You burn your hand on [src]!" - var/obj/item/bodypart/affecting = H.get_bodypart("[user.hand ? "l" : "r" ]_arm") + var/obj/item/bodypart/affecting = H.get_bodypart("[(user.active_hand_index % 2 == 0) ? "r" : "l" ]_arm") if(affecting && affecting.take_damage( 0, 5 )) // 5 burn damage H.update_damage_overlays(0) H.updatehealth() @@ -367,7 +367,7 @@ obj/item/proc/item_action_slot_check(slot, mob/user) if(usr.incapacitated() || !Adjacent(usr) || usr.lying) return - if(usr.get_active_hand() == null) // Let me know if this has any problems -Yota + if(usr.get_active_held_item() == null) // Let me know if this has any problems -Yota usr.UnarmedAttack(src) //This proc is executed when someone clicks the on-screen UI button. @@ -545,11 +545,7 @@ obj/item/proc/item_action_slot_check(slot, mob/user) if(ismob(location)) var/mob/M = location var/success = FALSE - if(src == M.get_item_by_slot(slot_l_hand)) - success = TRUE - else if(src == M.get_item_by_slot(slot_r_hand)) - success = TRUE - else if(src == M.get_item_by_slot(slot_wear_mask)) + if(src == M.get_item_by_slot(slot_wear_mask)) success = TRUE if(success) location = get_turf(M) diff --git a/code/game/objects/items/bodybag.dm b/code/game/objects/items/bodybag.dm index 3edc3ea2f25..4a8412696f8 100644 --- a/code/game/objects/items/bodybag.dm +++ b/code/game/objects/items/bodybag.dm @@ -41,7 +41,7 @@ /obj/structure/closet/body_bag/attackby(obj/item/I, mob/user, params) if (istype(I, /obj/item/weapon/pen) || istype(I, /obj/item/toy/crayon)) var/t = stripped_input(user, "What would you like the label to be?", name, null, 53) - if(user.get_active_hand() != I) + if(user.get_active_held_item() != I) return if(!in_range(src, user) && loc != user) return diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index a1ded3061aa..b7ce1e4a737 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -708,7 +708,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if(O) if (istype(loc, /mob)) var/mob/M = loc - if(M.get_active_hand() == null) + if(M.get_active_held_item() == null) M.put_in_hands(O) usr << "You remove \the [O] from \the [src]." return @@ -721,14 +721,14 @@ var/global/list/obj/item/device/pda/PDAs = list() if (id) remove_id() else - var/obj/item/I = user.get_active_hand() + var/obj/item/I = user.get_active_held_item() if (istype(I, /obj/item/weapon/card/id)) if(!user.unEquip(I)) return 0 I.loc = src id = I else - var/obj/item/weapon/card/I = user.get_active_hand() + var/obj/item/weapon/card/I = user.get_active_held_item() if (istype(I, /obj/item/weapon/card/id) && I:registered_name) if(!user.unEquip(I)) return 0 diff --git a/code/game/objects/items/devices/taperecorder.dm b/code/game/objects/items/devices/taperecorder.dm index 2c61dff29a3..605caa32cd0 100644 --- a/code/game/objects/items/devices/taperecorder.dm +++ b/code/game/objects/items/devices/taperecorder.dm @@ -54,7 +54,7 @@ /obj/item/device/taperecorder/attack_hand(mob/user) if(loc == user) if(mytape) - if(user.l_hand != src && user.r_hand != src) + if(!user.is_holding(src)) ..() return eject(user) diff --git a/code/game/objects/items/latexballoon.dm b/code/game/objects/items/latexballoon.dm index 3950e17d5fa..5eba01086ed 100644 --- a/code/game/objects/items/latexballoon.dm +++ b/code/game/objects/items/latexballoon.dm @@ -16,8 +16,7 @@ return icon_state = "latexballon_blow" item_state = "latexballon" - user.update_inv_r_hand() - user.update_inv_l_hand() + user.update_inv_hands() user << "You blow up [src] with [tank]." air_contents = tank.remove_air_volume(3) @@ -29,8 +28,7 @@ item_state = "lgloves" if(istype(src.loc, /mob/living)) var/mob/living/user = src.loc - user.update_inv_r_hand() - user.update_inv_l_hand() + user.update_inv_hands() loc.assume_air(air_contents) /obj/item/latexballon/ex_act(severity, target) diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index b29313d8374..d133a66b612 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -107,7 +107,7 @@ var/obj/item/weapon/ed209_assembly/B = new /obj/item/weapon/ed209_assembly B.loc = get_turf(src) user << "You arm the robot frame." - if (user.get_inactive_hand()==src) + if (user.get_inactive_held_item()==src) user.unEquip(src) user.put_in_inactive_hand(B) qdel(src) @@ -300,7 +300,7 @@ return var/mob/living/living_user = usr - var/obj/item/item_in_hand = living_user.get_active_hand() + var/obj/item/item_in_hand = living_user.get_active_held_item() if(!istype(item_in_hand, /obj/item/device/multitool)) living_user << "You need a multitool!" return diff --git a/code/game/objects/items/stacks/rods.dm b/code/game/objects/items/stacks/rods.dm index b88420836fd..15c576c6335 100644 --- a/code/game/objects/items/stacks/rods.dm +++ b/code/game/objects/items/stacks/rods.dm @@ -49,7 +49,7 @@ var/global/list/datum/stack_recipe/rod_recipes = list ( \ "You hear welding.") var/obj/item/stack/rods/R = src src = null - var/replace = (user.get_inactive_hand()==R) + var/replace = (user.get_inactive_held_item()==R) R.use(2) if (!R && replace) user.put_in_hands(new_item) diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index 8a7f6b89919..1fd3e766c62 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -46,7 +46,7 @@ RG.add_fingerprint(user) var/obj/item/stack/sheet/glass/G = src src = null - var/replace = (user.get_inactive_hand()==G) + var/replace = (user.get_inactive_held_item()==G) V.use(1) G.use(1) if (!G && replace) @@ -316,7 +316,7 @@ var/mob/living/carbon/human/H = user if(!H.gloves && !(PIERCEIMMUNE in H.dna.species.specflags)) // golems, etc H << "[src] cuts into your hand!" - var/organ = (H.hand ? "l_" : "r_") + "arm" + var/organ = ((H.active_hand_index % 2 == 0) ? "r_" : "l_") + "arm" var/obj/item/bodypart/affecting = H.get_bodypart(organ) if(affecting && affecting.take_damage(force / 2)) H.update_damage_overlays(0) diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index 32c6709676d..9f742a68855 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -111,7 +111,7 @@ /obj/item/stack/Topic(href, href_list) ..() - if (usr.restrained() || usr.stat || (usr.get_active_hand() != src && usr.get_inactive_hand() != src)) + if (usr.restrained() || usr.stat || !usr.is_holding(src)) return if (href_list["make"]) if (src.get_amount() < 1) qdel(src) //Never should happen @@ -222,7 +222,7 @@ return ..() /obj/item/stack/attack_hand(mob/user) - if (user.get_inactive_hand() == src) + if (user.get_inactive_held_item() == src) if(zero_amount()) return change_stack(user,1) diff --git a/code/game/objects/items/stacks/tiles/tile_types.dm b/code/game/objects/items/stacks/tiles/tile_types.dm index 8d8b89760fe..b44b5a9a7cc 100644 --- a/code/game/objects/items/stacks/tiles/tile_types.dm +++ b/code/game/objects/items/stacks/tiles/tile_types.dm @@ -51,7 +51,7 @@ "You hear welding.") var/obj/item/stack/rods/R = src src = null - var/replace = (user.get_inactive_hand()==R) + var/replace = (user.get_inactive_held_item()==R) R.use(4) if (!R && replace) user.put_in_hands(new_item) @@ -64,7 +64,7 @@ "You hear welding.") var/obj/item/stack/rods/R = src src = null - var/replace = (user.get_inactive_hand()==R) + var/replace = (user.get_inactive_held_item()==R) R.use(4) if (!R && replace) user.put_in_hands(new_item) diff --git a/code/game/objects/items/stacks/wrap.dm b/code/game/objects/items/stacks/wrap.dm index 010498a77d8..dbb750e3018 100644 --- a/code/game/objects/items/stacks/wrap.dm +++ b/code/game/objects/items/stacks/wrap.dm @@ -47,7 +47,7 @@ var/obj/item/I = target if(istype(I, /obj/item/smallDelivery)) return - if(user.r_hand == I || user.l_hand == I) + if(user.is_holding(I)) if(!user.unEquip(I)) return else if(!isturf(I.loc)) diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index c81e8596a99..e2924db1ac9 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -260,12 +260,7 @@ if(active) icon_state = "swordrainbow" - // Updating overlays, copied from welder code. - // I tried calling attack_self twice, which looked cool, except it somehow didn't update the overlays!! - if(user.r_hand == src) - user.update_inv_r_hand(0) - else if(user.l_hand == src) - user.update_inv_l_hand(0) + user.update_inv_hands() else user << "It's already fabulous!" else @@ -777,11 +772,7 @@ var/obj/screen/inventory/hand/H = over_object if(!remove_item_from_storage(M)) M.unEquip(src) - switch(H.slot_id) - if(slot_r_hand) - M.put_in_r_hand(src) - if(slot_l_hand) - M.put_in_l_hand(src) + M.put_in_hand(src, H.held_index) usr << "You pick up the deck." else @@ -822,7 +813,7 @@ var/mob/living/carbon/human/cardUser = usr var/O = src if(href_list["pick"]) - if (cardUser.get_item_by_slot(slot_l_hand) == src || cardUser.get_item_by_slot(slot_r_hand) == src) + if (cardUser.is_holding(src)) var/choice = href_list["pick"] var/obj/item/toy/cards/singlecard/C = new/obj/item/toy/cards/singlecard(cardUser.loc) src.currenthand -= choice @@ -899,7 +890,7 @@ /obj/item/toy/cards/singlecard/examine(mob/user) if(ishuman(user)) var/mob/living/carbon/human/cardUser = user - if(cardUser.get_item_by_slot(slot_l_hand) == src || cardUser.get_item_by_slot(slot_r_hand) == src) + if(cardUser.is_holding(src)) cardUser.visible_message("[cardUser] checks \his card.", "The card reads: [src.cardname]") else cardUser << "You need to have the card in your hand to check it!" diff --git a/code/game/objects/items/weapons/chrono_eraser.dm b/code/game/objects/items/weapons/chrono_eraser.dm index fa1e6f26631..3ef008add20 100644 --- a/code/game/objects/items/weapons/chrono_eraser.dm +++ b/code/game/objects/items/weapons/chrono_eraser.dm @@ -126,7 +126,7 @@ var/obj/item/weapon/gun/energy/chrono_gun/gun = null /obj/item/projectile/energy/chrono_beam/fire() - gun = firer.get_active_hand() + gun = firer.get_active_held_item() if(istype(gun)) return ..() else diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm index 992ebfbcf4f..461d4cc2a33 100644 --- a/code/game/objects/items/weapons/cigs_lighters.dm +++ b/code/game/objects/items/weapons/cigs_lighters.dm @@ -193,8 +193,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM if(ismob(loc)) var/mob/M = loc M.update_inv_wear_mask() - M.update_inv_l_hand() - M.update_inv_r_hand() + M.update_inv_hands() /obj/item/clothing/mask/cigarette/proc/handle_reagents() @@ -472,7 +471,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM icon_state = lit ? "[icon_state]_on" : "[initial(icon_state)]" /obj/item/weapon/lighter/attack_self(mob/living/user) - if(user.r_hand == src || user.l_hand == src) + if(user.is_holding(src)) if(!lit) lit = 1 update_icon() @@ -486,7 +485,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM if(prob(75)) user.visible_message("After a few attempts, [user] manages to light [src].", "After a few attempts, you manage to light [src].") else - var/hitzone = user.r_hand == src ? "r_hand" : "l_hand" + var/hitzone = user.held_index_to_dir(user.active_hand_index) == "r" ? "r_hand" : "l_hand" user.apply_damage(5, BURN, hitzone) user.visible_message("After a few attempts, [user] manages to light [src] - they however burn their finger in the process.", "You burn yourself while lighting the lighter!") diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index 7ef5fffb1dd..07550fb00f8 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -94,20 +94,10 @@ var/mob/M = src.loc if(istype(over_object, /obj/screen/inventory/hand)) var/obj/screen/inventory/hand/H = over_object + if(!M.unEquip(src)) + return + M.put_in_hand(src, H.held_index) - switch(H.slot_id) - if(slot_r_hand) - if(M.r_hand) - return - if(!M.unEquip(src)) - return - M.put_in_r_hand(src) - if(slot_l_hand) - if(M.l_hand) - return - if(!M.unEquip(src)) - return - M.put_in_l_hand(src) /obj/item/weapon/defibrillator/attackby(obj/item/weapon/W, mob/user, params) if(W == paddles) @@ -334,7 +324,7 @@ if(!req_defib) return ..() if(user) - var/obj/item/weapon/twohanded/offhand/O = user.get_inactive_hand() + var/obj/item/weapon/twohanded/offhand/O = user.get_inactive_held_item() if(istype(O)) O.unwield() user << "The paddles snap back into the main unit." diff --git a/code/game/objects/items/weapons/explosives.dm b/code/game/objects/items/weapons/explosives.dm index 57a33afa574..d329b466cf3 100644 --- a/code/game/objects/items/weapons/explosives.dm +++ b/code/game/objects/items/weapons/explosives.dm @@ -60,7 +60,7 @@ /obj/item/weapon/c4/attack_self(mob/user) var/newtime = input(usr, "Please set the timer.", "Timer", 10) as num - if(user.get_active_hand() == src) + if(user.get_active_held_item() == src) newtime = Clamp(newtime, 10, 60000) timer = newtime user << "Timer set for [timer] seconds." diff --git a/code/game/objects/items/weapons/flamethrower.dm b/code/game/objects/items/weapons/flamethrower.dm index 9efc0a78ed1..9dbfce86b95 100644 --- a/code/game/objects/items/weapons/flamethrower.dm +++ b/code/game/objects/items/weapons/flamethrower.dm @@ -39,7 +39,7 @@ var/turf/location = loc if(istype(location, /mob/)) var/mob/M = location - if(M.l_hand == src || M.r_hand == src) + if(M.is_holding(src)) location = M.loc if(isturf(location)) //start a fire if possible location.hotspot_expose(700, 2) @@ -62,7 +62,7 @@ /obj/item/weapon/flamethrower/afterattack(atom/target, mob/user, flag) if(flag) return // too close // Make sure our user is still holding us - if(user && user.get_active_hand() == src) + if(user && user.get_active_held_item() == src) var/turf/target_turf = get_turf(target) if(target_turf) var/turflist = getline(user, target_turf) diff --git a/code/game/objects/items/weapons/grenades/plastic.dm b/code/game/objects/items/weapons/grenades/plastic.dm index 3af83500b67..4ec3541ce2f 100644 --- a/code/game/objects/items/weapons/grenades/plastic.dm +++ b/code/game/objects/items/weapons/grenades/plastic.dm @@ -60,7 +60,7 @@ nadeassembly.attack_self(user) return var/newtime = input(usr, "Please set the timer.", "Timer", 10) as num - if(user.get_active_hand() == src) + if(user.get_active_held_item() == src) newtime = Clamp(newtime, 10, 60000) det_time = newtime user << "Timer set for [det_time] seconds." diff --git a/code/game/objects/items/weapons/implants/implantcase.dm b/code/game/objects/items/weapons/implants/implantcase.dm index e7426b2184d..eca8a792f41 100644 --- a/code/game/objects/items/weapons/implants/implantcase.dm +++ b/code/game/objects/items/weapons/implants/implantcase.dm @@ -26,7 +26,7 @@ /obj/item/weapon/implantcase/attackby(obj/item/weapon/W, mob/user, params) if(istype(W, /obj/item/weapon/pen)) var/t = stripped_input(user, "What would you like the label to be?", name, null) - if(user.get_active_hand() != W) + if(user.get_active_held_item() != W) return if(!in_range(src, user) && loc != user) return diff --git a/code/game/objects/items/weapons/implants/implanter.dm b/code/game/objects/items/weapons/implants/implanter.dm index d94709d2a46..f35bc2929dd 100644 --- a/code/game/objects/items/weapons/implants/implanter.dm +++ b/code/game/objects/items/weapons/implants/implanter.dm @@ -42,7 +42,7 @@ /obj/item/weapon/implanter/attackby(obj/item/weapon/W, mob/user, params) if(istype(W, /obj/item/weapon/pen)) var/t = stripped_input(user, "What would you like the label to be?", name, null) - if(user.get_active_hand() != W) + if(user.get_active_held_item() != W) return if(!in_range(src, user) && loc != user) return diff --git a/code/game/objects/items/weapons/implants/implantpad.dm b/code/game/objects/items/weapons/implants/implantpad.dm index 04287893b4f..5b11165fe2d 100644 --- a/code/game/objects/items/weapons/implants/implantpad.dm +++ b/code/game/objects/items/weapons/implants/implantpad.dm @@ -20,7 +20,7 @@ /obj/item/weapon/implantpad/attack_hand(mob/user) - if(case && (user.l_hand == src || user.r_hand == src)) + if(case && user.is_holding(src)) user.put_in_active_hand(case) case.add_fingerprint(user) diff --git a/code/game/objects/items/weapons/melee/energy.dm b/code/game/objects/items/weapons/melee/energy.dm index 0cc98cd62a3..106d91fdd73 100644 --- a/code/game/objects/items/weapons/melee/energy.dm +++ b/code/game/objects/items/weapons/melee/energy.dm @@ -202,12 +202,7 @@ if(active) icon_state = "swordrainbow" - // Updating overlays, copied from welder code. - // I tried calling attack_self twice, which looked cool, except it somehow didn't update the overlays!! - if(user.r_hand == src) - user.update_inv_r_hand(0) - else if(user.l_hand == src) - user.update_inv_l_hand(0) + user.update_inv_hands() else user << "It's already fabulous!" else diff --git a/code/game/objects/items/weapons/paint.dm b/code/game/objects/items/weapons/paint.dm index a62d5d5603f..bab00418b8c 100644 --- a/code/game/objects/items/weapons/paint.dm +++ b/code/game/objects/items/weapons/paint.dm @@ -57,7 +57,7 @@ /obj/item/weapon/paint/anycolor/attack_self(mob/user) var/t1 = input(user, "Please select a color:", "Locking Computer", null) in list( "red", "blue", "green", "yellow", "violet", "black", "white") - if ((user.get_active_hand() != src || user.stat || user.restrained())) + if ((user.get_active_held_item() != src || user.stat || user.restrained())) return switch(t1) if("red") diff --git a/code/game/objects/items/weapons/storage/boxes.dm b/code/game/objects/items/weapons/storage/boxes.dm index 0e6eb3470e7..47306dd27eb 100644 --- a/code/game/objects/items/weapons/storage/boxes.dm +++ b/code/game/objects/items/weapons/storage/boxes.dm @@ -47,8 +47,7 @@ var/obj/item/I = new foldable(get_turf(src)) user.drop_item() user.put_in_hands(I) - user.update_inv_l_hand() - user.update_inv_r_hand() + user.update_inv_hands() qdel(src) /obj/item/weapon/storage/box/attackby(obj/item/W, mob/user, params) diff --git a/code/game/objects/items/weapons/storage/fancy.dm b/code/game/objects/items/weapons/storage/fancy.dm index bce4035beb7..fd8d6395ec5 100644 --- a/code/game/objects/items/weapons/storage/fancy.dm +++ b/code/game/objects/items/weapons/storage/fancy.dm @@ -133,7 +133,7 @@ name = "\improper [name] packet" /obj/item/weapon/storage/fancy/cigarettes/AltClick(mob/user) - if(user.get_active_hand()) + if(user.get_active_held_item()) return for(var/obj/item/weapon/lighter/lighter in src) remove_from_storage(lighter, user.loc) diff --git a/code/game/objects/items/weapons/storage/firstaid.dm b/code/game/objects/items/weapons/storage/firstaid.dm index 582216e817d..1003d6aa62c 100644 --- a/code/game/objects/items/weapons/storage/firstaid.dm +++ b/code/game/objects/items/weapons/storage/firstaid.dm @@ -142,11 +142,7 @@ var/obj/screen/inventory/hand/H = over_object if(!M.unEquip(src)) return - switch(H.slot_id) - if(slot_r_hand) - M.put_in_r_hand(src) - if(slot_l_hand) - M.put_in_l_hand(src) + M.put_in_hand(src,H.held_index) src.add_fingerprint(usr) return if(over_object == usr && in_range(src, usr) || usr.contents.Find(src)) diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index 73869507264..c5a9427244e 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -61,11 +61,7 @@ var/obj/screen/inventory/hand/H = over_object if(!M.unEquip(src)) return - switch(H.slot_id) - if(slot_r_hand) - M.put_in_r_hand(src) - if(slot_l_hand) - M.put_in_l_hand(src) + M.put_in_hand(src,H.held_index) add_fingerprint(usr) @@ -75,7 +71,7 @@ var/obj/item/I = O if(iscarbon(user) || isdrone(user)) var/mob/living/L = user - if(!L.incapacitated() && I == L.get_active_hand()) + if(!L.incapacitated() && I == L.get_active_held_item()) if(can_be_inserted(I, 0)) handle_item_insertion(I, 0 , L) @@ -439,11 +435,11 @@ if(ishuman(user)) var/mob/living/carbon/human/H = user - if(H.l_store == src && !H.get_active_hand()) //Prevents opening if it's in a pocket. + if(H.l_store == src && !H.get_active_held_item()) //Prevents opening if it's in a pocket. H.put_in_hands(src) H.l_store = null return - if(H.r_store == src && !H.get_active_hand()) + if(H.r_store == src && !H.get_active_held_item()) H.put_in_hands(src) H.r_store = null return @@ -542,7 +538,7 @@ /obj/item/weapon/storage/attack_self(mob/user) //Clicking on itself will empty it, if it has the verb to do that. - if(user.get_active_hand() == src) + if(user.get_active_held_item() == src) if(verbs.Find(/obj/item/weapon/storage/verb/quick_empty)) quick_empty() diff --git a/code/game/objects/items/weapons/tanks/watertank.dm b/code/game/objects/items/weapons/tanks/watertank.dm index 49cb244c150..86404905456 100644 --- a/code/game/objects/items/weapons/tanks/watertank.dm +++ b/code/game/objects/items/weapons/tanks/watertank.dm @@ -83,19 +83,10 @@ var/mob/M = src.loc if(istype(M) && istype(over_object, /obj/screen/inventory/hand)) var/obj/screen/inventory/hand/H = over_object - switch(H.slot_id) - if(slot_r_hand) - if(M.r_hand) - return - if(!M.unEquip(src)) - return - M.put_in_r_hand(src) - if(slot_l_hand) - if(M.l_hand) - return - if(!M.unEquip(src)) - return - M.put_in_l_hand(src) + if(!M.unEquip(src)) + return + M.put_in_hand(src, H.held_index) + /obj/item/weapon/watertank/attackby(obj/item/W, mob/user, params) if(W == noz) diff --git a/code/game/objects/items/weapons/teleportation.dm b/code/game/objects/items/weapons/teleportation.dm index 010e07df9a7..b0b0e8ac781 100644 --- a/code/game/objects/items/weapons/teleportation.dm +++ b/code/game/objects/items/weapons/teleportation.dm @@ -165,7 +165,7 @@ Frequency: if(turfs.len) L["None (Dangerous)"] = pick(turfs) var/t1 = input(user, "Please select a teleporter to lock in on.", "Hand Teleporter") in L - if (user.get_active_hand() != src || user.incapacitated()) + if (user.get_active_held_item() != src || user.incapacitated()) return if(active_portals >= 3) user.show_message("\The [src] is recharging!") diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index d57c948c746..906af763df6 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -363,8 +363,7 @@ //mob icon update if(ismob(loc)) var/mob/M = loc - M.update_inv_r_hand(0) - M.update_inv_l_hand(0) + M.update_inv_hands(0) return 0 return 1 diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index 544613b54ea..b7b71cf6266 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -49,7 +49,7 @@ user << "You are now carrying the [name] with one hand." if(unwieldsound) playsound(loc, unwieldsound, 50, 1) - var/obj/item/weapon/twohanded/offhand/O = user.get_inactive_hand() + var/obj/item/weapon/twohanded/offhand/O = user.get_inactive_held_item() if(O && istype(O)) O.unwield() return @@ -60,7 +60,7 @@ if(istype(user,/mob/living/carbon/monkey) ) user << "It's too heavy for you to wield fully." return - if(user.get_inactive_hand()) + if(user.get_inactive_held_item()) user << "You need your other hand to be empty!" return if(user.get_num_arms() < 2) @@ -87,7 +87,7 @@ ..() //handles unwielding a twohanded weapon when dropped as well as clearing up the offhand if(user) - var/obj/item/weapon/twohanded/O = user.get_inactive_hand() + var/obj/item/weapon/twohanded/O = user.get_inactive_held_item() if(istype(O)) O.unwield(user) return unwield(user) @@ -135,7 +135,7 @@ return ..() /obj/item/weapon/twohanded/required/attack_hand(mob/user)//Can't even pick it up without both hands empty - var/obj/item/weapon/twohanded/required/H = user.get_inactive_hand() + var/obj/item/weapon/twohanded/required/H = user.get_inactive_held_item() if(get_dist(src,user) > 1) return 0 if(H != null) @@ -147,7 +147,7 @@ /obj/item/weapon/twohanded/required/equipped(mob/user, slot) ..() - if(slot == slot_l_hand || slot == slot_r_hand) + if(slot == slot_hands) wield(user) else unwield(user) @@ -431,9 +431,8 @@ else hitsound = "swing_hit" - if(src == user.get_active_hand()) //update inhands - user.update_inv_l_hand() - user.update_inv_r_hand() + if(src == user.get_active_held_item()) //update inhands + user.update_inv_hands() for(var/X in actions) var/datum/action/A = X A.UpdateButtonIcon() diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index 2c9ebb0f9ba..c2904d8e37b 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -64,7 +64,7 @@ if(user.canmove) climb_structure(user) return - if ((!( istype(O, /obj/item/weapon) ) || user.get_active_hand() != O)) + if ((!( istype(O, /obj/item/weapon) ) || user.get_active_held_item() != O)) return if(isrobot(user)) return diff --git a/code/game/objects/structures/guncase.dm b/code/game/objects/structures/guncase.dm index 598c5562e03..abaebce5de3 100644 --- a/code/game/objects/structures/guncase.dm +++ b/code/game/objects/structures/guncase.dm @@ -80,10 +80,8 @@ if(!usr.canUseTopic(src)) return if(ishuman(usr)) - if(!usr.get_active_hand()) - usr.put_in_hands(O) - else - O.loc = get_turf(src) + if(!usr.put_in_hands(O)) + O.forceMove(get_turf(src)) update_icon() /obj/structure/guncase/shotgun diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 7a7b200ab39..c16ae3f1401 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -66,7 +66,7 @@ add_fingerprint(user) if(istype(P, /obj/item/weapon/pen)) var/t = stripped_input(user, "What would you like the label to be?", text("[]", name), null) - if (user.get_active_hand() != P) + if (user.get_active_held_item() != P) return if ((!in_range(src, usr) && src.loc != user)) return diff --git a/code/game/objects/structures/noticeboard.dm b/code/game/objects/structures/noticeboard.dm index 8a7ce0ad0dd..411ea3ec003 100644 --- a/code/game/objects/structures/noticeboard.dm +++ b/code/game/objects/structures/noticeboard.dm @@ -60,15 +60,12 @@ var/obj/item/P = locate(href_list["write"]) if((P && P.loc == src)) //ifthe paper's on the board - if(istype(usr.r_hand, /obj/item/weapon/pen)) //and you're holding a pen + var/obj/item/I = usr.is_holding_item_of_type(/obj/item/weapon/pen) + if(I) //check hand for pen add_fingerprint(usr) - P.attackby(usr.r_hand, usr) //then do ittttt + P.attackby(I, usr) else - if(istype(usr.l_hand, /obj/item/weapon/pen)) //check other hand for pen - add_fingerprint(usr) - P.attackby(usr.l_hand, usr) - else - usr << "You'll need something to write with!" + usr << "You'll need something to write with!" if(href_list["read"]) var/obj/item/weapon/paper/P = locate(href_list["read"]) diff --git a/code/game/objects/structures/safe.dm b/code/game/objects/structures/safe.dm index 8cd1b6b101d..5b1acebb898 100644 --- a/code/game/objects/structures/safe.dm +++ b/code/game/objects/structures/safe.dm @@ -91,7 +91,7 @@ FLOOR SAFES var/mob/living/carbon/human/user = usr var/canhear = 0 - if(istype(user.l_hand, /obj/item/clothing/tie/stethoscope) || istype(user.r_hand, /obj/item/clothing/tie/stethoscope)) + if(user.is_holding_item_of_type(/obj/item/clothing/tie/stethoscope)) canhear = 1 if(href_list["open"]) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index d1ff3fbe443..ed406cc22aa 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -484,7 +484,7 @@ . = . || mover.checkpass(PASSTABLE) /obj/structure/rack/MouseDrop_T(obj/O, mob/user) - if ((!( istype(O, /obj/item/weapon) ) || user.get_active_hand() != O)) + if ((!( istype(O, /obj/item/weapon) ) || user.get_active_held_item() != O)) return if(!user.drop_item()) return diff --git a/code/game/objects/structures/target_stake.dm b/code/game/objects/structures/target_stake.dm index 0a0d96eac20..8814ec13fb6 100644 --- a/code/game/objects/structures/target_stake.dm +++ b/code/game/objects/structures/target_stake.dm @@ -41,7 +41,7 @@ pinned_target.nullPinnedLoc() nullPinnedTarget() if(ishuman(user)) - if(!user.get_active_hand()) + if(!user.get_active_held_item()) user.put_in_hands(pinned_target) user << "You take the target out of the stake." else diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index c65cd051b5d..269bae4878b 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -251,10 +251,8 @@ var/mob/living/carbon/M = L . = 1 check_heat(M) - if(M.r_hand) - M.r_hand.clean_blood() - if(M.l_hand) - M.l_hand.clean_blood() + for(var/obj/item/I in M.held_items) + I.clean_blood() if(M.back) if(M.back.clean_blood()) M.update_inv_back(0) diff --git a/code/game/turfs/open.dm b/code/game/turfs/open.dm index 07d70bfc4b7..6d164565ac9 100644 --- a/code/game/turfs/open.dm +++ b/code/game/turfs/open.dm @@ -100,8 +100,8 @@ if(!(lube&SLIDE_ICE)) playsound(C.loc, 'sound/misc/slip.ogg', 50, 1, -3) - C.accident(C.l_hand) - C.accident(C.r_hand) + for(var/obj/item/I in C.held_items) + C.accident(I) var/olddir = C.dir if(!(lube&SLIDE_ICE)) diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 9b5f0026e1a..e1da895de41 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -182,7 +182,7 @@ if(do_after(user, slicing_duration/W.toolspeed, target = src)) if( !istype(src, /turf/closed/wall) || !user || !WT || !WT.isOn() || !T ) return 1 - if( user.loc == T && user.get_active_hand() == WT ) + if( user.loc == T && user.get_active_held_item() == WT ) user << "You remove the outer plating." dismantle_wall() return 1 @@ -192,7 +192,7 @@ if(do_after(user, slicing_duration*0.6, target = src)) // plasma cutter is faster than welding tool if( !istype(src, /turf/closed/wall) || !user || !W || !T ) return 1 - if( user.loc == T && user.get_active_hand() == W ) + if( user.loc == T && user.get_active_held_item() == W ) user << "You remove the outer plating." dismantle_wall() visible_message("The wall was sliced apart by [user]!", "You hear metal being sliced apart.") @@ -205,7 +205,7 @@ var/obj/item/weapon/pickaxe/drill/jackhammer/D = W if( !istype(src, /turf/closed/wall) || !user || !W || !T ) return 1 - if( user.loc == T && user.get_active_hand() == W ) + if( user.loc == T && user.get_active_held_item() == W ) D.playDigSound() dismantle_wall() visible_message("[user] smashes through the [name] with the [W.name]!", "You hear the grinding of metal.") diff --git a/code/game/turfs/simulated/walls_reinforced.dm b/code/game/turfs/simulated/walls_reinforced.dm index 0212e8f32d2..cfcaf0159c8 100644 --- a/code/game/turfs/simulated/walls_reinforced.dm +++ b/code/game/turfs/simulated/walls_reinforced.dm @@ -38,7 +38,7 @@ if(do_after(user, 50, target = src)) if( !istype(src, /turf/closed/wall/r_wall) || !user || !W || !T ) return 1 - if( user.loc == T && user.get_active_hand() == W ) + if( user.loc == T && user.get_active_held_item() == W ) D.playDigSound() visible_message("[user] smashes through the [name] with the [D.name]!", "You hear the grinding of metal.") dismantle_wall() @@ -80,7 +80,7 @@ if( !istype(src, /turf/closed/wall/r_wall) || !user || !W || !T ) return 1 - if( d_state == 1 && user.loc == T && user.get_active_hand() == W ) + if( d_state == 1 && user.loc == T && user.get_active_held_item() == W ) src.d_state = 2 update_icon() user << "You remove the support lines." @@ -111,7 +111,7 @@ if( !istype(src, /turf/closed/wall/r_wall) || !user || !WT || !WT.isOn() || !T ) return 0 - if( d_state == 2 && user.loc == T && user.get_active_hand() == WT ) + if( d_state == 2 && user.loc == T && user.get_active_held_item() == WT ) src.d_state = 3 update_icon() user << "You press firmly on the cover, dislodging it." @@ -126,7 +126,7 @@ if( !istype(src, /turf/closed/wall/r_wall) || !user || !W || !T ) return 1 - if( d_state == 2 && user.loc == T && user.get_active_hand() == W ) + if( d_state == 2 && user.loc == T && user.get_active_held_item() == W ) src.d_state = 3 update_icon() user << "You press firmly on the cover, dislodging it." @@ -142,7 +142,7 @@ if( !istype(src, /turf/closed/wall/r_wall) || !user || !W || !T ) return 1 - if( d_state == 3 && user.loc == T && user.get_active_hand() == W ) + if( d_state == 3 && user.loc == T && user.get_active_held_item() == W ) src.d_state = 4 update_icon() user << "You pry off the cover." @@ -158,7 +158,7 @@ if( !istype(src, /turf/closed/wall/r_wall) || !user || !W || !T ) return 1 - if( d_state == 4 && user.loc == T && user.get_active_hand() == W ) + if( d_state == 4 && user.loc == T && user.get_active_held_item() == W ) src.d_state = 5 update_icon() user << "You remove the bolts anchoring the support rods." @@ -176,7 +176,7 @@ if( !istype(src, /turf/closed/wall/r_wall) || !user || !WT || !WT.isOn() || !T ) return 1 - if( d_state == 5 && user.loc == T && user.get_active_hand() == WT ) + if( d_state == 5 && user.loc == T && user.get_active_held_item() == WT ) src.d_state = 6 update_icon() user << "You slice through the support rods." @@ -191,7 +191,7 @@ if( !istype(src, /turf/closed/wall/r_wall) || !user || !W || !T ) return 1 - if( d_state == 5 && user.loc == T && user.get_active_hand() == W ) + if( d_state == 5 && user.loc == T && user.get_active_held_item() == W ) src.d_state = 6 update_icon() user << "You slice through the support rods." @@ -207,7 +207,7 @@ if( !istype(src, /turf/closed/wall/r_wall) || !user || !W || !T ) return 1 - if( user.loc == T && user.get_active_hand() == W ) + if( user.loc == T && user.get_active_held_item() == W ) user << "You pry off the outer sheath." dismantle_wall() return 1 diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 0f88f315ee3..f81cebf3259 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1735,17 +1735,15 @@ usr << "This can only be used on instances of type /mob/living/carbon/human." return - H.equip_to_slot_or_del( new /obj/item/weapon/reagent_containers/food/snacks/cookie(H), slot_l_hand ) - if(!(istype(H.l_hand,/obj/item/weapon/reagent_containers/food/snacks/cookie))) - H.equip_to_slot_or_del( new /obj/item/weapon/reagent_containers/food/snacks/cookie(H), slot_r_hand ) - if(!(istype(H.r_hand,/obj/item/weapon/reagent_containers/food/snacks/cookie))) - log_admin("[key_name(H)] has their hands full, so they did not receive their cookie, spawned by [key_name(src.owner)].") - message_admins("[key_name(H)] has their hands full, so they did not receive their cookie, spawned by [key_name(src.owner)].") - return - else - H.update_inv_r_hand()//To ensure the icon appears in the HUD + var/obj/item/weapon/reagent_containers/food/snacks/cookie/cookie = new(H) + if(H.put_in_hands(cookie)) + H.update_inv_hands() else - H.update_inv_l_hand() + qdel(cookie) + log_admin("[key_name(H)] has their hands full, so they did not receive their cookie, spawned by [key_name(src.owner)].") + message_admins("[key_name(H)] has their hands full, so they did not receive their cookie, spawned by [key_name(src.owner)].") + return + log_admin("[key_name(H)] got their cookie, spawned by [key_name(src.owner)].") message_admins("[key_name(H)] got their cookie, spawned by [key_name(src.owner)].") feedback_inc("admin_cookies_spawned",1) diff --git a/code/modules/admin/verbs/onlyone.dm b/code/modules/admin/verbs/onlyone.dm index bddc973b359..affb6b57bc9 100644 --- a/code/modules/admin/verbs/onlyone.dm +++ b/code/modules/admin/verbs/onlyone.dm @@ -76,11 +76,11 @@ var/obj/item/slot_item_ID = H.get_item_by_slot(slot_wear_id) qdel(slot_item_ID) - var/obj/item/slot_item_hand = H.get_item_by_slot(slot_r_hand) + var/obj/item/slot_item_hand = H.get_item_for_held_index(2) H.unEquip(slot_item_hand) var /obj/item/weapon/multisword/multi = new(H) - H.equip_to_slot_or_del(multi, slot_r_hand) + H.put_in_hands_or_del(multi) var/obj/item/weapon/card/id/W = new(H) W.icon_state = "centcom" diff --git a/code/modules/assembly/mousetrap.dm b/code/modules/assembly/mousetrap.dm index fb643f482bc..30adb230404 100644 --- a/code/modules/assembly/mousetrap.dm +++ b/code/modules/assembly/mousetrap.dm @@ -78,7 +78,7 @@ else if(((user.getBrainLoss() >= 60) || user.disabilities & CLUMSY) && prob(50)) var/which_hand = "l_hand" - if(!user.hand) + if(!(user.active_hand_index % 2)) which_hand = "r_hand" triggered(user, which_hand) user.visible_message("[user] accidentally sets off [src], breaking their fingers.", \ @@ -94,7 +94,7 @@ if(armed) if(((user.getBrainLoss() >= 60) || user.disabilities & CLUMSY) && prob(50)) var/which_hand = "l_hand" - if(!user.hand) + if(!(user.active_hand_index % 2)) which_hand = "r_hand" triggered(user, which_hand) user.visible_message("[user] accidentally sets off [src], breaking their fingers.", \ @@ -124,7 +124,7 @@ if(armed) finder.visible_message("[finder] accidentally sets off [src], breaking their fingers.", \ "You accidentally trigger [src]!") - triggered(finder, finder.hand ? "l_hand" : "r_hand") + triggered(finder, (finder.active_hand_index % 2 == 0) ? "r_hand" : "l_hand") return 1 //end the search! return 0 diff --git a/code/modules/awaymissions/corpse.dm b/code/modules/awaymissions/corpse.dm index ab8058af8a3..a2eef743256 100644 --- a/code/modules/awaymissions/corpse.dm +++ b/code/modules/awaymissions/corpse.dm @@ -154,9 +154,9 @@ if(back) H.equip_to_slot_or_del(new back(H), slot_back) if(l_hand) - H.equip_to_slot_or_del(new l_hand(H), slot_l_hand) + H.put_in_hands_or_del(new l_hand(H)) if(r_hand) - H.equip_to_slot_or_del(new r_hand(H), slot_r_hand) + H.put_in_hands_or_del(new r_hand(H)) if(has_id) var/obj/item/weapon/card/id/W = new(H) if(id_icon) diff --git a/code/modules/awaymissions/super_secret_room.dm b/code/modules/awaymissions/super_secret_room.dm index 2e0c60acf3c..2e4e1101163 100644 --- a/code/modules/awaymissions/super_secret_room.dm +++ b/code/modules/awaymissions/super_secret_room.dm @@ -105,7 +105,7 @@ /obj/item/rupee/Crossed(mob/M) if(M.put_in_hands(src)) - if(src != M.get_active_hand()) + if(src != M.get_active_held_item()) M.swap_hand() equip_to_best_slot(M) ..() diff --git a/code/modules/client/verbs/suicide.dm b/code/modules/client/verbs/suicide.dm index 413590b6db8..cb6120efe3d 100644 --- a/code/modules/client/verbs/suicide.dm +++ b/code/modules/client/verbs/suicide.dm @@ -10,7 +10,7 @@ if(confirm == "Yes") suiciding = 1 log_game("[key_name(src)] (job: [job ? "[job]" : "None"]) commited suicide at [get_area(src)].") - var/obj/item/held_item = get_active_hand() + var/obj/item/held_item = get_active_held_item() if(held_item) var/damagetype = held_item.suicide_act(src) if(damagetype) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index a26dfacd4fb..55721e470d2 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -44,12 +44,7 @@ var/obj/screen/inventory/hand/H = over_object if(!M.unEquip(src)) return - switch(H.slot_id) - if(slot_r_hand) - M.put_in_r_hand(src) - if(slot_l_hand) - M.put_in_l_hand(src) - + M.put_in_hand(src, H.held_index) add_fingerprint(usr) /obj/item/clothing/throw_at(atom/target, range, speed, mob/thrower, spin) diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index 340a2e174e9..e2dfe0f6cb8 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -60,7 +60,7 @@ var/turf/location = src.loc if(istype(location, /mob/)) var/mob/living/carbon/human/M = location - if(M.l_hand == src || M.r_hand == src || M.head == src) + if(M.is_holding(src) || M.head == src) location = M.loc if (istype(location, /turf)) diff --git a/code/modules/clothing/outfits/standard.dm b/code/modules/clothing/outfits/standard.dm index 1cd4a500a97..84b7de07b84 100644 --- a/code/modules/clothing/outfits/standard.dm +++ b/code/modules/clothing/outfits/standard.dm @@ -52,7 +52,7 @@ if(visualsOnly) return - var/obj/item/weapon/reagent_containers/glass/bucket/bucket = H.l_hand + var/obj/item/weapon/reagent_containers/glass/bucket/bucket = H.get_item_for_held_index(1) bucket.reagents.add_reagent("water",70) /datum/outfit/laser_tag @@ -159,10 +159,10 @@ return //Could use a type - var/obj/item/weapon/storage/secure/briefcase/sec_briefcase = H.l_hand + var/obj/item/weapon/storage/secure/briefcase/sec_briefcase = H.get_item_for_held_index(1) for(var/obj/item/briefcase_item in sec_briefcase) qdel(briefcase_item) - for(var/i=3, i>0, i--) + for(var/i = 3 to 0 step -1) sec_briefcase.handle_item_insertion(new /obj/item/stack/spacecash/c1000,1) sec_briefcase.handle_item_insertion(new /obj/item/weapon/gun/energy/kinetic_accelerator/crossbow,1) sec_briefcase.handle_item_insertion(new /obj/item/weapon/gun/projectile/revolver/mateba,1) diff --git a/code/modules/clothing/spacesuits/chronosuit.dm b/code/modules/clothing/spacesuits/chronosuit.dm index 6506f8239c4..48154a4ae46 100644 --- a/code/modules/clothing/spacesuits/chronosuit.dm +++ b/code/modules/clothing/spacesuits/chronosuit.dm @@ -25,7 +25,7 @@ actions_types = list(/datum/action/item_action/toggle) armor = list(melee = 60, bullet = 60, laser = 60, energy = 60, bomb = 30, bio = 90, rad = 90) var/list/chronosafe_items = list(/obj/item/weapon/chrono_eraser, /obj/item/weapon/gun/energy/chrono_gun) - var/hands_nodrop_states + var/list/hands_nodrop = list() var/obj/item/clothing/head/helmet/space/chronos/helmet = null var/obj/effect/chronos_cam/camera = null var/image/phase_underlay = null @@ -92,10 +92,9 @@ user.notransform = 0 user.anchored = 0 teleporting = 0 - if(user.l_hand && !(hands_nodrop_states & 1)) - user.l_hand.flags &= ~NODROP - if(user.r_hand && !(hands_nodrop_states & 2)) - user.r_hand.flags &= ~NODROP + for(var/obj/item/I in user.held_items) + if(I in hands_nodrop) + I.flags &= ~NODROP if(phase_underlay && !qdeleted(phase_underlay)) user.underlays -= phase_underlay qdel(phase_underlay) @@ -119,7 +118,7 @@ teleport_now.UpdateButtonIcon() - var/list/nonsafe_slots = list(slot_belt, slot_back, slot_l_hand, slot_r_hand) + var/list/nonsafe_slots = list(slot_belt, slot_back) for(var/slot in nonsafe_slots) var/obj/item/slot_item = user.get_item_by_slot(slot) if(slot_item && !(slot_item.type in chronosafe_items) && user.unEquip(slot_item)) @@ -129,14 +128,11 @@ phase_underlay = create_phase_underlay(user) - hands_nodrop_states = 0 - if(user.l_hand) - hands_nodrop_states |= (user.l_hand.flags & NODROP) ? 1 : 0 - user.l_hand.flags |= NODROP - if(user.r_hand) - hands_nodrop_states |= (user.r_hand.flags & NODROP) ? 2 : 0 - user.r_hand.flags |= NODROP - + hands_nodrop = list() + for(var/obj/item/I in user.held_items) + if(!(I.flags & NODROP)) + hands_nodrop += I + I.flags |= NODROP user.animate_movement = NO_STEPS user.changeNext_move(8 + phase_in_ds) user.notransform = 1 diff --git a/code/modules/crafting/craft.dm b/code/modules/crafting/craft.dm index 70f45474c5f..1e1ed209bf0 100644 --- a/code/modules/crafting/craft.dm +++ b/code/modules/crafting/craft.dm @@ -60,8 +60,8 @@ /datum/personal_crafting/proc/get_environment(mob/user) . = list() - . += user.r_hand - . += user.l_hand + for(var/obj/item/I in user.held_items) + . += I if(!istype(user.loc, /turf)) return var/list/L = block(get_step(user, SOUTHWEST), get_step(user, NORTHEAST)) diff --git a/code/modules/detectivework/evidence.dm b/code/modules/detectivework/evidence.dm index 706048c6985..8d6709abe84 100644 --- a/code/modules/detectivework/evidence.dm +++ b/code/modules/detectivework/evidence.dm @@ -39,10 +39,8 @@ if(istype(I.loc,/obj/item/weapon/storage)) //in a container. var/obj/item/weapon/storage/U = I.loc U.remove_from_storage(I, src) - else if(user.l_hand == I) //in a hand - user.drop_l_hand() - else if(user.r_hand == I) //in a hand - user.drop_r_hand() + if(user.is_holding(I)) + user.unEquip(I) else return diff --git a/code/modules/events/holiday/xmas.dm b/code/modules/events/holiday/xmas.dm index 7c2d638ed9d..ec21c483973 100644 --- a/code/modules/events/holiday/xmas.dm +++ b/code/modules/events/holiday/xmas.dm @@ -47,7 +47,7 @@ var/cracked = 0 /obj/item/weapon/toy/xmas_cracker/attack(mob/target, mob/user) - if( !cracked && istype(target,/mob/living/carbon/human) && (target.stat == CONSCIOUS) && !target.get_active_hand() ) + if( !cracked && istype(target,/mob/living/carbon/human) && (target.stat == CONSCIOUS) && !target.get_active_held_item() ) target.visible_message("[user] and [target] pop \an [src]! *pop*", "You pull \an [src] with [target]! *pop*", "You hear a pop.") var/obj/item/weapon/paper/Joke = new /obj/item/weapon/paper(user.loc) Joke.name = "[pick("awful","terrible","unfunny")] joke" diff --git a/code/modules/events/wizard/curseditems.dm b/code/modules/events/wizard/curseditems.dm index 300ecc83c69..5d0bc33b168 100644 --- a/code/modules/events/wizard/curseditems.dm +++ b/code/modules/events/wizard/curseditems.dm @@ -11,7 +11,7 @@ /datum/round_event/wizard/cursed_items/start() var/item_set = pick("wizardmimic", "swords", "bigfatdoobie", "boxing", "voicemodulators", "catgirls2015") - var/list/wearslots = list(slot_wear_suit, slot_shoes, slot_head, slot_wear_mask, slot_r_hand, slot_gloves, slot_ears) + var/list/wearslots = list(slot_wear_suit, slot_shoes, slot_head, slot_wear_mask, slot_gloves, slot_ears) var/list/loadout = list() var/ruins_spaceworthiness var/ruins_wizard_loadout @@ -44,8 +44,8 @@ continue if(item_set == "catgirls2015") //Wizard code means never having to say you're sorry H.gender = FEMALE - var/list/slots = list(H.wear_suit, H.shoes, H.head, H.wear_mask, H.r_hand, H.gloves, H.ears) //add new slots as needed to back - for(var/i = 1, i <= loadout.len, i++) + var/list/slots = list(H.wear_suit, H.shoes, H.head, H.wear_mask, H.gloves, H.ears) //add new slots as needed to back + for(var/i in 1 to loadout.len) if(loadout[i]) var/obj/item/J = loadout[i] var/obj/item/I = new J //dumb but required because of byond throwing a fit anytime new gets too close to a list diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index ad237db5be9..7e34d6a1b3a 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -324,14 +324,10 @@ Gunshots/explosions/opening doors/less rare audio (done) return var/obj/effect/fake_attacker/F = new/obj/effect/fake_attacker(get_turf(target),target) - if(clone.l_hand) - if(!(locate(clone.l_hand) in non_fakeattack_weapons)) - clone_weapon = clone.l_hand.name - F.weap = clone.l_hand - else if (clone.r_hand) - if(!(locate(clone.r_hand) in non_fakeattack_weapons)) - clone_weapon = clone.r_hand.name - F.weap = clone.r_hand + for(var/obj/item/I in clone.held_items) + if(!(locate(I) in non_fakeattack_weapons)) + clone_weapon = I.name + F.weap = I F.name = clone.name F.my_target = target @@ -619,9 +615,13 @@ var/list/non_fakeattack_weapons = list(/obj/item/weapon/gun/projectile, /obj/ite //src << "Traitor Items" if(!halitem) halitem = new - var/list/slots_free = list(ui_lhand,ui_rhand) - if(l_hand) slots_free -= ui_lhand - if(r_hand) slots_free -= ui_rhand + var/obj/item/l_hand = get_item_for_held_index(1) + var/obj/item/r_hand = get_item_for_held_index(2) + var/l = ui_hand_position(get_held_index_of_item(l_hand)) + var/r = ui_hand_position(get_held_index_of_item(r_hand)) + var/list/slots_free = list(l,r) + if(l_hand) slots_free -= l + if(r_hand) slots_free -= r if(istype(src,/mob/living/carbon/human)) var/mob/living/carbon/human/H = src if(!H.belt) slots_free += ui_belt diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm index cc29cb25b70..0d4a99a91b0 100644 --- a/code/modules/food_and_drinks/pizzabox.dm +++ b/code/modules/food_and_drinks/pizzabox.dm @@ -84,7 +84,7 @@ update_icon() /obj/item/pizzabox/attack_hand(mob/user) - if(user.get_inactive_hand() != src) + if(user.get_inactive_held_item() != src) ..() return if(open) diff --git a/code/modules/hydroponics/gene_modder.dm b/code/modules/hydroponics/gene_modder.dm index f5bd17e0ed0..4787f2829b0 100644 --- a/code/modules/hydroponics/gene_modder.dm +++ b/code/modules/hydroponics/gene_modder.dm @@ -234,7 +234,7 @@ update_genes() update_icon() else - var/obj/item/I = usr.get_active_hand() + var/obj/item/I = usr.get_active_held_item() if (istype(I, /obj/item/seeds)) if(!usr.drop_item()) return @@ -248,7 +248,7 @@ disk = null update_genes() else - var/obj/item/I = usr.get_active_hand() + var/obj/item/I = usr.get_active_held_item() if(istype(I, /obj/item/weapon/disk/plantgene)) if(!usr.drop_item()) return @@ -396,7 +396,7 @@ ..() if(istype(W, /obj/item/weapon/pen)) var/t = stripped_input(user, "What would you like the label to be?", name, null) - if(user.get_active_hand() != W) + if(user.get_active_held_item() != W) return if(!in_range(src, user) && loc != user) return diff --git a/code/modules/hydroponics/grown/chili.dm b/code/modules/hydroponics/grown/chili.dm index 4e641c4e8cd..be9ef5838ac 100644 --- a/code/modules/hydroponics/grown/chili.dm +++ b/code/modules/hydroponics/grown/chili.dm @@ -83,7 +83,7 @@ /obj/item/weapon/reagent_containers/food/snacks/grown/ghost_chili/process() if(held_mob && src.loc == held_mob) - if( (held_mob.l_hand == src) || (held_mob.r_hand == src)) + if(held_mob.is_holding(src)) if(hasvar(held_mob,"gloves") && held_mob:gloves) return held_mob.bodytemperature += 15 * TEMPERATURE_DAMAGE_COEFFICIENT diff --git a/code/modules/hydroponics/grown/nettle.dm b/code/modules/hydroponics/grown/nettle.dm index dac4b76aa3e..0dd97c68a36 100644 --- a/code/modules/hydroponics/grown/nettle.dm +++ b/code/modules/hydroponics/grown/nettle.dm @@ -55,7 +55,7 @@ var/mob/living/carbon/human/H = C if(H.gloves) return 0 - var/organ = ((H.hand ? "l_":"r_") + "arm") + var/organ = (H.held_index_to_dir(H.active_hand_index) == "l" ? "l_":"r_") + "arm" var/obj/item/bodypart/affecting = H.get_bodypart(organ) if(affecting && affecting.take_damage(0, force)) H.update_damage_overlays(0) diff --git a/code/modules/jobs/access.dm b/code/modules/jobs/access.dm index 4b6a96add86..0b15123b142 100644 --- a/code/modules/jobs/access.dm +++ b/code/modules/jobs/access.dm @@ -115,16 +115,16 @@ else if(istype(M, /mob/living/carbon/human)) var/mob/living/carbon/human/H = M //if they are holding or wearing a card that has access, that works - if(check_access(H.get_active_hand()) || src.check_access(H.wear_id)) + if(check_access(H.get_active_held_item()) || src.check_access(H.wear_id)) return 1 else if(istype(M, /mob/living/carbon/monkey) || istype(M, /mob/living/carbon/alien/humanoid)) var/mob/living/carbon/george = M //they can only hold things :( - if(check_access(george.get_active_hand())) + if(check_access(george.get_active_held_item())) return 1 else if(isanimal(M)) var/mob/living/simple_animal/A = M - if(check_access(A.get_active_hand()) || check_access(A.access_card)) + if(check_access(A.get_active_held_item()) || check_access(A.access_card)) return 1 return 0 diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm index c5d9add72cc..43ca9d51012 100644 --- a/code/modules/library/lib_items.dm +++ b/code/modules/library/lib_items.dm @@ -102,7 +102,7 @@ if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr)) return if(ishuman(user)) - if(!user.get_active_hand()) + if(!user.get_active_held_item()) user.put_in_hands(choice) else choice.loc = get_turf(src) @@ -264,7 +264,7 @@ B.name = src.name B.title = src.title B.icon_state = src.icon_state - if(user.l_hand == src || user.r_hand == src) + if(user.is_holding(src)) qdel(src) user.put_in_hands(B) return diff --git a/code/modules/mining/laborcamp/laborstacker.dm b/code/modules/mining/laborcamp/laborstacker.dm index 58e13865f94..6c328b8cd64 100644 --- a/code/modules/mining/laborcamp/laborstacker.dm +++ b/code/modules/mining/laborcamp/laborstacker.dm @@ -74,14 +74,14 @@ switch(action) if("handle_id") if(inserted_id) - if(!usr.get_active_hand()) + if(!usr.get_active_held_item()) usr.put_in_hands(inserted_id) inserted_id = null else inserted_id.forceMove(get_turf(src)) inserted_id = null else - var/obj/item/I = usr.get_active_hand() + var/obj/item/I = usr.get_active_held_item() if(istype(I, /obj/item/weapon/card/id/prisoner)) if(!usr.drop_item()) return diff --git a/code/modules/mining/lavaland/necropolis_chests.dm b/code/modules/mining/lavaland/necropolis_chests.dm index abcc8e7521b..68a3ca84760 100644 --- a/code/modules/mining/lavaland/necropolis_chests.dm +++ b/code/modules/mining/lavaland/necropolis_chests.dm @@ -338,11 +338,7 @@ var/obj/screen/inventory/hand/H = over_object if(!M.unEquip(src)) return - switch(H.slot_id) - if(slot_r_hand) - M.put_in_r_hand(src) - if(slot_l_hand) - M.put_in_l_hand(src) + M.put_in_hand(src, H.held_index) add_fingerprint(usr) @@ -734,6 +730,6 @@ if(H == L) continue H << "You have an overwhelming desire to kill [L]. They have been marked red! Go kill them!" - H.equip_to_slot_or_del(new /obj/item/weapon/kitchen/knife/butcher(H), slot_l_hand) + H.put_in_hands_or_del(new /obj/item/weapon/kitchen/knife/butcher(H)) qdel(src) diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 0d067eeb2b1..d298e3c146a 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -101,7 +101,7 @@ if (!powered()) return if(istype(W,/obj/item/weapon/card/id)) - var/obj/item/weapon/card/id/I = user.get_active_hand() + var/obj/item/weapon/card/id/I = user.get_active_held_item() if(istype(I) && !istype(inserted_id)) if(!user.drop_item()) return @@ -208,7 +208,7 @@ else usr << "Required access not found." else if(href_list["choice"] == "insert") - var/obj/item/weapon/card/id/I = usr.get_active_hand() + var/obj/item/weapon/card/id/I = usr.get_active_held_item() if(istype(I)) if(!usr.drop_item()) return diff --git a/code/modules/mining/machine_vending.dm b/code/modules/mining/machine_vending.dm index a3984de77d4..fdb907cac4b 100644 --- a/code/modules/mining/machine_vending.dm +++ b/code/modules/mining/machine_vending.dm @@ -121,7 +121,7 @@ inserted_id.verb_pickup() inserted_id = null else if(href_list["choice"] == "insert") - var/obj/item/weapon/card/id/I = usr.get_active_hand() + var/obj/item/weapon/card/id/I = usr.get_active_held_item() if(istype(I)) if(!usr.drop_item()) return @@ -149,7 +149,7 @@ RedeemVoucher(I, user) return if(istype(I,/obj/item/weapon/card/id)) - var/obj/item/weapon/card/id/C = usr.get_active_hand() + var/obj/item/weapon/card/id/C = usr.get_active_held_item() if(istype(C) && !istype(inserted_id)) if(!usr.drop_item()) return diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index f18a329581a..bf40e0b4564 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -436,10 +436,9 @@ ..() if(istype(AM,/mob/living/carbon/human)) var/mob/living/carbon/human/H = AM - if((istype(H.l_hand,/obj/item/weapon/pickaxe)) && (!H.hand)) - src.attackby(H.l_hand,H) - else if((istype(H.r_hand,/obj/item/weapon/pickaxe)) && H.hand) - src.attackby(H.r_hand,H) + var/obj/item/I = H.is_holding_item_of_type(/obj/item/weapon/pickaxe) + if(I) + attackby(I,H) return else if(istype(AM,/mob/living/silicon/robot)) var/mob/living/silicon/robot/R = AM diff --git a/code/modules/mob/interactive.dm b/code/modules/mob/interactive.dm index a6910a62eac..ab0aa56e1c0 100644 --- a/code/modules/mob/interactive.dm +++ b/code/modules/mob/interactive.dm @@ -299,8 +299,6 @@ BP.change_bodypart_status(ORGAN_ROBOTIC) update_icons() update_damage_overlays(0) - - hand = 0 functions = list("nearbyscan","combat","shitcurity","chatter") // stop customize adding multiple copies of a function //job specific favours switch(myjob.title) @@ -491,28 +489,35 @@ if(other_hand) if(other_hand.loc != src) other_hand = null - if(hand) - if(!l_hand) + + var/obj/item/L = get_item_for_held_index(1) //just going to hardcode SNPCs to 2 hands, for now. + var/obj/item/R = get_item_for_held_index(2) //they're just VERY assume-y about 2 hands. + if(active_hand_index == 1) + if(!L) main_hand = null - if(r_hand) + if(R) swap_hands() else - if(!r_hand) + if(!R) main_hand = null - if(l_hand) + if(L) swap_hands() + /mob/living/carbon/human/interactive/proc/swap_hands() - hand = !hand - var/obj/item/T = other_hand - main_hand = other_hand - other_hand = T + var/oindex = active_hand_index + if(active_hand_index == 1) + active_hand_index = 2 + else + active_hand_index = 1 + main_hand = get_active_held_item() + other_hand = get_item_for_held_index(oindex) update_hands = 1 /mob/living/carbon/human/interactive/proc/take_to_slot(obj/item/G, var/hands=0) - var/list/slots = list ("left pocket" = slot_l_store,"right pocket" = slot_r_store,"left hand" = slot_l_hand,"right hand" = slot_r_hand) + var/list/slots = list ("left pocket" = slot_l_store,"right pocket" = slot_r_store,"left hand" = slot_hands,"right hand" = slot_hands) if(hands) - slots = list ("left hand" = slot_l_hand,"right hand" = slot_r_hand) + slots = list ("left hand" = slot_hands,"right hand" = slot_hands) G.loc = src if(G.force && G.force > best_force) best_force = G.force @@ -520,7 +525,7 @@ update_hands = 1 /mob/living/carbon/human/interactive/proc/insert_into_backpack() - var/list/slots = list ("left pocket" = slot_l_store,"right pocket" = slot_r_store,"left hand" = slot_l_hand,"right hand" = slot_r_hand) + var/list/slots = list ("left pocket" = slot_l_store,"right pocket" = slot_r_store,"left hand" = slot_hands,"right hand" = slot_hands) var/obj/item/I = get_item_by_slot(pick(slots)) var/obj/item/weapon/storage/BP = get_item_by_slot(slot_back) if(back && BP && I) @@ -604,14 +609,16 @@ D.open() if(update_hands) + var/obj/item/l_hand = get_item_for_held_index(1) + var/obj/item/r_hand = get_item_for_held_index(2) if(l_hand || r_hand) if(l_hand) - hand = 1 + active_hand_index = 1 main_hand = l_hand if(r_hand) other_hand = r_hand else if(r_hand) - hand = 0 + active_hand_index = 2 main_hand = r_hand if(l_hand) //this technically shouldnt occur, but its a redundancy other_hand = l_hand @@ -659,12 +666,12 @@ if(istype(TARGET, /obj/item/weapon)) var/obj/item/weapon/W = TARGET if(W.force >= best_force || prob((FUZZY_CHANCE_LOW+FUZZY_CHANCE_HIGH)/2)) - if(!l_hand || !r_hand) + if(!get_item_for_held_index(1) || !get_item_for_held_index(2)) put_in_hands(W) else insert_into_backpack() else - if(!l_hand || !r_hand) + if(!get_item_for_held_index(1) || !get_item_for_held_index(2)) put_in_hands(TARGET) else insert_into_backpack() diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 1268581a38b..8e3cb40fbf4 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -1,178 +1,291 @@ -//These procs handle putting s tuff in your hand. It's probably best to use these rather than setting l_hand = ...etc +//These procs handle putting s tuff in your hands //as they handle all relevant stuff like adding it to the player's screen and updating their overlays. -//Returns the thing in our active hand -/mob/proc/get_active_hand() - if(hand) - return l_hand - else - return r_hand +//Returns the thing we're currently holding +/mob/proc/get_active_held_item() + return get_item_for_held_index(active_hand_index) -//Returns the thing in our inactive hand -/mob/proc/get_inactive_hand() - if(hand) - return r_hand +//Finds the opposite limb for the active one (eg: upper left arm will find the item in upper right arm) +//So we're treating each "pair" of limbs as a team, so "both" refers to them +/mob/proc/get_inactive_held_item() + return get_item_for_held_index(get_inactive_hand_index()) + + +//Finds the opposite index for the active one (eg: upper left arm will find the item in upper right arm) +//So we're treating each "pair" of limbs as a team, so "both" refers to them +/mob/proc/get_inactive_hand_index() + var/other_hand = 0 + if(!(active_hand_index % 2)) + other_hand = active_hand_index-1 //finding the matching "left" limb else - return l_hand + other_hand = active_hand_index+1 //finding the matching "right" limb + if(other_hand < 0 || other_hand > held_items.len) + other_hand = 0 + return other_hand + + +/mob/proc/get_item_for_held_index(i) + if(i > 0 && i <= held_items.len) + return held_items[i] + return FALSE + + +//Odd = left. Even = right +/mob/proc/held_index_to_dir(i) + if(!(i % 2)) + return "r" + return "l" + + +//Check we have an organ for this hand slot (Dismemberment), Only relevant for humans +/mob/proc/has_hand_for_held_index(i) + return TRUE + + +//Check we have an organ for our active hand slot (Dismemberment),Only relevant for humans +/mob/proc/has_active_hand() + return has_hand_for_held_index(active_hand_index) + + +//Finds the first available (null) index OR all available (null) indexes in held_items based on a side. +//Lefts: 1, 3, 5, 7... +//Rights:2, 4, 6, 8... +/mob/proc/get_empty_held_index_for_side(side = "left", all = FALSE) + var/start = 0 + var/static/list/lefts = list("l" = TRUE,"L" = TRUE,"LEFT" = TRUE,"left" = TRUE) + var/static/list/rights = list("r" = TRUE,"R" = TRUE,"RIGHT" = TRUE,"right" = TRUE) //"to remain silent" + if(lefts[side]) + start = 1 + else if(rights[side]) + start = 2 + if(!start) + return FALSE + var/list/empty_indexes + for(var/i in start to held_items.len step 2) + if(!held_items[i]) + if(!all) + return i + if(!empty_indexes) + empty_indexes = list() + empty_indexes += i + return empty_indexes + + +//Same as the above, but returns the first or ALL held *ITEMS* for the side +/mob/proc/get_held_items_for_side(side = "left", all = FALSE) + var/start = 0 + var/static/list/lefts = list("l" = TRUE,"L" = TRUE,"LEFT" = TRUE,"left" = TRUE) + var/static/list/rights = list("r" = TRUE,"R" = TRUE,"RIGHT" = TRUE,"right" = TRUE) //"to remain silent" + if(lefts[side]) + start = 1 + else if(rights[side]) + start = 2 + if(!start) + return FALSE + var/list/holding_items + for(var/i in start to held_items.len step 2) + var/obj/item/I = held_items[i] + if(I) + if(!all) + return I + if(!holding_items) + holding_items = list() + holding_items += I + return holding_items + + +/mob/proc/get_empty_held_indexes() + var/list/L + for(var/i in 1 to held_items.len) + if(!held_items[i]) + if(!L) + L = list() + L += i + return L + +/mob/proc/get_held_index_of_item(obj/item/I) + return held_items.Find(I) + + +//Sad that this will cause some overhead, but the alias seems necessary +//*I* may be happy with a million and one references to "indexes" but others won't be +/mob/proc/is_holding(obj/item/I) + return get_held_index_of_item(I) + + +//Checks if we're holding an item of type: typepath +/mob/proc/is_holding_item_of_type(typepath) + for(var/obj/item/I in held_items) + if(istype(I, typepath)) + return I + return FALSE + + +//To appropriately fluff things like "they are holding [I] in their [get_held_index_name(get_held_index_of_item(I))]" +//Can be overriden to pass off the fluff to something else (eg: science allowing people to add extra robotic limbs, and having this proc react to that +// with say "they are holding [I] in their Nanotrasen Brand Utility Arm - Right Edition" or w/e +/mob/proc/get_held_index_name(i) + var/list/hand = list() + if(i > 2) + hand += "upper " + var/num = 0 + if(!(i % 2)) + num = i-2 + hand += "right hand" + else + num = i-1 + hand += "left hand" + num -= (num*0.5) + if(num > 1) //"upper left hand #1" seems weird, but "upper left hand #2" is A-ok + hand += " #[num]" + return hand.Join() + //Returns if a certain item can be equipped to a certain slot. // Currently invalid for two-handed items - call obj/item/mob_can_equip() instead. /mob/proc/can_equip(obj/item/I, slot, disable_warning = 0) - return 0 - -//Puts the item into your l_hand if possible and calls all necessary triggers/updates. returns 1 on success. -/mob/proc/put_in_l_hand(obj/item/W) - if(!put_in_hand_check(W)) - return 0 - if(!has_left_hand()) - return 0 - if(!l_hand) - W.loc = src //TODO: move to equipped? - l_hand = W - W.layer = ABOVE_HUD_LAYER //TODO: move to equipped? - W.equipped(src,slot_l_hand) - if(W.pulledby) - W.pulledby.stop_pulling() - update_inv_l_hand() - W.pixel_x = initial(W.pixel_x) - W.pixel_y = initial(W.pixel_y) - return 1 - return 0 + return FALSE -//Puts the item into your r_hand if possible and calls all necessary triggers/updates. returns 1 on success. -/mob/proc/put_in_r_hand(obj/item/W) - if(!put_in_hand_check(W)) - return 0 - if(!has_right_hand()) - return 0 - if(!r_hand) - W.loc = src - r_hand = W - W.layer = ABOVE_HUD_LAYER - W.equipped(src,slot_r_hand) - if(W.pulledby) - W.pulledby.stop_pulling() - update_inv_r_hand() - W.pixel_x = initial(W.pixel_x) - W.pixel_y = initial(W.pixel_y) - return 1 - return 0 - -/mob/proc/put_in_hand_check(obj/item/W) - if(lying && !(W.flags&ABSTRACT)) - return 0 - if(!istype(W)) - return 0 - return 1 - -//Puts the item into our active hand if possible. returns 1 on success. -/mob/proc/put_in_active_hand(obj/item/W) - if(hand) - return put_in_l_hand(W) - else - return put_in_r_hand(W) +/mob/proc/put_in_hand(obj/item/I, hand_index) + if(!put_in_hand_check(I)) + return FALSE + if(!has_hand_for_held_index(hand_index)) + return FALSE + var/obj/item/curr = held_items[hand_index] + if(!curr) + I.loc = src + held_items[hand_index] = I + I.layer = ABOVE_HUD_LAYER + I.equipped(src, slot_hands) + if(I.pulledby) + I.pulledby.stop_pulling() + update_inv_hands() + I.pixel_x = initial(I.pixel_x) + I.pixel_y = initial(I.pixel_y) + return hand_index || TRUE + return FALSE -//Puts the item into our inactive hand if possible. returns 1 on success. -/mob/proc/put_in_inactive_hand(obj/item/W) - if(hand) - return put_in_r_hand(W) - else - return put_in_l_hand(W) +//Puts the item into the first available left hand if possible and calls all necessary triggers/updates. returns 1 on success. +/mob/proc/put_in_l_hand(obj/item/I) + return put_in_hand(I, get_empty_held_index_for_side("l")) -//Puts the item our active hand if possible. Failing that it tries our inactive hand. Returns 1 on success. -//If both fail it drops it on the floor and returns 0. +//Puts the item into the first available right hand if possible and calls all necessary triggers/updates. returns 1 on success. +/mob/proc/put_in_r_hand(obj/item/I) + return put_in_hand(I, get_empty_held_index_for_side("r")) + + +/mob/proc/put_in_hand_check(obj/item/I) + if(lying && !(I.flags&ABSTRACT)) + return FALSE + if(!istype(I)) + return FALSE + return TRUE + + +//Puts the item into our active hand if possible. returns TRUE on success. +/mob/proc/put_in_active_hand(obj/item/I) + return put_in_hand(I, active_hand_index) + + +//Puts the item into our inactive hand if possible, returns TRUE on success +/mob/proc/put_in_inactive_hand(obj/item/I) + return put_in_hand(I, get_inactive_hand_index()) + + +//Puts the item our active hand if possible. Failing that it tries our inactive hand. Returns TRUE on success. +//If both fail it drops it on the floor and returns FALSE. //This is probably the main one you need to know :) -/mob/proc/put_in_hands(obj/item/W) - if(!W) - return 0 - if(put_in_active_hand(W)) - return 1 - else if(put_in_inactive_hand(W)) - return 1 - else - W.loc = get_turf(src) - W.layer = initial(W.layer) - W.dropped(src) - return 0 +/mob/proc/put_in_hands(obj/item/I, del_on_fail = FALSE) + if(!I) + return FALSE + var/hand = get_empty_held_index_for_side("l") + if(!hand) + hand = get_empty_held_index_for_side("r") + if(hand) + if(put_in_hand(I, hand)) + return TRUE + if(del_on_fail) + qdel(I) + return FALSE + I.forceMove(get_turf(src)) + I.layer = initial(I.layer) + I.dropped(src) + return FALSE + + +/mob/proc/put_in_hands_or_del(obj/item/I) + return put_in_hands(I, TRUE) /mob/proc/drop_item_v() //this is dumb. if(stat == CONSCIOUS && isturf(loc)) return drop_item() - return 0 + return FALSE -//Drops the item in our left hand -/mob/proc/drop_l_hand() - if(!loc || !loc.allow_drop()) - return - return unEquip(l_hand) //All needed checks are in unEquip - - -//Drops the item in our right hand +/* +/mob/proc/drop_l_hand() //pending re-implementation /mob/proc/drop_r_hand() +*/ +/mob/proc/drop_all_held_items() if(!loc || !loc.allow_drop()) return - return unEquip(r_hand) - + for(var/obj/item/I in held_items) + unEquip(I) //Drops the item in our active hand. /mob/proc/drop_item() - if(hand) - return drop_l_hand() - else - return drop_r_hand() + if(!loc || !loc.allow_drop()) + return + var/obj/item/held = get_active_held_item() + return unEquip(held) //Here lie drop_from_inventory and before_item_take, already forgotten and not missed. - /mob/proc/canUnEquip(obj/item/I, force) if(!I) - return 1 + return TRUE if((I.flags & NODROP) && !force) - return 0 - return 1 + return FALSE + return TRUE /mob/proc/unEquip(obj/item/I, force) //Force overrides NODROP for things like wizarditis and admin undress. if(!I) //If there's nothing to drop, the drop is automatically succesfull. If(unEquip) should generally be used to check for NODROP. - return 1 + return TRUE if((I.flags & NODROP) && !force) - return 0 - - if(I == r_hand) - r_hand = null - update_inv_r_hand() - else if(I == l_hand) - l_hand = null - update_inv_l_hand() + return FALSE + var/hand_index = get_held_index_of_item(I) + if(hand_index) + held_items[hand_index] = null + update_inv_hands() if(I) if(client) client.screen -= I - I.loc = loc + I.layer = initial(I.layer) + I.forceMove(loc) I.dropped(src) - if(I) - I.layer = initial(I.layer) - return 1 + return TRUE //Attemps to remove an object on a mob. Will not move it to another area or such, just removes from the mob. -/mob/proc/remove_from_mob(var/obj/O) - unEquip(O) - O.screen_loc = null - return 1 +/mob/proc/remove_from_mob(var/obj/item/I) + unEquip(I) + I.screen_loc = null + return TRUE //Outdated but still in use apparently. This should at least be a human proc. +//Daily reminder to murder this - Remie. /mob/proc/get_equipped_items() - var/list/items = new/list() + var/list/items = list() if(hasvar(src,"back")) if(src:back) @@ -204,48 +317,34 @@ if(hasvar(src,"wear_suit")) if(src:wear_suit) items += src:wear_suit -/* if(hasvar(src,"w_radio")) - if(src:w_radio) - items += src:w_radio commenting this out since headsets go on your ears now PLEASE DON'T BE MAD KEELIN */ if(hasvar(src,"w_uniform")) if(src:w_uniform) items += src:w_uniform - -/* if(hasvar(src,"l_hand")) - if(src:l_hand) - items += src:l_hand - if(hasvar(src,"r_hand")) - if(src:r_hand) - items += src:r_hand*/ - return items /obj/item/proc/equip_to_best_slot(var/mob/M) - if(src != M.get_active_hand()) + if(src != M.get_active_held_item()) M << "You are not holding anything to equip!" - return 0 + return FALSE if(M.equip_to_appropriate_slot(src)) - if(M.hand) - M.update_inv_l_hand() - else - M.update_inv_r_hand() - return 1 + M.update_inv_hands() + return TRUE if(M.s_active && M.s_active.can_be_inserted(src,1)) //if storage active insert there M.s_active.handle_item_insertion(src) - return 1 + return TRUE - var/obj/item/weapon/storage/S = M.get_inactive_hand() + var/obj/item/weapon/storage/S = M.get_inactive_held_item() if(istype(S) && S.can_be_inserted(src,1)) //see if we have box in other hand S.handle_item_insertion(src) - return 1 + return TRUE S = M.get_item_by_slot(slot_belt) if(istype(S) && S.can_be_inserted(src,1)) //else we put in belt S.handle_item_insertion(src) - return 1 + return TRUE S = M.get_item_by_slot(slot_generic_dextrous_storage) //else we put in whatever is in drone storage if(istype(S) && S.can_be_inserted(src,1)) @@ -255,17 +354,17 @@ if(istype(S) && S.can_be_inserted(src,1)) S.handle_item_insertion(src) playsound(src.loc, "rustle", 50, 1, -5) - return 1 + return TRUE M << "You are unable to equip that!" - return 0 + return FALSE /mob/verb/quick_equip() set name = "quick-equip" set hidden = 1 - var/obj/item/I = get_active_hand() + var/obj/item/I = get_active_held_item() if (I) I.equip_to_best_slot(src) @@ -274,4 +373,47 @@ return slot_back /mob/proc/getBeltSlot() - return slot_belt \ No newline at end of file + return slot_belt + + + +//Inventory.dm is -kind of- an ok place for this I guess + +//This is NOT for dismemberment, as the user still technically has 2 "hands" +//This is for multi-handed mobs, such as a human with a third limb installed +//This is a very rare proc to call (besides admin fuckery) so +//any cost it has isn't a worry +/mob/proc/change_number_of_hands(amt) + if(amt < held_items.len) + for(var/i in held_items.len to amt step -1) + unEquip(held_items[i]) + held_items.len = amt + + if(hud_used) + var/style + if(client && client.prefs) + style = ui_style2icon(client.prefs.UI_style) + hud_used.build_hand_slots(style) + + +/mob/living/carbon/human/change_number_of_hands(amt) + var/old_limbs = held_items.len + if(amt < old_limbs) + for(var/i in hand_organs.len to amt step -1) + var/obj/item/bodypart/BP = hand_organs[i] + BP.dismember() + hand_organs[i] = null + hand_organs.len = amt + else if(amt > old_limbs) + hand_organs.len = amt + for(var/i in old_limbs+1 to amt) + var/path = /obj/item/bodypart/l_arm + if(!(i % 2)) + path = /obj/item/bodypart/r_arm + + var/obj/item/bodypart/BP = new path () + BP.owner = src + BP.held_index = i + bodyparts += BP + hand_organs[i] = BP + ..() //Don't redraw hands until we have organs for them diff --git a/code/modules/mob/living/bloodcrawl.dm b/code/modules/mob/living/bloodcrawl.dm index 69e85dfb9ab..fd09b35a440 100644 --- a/code/modules/mob/living/bloodcrawl.dm +++ b/code/modules/mob/living/bloodcrawl.dm @@ -27,7 +27,7 @@ /mob/living/proc/phaseout(obj/effect/decal/cleanable/B) if(iscarbon(src)) var/mob/living/carbon/C = src - if(C.l_hand || C.r_hand) + for(var/obj/item/I in C.held_items) //TODO make it toggleable to either forcedrop the items, or deny //entry when holding them // literally only an option for carbons though diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index 1dfe38aaf9d..89acb9ab91c 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -90,13 +90,15 @@ /mob/living/carbon/alien/humanoid/show_inv(mob/user) user.set_machine(src) - var/dat = {" + var/list/dat = list() + dat += {"
[name] -
-
Left Hand: [l_hand ? l_hand : "Nothing"] -
Right Hand: [r_hand ? r_hand : "Nothing"] -
Empty Pouches"} +
"} + for(var/i in 1 to held_items.len) + var/obj/item/I = get_item_for_held_index(i) + dat += "
[get_held_index_name(i)]:[(I && !(I.flags & ABSTRACT)) ? I : "Empty"]" + dat += "
Empty Pouches" if(handcuffed) dat += "
Handcuffed" @@ -107,7 +109,7 @@

Close "} - user << browse(dat, "window=mob\ref[src];size=325x500") + user << browse(dat.Join(), "window=mob\ref[src];size=325x500") onclose(user, "mob\ref[src]") @@ -155,8 +157,7 @@ return 0.8 /mob/living/carbon/alien/humanoid/alien_evolve(mob/living/carbon/alien/humanoid/new_xeno) - drop_l_hand() - drop_r_hand() + drop_all_held_items() for(var/atom/movable/A in stomach_contents) stomach_contents.Remove(A) new_xeno.stomach_contents.Add(A) diff --git a/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm b/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm index b4e3dc16c8f..9e8475a4e6c 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/update_icons.dm @@ -68,27 +68,26 @@ apply_overlay(HANDCUFF_LAYER) //Royals have bigger sprites, so inhand things must be handled differently. -/mob/living/carbon/alien/humanoid/royal/update_inv_r_hand() +/mob/living/carbon/alien/humanoid/royal/update_inv_hands() ..() - remove_overlay(R_HAND_LAYER) - if(r_hand) - var/itm_state = r_hand.item_state - if(!itm_state) - itm_state = r_hand.icon_state + remove_overlay(HANDS_LAYER) + var/list/hands = list() - var/image/I = image("icon" = alt_inhands_file , "icon_state"="[itm_state][caste]_r", "layer"=-R_HAND_LAYER) - overlays_standing[R_HAND_LAYER] = I - - apply_overlay(R_HAND_LAYER) - -/mob/living/carbon/alien/humanoid/royal/update_inv_l_hand() - ..() - remove_overlay(L_HAND_LAYER) + var/obj/item/l_hand = get_item_for_held_index(1) if(l_hand) var/itm_state = l_hand.item_state if(!itm_state) itm_state = l_hand.icon_state + var/image/I = image("icon" = alt_inhands_file , "icon_state"="[itm_state][caste]_l", "layer"=-HANDS_LAYER) + hands += I - var/image/I = image("icon" = alt_inhands_file , "icon_state"="[itm_state][caste]_l", "layer"=-L_HAND_LAYER) - overlays_standing[L_HAND_LAYER] = I - apply_overlay(L_HAND_LAYER) \ No newline at end of file + var/obj/item/r_hand = get_item_for_held_index(2) + if(r_hand) + var/itm_state = r_hand.item_state + if(!itm_state) + itm_state = r_hand.icon_state + var/image/I = image("icon" = alt_inhands_file , "icon_state"="[itm_state][caste]_r", "layer"=-HANDS_LAYER) + hands += I + + overlays_standing[HANDS_LAYER] = hands + apply_overlay(HANDS_LAYER) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 9d30f85a661..001fe2d50ce 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -25,7 +25,7 @@ audible_message("You hear something rumbling inside [src]'s stomach...", \ "You hear something rumbling.", 4,\ "Something is rumbling inside your stomach!") - var/obj/item/I = user.get_active_hand() + var/obj/item/I = user.get_active_held_item() if(I && I.force) var/d = rand(round(I.force / 4), I.force) if(istype(src, /mob/living/carbon/human)) @@ -79,38 +79,41 @@ return shock_damage -/mob/living/carbon/swap_hand() - var/obj/item/item_in_hand = src.get_active_hand() +/mob/living/carbon/swap_hand(held_index) + if(!held_index) + held_index = (held_index % held_items.len)+1 + + var/obj/item/item_in_hand = src.get_active_held_item() if(item_in_hand) //this segment checks if the item in your hand is twohanded. if(istype(item_in_hand,/obj/item/weapon/twohanded)) if(item_in_hand:wielded == 1) usr << "Your other hand is too busy holding the [item_in_hand.name]" return - src.hand = !( src.hand ) - if(hud_used && hud_used.inv_slots[slot_l_hand] && hud_used.inv_slots[slot_r_hand]) + var/oindex = active_hand_index + active_hand_index = held_index + if(hud_used) var/obj/screen/inventory/hand/H - H = hud_used.inv_slots[slot_l_hand] - H.update_icon() - H = hud_used.inv_slots[slot_r_hand] - H.update_icon() - /*if (!( src.hand )) - src.hands.setDir(NORTH) - else - src.hands.setDir(SOUTH)*/ - return + H = hud_used.hand_slots["[oindex]"] + if(H) + H.update_icon() + H = hud_used.hand_slots["[held_index]"] + if(H) + H.update_icon() -/mob/living/carbon/activate_hand(selhand) //0 or "r" or "right" for right hand; 1 or "l" or "left" for left hand. + +/mob/living/carbon/activate_hand(selhand) //l/r OR 1-held_items.len + if(!selhand) + selhand = (selhand % held_items.len)+1 if(istext(selhand)) selhand = lowertext(selhand) - if(selhand == "right" || selhand == "r") - selhand = 0 + selhand = 2 if(selhand == "left" || selhand == "l") selhand = 1 - if(selhand != src.hand) - swap_hand() + if(selhand != active_hand_index) + swap_hand(selhand) else mode() // Activate held item @@ -215,7 +218,7 @@ return var/atom/movable/thrown_thing - var/obj/item/I = src.get_active_hand() + var/obj/item/I = src.get_active_held_item() if(!I) if(pulling && isliving(pulling) && grab_state >= GRAB_AGGRESSIVE) @@ -253,9 +256,11 @@ [name]

Head: [(head && !(head.flags&ABSTRACT)) ? head : "Nothing"] -
Mask: [(wear_mask && !(wear_mask.flags&ABSTRACT)) ? wear_mask : "Nothing"] -
Left Hand: [(l_hand && !(l_hand.flags&ABSTRACT)) ? l_hand : "Nothing"] -
Right Hand: [(r_hand && !(r_hand.flags&ABSTRACT)) ? r_hand : "Nothing"]"} +
Mask: [(wear_mask && !(wear_mask.flags&ABSTRACT)) ? wear_mask : "Nothing"]"} + + for(var/i in 1 to held_items.len) + var/obj/item/I = get_item_for_held_index(i) + dat += "
[get_held_index_name(i)]:[(I && !(I.flags & ABSTRACT)) ? I : "Nothing"]" dat += "
Back: [back ? back : "Nothing"]" @@ -733,8 +738,7 @@ //called when we get cuffed/uncuffed /mob/living/carbon/proc/update_handcuffed() if(handcuffed) - drop_r_hand() - drop_l_hand() + drop_all_held_items() stop_pulling() throw_alert("handcuffed", /obj/screen/alert/restrained/handcuffed, new_master = src.handcuffed) else diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 09153d8cd93..6a82174e41e 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -1,6 +1,6 @@ /mob/living/carbon/hitby(atom/movable/AM, skipcatch, hitpush = 1, blocked = 0) if(!skipcatch) //ugly, but easy - if(in_throw_mode && !get_active_hand()) //empty active hand and we're in throw mode + if(in_throw_mode && !get_active_held_item()) //empty active hand and we're in throw mode if(canmove && !restrained()) if(istype(AM, /obj/item)) var/obj/item/I = AM diff --git a/code/modules/mob/living/carbon/examine.dm b/code/modules/mob/living/carbon/examine.dm index 6842d856b03..1be55c38a12 100644 --- a/code/modules/mob/living/carbon/examine.dm +++ b/code/modules/mob/living/carbon/examine.dm @@ -7,10 +7,14 @@ msg += "It has \icon[src.head] \a [src.head] on its head. \n" if (wear_mask) msg += "It has \icon[src.wear_mask] \a [src.wear_mask] on its face.\n" - if (l_hand) - msg += "It has \icon[src.l_hand] \a [src.l_hand] in its left hand.\n" - if (r_hand) - msg += "It has \icon[src.r_hand] \a [src.r_hand] in its right hand.\n" + + for(var/obj/item/I in held_items) + if(!(I.flags & ABSTRACT)) + if(I.blood_DNA) + msg += "It has \icon[I] [I.gender==PLURAL?"some":"a"] blood-stained [I.name] in its [get_held_index_name(get_held_index_of_item(I))]!\n" + else + msg += "It has \icon[I] \a [I] in its [get_held_index_name(get_held_index_of_item(I))].\n" + if (back) msg += "It has \icon[src.back] \a [src.back] on its back.\n" if (stat == DEAD) diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm index 6d67ed7ad7c..91b85c8a40a 100644 --- a/code/modules/mob/living/carbon/human/emote.dm +++ b/code/modules/mob/living/carbon/human/emote.dm @@ -178,7 +178,7 @@ if ("handshake") m_type = 1 - if (!src.restrained() && !src.r_hand) + if (!src.restrained() && get_empty_held_indexes()) var/mob/M = null if (param) for (var/mob/A in view(1, src)) @@ -188,7 +188,7 @@ if (M == src) M = null if (M) - if (M.canmove && !M.r_hand && !M.restrained()) + if (M.canmove && M.get_empty_held_indexes() && !M.restrained()) message = "[src] shakes hands with [M]." else message = "[src] holds out \his hand to [M]." @@ -298,12 +298,16 @@ if ("signal","signals") if (!src.restrained()) + var/maximum_fingers = 10 + var/full_hands + for(var/obj/item/I in held_items) + full_hands++ + maximum_fingers = (held_items.len-full_hands)*5 var/t1 = round(text2num(param)) if (isnum(t1)) - if (t1 <= 5 && (!src.r_hand || !src.l_hand)) - message = "[src] raises [t1] finger\s." - else if (t1 <= 10 && (!src.r_hand && !src.l_hand)) + if (t1 <= maximum_fingers) message = "[src] raises [t1] finger\s." + m_type = 1 if ("sneeze","sneezes") diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 4f153b8ad86..6aae26c14c5 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -73,19 +73,13 @@ else msg += "[t_He] [t_has] \icon[back] \a [back] on [t_his] back.\n" - //left hand - if(l_hand && !(l_hand.flags&ABSTRACT)) - if(l_hand.blood_DNA) - msg += "[t_He] [t_is] holding \icon[l_hand] [l_hand.gender==PLURAL?"some":"a"] blood-stained [l_hand.name] in [t_his] left hand!\n" - else - msg += "[t_He] [t_is] holding \icon[l_hand] \a [l_hand] in [t_his] left hand.\n" - - //right hand - if(r_hand && !(r_hand.flags&ABSTRACT)) - if(r_hand.blood_DNA) - msg += "[t_He] [t_is] holding \icon[r_hand] [r_hand.gender==PLURAL?"some":"a"] blood-stained [r_hand.name] in [t_his] right hand!\n" - else - msg += "[t_He] [t_is] holding \icon[r_hand] \a [r_hand] in [t_his] right hand.\n" + //Hands + for(var/obj/item/I in held_items) + if(!(I.flags & ABSTRACT)) + if(I.blood_DNA) + msg += "[t_He] [t_is] holding \icon[I] [I.gender==PLURAL?"some":"a"] blood-stained [I.name] in [t_his] [get_held_index_name(get_held_index_of_item(I))]!\n" + else + msg += "[t_He] [t_is] holding \icon[I] \a [I] in [t_his] [get_held_index_name(get_held_index_of_item(I))].\n" //gloves if(gloves && !(slot_gloves in obscured)) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 41f2caab2dc..baf119af757 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -18,8 +18,15 @@ verbs += /mob/living/proc/lay_down //initialize limbs first - bodyparts = newlist(/obj/item/bodypart/chest, /obj/item/bodypart/head, /obj/item/bodypart/l_arm, - /obj/item/bodypart/r_arm, /obj/item/bodypart/r_leg, /obj/item/bodypart/l_leg) + bodyparts = newlist(/obj/item/bodypart/chest, /obj/item/bodypart/head, /obj/item/bodypart/r_leg, /obj/item/bodypart/l_leg) + var/obj/item/bodypart/l_arm/l_arm = new() + var/obj/item/bodypart/r_arm/r_arm = new() + bodyparts += l_arm + bodyparts += r_arm + l_arm.held_index = 1 + r_arm.held_index = 2 + hand_organs += l_arm + hand_organs += r_arm for(var/X in bodyparts) var/obj/item/bodypart/O = X O.owner = src @@ -193,7 +200,7 @@ ..() /mob/living/carbon/human/attack_ui(slot) - if(!get_bodypart(hand ? "l_arm" : "r_arm")) + if(!has_hand_for_held_index(active_hand_index)) return 0 return ..() @@ -201,11 +208,13 @@ user.set_machine(src) var/has_breathable_mask = istype(wear_mask, /obj/item/clothing/mask) var/list/obscured = check_obscured_slots() + var/list/dat = list() - var/dat = {" - - - "} + dat += "
Left Hand:[(l_hand && !(l_hand.flags&ABSTRACT)) ? l_hand : "Empty"]
Right Hand:[(r_hand && !(r_hand.flags&ABSTRACT)) ? r_hand : "Empty"]
 
" + for(var/i in 1 to held_items.len) + var/obj/item/I = get_item_for_held_index(i) + dat += "" + dat += "" dat += "
[get_held_index_name(i)]:[(I && !(I.flags & ABSTRACT)) ? I : "Empty"]
 
Back:[(back && !(back.flags&ABSTRACT)) ? back : "Empty"]" if(has_breathable_mask && istype(back, /obj/item/weapon/tank)) @@ -279,7 +288,7 @@ "} var/datum/browser/popup = new(user, "mob\ref[src]", "[src]", 440, 510) - popup.set_content(dat) + popup.set_content(dat.Join()) popup.open() // called when something steps onto a human @@ -354,7 +363,7 @@ var/pocket_side = href_list["pockets"] var/pocket_id = (pocket_side == "right" ? slot_r_store : slot_l_store) var/obj/item/pocket_item = (pocket_id == slot_r_store ? r_store : l_store) - var/obj/item/place_item = usr.get_active_hand() // Item to place in the pocket, if it's empty + var/obj/item/place_item = usr.get_active_held_item() // Item to place in the pocket, if it's empty var/delay_denominator = 1 if(pocket_item && !(pocket_item.flags&ABSTRACT)) @@ -653,7 +662,7 @@ if(lasercolor == "b")//Lasertag turrets target the opposing team, how great is that? -Sieve if(istype(wear_suit, /obj/item/clothing/suit/redtag)) threatcount += 4 - if((istype(r_hand,/obj/item/weapon/gun/energy/laser/redtag)) || (istype(l_hand,/obj/item/weapon/gun/energy/laser/redtag))) + if(is_holding_item_of_type(/obj/item/weapon/gun/energy/laser/redtag)) threatcount += 4 if(istype(belt, /obj/item/weapon/gun/energy/laser/redtag)) threatcount += 2 @@ -661,7 +670,7 @@ if(lasercolor == "r") if(istype(wear_suit, /obj/item/clothing/suit/bluetag)) threatcount += 4 - if((istype(r_hand,/obj/item/weapon/gun/energy/laser/bluetag)) || (istype(l_hand,/obj/item/weapon/gun/energy/laser/bluetag))) + if(is_holding_item_of_type(/obj/item/weapon/gun/energy/laser/bluetag)) threatcount += 4 if(istype(belt, /obj/item/weapon/gun/energy/laser/bluetag)) threatcount += 2 @@ -676,10 +685,9 @@ //Check for weapons if(judgebot.weaponscheck) if(!idcard || !(access_weapons in idcard.access)) - if(judgebot.check_for_weapons(l_hand)) - threatcount += 4 - if(judgebot.check_for_weapons(r_hand)) - threatcount += 4 + for(var/obj/item/I in held_items) + if(judgebot.check_for_weapons(I)) + threatcount += 4 if(judgebot.check_for_weapons(belt)) threatcount += 2 @@ -739,8 +747,7 @@ /mob/living/carbon/human/singularity_pull(S, current_size) if(current_size >= STAGE_THREE) - var/list/handlist = list(l_hand, r_hand) - for(var/obj/item/hand in handlist) + for(var/obj/item/hand in held_items) if(prob(current_size * 5) && hand.w_class >= ((11-current_size)/2) && unEquip(hand)) step_towards(hand, src) src << "\The [S] pulls \the [hand] from your grip!" diff --git a/code/modules/mob/living/carbon/human/human_attackalien.dm b/code/modules/mob/living/carbon/human/human_attackalien.dm index 9ab3c8decc9..b407a2881a9 100644 --- a/code/modules/mob/living/carbon/human/human_attackalien.dm +++ b/code/modules/mob/living/carbon/human/human_attackalien.dm @@ -26,7 +26,7 @@ updatehealth() if(M.a_intent == "disarm") //Always drop item in hand, if no item, get stunned instead. - if(get_active_hand() && drop_item()) + if(get_active_held_item() && drop_item()) playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) visible_message("[M] disarmed [src]!", \ "[M] disarmed [src]!") diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index edf30eb4b84..f19d0567565 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -72,25 +72,19 @@ if(wear_suit) if(wear_suit.IsReflect(def_zone) == 1) return 1 - if(l_hand) - if(l_hand.IsReflect(def_zone) == 1) - return 1 - if(r_hand) - if(r_hand.IsReflect(def_zone) == 1) + for(var/obj/item/I in held_items) + if(I.IsReflect(def_zone) == 1) return 1 return 0 /mob/living/carbon/human/proc/check_shields(damage = 0, attack_text = "the attack", atom/movable/AM, attack_type = MELEE_ATTACK, armour_penetration = 0) var/block_chance_modifier = round(damage / -3) - if(l_hand && !istype(l_hand, /obj/item/clothing)) - var/final_block_chance = l_hand.block_chance - (Clamp((armour_penetration-l_hand.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example - if(l_hand.hit_reaction(src, attack_text, final_block_chance, damage, attack_type)) - return 1 - if(r_hand && !istype(r_hand, /obj/item/clothing)) - var/final_block_chance = r_hand.block_chance - (Clamp((armour_penetration-r_hand.armour_penetration)/2,0,100)) + block_chance_modifier //Need to reset the var so it doesn't carry over modifications between attempts - if(r_hand.hit_reaction(src, attack_text, final_block_chance, damage, attack_type)) - return 1 + for(var/obj/item/I in held_items) + if(!istype(I, /obj/item/clothing)) + var/final_block_chance = I.block_chance - (Clamp((armour_penetration-I.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example + if(I.hit_reaction(src, attack_text, final_block_chance, damage, attack_type)) + return 1 if(wear_suit) var/final_block_chance = wear_suit.block_chance - (Clamp((armour_penetration-wear_suit.armour_penetration)/2,0,100)) + block_chance_modifier if(wear_suit.hit_reaction(src, attack_text, final_block_chance, damage, attack_type)) @@ -262,10 +256,8 @@ inventory_items_to_kill += back if(belt) inventory_items_to_kill += belt - if(r_hand) - inventory_items_to_kill += r_hand - if(l_hand) - inventory_items_to_kill += l_hand + + inventory_items_to_kill += held_items for(var/obj/item/I in inventory_items_to_kill) I.acid_act(acidpwr, acid_volume_left) diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index ada7a5cceaf..b2dee2df5e8 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -53,3 +53,5 @@ var/global/default_martial_art = new/datum/martial_art var/drunkenness = 0 //Overall drunkenness - check handle_alcohol() in life.dm for effects var/datum/personal_crafting/handcrafting + + var/list/hand_organs = list() //a collection of arms (or actually whatever the fug /bodyparts you monsters use to wreck my systems) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/human_helpers.dm b/code/modules/mob/living/carbon/human/human_helpers.dm index 4b25bca1238..69863d41b9b 100644 --- a/code/modules/mob/living/carbon/human/human_helpers.dm +++ b/code/modules/mob/living/carbon/human/human_helpers.dm @@ -101,13 +101,15 @@ return 1 /mob/living/carbon/human/abiotic(full_body = 0) - if(full_body && ((l_hand && !( src.l_hand.flags&NODROP )) || (r_hand && !( src.r_hand.flags&NODROP )) || (back && !(back.flags&NODROP)) || (wear_mask && !(wear_mask.flags&NODROP)) || (head && !(head.flags&NODROP)) || (shoes && !(shoes.flags&NODROP)) || (w_uniform && !(w_uniform.flags&NODROP)) || (wear_suit && !(wear_suit.flags&NODROP)) || (glasses && !(glasses.flags&NODROP)) || (ears && !(ears.flags&NODROP)) || (gloves && !(gloves.flags&NODROP)) ) ) - return 1 + var/abiotic_hands = FALSE + for(var/obj/item/I in held_items) + if(!(I.flags & NODROP)) + abiotic_hands = TRUE + break + if(full_body && abiotic_hands && ((back && !(back.flags&NODROP)) || (wear_mask && !(wear_mask.flags&NODROP)) || (head && !(head.flags&NODROP)) || (shoes && !(shoes.flags&NODROP)) || (w_uniform && !(w_uniform.flags&NODROP)) || (wear_suit && !(wear_suit.flags&NODROP)) || (glasses && !(glasses.flags&NODROP)) || (ears && !(ears.flags&NODROP)) || (gloves && !(gloves.flags&NODROP)) ) ) + return TRUE + return abiotic_hands - if( (src.l_hand && !(src.l_hand.flags&NODROP)) || (src.r_hand && !(src.r_hand.flags&NODROP)) ) - return 1 - - return 0 /mob/living/carbon/human/IsAdvancedToolUser() return 1//Humans can use guns and such diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 7fbb7e01a83..cf9504df710 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -22,10 +22,6 @@ return handcuffed if(slot_legcuffed) return legcuffed - if(slot_l_hand) - return l_hand - if(slot_r_hand) - return r_hand if(slot_belt) return belt if(slot_wear_id) @@ -113,7 +109,7 @@ //Item is handled and in slot, valid to call callback, for this proc should always be true if(!not_handled) I.equipped(src, slot) - + return not_handled //For future deeper overrides /mob/living/carbon/human/unEquip(obj/item/I) diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index b4ee5a8844d..32d34cbaf95 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -494,24 +494,14 @@ if(!I.species_exception || !is_type_in_list(src, I.species_exception)) return 0 - var/R = H.has_right_hand() - var/L = H.has_left_hand() var/num_arms = H.get_num_arms() var/num_legs = H.get_num_legs() switch(slot) - if(slot_l_hand) - if(H.l_hand) - return 0 - if(!L) - return 0 - return 1 - if(slot_r_hand) - if(H.r_hand) - return 0 - if(!R) - return 0 - return 1 + if(slot_hands) + if(H.get_empty_held_indexes()) + return TRUE + return FALSE if(slot_wear_mask) if(H.wear_mask) return 0 @@ -881,11 +871,9 @@ . += H.shoes.slowdown if(H.back) . += H.back.slowdown - if(H.l_hand && (H.l_hand.flags & HANDSLOW)) - . += H.l_hand.slowdown - if(H.r_hand && (H.r_hand.flags & HANDSLOW)) - . += H.r_hand.slowdown - + for(var/obj/item/I in H.held_items) + if(I.flags & HANDSLOW) + . += I.slowdown if((H.disabilities & FAT)) . += 1.5 if(H.bodytemperature < BODYTEMP_COLD_DAMAGE_LIMIT) diff --git a/code/modules/mob/living/carbon/human/species_types.dm b/code/modules/mob/living/carbon/human/species_types.dm index 6f7beec0e7d..9677c1b0bfc 100644 --- a/code/modules/mob/living/carbon/human/species_types.dm +++ b/code/modules/mob/living/carbon/human/species_types.dm @@ -676,10 +676,9 @@ . = ..() // Drop items in hands // If you're a zombie lucky enough to have a NODROP item, then it stays. - if(C.unEquip(C.l_hand)) - C.put_in_l_hand(new /obj/item/zombie_hand(C)) - if(C.unEquip(C.r_hand)) - C.put_in_r_hand(new /obj/item/zombie_hand(C)) + for(var/obj/item/I in C.held_items) + C.unEquip(I) + C.put_in_hands(new /obj/item/zombie_hand(C)) // Next, deal with the source of this zombie corruption var/obj/item/organ/body_egg/zombie_infection/infection @@ -689,13 +688,10 @@ /datum/species/zombie/infectious/on_species_loss(mob/living/carbon/C) . = ..() - var/obj/item/zombie_hand/left = C.l_hand - var/obj/item/zombie_hand/right = C.r_hand - // Deletion of the hands is handled in the items dropped() - if(istype(left)) - C.unEquip(left, TRUE) - if(istype(right)) - C.unEquip(right, TRUE) + for(var/obj/item/I in C.held_items) + if(istype(I, /obj/item/zombie_hand)) + C.unEquip(I, TRUE) + // Your skin falls off /datum/species/krokodil_addict @@ -757,7 +753,7 @@ var/global/image/plasmaman_on_fire = image("icon"='icons/mob/OnFire.dmi', "icon_ /datum/species/plasmaman/before_equip_job(datum/job/J, mob/living/carbon/human/H, visualsOnly = FALSE) var/datum/outfit/plasmaman/O = new /datum/outfit/plasmaman H.equipOutfit(O, visualsOnly) - H.internal = H.r_hand + H.internal = H.get_item_for_held_index(2) H.update_internals_hud_icon(1) return 0 @@ -1016,8 +1012,8 @@ SYNDICATE BLACK OPS playsound(H.loc, 'sound/misc/slip.ogg', 50, 1, -3) - H.accident(H.l_hand) - H.accident(H.r_hand) + for(var/obj/item/I in H.held_items) + H.accident(I) var/olddir = H.dir diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 98e5d5d82b6..d2bb7c4b0c2 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -392,8 +392,7 @@ There are several things that need to be remembered: overlays_standing[SUIT_LAYER] = standing if(istype(wear_suit, /obj/item/clothing/suit/straight_jacket)) - drop_l_hand() - drop_r_hand() + drop_all_held_items() update_hair() update_mutant_bodyparts() @@ -548,14 +547,38 @@ generate/load female uniform sprites matching all previously decided variables standing = center_image(standing, isinhands ? inhand_x_dimension : worn_x_dimension, isinhands ? inhand_y_dimension : worn_y_dimension) + //Handle held offsets + var/mob/M = loc + if(istype(M)) + var/list/L = get_held_offsets() + if(L) + standing.pixel_x += L["x"] //+= because of center()ing + standing.pixel_y += L["y"] + standing.alpha = alpha standing.color = color return standing +/obj/item/proc/get_held_offsets() + var/list/L + if(ismob(loc)) + var/mob/M = loc + L = M.get_item_offsets_for_index(M.get_held_index_of_item(src)) + return L +//Can't think of a better way to do this, sadly +/mob/proc/get_item_offsets_for_index(i) + switch(i) + if(3) //odd = left hands + return list("x" = 0, "y" = 16) + if(4) //even = right hands + return list("x" = 0, "y" = 16) + else //No offsets or Unwritten number of hands + return list("x" = 0, "y" = 0) + diff --git a/code/modules/mob/living/carbon/inventory.dm b/code/modules/mob/living/carbon/inventory.dm index 3eb8b085a0f..c4589e1125b 100644 --- a/code/modules/mob/living/carbon/inventory.dm +++ b/code/modules/mob/living/carbon/inventory.dm @@ -1,4 +1,4 @@ -/mob/living/carbon/get_item_by_slot(slot_id) +/mob/living/carbon/get_item_by_slot(slot_id, hand_index) switch(slot_id) if(slot_back) return back @@ -10,10 +10,6 @@ return handcuffed if(slot_legcuffed) return legcuffed - if(slot_l_hand) - return l_hand - if(slot_r_hand) - return r_hand return null @@ -24,10 +20,9 @@ if(!istype(I)) return - if(I == l_hand) - l_hand = null - else if(I == r_hand) - r_hand = null + var/index = get_held_index_of_item(I) + if(index) + held_items[index] = null if(I.pulledby) I.pulledby.stop_pulling() @@ -59,25 +54,22 @@ if(slot_legcuffed) legcuffed = I update_inv_legcuffed() - if(slot_l_hand) - l_hand = I - update_inv_l_hand() - if(slot_r_hand) - r_hand = I - update_inv_r_hand() + if(slot_hands) + put_in_hands(I) + update_inv_hands() if(slot_in_backpack) - if(I == get_active_hand()) + if(I == get_active_held_item()) unEquip(I) I.loc = back else not_handled = TRUE - + //Item has been handled at this point and equipped callback can be safely called //We cannot call it for items that have not been handled as they are not yet correctly //in a slot (handled further down inheritance chain, probably living/carbon/human/equip_to_slot if(!not_handled) I.equipped(src, slot) - + return not_handled /mob/living/carbon/unEquip(obj/item/I) diff --git a/code/modules/mob/living/carbon/monkey/inventory.dm b/code/modules/mob/living/carbon/monkey/inventory.dm index 0d7378a729c..a66f14c1c36 100644 --- a/code/modules/mob/living/carbon/monkey/inventory.dm +++ b/code/modules/mob/living/carbon/monkey/inventory.dm @@ -1,32 +1,28 @@ /mob/living/carbon/monkey/can_equip(obj/item/I, slot, disable_warning = 0) switch(slot) - if(slot_l_hand) - if(l_hand) - return 0 - return 1 - if(slot_r_hand) - if(r_hand) - return 0 - return 1 + if(slot_hands) + if(get_empty_held_indexes()) + return TRUE + return FALSE if(slot_wear_mask) if(wear_mask) - return 0 + return FALSE if( !(I.slot_flags & SLOT_MASK) ) - return 0 - return 1 + return FALSE + return TRUE if(slot_head) if(head) - return 0 + return FALSE if( !(I.slot_flags & SLOT_HEAD) ) - return 0 - return 1 + return FALSE + return TRUE if(slot_back) if(back) - return 0 + return FALSE if( !(I.slot_flags & SLOT_BACK) ) - return 0 - return 1 - return 0 //Unsupported slot + return FALSE + return TRUE + return FALSE //Unsupported slot diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index 344fcf1c7f7..6ae41f3c859 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -249,21 +249,20 @@ //Lasertag bullshit if(lasercolor) if(lasercolor == "b")//Lasertag turrets target the opposing team, how great is that? -Sieve - if((istype(r_hand,/obj/item/weapon/gun/energy/laser/redtag)) || (istype(l_hand,/obj/item/weapon/gun/energy/laser/redtag))) + if(is_holding_item_of_type(/obj/item/weapon/gun/energy/laser/redtag)) threatcount += 4 if(lasercolor == "r") - if((istype(r_hand,/obj/item/weapon/gun/energy/laser/bluetag)) || (istype(l_hand,/obj/item/weapon/gun/energy/laser/bluetag))) + if(is_holding_item_of_type(/obj/item/weapon/gun/energy/laser/bluetag)) threatcount += 4 return threatcount //Check for weapons if(judgebot.weaponscheck) - if(judgebot.check_for_weapons(l_hand)) - threatcount += 4 - if(judgebot.check_for_weapons(r_hand)) - threatcount += 4 + for(var/obj/item/I in held_items) + if(judgebot.check_for_weapons(I)) + threatcount += 4 //mindshield implants imply trustworthyness if(isloyal(src)) diff --git a/code/modules/mob/living/carbon/update_icons.dm b/code/modules/mob/living/carbon/update_icons.dm index a89af54cd5d..05f410fafe2 100644 --- a/code/modules/mob/living/carbon/update_icons.dm +++ b/code/modules/mob/living/carbon/update_icons.dm @@ -40,64 +40,43 @@ overlays -= overlays_standing[cache_index] overlays_standing[cache_index] = null -/mob/living/carbon/update_inv_r_hand() - remove_overlay(R_HAND_LAYER) - if (handcuffed) - drop_r_hand() - return - if(r_hand) - if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD) - r_hand.screen_loc = ui_rhand - client.screen += r_hand - if(observers && observers.len) - for(var/M in observers) - var/mob/dead/observe = M - if(observe.client && observe.client.eye == src) - observe.client.screen += r_hand - else - observers -= observe - if(!observers.len) - observers = null - break - - var/t_state = r_hand.item_state - if(!t_state) - t_state = r_hand.icon_state - - var/image/standing = r_hand.build_worn_icon(state = t_state, default_layer = R_HAND_LAYER, default_icon_file = r_hand.righthand_file, isinhands = TRUE) - overlays_standing[R_HAND_LAYER] = standing - - apply_overlay(R_HAND_LAYER) - -/mob/living/carbon/update_inv_l_hand() - remove_overlay(L_HAND_LAYER) +/mob/living/carbon/update_inv_hands() + remove_overlay(HANDS_LAYER) if(handcuffed) - drop_l_hand() + drop_all_held_items() return - if(l_hand) + + var/list/hands = list() + for(var/obj/item/I in held_items) if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD) - l_hand.screen_loc = ui_lhand - client.screen += l_hand + I.screen_loc = ui_hand_position(get_held_index_of_item(I)) + client.screen += I if(observers && observers.len) for(var/M in observers) var/mob/dead/observe = M if(observe.client && observe.client.eye == src) - observe.client.screen += l_hand + observe.client.screen += I else observers -= observe if(!observers.len) observers = null break - var/t_state = l_hand.item_state + var/t_state = I.item_state if(!t_state) - t_state = l_hand.icon_state + t_state = I.icon_state - var/image/standing = l_hand.build_worn_icon(state = t_state, default_layer = L_HAND_LAYER, default_icon_file = l_hand.lefthand_file, isinhands = TRUE) - overlays_standing[L_HAND_LAYER] = standing + var/icon_file = I.lefthand_file + if(get_held_index_of_item(I) % 2 == 0) + icon_file = I.righthand_file + + var/image/standing = I.build_worn_icon(state = t_state, default_layer = HANDS_LAYER, default_icon_file = icon_file, isinhands = TRUE) + hands += standing + + overlays_standing[HANDS_LAYER] = hands + apply_overlay(HANDS_LAYER) - apply_overlay(L_HAND_LAYER) /mob/living/carbon/update_fire(var/fire_icon = "Generic_mob_burning") remove_overlay(FIRE_LAYER) @@ -109,8 +88,7 @@ /mob/living/carbon/regenerate_icons() if(notransform) return 1 - update_inv_r_hand() - update_inv_l_hand() + update_inv_hands() update_inv_handcuffed() update_inv_legcuffed() update_fire() @@ -154,11 +132,10 @@ //update whether handcuffs appears on our hud. /mob/living/carbon/proc/update_hud_handcuffed() if(hud_used) - var/obj/screen/inventory/R = hud_used.inv_slots[slot_r_hand] - var/obj/screen/inventory/L = hud_used.inv_slots[slot_l_hand] - if(R && L) - R.update_icon() - L.update_icon() + for(var/hand in hud_used.hand_slots) + var/obj/screen/inventory/hand/H = hud_used.hand_slots[hand] + if(H) + H.update_icon() //update whether our head item appears on our hud. /mob/living/carbon/proc/update_hud_head(obj/item/I) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 2ac3753795c..daf09118c9d 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -149,10 +149,10 @@ if(!(M.status_flags & CANPUSH)) return 1 //anti-riot equipment is also anti-push - if(M.r_hand && (prob(M.r_hand.block_chance * 2)) && !istype(M.r_hand, /obj/item/clothing)) - return 1 - if(M.l_hand && (prob(M.l_hand.block_chance * 2)) && !istype(M.l_hand, /obj/item/clothing)) - return 1 + for(var/obj/item/I in M.held_items) + if(!istype(M, /obj/item/clothing)) + if(prob(I.block_chance*2)) + return 1 //Called when we bump onto an obj /mob/living/proc/ObjBump(obj/O) @@ -790,7 +790,7 @@ // The src mob is trying to place an item on someone // Override if a certain mob should be behave differently when placing items (can't, for example) /mob/living/stripPanelEquip(obj/item/what, mob/who, where) - what = src.get_active_hand() + what = src.get_active_held_item() if(what && (what.flags & NODROP)) src << "You can't put \the [what.name] on [who], it's stuck to your hand!" return @@ -869,11 +869,10 @@ // What icon do we use for the attack? var/image/I - if(hand && l_hand) // Attacked with item in left hand. - I = image(l_hand.icon, A, l_hand.icon_state, A.layer + 0.1) - else if(!hand && r_hand) // Attacked with item in right hand. - I = image(r_hand.icon, A, r_hand.icon_state, A.layer + 0.1) - else // Attacked with a fist? + var/obj/item/held_item = get_active_held_item() + if(held_item) + I = image(held_item.icon, A, held_item.icon_state, A.layer + 0.1) + else return // Who can see the attack? diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index c61e41458f1..c7543c03ede 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -216,8 +216,7 @@ add_logs(user, src, "grabbed", addition="aggressively") visible_message("[user] has grabbed [src] aggressively!", \ "[user] has grabbed [src] aggressively!") - drop_r_hand() - drop_l_hand() + drop_all_held_items() stop_pulling() if(GRAB_NECK) visible_message("[user] has grabbed [src] by the neck!",\ diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 7b4793a4cca..75ed1c827d7 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -266,14 +266,15 @@ var/list/crit_allowed_modes = list(MODE_WHISPER,MODE_CHANGELING,MODE_ALIEN) /mob/living/proc/radio(message, message_mode, list/spans) switch(message_mode) if(MODE_R_HAND) - if (r_hand) - r_hand.talk_into(src, message, , spans) - return ITALICS | REDUCE_RANGE - + for(var/obj/item/r_hand in get_held_items_for_side("r", all = TRUE)) + if (r_hand) + r_hand.talk_into(src, message, , spans) + return ITALICS | REDUCE_RANGE if(MODE_L_HAND) - if (l_hand) - l_hand.talk_into(src, message, , spans) - return ITALICS | REDUCE_RANGE + for(var/obj/item/l_hand in get_held_items_for_side("l", all = TRUE)) + if (l_hand) + l_hand.talk_into(src, message, , spans) + return ITALICS | REDUCE_RANGE if(MODE_INTERCOM) for (var/obj/item/device/radio/intercom/I in view(1, null)) diff --git a/code/modules/mob/living/silicon/robot/examine.dm b/code/modules/mob/living/silicon/robot/examine.dm index 81e0365ba06..e4233a06e8d 100644 --- a/code/modules/mob/living/silicon/robot/examine.dm +++ b/code/modules/mob/living/silicon/robot/examine.dm @@ -3,7 +3,7 @@ if(desc) msg += "[desc]\n" - var/obj/act_module = get_active_hand() + var/obj/act_module = get_active_held_item() if(act_module) msg += "It is holding \icon[act_module] \a [act_module].\n" msg += "" diff --git a/code/modules/mob/living/silicon/robot/inventory.dm b/code/modules/mob/living/silicon/robot/inventory.dm index 55276e7807b..71aaaf15df1 100644 --- a/code/modules/mob/living/silicon/robot/inventory.dm +++ b/code/modules/mob/living/silicon/robot/inventory.dm @@ -2,7 +2,7 @@ //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) -/mob/living/silicon/robot/get_active_hand() +/mob/living/silicon/robot/get_active_held_item() return module_active diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 810cca481f8..63fd0413051 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -24,6 +24,7 @@ var/obj/screen/inv3 = null var/obj/screen/lamp_button = null var/obj/screen/thruster_button = null + var/obj/screen/hands = null var/shown_robot_modules = 0 //Used to determine whether they have the module menu shown or not var/obj/screen/robot_modules_background @@ -715,7 +716,7 @@ if (M.a_intent =="disarm") if(!(lying)) M.do_attack_animation(src) - if(get_active_hand()) + if(get_active_held_item()) uneq_active() visible_message("[M] disarmed [src]!", \ "[M] has disabled [src]'s active module!") @@ -777,13 +778,13 @@ if(istype(M, /mob/living/carbon/human)) var/mob/living/carbon/human/H = M //if they are holding or wearing a card that has access, that works - if(check_access(H.get_active_hand()) || check_access(H.wear_id)) + if(check_access(H.get_active_held_item()) || check_access(H.wear_id)) return 1 else if(istype(M, /mob/living/carbon/monkey)) var/mob/living/carbon/monkey/george = M //they can only hold things :( - if(istype(george.get_active_hand(), /obj/item)) - return check_access(george.get_active_hand()) + if(istype(george.get_active_held_item(), /obj/item)) + return check_access(george.get_active_held_item()) return 0 /mob/living/silicon/robot/proc/check_access(obj/item/weapon/card/id/I) @@ -1033,7 +1034,7 @@ if(incapacitated()) return - var/obj/item/W = get_active_hand() + var/obj/item/W = get_active_held_item() if(W) W.attack_self(src) diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index 0c40e06055e..40bda94fb41 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -147,14 +147,14 @@ switch(add_to) if("head") - place_on_head(usr.get_active_hand(),usr) + place_on_head(usr.get_active_held_item(),usr) if("back") if(inventory_back) usr << "It's already wearing something!" return else - var/obj/item/item_to_add = usr.get_active_hand() + var/obj/item/item_to_add = usr.get_active_held_item() if(!item_to_add) usr.visible_message("[usr] pets [src].","You rest your hand on [src]'s back for a moment.") diff --git a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm index 3a0ff80b5db..ee5f1893324 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm @@ -144,19 +144,13 @@ /mob/living/simple_animal/drone/examine(mob/user) var/msg = "*---------*\nThis is \icon[src] \a [src]!\n" - //Left hand items - if(l_hand && !(l_hand.flags&ABSTRACT)) - if(l_hand.blood_DNA) - msg += "It is holding \icon[l_hand] [l_hand.gender==PLURAL?"some":"a"] blood-stained [l_hand.name] in its left hand!\n" - else - msg += "It is holding \icon[l_hand] \a [l_hand] in its left hand.\n" - - //Right hand items - if(r_hand && !(r_hand.flags&ABSTRACT)) - if(r_hand.blood_DNA) - msg += "It is holding \icon[r_hand] [r_hand.gender==PLURAL?"some":"a"] blood-stained [r_hand.name] in its right hand!\n" - else - msg += "It is holding \icon[r_hand] \a [r_hand] in its right hand.\n" + //Hands + for(var/obj/item/I in held_items) + if(!(I.flags & ABSTRACT)) + if(I.blood_DNA) + msg += "It has \icon[I] [I.gender==PLURAL?"some":"a"] blood-stained [I.name] in its [get_held_index_name(get_held_index_of_item(I))]!\n" + else + msg += "It has \icon[I] \a [I] in its [get_held_index_name(get_held_index_of_item(I))].\n" //Internal storage if(internal_storage && !(internal_storage.flags&ABSTRACT)) diff --git a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm index fba7b98f181..b95e845d563 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm @@ -64,7 +64,7 @@ if(stat == DEAD || status_flags & GODMODE) ..() return - if(user.get_active_hand()) + if(user.get_active_held_item()) user << "Your hands are full!" return visible_message("[user] starts picking up [src].", \ @@ -77,8 +77,7 @@ user << "[src] is buckled to [buckled] and cannot be picked up!" return user << "You pick [src] up." - drop_l_hand() - drop_r_hand() + drop_all_held_items() var/obj/item/clothing/head/drone_holder/DH = new /obj/item/clothing/head/drone_holder(src) DH.updateVisualAppearence(src) DH.drone = src diff --git a/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm b/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm index 5fc07a58efe..44838adbe88 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm @@ -49,10 +49,9 @@ if(!istype(I)) return - if(I == l_hand) - l_hand = null - else if(I == r_hand) - r_hand = null + var/index = get_held_index_of_item(I) + if(index) + held_items[index] = null update_inv_hands() if(I.pulledby) diff --git a/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm b/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm index 6ebc4d8066c..ca5456e625c 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm @@ -18,10 +18,13 @@ drone_overlays[cache_index] = null -/mob/living/simple_animal/drone/proc/update_inv_hands() +/mob/living/simple_animal/drone/update_inv_hands() remove_overlay(DRONE_HANDS_LAYER) var/list/hands_overlays = list() + var/obj/item/l_hand = get_item_for_held_index(1) + var/obj/item/r_hand = get_item_for_held_index(2) + var/y_shift = getItemPixelShiftY() if(r_hand) @@ -38,7 +41,7 @@ if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD) r_hand.layer = ABOVE_HUD_LAYER - r_hand.screen_loc = ui_rhand + r_hand.screen_loc = ui_hand_position(get_held_index_of_item(r_hand)) client.screen |= r_hand if(l_hand) @@ -55,7 +58,7 @@ if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD) l_hand.layer = ABOVE_HUD_LAYER - l_hand.screen_loc = ui_lhand + l_hand.screen_loc = ui_hand_position(get_held_index_of_item(l_hand)) client.screen |= l_hand @@ -87,16 +90,6 @@ apply_overlay(DRONE_HEAD_LAYER) - -//These procs serve as redirection so that the drone updates as expected when other things call these procs -/mob/living/simple_animal/drone/update_inv_l_hand() - update_inv_hands() - - -/mob/living/simple_animal/drone/update_inv_r_hand() - update_inv_hands() - - /mob/living/simple_animal/drone/update_inv_wear_mask() update_inv_head() diff --git a/code/modules/mob/living/simple_animal/guardian/guardian.dm b/code/modules/mob/living/simple_animal/guardian/guardian.dm index 96f074c5dcc..407076bbd4c 100644 --- a/code/modules/mob/living/simple_animal/guardian/guardian.dm +++ b/code/modules/mob/living/simple_animal/guardian/guardian.dm @@ -187,8 +187,7 @@ var/global/list/parasites = list() //all currently existing/living guardians return 1 /mob/living/simple_animal/hostile/guardian/death() - drop_l_hand() - drop_r_hand() + drop_all_held_items() ..() if(summoner) summoner << "Your [name] died somehow!" @@ -243,11 +242,10 @@ var/global/list/parasites = list() //all currently existing/living guardians return FALSE . = TRUE - if(I == l_hand) - l_hand = null - else if(I == r_hand) - r_hand = null - update_inv_hands() + var/index = get_held_index_of_item(I) + if(index) + held_items[index] = null + update_inv_hands() if(I.pulledby) I.pulledby.stop_pulling() @@ -267,9 +265,11 @@ var/global/list/parasites = list() //all currently existing/living guardians overlays -= guardian_overlays[cache_index] guardian_overlays[cache_index] = null -/mob/living/simple_animal/hostile/guardian/proc/update_inv_hands() +/mob/living/simple_animal/hostile/guardian/update_inv_hands() remove_overlay(GUARDIAN_HANDS_LAYER) var/list/hands_overlays = list() + var/obj/item/l_hand = get_item_for_held_index(1) + var/obj/item/r_hand = get_item_for_held_index(2) if(r_hand) var/r_state = r_hand.item_state @@ -282,7 +282,7 @@ var/global/list/parasites = list() //all currently existing/living guardians if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD) r_hand.layer = ABOVE_HUD_LAYER - r_hand.screen_loc = ui_rhand + r_hand.screen_loc = ui_hand_position(get_held_index_of_item(r_hand)) client.screen |= r_hand if(l_hand) @@ -296,19 +296,13 @@ var/global/list/parasites = list() //all currently existing/living guardians if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD) l_hand.layer = ABOVE_HUD_LAYER - l_hand.screen_loc = ui_lhand + l_hand.screen_loc = ui_hand_position(get_held_index_of_item(l_hand)) client.screen |= l_hand if(hands_overlays.len) guardian_overlays[GUARDIAN_HANDS_LAYER] = hands_overlays apply_overlay(GUARDIAN_HANDS_LAYER) -/mob/living/simple_animal/hostile/guardian/update_inv_l_hand() - update_inv_hands() - -/mob/living/simple_animal/hostile/guardian/update_inv_r_hand() - update_inv_hands() - /mob/living/simple_animal/hostile/guardian/regenerate_icons() update_inv_hands() diff --git a/code/modules/mob/living/simple_animal/guardian/types/charger.dm b/code/modules/mob/living/simple_animal/guardian/types/charger.dm index fc519b92144..2da19573101 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/charger.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/charger.dm @@ -60,9 +60,7 @@ if(H.check_shields(90, "[name]", src, attack_type = THROWN_PROJECTILE_ATTACK)) blocked = 1 if(!blocked) - - L.drop_r_hand() - L.drop_l_hand() + L.drop_all_held_items() L.visible_message("[src] slams into [L]!", "[src] slams into you!") L.apply_damage(20, BRUTE) playsound(get_turf(L), 'sound/effects/meteorimpact.ogg', 100, 1) diff --git a/code/modules/mob/living/simple_animal/guardian/types/dextrous.dm b/code/modules/mob/living/simple_animal/guardian/types/dextrous.dm index 0d2387ef10b..e86c85e182b 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/dextrous.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/dextrous.dm @@ -28,17 +28,13 @@ if(dextrous) var/msg = "*---------*\nThis is \icon[src] \a [src]!\n" msg += "[desc]\n" - if(l_hand && !(l_hand.flags&ABSTRACT)) - if(l_hand.blood_DNA) - msg += "It is holding \icon[l_hand] [l_hand.gender==PLURAL?"some":"a"] blood-stained [l_hand.name] in its left hand!\n" - else - msg += "It is holding \icon[l_hand] \a [l_hand] in its left hand.\n" - if(r_hand && !(r_hand.flags&ABSTRACT)) - if(r_hand.blood_DNA) - msg += "It is holding \icon[r_hand] [r_hand.gender==PLURAL?"some":"a"] blood-stained [r_hand.name] in its right hand!\n" - else - msg += "It is holding \icon[r_hand] \a [r_hand] in its right hand.\n" + for(var/obj/item/I in held_items) + if(!(I.flags & ABSTRACT)) + if(I.blood_DNA) + msg += "It has \icon[I] [I.gender==PLURAL?"some":"a"] blood-stained [I.name] in its [get_held_index_name(get_held_index_of_item(I))]!\n" + else + msg += "It has \icon[I] \a [I] in its [get_held_index_name(get_held_index_of_item(I))].\n" if(internal_storage && !(internal_storage.flags&ABSTRACT)) if(internal_storage.blood_DNA) @@ -53,14 +49,12 @@ /mob/living/simple_animal/hostile/guardian/dextrous/Recall() if(loc == summoner || cooldown > world.time) return 0 - drop_l_hand() - drop_r_hand() + drop_all_held_items() return ..() //lose items, then return /mob/living/simple_animal/hostile/guardian/dextrous/snapback() if(summoner && !(get_dist(get_turf(summoner),get_turf(src)) <= range)) - drop_l_hand() - drop_r_hand() + drop_all_held_items() ..() //lose items, then return //SLOT HANDLING BULLSHIT FOR INTERNAL STORAGE diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index 23455487021..ebe6e335255 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -224,7 +224,7 @@ //Adding things to inventory else if(href_list["add_inv"]) var/add_to = href_list["add_inv"] - if(!usr.get_active_hand()) + if(!usr.get_active_held_item()) usr << "You have nothing in your hand to put on its [add_to]!" return switch(add_to) @@ -233,7 +233,7 @@ usr << "It's already wearing something!" return else - var/obj/item/item_to_add = usr.get_active_hand() + var/obj/item/item_to_add = usr.get_active_held_item() if(!item_to_add) return @@ -633,8 +633,10 @@ item = I else if(iscarbon(AM)) var/mob/living/carbon/C = AM - if((C.l_hand && C.l_hand.w_class <= 2) || (C.r_hand && C.r_hand.w_class <= 2)) - item = C + for(var/obj/item/I in C.held_items) + if(I.w_class <= 2) + item = I + break if(item) if(!AStar(src, get_turf(item), /turf/proc/Distance_cardinal)) item = null @@ -668,8 +670,9 @@ if(iscarbon(AM)) var/mob/living/carbon/C = AM - if(C.l_hand && C.l_hand.w_class <= 2 || C.r_hand && C.r_hand.w_class <= 2) - return C + for(var/obj/item/I in C.held_items) + if(I.w_class <= 2) + return C return null @@ -719,11 +722,10 @@ var/obj/item/stolen_item = null for(var/mob/living/carbon/C in view(1,src)) - if(C.l_hand && C.l_hand.w_class <= 2) - stolen_item = C.l_hand - - if(C.r_hand && C.r_hand.w_class <= 2) - stolen_item = C.r_hand + for(var/obj/item/I in C.held_items) + if(I.w_class <= 2) + stolen_item = I + break if(stolen_item) C.unEquip(stolen_item) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 342ed9d9946..e5134bf3398 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -412,8 +412,7 @@ for(var/i in loot) new i(loc) if(dextrous) - unEquip(r_hand) - unEquip(l_hand) + drop_all_held_items() if(!gibbed) if(death_sound) playsound(get_turf(src),death_sound, 200, 1) @@ -545,8 +544,7 @@ /mob/living/simple_animal/update_canmove() if(paralysis || stunned || weakened || stat || resting) - drop_r_hand() - drop_l_hand() + drop_all_held_items() canmove = 0 else if(buckled) canmove = 0 @@ -622,54 +620,63 @@ /mob/living/simple_animal/activate_hand(selhand) if(!dextrous) return ..() + if(!selhand) + selhand = (selhand % held_items.len)+1 if(istext(selhand)) selhand = lowertext(selhand) if(selhand == "right" || selhand == "r") - selhand = 0 + selhand = 2 if(selhand == "left" || selhand == "l") selhand = 1 - if(selhand != src.hand) - swap_hand() + if(selhand != active_hand_index) + swap_hand(selhand) else mode() -/mob/living/simple_animal/swap_hand() +/mob/living/simple_animal/swap_hand(hand_index) if(!dextrous) return ..() - var/obj/item/held_item = get_active_hand() + if(!hand_index) + hand_index = (hand_index % held_items.len)+1 + var/obj/item/held_item = get_active_held_item() if(held_item) if(istype(held_item, /obj/item/weapon/twohanded)) var/obj/item/weapon/twohanded/T = held_item if(T.wielded == 1) usr << "Your other hand is too busy holding the [T.name]." return - hand = !hand - if(hud_used && hud_used.inv_slots[slot_l_hand] && hud_used.inv_slots[slot_r_hand]) + var/oindex = active_hand_index + active_hand_index = hand_index + if(hud_used) var/obj/screen/inventory/hand/H - H = hud_used.inv_slots[slot_l_hand] - H.update_icon() - H = hud_used.inv_slots[slot_r_hand] - H.update_icon() + H = hud_used.hand_slots["[hand_index]"] + if(H) + H.update_icon() + H = hud_used.hand_slots["[oindex]"] + if(H) + H.update_icon() /mob/living/simple_animal/UnarmedAttack(atom/A, proximity) if(!dextrous) return ..() if(!ismob(A)) A.attack_hand(src) - update_hand_icons() + update_inv_hands() /mob/living/simple_animal/put_in_hands(obj/item/I) ..() - update_hand_icons() + update_inv_hands() -/mob/living/simple_animal/proc/update_hand_icons() +/mob/living/simple_animal/update_inv_hands() if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD) + var/obj/item/l_hand = get_item_for_held_index(1) + var/obj/item/r_hand = get_item_for_held_index(2) if(r_hand) r_hand.layer = ABOVE_HUD_LAYER - r_hand.screen_loc = ui_rhand + r_hand.screen_loc = ui_hand_position(get_held_index_of_item(r_hand)) client.screen |= r_hand if(l_hand) l_hand.layer = ABOVE_HUD_LAYER - l_hand.screen_loc = ui_lhand + l_hand.screen_loc = ui_hand_position(get_held_index_of_item(l_hand)) client.screen |= l_hand diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 77dd49ef152..52f58164289 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -178,11 +178,6 @@ var/next_mob_id = 0 return /mob/proc/get_item_by_slot(slot_id) - switch(slot_id) - if(slot_l_hand) - return l_hand - if(slot_r_hand) - return r_hand return null /mob/proc/restrained(ignore_grab) @@ -193,7 +188,7 @@ var/next_mob_id = 0 //This proc is called whenever someone clicks an inventory ui slot. /mob/proc/attack_ui(slot) - var/obj/item/W = get_active_hand() + var/obj/item/W = get_active_held_item() if(istype(W)) if(equip_to_slot_if_possible(W, slot,0,0,0)) @@ -399,16 +394,11 @@ var/next_mob_id = 0 if(incapacitated()) return - if(hand) - var/obj/item/W = l_hand - if (W) - W.attack_self(src) - update_inv_l_hand() - else - var/obj/item/W = r_hand - if (W) - W.attack_self(src) - update_inv_r_hand() + var/obj/item/I = get_active_held_item() + if(I) + I.attack_self(src) + update_inv_hands() + /* /mob/verb/dump_source() @@ -694,8 +684,7 @@ var/next_mob_id = 0 var/has_arms = get_num_arms() var/ignore_legs = get_leg_ignore() if(ko || resting || stunned || chokehold) - drop_r_hand() - drop_l_hand() + drop_all_held_items() unset_machine() if(pulling) stop_pulling() @@ -728,8 +717,7 @@ var/next_mob_id = 0 /mob/proc/fall(forced) - drop_l_hand() - drop_r_hand() + drop_all_held_items() /mob/verb/eastface() set hidden = 1 diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index b361cf48130..ee73870dfd0 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -11,7 +11,6 @@ var/stat = 0 //Whether a mob is alive or dead. TODO: Move this to living - Nodrak - var/obj/screen/hands = null /*A bunch of this stuff really needs to go under their own defines instead of being globally attached to mob. A variable should only be globally attached to turfs/objects/whatever, when it is in fact needed as such. The current method unnecessarily clusters up the variable list, especially for humans (although rearranging won't really clean it up a lot but the difference will be noticable for other mobs). @@ -38,7 +37,6 @@ var/next_move = null var/notransform = null //Carbon - var/hand = null var/eye_blind = 0 //Carbon var/eye_blurry = 0 //Carbon var/ear_deaf = 0 //Carbon @@ -62,7 +60,6 @@ var/timeofdeath = 0//Living var/cpr_time = 1//Carbon - var/bodytemperature = 310.055 //98.7 F var/drowsyness = 0//Carbon var/dizziness = 0//Carbon @@ -79,8 +76,12 @@ var/m_intent = "run"//Living var/lastKnownIP = null var/atom/movable/buckled = null//Living - var/obj/item/l_hand = null//Living - var/obj/item/r_hand = null//Living + + //Hands + var/active_hand_index = 1 + var/list/held_items = list(null, null) //len = number of hands, eg: 2 nulls is 2 empty hands, 1 item and 1 null is 1 full hand and 1 empty hand. + //held_items[active_hand_index] is the actively held item, but please use get_active_held_item() instead, because OOP + var/obj/item/weapon/storage/s_active = null//Carbon var/see_override = 0 //0 for no override, sets see_invisible = see_override in mob life process diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 3e734dee12f..37e60e3b93c 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -273,8 +273,9 @@ It's fairly easy to fix if dealing with single letters but not so much with comp return 0 /mob/proc/abiotic(full_body = 0) - if(l_hand && !l_hand.flags&NODROP || r_hand && !r_hand.flags&NODROP) - return 1 + for(var/obj/item/I in held_items) + if(!(I.flags & NODROP)) + return 1 return 0 //converts intent-strings into numbers and back @@ -384,10 +385,6 @@ It's fairly easy to fix if dealing with single letters but not so much with comp return 1 return 0 -/proc/get_both_hands(mob/living/carbon/M) - var/list/hands = list(M.l_hand, M.r_hand) - return hands - /mob/proc/reagent_check(datum/reagent/R) // utilized in the species code return 1 diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index d7b4a73fc86..5cbc3b370bc 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -55,7 +55,7 @@ /client/Northwest() - if(!usr.get_active_hand()) + if(!usr.get_active_held_item()) usr << "You have nothing to drop in your hand!" return usr.drop_item() diff --git a/code/modules/mob/update_icons.dm b/code/modules/mob/update_icons.dm index b14056f4186..e2cb8d95974 100644 --- a/code/modules/mob/update_icons.dm +++ b/code/modules/mob/update_icons.dm @@ -19,10 +19,7 @@ /mob/proc/update_inv_back() return -/mob/proc/update_inv_l_hand() - return - -/mob/proc/update_inv_r_hand() +/mob/proc/update_inv_hands() return /mob/proc/update_inv_wear_mask() @@ -62,4 +59,4 @@ return /mob/proc/update_inv_ears() - return + return \ No newline at end of file diff --git a/code/modules/modular_computers/computers/item/laptop.dm b/code/modules/modular_computers/computers/item/laptop.dm index 51c91a595ae..946a0c2fe52 100644 --- a/code/modules/modular_computers/computers/item/laptop.dm +++ b/code/modules/modular_computers/computers/item/laptop.dm @@ -55,12 +55,7 @@ if(!M.restrained() && !M.stat) if(!isturf(loc) || !Adjacent(M)) return - - switch(H.slot_id) - if(slot_r_hand) - M.put_in_r_hand(src) - if(slot_l_hand) - M.put_in_l_hand(src) + M.put_in_hand(src, H.held_index) /obj/item/device/modular_computer/laptop/attack_hand(mob/user) if(screen_on && isturf(loc)) diff --git a/code/modules/modular_computers/file_system/program.dm b/code/modules/modular_computers/file_system/program.dm index b8ec10694b8..8ddff02fb64 100644 --- a/code/modules/modular_computers/file_system/program.dm +++ b/code/modules/modular_computers/file_system/program.dm @@ -89,7 +89,7 @@ if(ishuman(user)) var/mob/living/carbon/human/h = user var/obj/item/weapon/card/id/I = h.get_idcard() - var/obj/item/weapon/card/id/C = h.get_active_hand() + var/obj/item/weapon/card/id/C = h.get_active_held_item() if(C) C = C.GetID() if(!(C && istype(C))) diff --git a/code/modules/modular_computers/file_system/programs/card.dm b/code/modules/modular_computers/file_system/programs/card.dm index 1e201da470b..780045d8b73 100644 --- a/code/modules/modular_computers/file_system/programs/card.dm +++ b/code/modules/modular_computers/file_system/programs/card.dm @@ -169,7 +169,7 @@ data_core.manifest_modify(id_card.registered_name, id_card.assignment) computer.proc_eject_id(user, 1) else - var/obj/item/I = usr.get_active_hand() + var/obj/item/I = usr.get_active_held_item() if (istype(I, /obj/item/weapon/card/id)) if(!usr.drop_item()) return @@ -185,7 +185,7 @@ minor = 0 computer.proc_eject_id(user, 2) else - var/obj/item/I = usr.get_active_hand() + var/obj/item/I = usr.get_active_held_item() if (istype(I, /obj/item/weapon/card/id)) if(!usr.drop_item()) return diff --git a/code/modules/ninja/suit/n_suit_verbs/ninja_stars.dm b/code/modules/ninja/suit/n_suit_verbs/ninja_stars.dm index 1fa003fa76a..39e7f5c5701 100644 --- a/code/modules/ninja/suit/n_suit_verbs/ninja_stars.dm +++ b/code/modules/ninja/suit/n_suit_verbs/ninja_stars.dm @@ -9,11 +9,11 @@ if(!ninjacost(10)) var/mob/living/carbon/human/H = affecting - var/slot = H.hand ? slot_l_hand : slot_r_hand - - if(H.equip_to_slot_or_del(new /obj/item/weapon/throwing_star/ninja(H), slot)) + var/obj/item/weapon/throwing_star/ninja/N = new(H) + if(H.put_in_hands(N)) H << "A throwing star has been created in your hand!" - + else + qdel(N) H.throw_mode_on() //So they can quickly throw it. diff --git a/code/modules/paperwork/clipboard.dm b/code/modules/paperwork/clipboard.dm index b58b7d2bfec..f9e66b606ee 100644 --- a/code/modules/paperwork/clipboard.dm +++ b/code/modules/paperwork/clipboard.dm @@ -35,7 +35,7 @@ user << "You clip the paper onto \the [src]." update_icon() else if(toppaper) - toppaper.attackby(usr.get_active_hand(), usr) + toppaper.attackby(user.get_active_held_item(), user) update_icon() @@ -75,8 +75,9 @@ if(href_list["addpen"]) if(!haspen) - if(istype(usr.get_active_hand(), /obj/item/weapon/pen)) - var/obj/item/weapon/pen/W = usr.get_active_hand() + var/obj/item/held = usr.get_active_held_item() + if(istype(held, /obj/item/weapon/pen)) + var/obj/item/weapon/pen/W = held if(!usr.unEquip(W)) return W.loc = src @@ -86,8 +87,8 @@ if(href_list["write"]) var/obj/item/P = locate(href_list["write"]) if(istype(P) && P.loc == src) - if(usr.get_active_hand()) - P.attackby(usr.get_active_hand(), usr) + if(usr.get_active_held_item()) + P.attackby(usr.get_active_held_item(), usr) if(href_list["remove"]) var/obj/item/P = locate(href_list["remove"]) diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index f6b887f1a2f..87b424efbfb 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -257,14 +257,14 @@ var/t = stripped_multiline_input("Enter what you want to write:", "Write") if(!t) return - var/obj/item/i = usr.get_active_hand() //Check to see if he still got that darn pen, also check if he's using a crayon or pen. + var/obj/item/i = usr.get_active_held_item() //Check to see if he still got that darn pen, also check if he's using a crayon or pen. var/iscrayon = 0 if(!istype(i, /obj/item/weapon/pen)) if(!istype(i, /obj/item/toy/crayon)) return iscrayon = 1 - if(!in_range(src, usr) && loc != usr && !istype(loc, /obj/item/weapon/clipboard) && loc.loc != usr && usr.get_active_hand() != i) //Some check to see if he's allowed to write + if(!in_range(src, usr) && loc != usr && !istype(loc, /obj/item/weapon/clipboard) && loc.loc != usr && usr.get_active_held_item() != i) //Some check to see if he's allowed to write return t = parsepencode(t, i, usr, iscrayon) // Encode everything from pencode to html diff --git a/code/modules/paperwork/paper_cutter.dm b/code/modules/paperwork/paper_cutter.dm index 88d12fbd1c5..d147fb85a14 100644 --- a/code/modules/paperwork/paper_cutter.dm +++ b/code/modules/paperwork/paper_cutter.dm @@ -97,11 +97,7 @@ if(!remove_item_from_storage(M)) if(!M.unEquip(src)) return - switch(H.slot_id) - if(slot_r_hand) - M.put_in_r_hand(src) - if(slot_l_hand) - M.put_in_l_hand(src) + M.put_in_hand(src, H.held_index) add_fingerprint(M) diff --git a/code/modules/paperwork/paperbin.dm b/code/modules/paperwork/paperbin.dm index 08f1f9bd76f..f559e5bde98 100644 --- a/code/modules/paperwork/paperbin.dm +++ b/code/modules/paperwork/paperbin.dm @@ -43,11 +43,7 @@ if(!remove_item_from_storage(M)) if(!M.unEquip(src)) return - switch(H.slot_id) - if(slot_r_hand) - M.put_in_r_hand(src) - if(slot_l_hand) - M.put_in_l_hand(src) + M.put_in_hand(src, H.held_index) add_fingerprint(M) diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index 52b39bc2737..4007929f9a9 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -245,17 +245,17 @@ else continue - var/holding = null + var/list/holding = list() if(istype(M, /mob/living)) var/mob/living/L = M - if(L.l_hand || L.r_hand) - if(L.l_hand) holding = "They are holding \a [L.l_hand]" - if(L.r_hand) - if(holding) - holding += " and \a [L.r_hand]" - else - holding = "They are holding \a [L.r_hand]" + + for(var/obj/item/I in L.held_items) + if(!holding) + holding += "They are holding \a [I]" + else + holding += " and \a [I]" + holding = holding.Join() if(!mob_detail) mob_detail = "You can see [L] on the photo[L.health < (L.maxHealth * 0.75) ? " - [L] looks hurt":""].[holding ? " [holding]":"."]. " diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 68c06b4cb51..9b6f7a79297 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -439,7 +439,7 @@ else user << "You try to remove the light [fitting], but you burn your hand on it!" - var/obj/item/bodypart/affecting = H.get_bodypart("[user.hand ? "l" : "r" ]_arm") + var/obj/item/bodypart/affecting = H.get_bodypart("[(user.active_hand_index % 2 == 0) ? "r" : "l" ]_arm") if(affecting && affecting.take_damage( 0, 5 )) // 5 burn damage H.update_damage_overlays(0) H.updatehealth() diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 03df590ca0a..9311a0e0e42 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -125,7 +125,7 @@ user.visible_message("[user] fires [src]!", "You fire [src]!", "You hear a [istype(src, /obj/item/weapon/gun/energy) ? "laser blast" : "gunshot"]!") if(weapon_weight >= WEAPON_MEDIUM) - if(user.get_inactive_hand()) + if(user.get_inactive_held_item()) if(prob(15)) if(user.drop_item()) user.visible_message("[src] flies out of [user]'s hands!", "[src] kicks out of your grip!") @@ -171,7 +171,7 @@ user.drop_item() return - if(weapon_weight == WEAPON_HEAVY && user.get_inactive_hand()) + if(weapon_weight == WEAPON_HEAVY && user.get_inactive_held_item()) user << "You need both hands free to fire \the [src]!" return @@ -207,7 +207,7 @@ obj/item/weapon/gun/proc/newshot() return if(weapon_weight) - if(user.get_inactive_hand()) + if(user.get_inactive_held_item()) recoil = 4 //one-handed kick else recoil = initial(recoil) @@ -218,7 +218,7 @@ obj/item/weapon/gun/proc/newshot() if(!user) break if(!issilicon(user)) - if( i>1 && !(src in get_both_hands(user))) //for burst firing + if( i>1 && !(user.is_holding(src))) //for burst firing break if(chambered) var/sprd = 0 @@ -261,10 +261,7 @@ obj/item/weapon/gun/proc/newshot() semicd = 0 if(user) - if(user.hand) - user.update_inv_l_hand() - else - user.update_inv_r_hand() + user.update_inv_hands() feedback_add_details("gun_fired","[src.type]") /obj/item/weapon/gun/attack(mob/M as mob, mob/user) diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index 9001dd964d5..f729b9966cf 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -139,7 +139,7 @@ if (src.can_shoot()) user.visible_message("[user] is putting the barrel of the [src.name] in \his mouth. It looks like \he's trying to commit suicide.") sleep(25) - if(user.l_hand == src || user.r_hand == src) + if(user.is_holding(src)) user.visible_message("[user] melts \his face off with the [src.name]!") playsound(loc, fire_sound, 50, 1, -1) var/obj/item/ammo_casing/energy/shot = ammo_type[select] diff --git a/code/modules/projectiles/guns/projectile.dm b/code/modules/projectiles/guns/projectile.dm index cd5b9c737ab..594df3bd3b6 100644 --- a/code/modules/projectiles/guns/projectile.dm +++ b/code/modules/projectiles/guns/projectile.dm @@ -98,7 +98,7 @@ if(loc == user) if(suppressed && can_unsuppress) var/obj/item/weapon/suppressor/S = suppressed - if(user.l_hand != src && user.r_hand != src) + if(!user.is_holding(src)) ..() return user << "You unscrew [suppressed] from [src]." @@ -145,7 +145,7 @@ if (src.chambered && src.chambered.BB && !src.chambered.BB.nodamage) user.visible_message("[user] is putting the barrel of the [src.name] in \his mouth. It looks like \he's trying to commit suicide.") sleep(25) - if(user.l_hand == src || user.r_hand == src) + if(user.is_holding(src)) process_fire(user, user, 0, zone_override = "head") user.visible_message("[user] blows \his brains out with the [src.name]!") return(BRUTELOSS) diff --git a/code/modules/projectiles/guns/projectile/laser_gatling.dm b/code/modules/projectiles/guns/projectile/laser_gatling.dm index 35210e78702..43de02219f3 100644 --- a/code/modules/projectiles/guns/projectile/laser_gatling.dm +++ b/code/modules/projectiles/guns/projectile/laser_gatling.dm @@ -69,11 +69,7 @@ var/obj/screen/inventory/hand/H = over_object if(!M.unEquip(src)) return - switch(H.slot_id) - if(slot_r_hand) - M.put_in_r_hand(src) - if(slot_l_hand) - M.put_in_l_hand(src) + M.put_in_hand(src, H.held_index) /obj/item/weapon/minigunpack/update_icon() diff --git a/code/modules/reagents/chemistry/reagents/drug_reagents.dm b/code/modules/reagents/chemistry/reagents/drug_reagents.dm index 8e130dac8ce..939f77472cf 100644 --- a/code/modules/reagents/chemistry/reagents/drug_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drug_reagents.dm @@ -173,13 +173,13 @@ /datum/reagent/drug/methamphetamine/overdose_process(mob/living/M) if(M.canmove && !istype(M.loc, /atom/movable)) - for(var/i = 0, i < 4, i++) + for(var/i in 1 to 4) step(M, pick(cardinal)) if(prob(20)) M.emote("laugh") if(prob(33)) M.visible_message("[M]'s hands flip out and flail everywhere!") - var/obj/item/I = M.get_active_hand() + var/obj/item/I = M.get_active_held_item() if(I) M.drop_item() ..() @@ -252,12 +252,12 @@ /datum/reagent/drug/bath_salts/overdose_process(mob/living/M) M.hallucination += 10 if(M.canmove && !istype(M.loc, /atom/movable)) - for(var/i = 0, i < 8, i++) + for(var/i in 1 to 8) step(M, pick(cardinal)) if(prob(20)) M.emote(pick("twitch","drool","moan")) if(prob(33)) - var/obj/item/I = M.get_active_hand() + var/obj/item/I = M.get_active_held_item() if(I) M.drop_item() ..() diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index b81330a3099..2461aaba745 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -579,7 +579,7 @@ /datum/reagent/medicine/morphine/overdose_process(mob/living/M) if(prob(33)) - var/obj/item/I = M.get_active_hand() + var/obj/item/I = M.get_active_held_item() if(I) M.drop_item() M.Dizzy(2) @@ -588,7 +588,7 @@ /datum/reagent/medicine/morphine/addiction_act_stage1(mob/living/M) if(prob(33)) - var/obj/item/I = M.get_active_hand() + var/obj/item/I = M.get_active_held_item() if(I) M.drop_item() M.Dizzy(2) @@ -597,7 +597,7 @@ /datum/reagent/medicine/morphine/addiction_act_stage2(mob/living/M) if(prob(33)) - var/obj/item/I = M.get_active_hand() + var/obj/item/I = M.get_active_held_item() if(I) M.drop_item() M.adjustToxLoss(1*REM, 0) @@ -608,7 +608,7 @@ /datum/reagent/medicine/morphine/addiction_act_stage3(mob/living/M) if(prob(33)) - var/obj/item/I = M.get_active_hand() + var/obj/item/I = M.get_active_held_item() if(I) M.drop_item() M.adjustToxLoss(2*REM, 0) @@ -619,7 +619,7 @@ /datum/reagent/medicine/morphine/addiction_act_stage4(mob/living/M) if(prob(33)) - var/obj/item/I = M.get_active_hand() + var/obj/item/I = M.get_active_held_item() if(I) M.drop_item() M.adjustToxLoss(3*REM, 0) diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index 64de2aef123..ace882be22e 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -748,10 +748,8 @@ if(H.lip_style) H.lip_style = null H.update_body() - if(C.r_hand) - C.r_hand.clean_blood() - if(C.l_hand) - C.l_hand.clean_blood() + for(var/obj/item/I in C.held_items) + I.clean_blood() if(C.wear_mask) if(C.wear_mask.clean_blood()) C.update_inv_wear_mask() diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index 08b12d92666..1ed89a74db8 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -78,7 +78,7 @@ var/t = stripped_input(user, "What would you like to label the blood pack?", name, null, 53) if(!user.canUseTopic(src)) return - if(user.get_active_hand() != I) + if(user.get_active_held_item() != I) return if(loc != user) return diff --git a/code/modules/spells/spell_types/charge.dm b/code/modules/spells/spell_types/charge.dm index 57088176cb2..ebd4933f58d 100644 --- a/code/modules/spells/spell_types/charge.dm +++ b/code/modules/spells/spell_types/charge.dm @@ -14,7 +14,7 @@ /obj/effect/proc_holder/spell/targeted/charge/cast(list/targets,mob/user = usr) for(var/mob/living/L in targets) - var/list/hand_items = list(L.get_active_hand(),L.get_inactive_hand()) + var/list/hand_items = list(L.get_active_held_item(),L.get_inactive_held_item()) var/charged_item = null var/burnt_out = 0 diff --git a/code/modules/spells/spell_types/lichdom.dm b/code/modules/spells/spell_types/lichdom.dm index 511f446bf4f..9a1d27ebbc7 100644 --- a/code/modules/spells/spell_types/lichdom.dm +++ b/code/modules/spells/spell_types/lichdom.dm @@ -43,7 +43,7 @@ for(var/mob/M in targets) var/list/hand_items = list() if(iscarbon(M)) - hand_items = list(M.get_active_hand(),M.get_inactive_hand()) + hand_items = list(M.get_active_held_item(),M.get_inactive_held_item()) if(marked_item && !stat_allowed) //sanity, shouldn't happen without badminry marked_item = null diff --git a/code/modules/spells/spell_types/summonitem.dm b/code/modules/spells/spell_types/summonitem.dm index e4b02f8b08b..4d6d1b5a3b3 100644 --- a/code/modules/spells/spell_types/summonitem.dm +++ b/code/modules/spells/spell_types/summonitem.dm @@ -17,8 +17,7 @@ /obj/effect/proc_holder/spell/targeted/summonitem/cast(list/targets,mob/user = usr) for(var/mob/living/L in targets) - var/list/hand_items = list(L.get_active_hand(),L.get_inactive_hand()) - var/butterfingers = 0 + var/list/hand_items = list(L.get_active_held_item(),L.get_inactive_held_item()) var/message if(!marked_item) //linking item to the spell @@ -93,17 +92,7 @@ if(item_to_retrive.loc) item_to_retrive.loc.visible_message("The [item_to_retrive.name] suddenly disappears!") - - - if(L.hand) //left active hand - if(!L.equip_to_slot_if_possible(item_to_retrive, slot_l_hand, 0, 1, 1)) - if(!L.equip_to_slot_if_possible(item_to_retrive, slot_r_hand, 0, 1, 1)) - butterfingers = 1 - else //right active hand - if(!L.equip_to_slot_if_possible(item_to_retrive, slot_r_hand, 0, 1, 1)) - if(!L.equip_to_slot_if_possible(item_to_retrive, slot_l_hand, 0, 1, 1)) - butterfingers = 1 - if(butterfingers) + if(!L.put_in_hands(item_to_retrive)) item_to_retrive.loc = L.loc item_to_retrive.loc.visible_message("The [item_to_retrive.name] suddenly appears!") playsound(get_turf(L),"sound/magic/SummonItems_generic.ogg",50,1) diff --git a/code/modules/spells/spell_types/touch_attacks.dm b/code/modules/spells/spell_types/touch_attacks.dm index 51fa79bccc7..7cc593a1d0d 100644 --- a/code/modules/spells/spell_types/touch_attacks.dm +++ b/code/modules/spells/spell_types/touch_attacks.dm @@ -24,17 +24,8 @@ sleep(1) /obj/effect/proc_holder/spell/targeted/touch/proc/ChargeHand(mob/living/carbon/user) - var/hand_handled = 1 attached_hand = new hand_path(src) - if(user.hand) //left active hand - if(!user.equip_to_slot_if_possible(attached_hand, slot_l_hand, 0, 1, 1)) - if(!user.equip_to_slot_if_possible(attached_hand, slot_r_hand, 0, 1, 1)) - hand_handled = 0 - else //right active hand - if(!user.equip_to_slot_if_possible(attached_hand, slot_r_hand, 0, 1, 1)) - if(!user.equip_to_slot_if_possible(attached_hand, slot_l_hand, 0, 1, 1)) - hand_handled = 0 - if(!hand_handled) + if(!user.put_in_hands(attached_hand)) qdel(attached_hand) charge_counter = charge_max attached_hand = null diff --git a/code/modules/surgery/bodyparts/bodyparts.dm b/code/modules/surgery/bodyparts/bodyparts.dm index 42b001e1ddd..74c8679cd78 100644 --- a/code/modules/surgery/bodyparts/bodyparts.dm +++ b/code/modules/surgery/bodyparts/bodyparts.dm @@ -16,6 +16,7 @@ var/burn_dam = 0 var/max_damage = 0 var/list/embedded_objects = list() + var/held_index = 0 //are we a hand? if so, which one! //Coloring and proper item icon update var/skin_tone = "" @@ -287,7 +288,6 @@ return I - /obj/item/bodypart/chest name = "chest" desc = "It's impolite to stare at a person's chest." diff --git a/code/modules/surgery/bodyparts/dismemberment.dm b/code/modules/surgery/bodyparts/dismemberment.dm index 5d2e56971d7..b3a9c4aebb1 100644 --- a/code/modules/surgery/bodyparts/dismemberment.dm +++ b/code/modules/surgery/bodyparts/dismemberment.dm @@ -69,6 +69,10 @@ if(!no_update) update_limb(1) H.bodyparts -= src + if(held_index) + H.unEquip(owner.get_item_for_held_index(held_index), 1) + H.hand_organs[held_index] = null + owner = null for(var/X in H.surgeries) //if we had an ongoing surgery on that limb, we stop it. @@ -138,11 +142,9 @@ H.handcuffed = null H.update_handcuffed() if(H.hud_used) - var/obj/screen/inventory/R = H.hud_used.inv_slots[slot_r_hand] + var/obj/screen/inventory/hand/R = H.hud_used.hand_slots["[held_index]"] if(R) R.update_icon() - if(H.r_hand) - H.unEquip(H.r_hand, 1) if(H.gloves) H.unEquip(H.gloves, 1) H.update_inv_gloves() //to remove the bloody hands overlay @@ -158,11 +160,9 @@ H.handcuffed = null H.update_handcuffed() if(H.hud_used) - var/obj/screen/inventory/L = H.hud_used.inv_slots[slot_l_hand] + var/obj/screen/inventory/hand/L = H.hud_used.hand_slots["[held_index]"] if(L) L.update_icon() - if(H.l_hand) - H.unEquip(H.l_hand, 1) if(H.gloves) H.unEquip(H.gloves, 1) H.update_inv_gloves() //to remove the bloody hands overlay @@ -258,14 +258,14 @@ /obj/item/bodypart/r_arm/attach_limb(mob/living/carbon/human/H, special) ..() if(H.hud_used) - var/obj/screen/inventory/R = H.hud_used.inv_slots[slot_r_hand] + var/obj/screen/inventory/hand/R = H.hud_used.hand_slots["[held_index]"] if(R) R.update_icon() /obj/item/bodypart/l_arm/attach_limb(mob/living/carbon/human/H, special) ..() if(H.hud_used) - var/obj/screen/inventory/L = H.hud_used.inv_slots[slot_l_hand] + var/obj/screen/inventory/hand/L = H.hud_used.hand_slots["[held_index]"] if(L) L.update_icon() diff --git a/code/modules/surgery/bodyparts/helpers.dm b/code/modules/surgery/bodyparts/helpers.dm index f3e6fdbeabc..8df7c38ed3e 100644 --- a/code/modules/surgery/bodyparts/helpers.dm +++ b/code/modules/surgery/bodyparts/helpers.dm @@ -10,44 +10,36 @@ if(L.body_zone == zone) return L -//Mob has their active hand -/mob/proc/has_active_hand() - return 1 - -/mob/living/carbon/human/has_active_hand() - var/obj/item/bodypart/L - if(hand) - L = get_bodypart("l_arm") - else - L = get_bodypart("r_arm") - if(!L) - return 0 - return 1 +/mob/living/carbon/human/has_hand_for_held_index(i) + if(i) + var/obj/item/bodypart/L = hand_organs[i] + if(L) + return L + return FALSE /mob/proc/has_left_hand() - return 1 + return TRUE /mob/living/carbon/human/has_left_hand() - var/obj/item/bodypart/L - L = get_bodypart("l_arm") - if(!L) - return 0 - return 1 + for(var/obj/item/bodypart/L in hand_organs) + if(!(L.held_index % 2)) + return TRUE + return FALSE /mob/proc/has_right_hand() - return 1 + return TRUE /mob/living/carbon/human/has_right_hand() - var/obj/item/bodypart/L - L = get_bodypart("r_arm") - if(!L) - return 0 - return 1 + for(var/obj/item/bodypart/L in hand_organs) + if(L.held_index % 2) + return TRUE + return FALSE //Limb numbers /mob/proc/get_num_arms() return 2 + /mob/proc/get_num_legs() return 2 diff --git a/code/modules/surgery/helpers.dm b/code/modules/surgery/helpers.dm index 79b641e3c06..982ef0d4d40 100644 --- a/code/modules/surgery/helpers.dm +++ b/code/modules/surgery/helpers.dm @@ -76,7 +76,7 @@ user.visible_message("[user] removes the drapes from [M]'s [parse_zone(selected_zone)].", \ "You remove the drapes from [M]'s [parse_zone(selected_zone)].") qdel(current_surgery) - else if(istype(user.get_inactive_hand(), /obj/item/weapon/cautery) && current_surgery.can_cancel) + else if(istype(user.get_inactive_held_item(), /obj/item/weapon/cautery) && current_surgery.can_cancel) M.surgeries -= current_surgery user.visible_message("[user] mends the incision and removes the drapes from [M]'s [parse_zone(selected_zone)].", \ "You mend the incision and remove the drapes from [M]'s [parse_zone(selected_zone)].") diff --git a/code/modules/surgery/implant_removal.dm b/code/modules/surgery/implant_removal.dm index b3ab5a6379c..92704aa1356 100644 --- a/code/modules/surgery/implant_removal.dm +++ b/code/modules/surgery/implant_removal.dm @@ -26,14 +26,11 @@ I.removed(target) var/obj/item/weapon/implantcase/case - - if(istype(user.get_item_by_slot(slot_l_hand), /obj/item/weapon/implantcase)) - case = user.get_item_by_slot(slot_l_hand) - else if(istype(user.get_item_by_slot(slot_r_hand), /obj/item/weapon/implantcase)) - case = user.get_item_by_slot(slot_r_hand) - else + for(var/obj/item/weapon/implantcase/ic in user.held_items) + case = ic + break + if(!case) case = locate(/obj/item/weapon/implantcase) in get_turf(target) - if(case && !case.imp) case.imp = I I.loc = case diff --git a/code/modules/surgery/limb_augmentation.dm b/code/modules/surgery/limb_augmentation.dm index f0a03ea7269..3a00620a172 100644 --- a/code/modules/surgery/limb_augmentation.dm +++ b/code/modules/surgery/limb_augmentation.dm @@ -84,7 +84,7 @@ user.visible_message("[user] begins to install the chainsaw onto [target].", "You begin to install the chainsaw onto [target]...") /datum/surgery_step/chainsaw/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) - if(target.l_hand && target.r_hand) + if(!target.get_empty_held_indexes()) user << "You can't fit the chainsaw in while [target]'s hands are full!" return 0 else @@ -104,9 +104,7 @@ requires_organic_bodypart = 0 /datum/surgery/chainsaw_removal/can_start(mob/user, mob/living/carbon/target) - var/list/hands = get_both_hands(target) - var/M = locate(/obj/item/weapon/mounted_chainsaw) in hands - if(M) + if(target.is_holding_item_of_type(/obj/item/weapon/mounted_chainsaw)) return 1//can continue surgery else return 0//surgery will never be available @@ -120,8 +118,7 @@ user.visible_message("[user] begins sawing the chainsaw off of [target]'s arms.", "You begin removing [target]'s chainsaw...") /datum/surgery_step/chainsaw_removal/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) - var/list/hands = get_both_hands(target) - for(var/obj/item/weapon/mounted_chainsaw/V in hands) + for(var/obj/item/weapon/mounted_chainsaw/V in target.held_items) target.unEquip(V, 1) user.visible_message("[user] carefully saws [target]'s arm free of the chainsaw.", "You remove the chainsaw.") return 1 diff --git a/code/modules/surgery/organ_manipulation.dm b/code/modules/surgery/organ_manipulation.dm index 8e8eccc4c8a..f2ccd41e270 100644 --- a/code/modules/surgery/organ_manipulation.dm +++ b/code/modules/surgery/organ_manipulation.dm @@ -77,7 +77,7 @@ organs[O.name] = O I = input("Remove which organ?", "Surgery", null, null) as null|anything in organs - if(I && user && target && user.Adjacent(target) && user.get_active_hand() == tool) + if(I && user && target && user.Adjacent(target) && user.get_active_held_item() == tool) I = organs[I] if(!I) return -1 user.visible_message("[user] begins to extract [I] from [target]'s [parse_zone(target_zone)].", diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm index 3cdf2328b19..76220ef9ddc 100644 --- a/code/modules/surgery/organs/augments_arms.dm +++ b/code/modules/surgery/organs/augments_arms.dm @@ -85,8 +85,7 @@ holder.w_class = 5 holder.materials = null - var/arm_slot = (zone == "r_arm" ? slot_r_hand : slot_l_hand) - var/obj/item/arm_item = owner.get_item_by_slot(arm_slot) + var/obj/item/arm_item = owner.get_active_held_item() if(arm_item) if(!owner.unEquip(arm_item)) @@ -95,13 +94,13 @@ else owner << "You drop [arm_item] to activate [src]!" - if(zone == "r_arm" ? !owner.put_in_r_hand(holder) : !owner.put_in_l_hand(holder)) + var/result = (zone == "r_arm" ? owner.put_in_r_hand(holder) : owner.put_in_l_hand(holder)) + if(!result) owner << "Your [src] fails to activate!" return // Activate the hand that now holds our item. - if(zone == "r_arm" ? owner.hand : !owner.hand) - owner.swap_hand() + owner.swap_hand(result)//... or the 1st hand if the index gets lost somehow owner.visible_message("[owner] extends [holder] from \his [zone == "r_arm" ? "right" : "left"] arm.", "You extend [holder] from your [zone == "r_arm" ? "right" : "left"] arm.", @@ -114,8 +113,7 @@ return // You can emag the arm-mounted implant by activating it while holding emag in it's hand. - var/arm_slot = (zone == "r_arm" ? slot_r_hand : slot_l_hand) - if(istype(owner.get_item_by_slot(arm_slot), /obj/item/weapon/card/emag) && emag_act()) + if(istype(owner.get_active_held_item(), /obj/item/weapon/card/emag) && emag_act()) return if(!holder || (holder in src)) diff --git a/code/modules/surgery/organs/augments_internal.dm b/code/modules/surgery/organs/augments_internal.dm index 55a3ff40153..3a5abcf647e 100644 --- a/code/modules/surgery/organs/augments_internal.dm +++ b/code/modules/surgery/organs/augments_internal.dm @@ -41,10 +41,7 @@ name = "anti-drop implant" desc = "This cybernetic brain implant will allow you to force your hand muscles to contract, preventing item dropping. Twitch ear to toggle." var/active = 0 - var/l_hand_ignore = 0 - var/r_hand_ignore = 0 - var/obj/item/l_hand_obj = null - var/obj/item/r_hand_obj = null + var/list/stored_items = list() implant_color = "#DE7E00" slot = "brain_antidrop" origin_tech = "materials=4;programming=5;biotech=4" @@ -53,66 +50,41 @@ /obj/item/organ/cyberimp/brain/anti_drop/ui_action_click() active = !active if(active) - l_hand_obj = owner.l_hand - r_hand_obj = owner.r_hand - if(l_hand_obj) - if(owner.l_hand.flags & NODROP) - l_hand_ignore = 1 - else - owner.l_hand.flags |= NODROP - l_hand_ignore = 0 + for(var/obj/item/I in owner.held_items) + if(!(I.flags & NODROP)) + stored_items += I - if(r_hand_obj) - if(owner.r_hand.flags & NODROP) - r_hand_ignore = 1 - else - owner.r_hand.flags |= NODROP - r_hand_ignore = 0 - - if(!l_hand_obj && !r_hand_obj) + var/list/L = owner.get_empty_held_indexes() + if(L && L.len == owner.held_items.len) owner << "You are not holding any items, your hands relax..." active = 0 + stored_items = list() else - var/msg = 0 - msg += !l_hand_ignore && l_hand_obj ? 1 : 0 - msg += !r_hand_ignore && r_hand_obj ? 2 : 0 - switch(msg) - if(1) - owner << "Your left hand's grip tightens." - if(2) - owner << "Your right hand's grip tightens." - if(3) - owner << "Both of your hand's grips tighten." + for(var/obj/item/I in stored_items) + owner << "Your [owner.get_held_index_name(owner.get_held_index_of_item(I))]'s grip tightens." else release_items() owner << "Your hands relax..." - l_hand_obj = null - r_hand_obj = null + /obj/item/organ/cyberimp/brain/anti_drop/emp_act(severity) if(!owner) return var/range = severity ? 10 : 5 var/atom/A - var/obj/item/L_item = owner.l_hand - var/obj/item/R_item = owner.r_hand - release_items() ..() - if(L_item) + for(var/obj/item/I in stored_items) A = pick(oview(range)) - L_item.throw_at(A, range, 2) - owner << "Your left arm spasms and throws the [L_item.name]!" - if(R_item) - A = pick(oview(range)) - R_item.throw_at(A, range, 2) - owner << "Your right arm spasms and throws the [R_item.name]!" + I.throw_at(A, range, 2) + owner << "Your [owner.get_held_index_name(owner.get_held_index_of_item(I))] spasms and throws the [I.name]!" + stored_items = list() + /obj/item/organ/cyberimp/brain/anti_drop/proc/release_items() - if(!l_hand_ignore && l_hand_obj in owner.contents) - l_hand_obj.flags ^= NODROP - if(!r_hand_ignore && r_hand_obj in owner.contents) - r_hand_obj.flags ^= NODROP + for(var/obj/item/I in stored_items) + I.flags ^= NODROP + /obj/item/organ/cyberimp/brain/anti_drop/Remove(var/mob/living/carbon/M, special = 0) if(active) diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm index 1b8616c1fbb..35b15432304 100644 --- a/code/modules/surgery/surgery.dm +++ b/code/modules/surgery/surgery.dm @@ -45,7 +45,7 @@ var/datum/surgery_step/S = get_surgery_step() if(S) - if(S.try_op(user, target, user.zone_selected, user.get_active_hand(), src)) + if(S.try_op(user, target, user.zone_selected, user.get_active_held_item(), src)) return 1 return 0 diff --git a/code/modules/telesci/bscrystal.dm b/code/modules/telesci/bscrystal.dm index e9394c806b2..1077931fcbf 100644 --- a/code/modules/telesci/bscrystal.dm +++ b/code/modules/telesci/bscrystal.dm @@ -62,7 +62,7 @@ return /obj/item/stack/sheet/bluespace_crystal/attack_hand(mob/user) - if (user.get_inactive_hand() == src) + if (user.get_inactive_held_item() == src) if(zero_amount()) // in this case, a sanity check return var/obj/item/weapon/ore/bluespace_crystal/BC = new(src) diff --git a/code/modules/tgui/states/hands.dm b/code/modules/tgui/states/hands.dm index e3e110a2a83..a312bcecddf 100644 --- a/code/modules/tgui/states/hands.dm +++ b/code/modules/tgui/states/hands.dm @@ -15,7 +15,7 @@ return UI_CLOSE /mob/living/hands_can_use_topic(src_object) - if(src_object in get_both_hands(src)) + if(is_holding(src_object)) return UI_INTERACTIVE return UI_CLOSE diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm index 064a6bb1477..9c9a53cd9e1 100644 --- a/code/modules/vehicles/vehicle.dm +++ b/code/modules/vehicles/vehicle.dm @@ -52,7 +52,7 @@ //KEYS /obj/vehicle/proc/keycheck(mob/user) if(keytype) - if(istype(user.l_hand, keytype) || istype(user.r_hand, keytype)) + if(user.is_holding_item_of_type(keytype)) return 1 else return 1 diff --git a/code/modules/zombie/items.dm b/code/modules/zombie/items.dm index 9057dff9547..c2aa26041cd 100644 --- a/code/modules/zombie/items.dm +++ b/code/modules/zombie/items.dm @@ -17,12 +17,12 @@ /obj/item/zombie_hand/equipped(mob/user, slot) . = ..() - switch(slot) - // Yes, these intentionally don't match - if(slot_l_hand) - icon_state = icon_right - if(slot_r_hand) - icon_state = icon_left + //these are intentionally inverted + var/i = user.get_held_index_of_item(src) + if(!(i % 2)) + icon_state = icon_left + else + icon_state = icon_right /obj/item/zombie_hand/afterattack(atom/target, mob/user, proximity_flag) . = ..()