From f9a0fe6b2fc8a7c55c58b6066ecb49b22493a129 Mon Sep 17 00:00:00 2001 From: JJRcop Date: Sun, 14 Sep 2014 04:57:30 -0400 Subject: [PATCH] Makes the drone internal storage much more user-friendly --- code/_onclick/hud/_defines.dm | 2 + code/_onclick/hud/other_mobs.dm | 9 +++ .../living/simple_animal/friendly/drone.dm | 60 ++++++++++--------- 3 files changed, 43 insertions(+), 28 deletions(-) diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm index faad4720b36..87102334fb1 100644 --- a/code/_onclick/hud/_defines.dm +++ b/code/_onclick/hud/_defines.dm @@ -60,6 +60,8 @@ #define ui_alien_storage_l "CENTER-2:14,SOUTH:5"//alien #define ui_alien_storage_r "CENTER+1:18,SOUTH:5"//alien +#define ui_drone_storage "CENTER-2:14,SOUTH:5" //maintenance drones + //Lower right, persistant menu #define ui_drop_throw "EAST-1:28,SOUTH+1:7" #define ui_pull_resist "EAST-2:26,SOUTH+1:7" diff --git a/code/_onclick/hud/other_mobs.dm b/code/_onclick/hud/other_mobs.dm index 430d2447f19..8056e50f989 100644 --- a/code/_onclick/hud/other_mobs.dm +++ b/code/_onclick/hud/other_mobs.dm @@ -69,6 +69,15 @@ l_hand_hud_object = inv_box adding += inv_box + inv_box = new /obj/screen/inventory() + inv_box.name = "internal storage" + inv_box.icon = ui_style + inv_box.icon_state = "suit_storage" + inv_box.screen_loc = ui_drone_storage + inv_box.slot_id = "drone_storage_slot" + inv_box.layer = 19 + adding += inv_box + using = new /obj/screen/inventory() using.name = "hand" using.icon = ui_style diff --git a/code/modules/mob/living/simple_animal/friendly/drone.dm b/code/modules/mob/living/simple_animal/friendly/drone.dm index 37a3f55754a..339278bff32 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone.dm @@ -79,14 +79,6 @@ return - if(internal_storage) - var/obj/item/dummy_item = internal_storage - if(D.put_in_hands(dummy_item)) - D.visible_message("[D] retrieves \a [dummy_item] from their internal storage.") - else - D.visible_message("\A [dummy_item] falls out of [D]'s internal storage and onto the floor.") - internal_storage = null - return if(ishuman(user)) if(user.get_active_hand()) @@ -121,30 +113,31 @@ A.attack_hand(src) -/mob/living/simple_animal/drone/attackby(var/obj/item/I, var/mob/user) - if(!I || !user) - return - - if(user == src) - if(!internal_storage) - user.drop_item() - internal_storage = I - I.loc = user - user.visible_message("[user] places \a [I] into their internal storage.") +/mob/living/simple_animal/drone/attack_ui(slot_id) + if(slot_id == "drone_storage_slot") + var/obj/item/I = get_active_hand() + var/mob/user = src + if(I) + if(!internal_storage) + user.drop_item() + internal_storage = I + I.loc = user + user.visible_message("[user] places \a [I] into their internal storage.") + else + user << "Your internal storage is full." else - user << "Your internal storage is full." - + var/obj/item/dummy_item = internal_storage + if(user.put_in_hands(dummy_item)) + user.visible_message("[user] retrieves \a [dummy_item] from their internal storage.") + else + user.visible_message("\A [dummy_item] falls out of [user]'s internal storage and onto the floor.") + internal_storage = null + update_inv_internal_storage() + return 1 else - ..(I,user) + ..(slot_id) -/mob/living/simple_animal/drone/Stat() - statpanel("Status") - ..() - if(client.statpanel == "Status") - if(internal_storage) - stat(null, "Internal storage: [internal_storage]") - /mob/living/simple_animal/drone/swap_hand() var/obj/item/held_item = get_active_hand() if(held_item) @@ -212,6 +205,7 @@ dummy_item.loc = get_turf(src) visible_message("\A [dummy_item] falls out of [src]!") internal_storage = null + update_inv_internal_storage() /mob/living/simple_animal/drone/unEquip(obj/item/I, force) if(..(I,force)) @@ -260,8 +254,18 @@ drone_overlays[HANDS_LAYER] = hands_overlays apply_overlay(HANDS_LAYER) +/mob/living/simple_animal/drone/proc/update_inv_internal_storage() + if(client && hud_used) + for(var/obj/screen/inventory/drone_storage in client.screen) + if(drone_storage.slot_id == "drone_storage_slot") + drone_storage.overlays = list() + if(internal_storage) + drone_storage.overlays += image("icon"=internal_storage.icon, "icon_state"=internal_storage.icon_state) + break + #undef HANDS_LAYER +#undef TOTAL_LAYERS /mob/living/simple_animal/drone/canUseTopic() if(stat)