diff --git a/code/__DEFINES/screen.dm b/code/__DEFINES/screen.dm index 36428fed621..8d5c6005302 100644 --- a/code/__DEFINES/screen.dm +++ b/code/__DEFINES/screen.dm @@ -27,31 +27,27 @@ //* These should be widescreen-agnostic and use anchorings *// //* to the sides of the screen / center. *// +//* Mob HUD - Inventory *// + /// the bottom-left hand of hands HUD -#define SCREEN_LOC_MOB_HANDS_HUD_ANCHOR "CENTER-1:16,BOTTOM+1:5" +#define SCREEN_LOC_MOB_HUD_INVENTORY_HANDS_BOTTOM_LEFT "CENTER-1:16,BOTTOM+1:5" +#define SCREEN_LOC_MOB_HUD_INVENTORY_HAND(HAND) "CENTER[index % 2? "" : "-1"]:16,BOTTOM[index < 2? "" : "+[(round(index / 2) - 1)]"]:5" +#warn fill these in +#define SCREEN_LOC_MOB_HUD_INVENTORY_HAND_SWAP(TOTAL_HANDS) "" +#define SCREEN_LOC_MOB_HUD_INVENTORY_EQUIP_HAND(TOTAL_HANDS) "" /// the bottom-left drawer position of inventory HUD -#define SCREEN_LOC_MOB_INVENTORY_HUD_ANCHOR "LEFT:6,BOTTOM:5" +#define SCREEN_LOC_MOB_HUD_INVENTORY_DRAWER "LEFT:6,BOTTOM:5" + +#warn fill these in +#define SCREEN_LOC_MOB_HUD_INVENTORY_SLOT_DRAWER_ALIGNED(MAIN_AXIS, CROSS_AXIS) "" +#define SCREEN_LOC_MOB_HUD_INVENTORY_SLOT_HANDS_ALIGNED(MAIN_AXIS, CROSS_AXIS) "" #warn deal with this crap /// Hands -#define SCREEN_LOC_INV_HAND(index) "CENTER[index % 2? "" : "-1"]:16,BOTTOM[index < 2? "" : "+[(round(index / 2) - 1)]"]:5" -#define ui_swaphand1 "CENTER-1:16,BOTTOM+1:5" -#define ui_swaphand2 "CENTER:16,BOTTOM+1:5" - -//Lower left, persistant menu -#define ui_inventory "LEFT:6,BOTTOM:5" - -//Lower center, persistant menu -#define ui_sstore1 "LEFT+2:10,BOTTOM:5" -#define ui_id "LEFT+3:12,BOTTOM:5" -#define ui_belt "LEFT+4:14,BOTTOM:5" -#define ui_back "CENTER-2:14,BOTTOM:5" #define ui_equip "CENTER-1:16,BOTTOM+1:5" -#define ui_storage1 "CENTER+1:16,BOTTOM:5" -#define ui_storage2 "CENTER+2:16,BOTTOM:5" #define ui_smallquad "RIGHT-4:18,BOTTOM:4" ///aliens diff --git a/code/game/rendering/mob_huds/inventory.dm b/code/game/rendering/mob_huds/inventory.dm index d5ae130caf7..d3ee7c37f30 100644 --- a/code/game/rendering/mob_huds/inventory.dm +++ b/code/game/rendering/mob_huds/inventory.dm @@ -16,13 +16,12 @@ /// ordered hand objects var/list/atom/movable/screen/inventory/plate/hand/hands + /// drawer object + var/atom/movable/screen/inventory/drawer/button_drawer /// swap hand object - var/atom/movable/screen/inventory/swap_hand/swap_hand + var/atom/movable/screen/inventory/swap_hand/button_swap_hand /// equip object - var/atom/movable/screen/inventory/equip_hand/equip_hand - /// use hand on self object - var/atom/movable/screen/inventory/use_self_hand/use_self_hand - #warn add the drawer. + var/atom/movable/screen/inventory/equip_hand/button_equip_hand /datum/mob_hud/inventory/New(mob/owner, datum/inventory/host) src.host = host @@ -75,9 +74,9 @@ cleanup() // buttons - add_screen((swap_hand = new)) - add_screen((equip_hand = new)) - add_screen((use_self_hand = new)) + add_screen((button_swap_hand = new)) + add_screen((button_equip_hand = new)) + add_screen((button_drawer = new)) // slots rebuild_slots(inventory_slots_with_mappings) @@ -138,6 +137,9 @@ qdel(hands[i]) hands.len = number_of_hands + button_equip_hand?.screen_loc = SCREEN_LOC_MOB_HUD_INVENTORY_EQUIP_HAND(number_of_hands) + button_swap_hand?.screen_loc = SCREEN_LOC_MOB_HUD_INVENTORY_HAND_SWAP(number_of_hands) + /datum/mob_hud/inventory/proc/all_slot_screen_objects(filter_by_class) RETURN_TYPE(/list) . = list() @@ -165,12 +167,22 @@ /datum/mob_hud/inventory/proc/all_button_screen_objects() RETURN_TYPE(/list) . = list() - if(swap_hand) - . += swap_hand - if(equip_hand) - . += equip_hand - if(use_self_hand) - . += use_self_hand + if(button_swap_hand) + . += button_swap_hand + if(button_equip_hand) + . += button_equip_hand + if(button_drawer) + . += button_drawer + +/datum/mob_hud/inventory/proc/toggle_hidden_class(class) + var/list/atom/movable/screen/inventory/affected = all_slot_screen_objects(class) + if(class in hidden_classes) + LAZYREMOVE(hidden_classes, class) + add_screen(affected) + else + LAZYADD(hidden_classes, class) + remove_screen(affected) + button_drawer?.update_icon() /datum/mob_hud/inventory/proc/add_item(obj/item/item, datum/inventory_slot/slot_or_index) var/atom/movable/screen/inventory/plate/screen_obj = isnum(slot_or_index) ? hands[slot_or_index] : slot_by_id[slot_or_index.id] @@ -193,6 +205,9 @@ old_hand.cut_overlay("[old_hand.icon_state]-active") new_hand.add_overlay("[new_hand.icon_state]-active") +/** + * Base type of inventory screen objects. + */ /atom/movable/screen/inventory name = "inventory" icon = 'icons/screen/hud/midnight/inventory.dmi' @@ -298,7 +313,7 @@ /atom/movable/screen/inventory/plate/hand/handle_inventory_click(mob/user, slot_or_index, obj/item/with_item) /atom/movable/screen/inventory/plate/hand/proc/sync_index(index = hand_index) - screen_loc = SCREEN_LOC_INV_HAND(index) + screen_loc = SCREEN_LOC_MOB_HUD_INVENTORY_HAND(index) var/index_of_side = round(index / 2) name = "[index % 2? "left" : "right"] hand[index > 1? " #[index]" : ""]" icon_state = "hand-[index % 2? "left" : "right"]" @@ -315,6 +330,24 @@ if(handcuffed) . += image('icons/mob/screen_gen.dmi', "[hand_index % 2 ? "r_hand" : "l_hand"]_hud_handcuffs") +/** + * Button: 'swap hand' + */ +/atom/movable/screen/inventory/drawer + icon_state = "drawer" + +/atom/movable/screen/inventory/drawer/sync_style(datum/hud_style/style, style_alpha, style_color) + ..() + icon = style.inventory_icons_wide + +/atom/movable/screen/inventory/drawer/on_click(mob/user, list/params) + // todo: remote control + hud.toggle_hidden_class(INVENTORY_HUD_CLASS_DRAWER) + +/atom/movable/screen/inventory/drawer/update_icon_state() + icon_state = "[INVENTORY_HUD_CLASS_DRAWER in hud.hidden_classes ? "drawer" : "drawer-active"]" + return ..() + /** * Button: 'swap hand' */ @@ -325,7 +358,7 @@ ..() icon = style.inventory_icons_wide -/atom/movable/screen/inventory/swap_hands/on_click(mob/user, list/params) +/atom/movable/screen/inventory/swap_hand/on_click(mob/user, list/params) // todo: remote control user.swap_hand() @@ -342,12 +375,3 @@ /atom/movable/screen/inventory/equip_hand/on_click(mob/user, list/params) // todo: remote control user.attempt_smart_equip(user.get_active_held_item()) - -/** - * Button: 'activate inhand' - */ -/atom/movable/screen/inventory/use_self_hand - #warn does main have this? - -/atom/movable/screen/inventory/use_self_hand/on_click(mob/user, list/params) - // todo: remote control diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 5e88fae9b74..c93bdf60f8a 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -35,51 +35,51 @@ Gunshots/explosions/opening doors/less rare audio (done) if(16 to 25) //Strange items //to_chat(src, "Traitor Items") - if(!halitem) - halitem = new - var/list/slots_free = list() - for(var/i in get_empty_hand_indices()) - slots_free += SCREEN_LOC_INV_HAND(i) - if(istype(src,/mob/living/carbon/human)) - var/mob/living/carbon/human/H = src - if(!H.belt) slots_free += ui_belt - if(!H.l_store) slots_free += ui_storage1 - if(!H.r_store) slots_free += ui_storage2 - if(slots_free.len) - halitem.screen_loc = pick(slots_free) - halitem.hud_layerise() - switch(rand(1,6)) - if(1) //revolver - halitem.icon = 'icons/obj/gun/ballistic.dmi' - halitem.icon_state = "revolver" - halitem.name = "Revolver" - if(2) //c4 - halitem.icon = 'icons/obj/assemblies.dmi' - halitem.icon_state = "plastic-explosive0" - halitem.name = "Mysterious Package" - if(prob(25)) - halitem.icon_state = "c4small_1" - if(3) //sword - halitem.icon = 'icons/obj/weapons.dmi' - halitem.icon_state = "sword1" - halitem.name = "Sword" - if(4) //stun baton - halitem.icon = 'icons/obj/weapons.dmi' - halitem.icon_state = "stunbaton" - halitem.name = "Stun Baton" - if(5) //emag - halitem.icon = 'icons/obj/card.dmi' - halitem.icon_state = "emag" - halitem.name = "Cryptographic Sequencer" - if(6) //flashbang - halitem.icon = 'icons/obj/grenade.dmi' - halitem.icon_state = "flashbang1" - halitem.name = "Flashbang" - if(client) client.screen += halitem - spawn(rand(100,250)) - if(client) - client.screen -= halitem - halitem = null + // if(!halitem) + // halitem = new + // var/list/slots_free = list() + // for(var/i in get_empty_hand_indices()) + // slots_free += SCREEN_LOC_INV_HAND(i) + // if(istype(src,/mob/living/carbon/human)) + // var/mob/living/carbon/human/H = src + // if(!H.belt) slots_free += ui_belt + // if(!H.l_store) slots_free += ui_storage1 + // if(!H.r_store) slots_free += ui_storage2 + // if(slots_free.len) + // halitem.screen_loc = pick(slots_free) + // halitem.hud_layerise() + // switch(rand(1,6)) + // if(1) //revolver + // halitem.icon = 'icons/obj/gun/ballistic.dmi' + // halitem.icon_state = "revolver" + // halitem.name = "Revolver" + // if(2) //c4 + // halitem.icon = 'icons/obj/assemblies.dmi' + // halitem.icon_state = "plastic-explosive0" + // halitem.name = "Mysterious Package" + // if(prob(25)) + // halitem.icon_state = "c4small_1" + // if(3) //sword + // halitem.icon = 'icons/obj/weapons.dmi' + // halitem.icon_state = "sword1" + // halitem.name = "Sword" + // if(4) //stun baton + // halitem.icon = 'icons/obj/weapons.dmi' + // halitem.icon_state = "stunbaton" + // halitem.name = "Stun Baton" + // if(5) //emag + // halitem.icon = 'icons/obj/card.dmi' + // halitem.icon_state = "emag" + // halitem.name = "Cryptographic Sequencer" + // if(6) //flashbang + // halitem.icon = 'icons/obj/grenade.dmi' + // halitem.icon_state = "flashbang1" + // halitem.name = "Flashbang" + // if(client) client.screen += halitem + // spawn(rand(100,250)) + // if(client) + // client.screen -= halitem + // halitem = null if(26 to 40) //Flashes of danger //to_chat(src, "Danger Flash") diff --git a/code/modules/mob/living/simple_mob/simple_hud.dm b/code/modules/mob/living/simple_mob/simple_hud.dm index be5132d3330..c57feeb371f 100644 --- a/code/modules/mob/living/simple_mob/simple_hud.dm +++ b/code/modules/mob/living/simple_mob/simple_hud.dm @@ -21,42 +21,6 @@ var/list/hud_elements = list() var/atom/movable/screen/using - var/atom/movable/screen/inventory/plate/slot/inv_box - - var/has_hidden_gear - if(LAZYLEN(hud_gears)) - for(var/gear_slot in hud_gears) - inv_box = new /atom/movable/screen/inventory() - inv_box.icon = ui_style - inv_box.color = ui_color - inv_box.alpha = ui_alpha - - var/list/slot_data = hud_gears[gear_slot] - inv_box.name = gear_slot - inv_box.screen_loc = slot_data["loc"] - inv_box.slot_id = slot_data["slot"] - inv_box.icon_state = slot_data["state"] - slot_info["[inv_box.slot_id]"] = inv_box.screen_loc - - if(slot_data["dir"]) - inv_box.setDir(slot_data["dir"]) - - if(slot_data["toggle"]) - other += inv_box - has_hidden_gear = 1 - else - adding += inv_box - - if(has_hidden_gear) - using = new /atom/movable/screen() - using.name = "toggle" - using.icon = ui_style - using.icon_state = "other" - using.screen_loc = ui_inventory - using.hud_layerise() - using.color = ui_color - using.alpha = ui_alpha - adding += using //Intent Backdrop using = new /atom/movable/screen() diff --git a/code/modules/species/station/station_special_abilities.dm b/code/modules/species/station/station_special_abilities.dm index 5055b58fe1e..b7debb074b5 100644 --- a/code/modules/species/station/station_special_abilities.dm +++ b/code/modules/species/station/station_special_abilities.dm @@ -159,51 +159,51 @@ if(16 to 25) //10% chance //Strange items //to_chat(src, "Traitor Items") - if(!halitem) - halitem = new - var/list/slots_free = list() - for(var/i in get_empty_hand_indices()) - slots_free += SCREEN_LOC_INV_HAND(i) - if(istype(src,/mob/living/carbon/human)) - var/mob/living/carbon/human/H = src - if(!H.belt) slots_free += ui_belt - if(!H.l_store) slots_free += ui_storage1 - if(!H.r_store) slots_free += ui_storage2 - if(slots_free.len) - halitem.screen_loc = pick(slots_free) - halitem.layer = 50 - switch(rand(1,6)) - if(1) //revolver - halitem.icon = 'icons/obj/gun/ballistic.dmi' - halitem.icon_state = "revolver" - halitem.name = "Revolver" - if(2) //c4 - halitem.icon = 'icons/obj/assemblies.dmi' - halitem.icon_state = "plastic-explosive0" - halitem.name = "Mysterious Package" - if(prob(25)) - halitem.icon_state = "c4small_1" - if(3) //sword - halitem.icon = 'icons/obj/weapons.dmi' - halitem.icon_state = "sword1" - halitem.name = "Sword" - if(4) //stun baton - halitem.icon = 'icons/obj/weapons.dmi' - halitem.icon_state = "stunbaton" - halitem.name = "Stun Baton" - if(5) //emag - halitem.icon = 'icons/obj/card.dmi' - halitem.icon_state = "emag" - halitem.name = "Cryptographic Sequencer" - if(6) //flashbang - halitem.icon = 'icons/obj/grenade.dmi' - halitem.icon_state = "flashbang1" - halitem.name = "Flashbang" - if(client) client.screen += halitem - spawn(rand(100,250)) - if(client) - client.screen -= halitem - halitem = null + // if(!halitem) + // halitem = new + // var/list/slots_free = list() + // for(var/i in get_empty_hand_indices()) + // slots_free += SCREEN_LOC_INV_HAND(i) + // if(istype(src,/mob/living/carbon/human)) + // var/mob/living/carbon/human/H = src + // if(!H.belt) slots_free += ui_belt + // if(!H.l_store) slots_free += ui_storage1 + // if(!H.r_store) slots_free += ui_storage2 + // if(slots_free.len) + // halitem.screen_loc = pick(slots_free) + // halitem.layer = 50 + // switch(rand(1,6)) + // if(1) //revolver + // halitem.icon = 'icons/obj/gun/ballistic.dmi' + // halitem.icon_state = "revolver" + // halitem.name = "Revolver" + // if(2) //c4 + // halitem.icon = 'icons/obj/assemblies.dmi' + // halitem.icon_state = "plastic-explosive0" + // halitem.name = "Mysterious Package" + // if(prob(25)) + // halitem.icon_state = "c4small_1" + // if(3) //sword + // halitem.icon = 'icons/obj/weapons.dmi' + // halitem.icon_state = "sword1" + // halitem.name = "Sword" + // if(4) //stun baton + // halitem.icon = 'icons/obj/weapons.dmi' + // halitem.icon_state = "stunbaton" + // halitem.name = "Stun Baton" + // if(5) //emag + // halitem.icon = 'icons/obj/card.dmi' + // halitem.icon_state = "emag" + // halitem.name = "Cryptographic Sequencer" + // if(6) //flashbang + // halitem.icon = 'icons/obj/grenade.dmi' + // halitem.icon_state = "flashbang1" + // halitem.name = "Flashbang" + // if(client) client.screen += halitem + // spawn(rand(100,250)) + // if(client) + // client.screen -= halitem + // halitem = null if(26 to 35) //10% chance //Flashes of danger //to_chat(src, "Danger Flash")