From eb10f04ea3fbf3cd8dc6cf8415f0f958d0bd5a1c Mon Sep 17 00:00:00 2001 From: "elly1989@rocketmail.com" Date: Fri, 28 Sep 2012 23:02:11 +0000 Subject: [PATCH] obj/hud is now datum/hud. There was no need for it to be an object. Moved some of the static overlays such as the dither effects, druggy effect and blurry-eyes into datum/global_hud. Meaning that only one object is instanced per server rather than per mob. It reduces on code. Commented out a green and red overlay which aren't used, which were being instanced for every mob. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4767 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/hud.dm | 142 +++++++++++++++--- code/game/objects/hud.dm | 21 --- .../structures/crates_lockers/closets.dm | 2 +- code/global.dm | 1 - code/modules/mob/dead/observer/hud.dm | 2 +- .../mob/living/carbon/alien/humanoid/hud.dm | 68 +-------- .../mob/living/carbon/alien/humanoid/life.dm | 10 +- .../mob/living/carbon/alien/larva/hud.dm | 69 +-------- .../mob/living/carbon/alien/larva/life.dm | 10 +- code/modules/mob/living/carbon/brain/hud.dm | 20 +-- code/modules/mob/living/carbon/brain/life.dm | 10 +- code/modules/mob/living/carbon/human/hud.dm | 137 +---------------- code/modules/mob/living/carbon/human/life.dm | 14 +- code/modules/mob/living/carbon/metroid/hud.dm | 2 +- code/modules/mob/living/carbon/monkey/hud.dm | 81 +--------- code/modules/mob/living/carbon/monkey/life.dm | 20 ++- code/modules/mob/living/silicon/ai/hud.dm | 2 +- code/modules/mob/living/silicon/robot/hud.dm | 32 +--- code/modules/mob/living/silicon/robot/life.dm | 12 +- code/modules/mob/login.dm | 2 +- code/modules/mob/mob_defines.dm | 2 +- code/modules/mob/mob_helpers.dm | 48 +++++- code/modules/mob/new_player/hud.dm | 2 +- code/modules/mob/screen.dm | 2 +- interface/interface.dm | 47 ------ tgstation.dme | 1 - 26 files changed, 212 insertions(+), 547 deletions(-) delete mode 100644 code/game/objects/hud.dm diff --git a/code/game/hud.dm b/code/game/hud.dm index 80603d2bcd..9939045a99 100644 --- a/code/game/hud.dm +++ b/code/game/hud.dm @@ -1,4 +1,3 @@ - //Upper left action buttons, displayed when you pick up an item that has this enabled. #define ui_action_slot1 "1:6,14:26" #define ui_action_slot2 "2:8,14:26" @@ -55,18 +54,15 @@ #define ui_alien_fire "14:28,12:25" #define ui_alien_oxygen "14:28,11:25" - //Middle right (status indicators) #define ui_nutrition "14:28,5:11" #define ui_temp "14:28,6:13" #define ui_health "14:28,7:15" #define ui_internal "14:28,8:17" - //borgs #define ui_borg_health "14:28,6:13" //borgs have the health display where humans have the pressure damage indicator. #define ui_alien_health "14:28,6:13" //aliens have the health display where humans have the pressure damage indicator. - //Pop-up inventory #define ui_shoes "2:8,1:5" @@ -80,20 +76,14 @@ #define ui_head "2:8,4:11" - - - //Intent small buttons #define ui_help_small "12:8,1:1" #define ui_disarm_small "12:15,1:18" #define ui_grab_small "12:32,1:18" #define ui_harm_small "12:39,1:1" - - //#define ui_swapbutton "6:-16,1:5" //Unused - //#define ui_headset "SOUTH,8" #define ui_hand "6:14,1:5" #define ui_hstore1 "5,5" @@ -105,16 +95,126 @@ #define ui_iarrowleft "SOUTH-1,11" #define ui_iarrowright "SOUTH-1,13" +var/datum/global_hud/global_hud = new() + +/datum/global_hud + var/h_type = /obj/screen + var/obj/screen/druggy + var/obj/screen/blurry +// var/obj/screen/alien_view +// var/obj/screen/g_dither + var/list/vimpaired + var/list/darkMask + + New() + //420erryday psychedellic colours screen overlay for when you are high + druggy = new h_type() + druggy.screen_loc = "WEST,SOUTH to EAST,NORTH" + druggy.icon_state = "druggy" + druggy.layer = 17 + druggy.mouse_opacity = 0 + + //that white blurry effect you get when you eyes are damaged + blurry = new h_type() + blurry.screen_loc = "WEST,SOUTH to EAST,NORTH" + blurry.icon_state = "blurry" + blurry.layer = 17 + blurry.mouse_opacity = 0 + + var/obj/screen/O + var/i + //that nasty looking dither you get when you're short-sighted + vimpaired = newlist(h_type,h_type,h_type,h_type) + O = vimpaired[1] + O.screen_loc = "1,1 to 5,15" + O = vimpaired[2] + O.screen_loc = "5,1 to 10,5" + O = vimpaired[3] + O.screen_loc = "6,11 to 10,15" + O = vimpaired[4] + O.screen_loc = "11,1 to 15,15" + + //welding mask overlay black/dither + darkMask = newlist(h_type,h_type,h_type,h_type,h_type,h_type,h_type,h_type) + O = darkMask[1] + O.screen_loc = "3,3 to 5,13" + O = darkMask[2] + O.screen_loc = "5,3 to 10,5" + O = darkMask[3] + O.screen_loc = "6,11 to 10,13" + O = darkMask[4] + O.screen_loc = "11,3 to 13,13" + O = darkMask[5] + O.screen_loc = "1,1 to 15,2" + O = darkMask[6] + O.screen_loc = "1,3 to 2,15" + O = darkMask[7] + O.screen_loc = "14,3 to 15,15" + O = darkMask[8] + O.screen_loc = "3,14 to 13,15" + + for(i=1,i<=4,i++) + O = vimpaired[i] + O.icon_state = "dither50" + O.layer = 17 + O.mouse_opacity = 0 + + O = darkMask[i] + O.icon_state = "dither50" + O.layer = 17 + O.mouse_opacity = 0 + + for(i=5,i<=8,i++) + O = darkMask[i] + O.icon_state = "black" + O.layer = 17 + O.mouse_opacity = 0 +/* + //not used + alien_view = new h_type() + alien_view.screen_loc = "WEST,SOUTH to EAST,NORTH" + alien_view.icon_state = "alien" + alien_view.layer = 18 + alien_view.mouse_opacity = 0 + + g_dither = new h_type() + g_dither.screen_loc = "WEST,SOUTH to EAST,NORTH" + g_dither.icon_state = "dither12g" + g_dither.layer = 18 + g_dither.mouse_opacity = 0 +*/ -obj/hud/New(var/type = 0) - instantiate(type) +/datum/hud + var/mob/mymob + var/h_type = /obj/screen //this is like...the most pointless thing ever. Use a god damn define! + + var/hud_shown = 1 //Used for the HUD toggle (F12) + var/inventory_shown = 1 //the inventory + var/show_intent_icons = 0 + var/hotkey_ui_hidden = 0 //This is to hide the buttons that can be used via hotkeys. (hotkeybuttons list of buttons) + + var/obj/screen/r_hand_hud_object + var/obj/screen/l_hand_hud_object + var/obj/screen/action_intent + var/obj/screen/move_intent + + var/list/adding + var/list/other + var/list/obj/screen/hotkeybuttons + + var/list/obj/screen/item_action/item_action_list //Used for the item action ui buttons. + + +datum/hud/New(mob/owner) + mymob = owner + instantiate() ..() return -/obj/hud/proc/hidden_inventory_update() +/datum/hud/proc/hidden_inventory_update() if(!mymob) return if(inventory_shown && hud_shown) if(ishuman(mymob)) @@ -137,7 +237,7 @@ obj/hud/New(var/type = 0) if(mymob:wear_mask) mymob:wear_mask:screen_loc = null if(mymob:head) mymob:head:screen_loc = null -/obj/hud/proc/persistant_inventory_update() +/datum/hud/proc/persistant_inventory_update() if(!mymob) return if(hud_shown) if(ishuman(mymob)) @@ -157,16 +257,8 @@ obj/hud/New(var/type = 0) if(mymob:r_store) mymob:r_store:screen_loc = null -/obj/hud - var/obj/screen/action_intent - var/obj/screen/move_intent - var/hud_shown = 1 //Used for the HUD toggle (F12) - var/inventory_shown = 1 //the inventory - -/obj/hud/proc/instantiate(var/type = 0) - - mymob = loc - if(!istype(mymob, /mob)) return 0 +/datum/hud/proc/instantiate() + if(!ismob(mymob)) return 0 if(ishuman(mymob)) human_hud(mymob.UI) // Pass the player the UI style chosen in preferences @@ -204,4 +296,4 @@ obj/hud/New(var/type = 0) else if(isobserver(mymob)) ghost_hud() - return + return \ No newline at end of file diff --git a/code/game/objects/hud.dm b/code/game/objects/hud.dm deleted file mode 100644 index 7559f9044b..0000000000 --- a/code/game/objects/hud.dm +++ /dev/null @@ -1,21 +0,0 @@ -/obj/hud - name = "hud" - unacidable = 1 - var/mob/mymob = null - var/list/adding = null - var/list/other = null - var/obj/screen/druggy = null - var/vimpaired = null - var/obj/screen/alien_view = null - var/obj/screen/g_dither = null - var/obj/screen/blurry = null - var/list/darkMask = null - var/obj/screen/r_hand_hud_object = null - var/obj/screen/l_hand_hud_object = null - var/show_intent_icons = 0 - var/list/obj/screen/hotkeybuttons = null - var/hotkey_ui_hidden = 0 //This is to hide the buttons that can be used via hotkeys. (hotkeybuttons list of buttons) - - var/list/obj/screen/item_action/item_action_list = null //Used for the item action ui buttons. - - var/h_type = /obj/screen //this is like...the most pointless thing ever. Use a god damn define! \ No newline at end of file diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 5634bb8dfe..96fd8c8a51 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -201,7 +201,7 @@ return /obj/structure/closet/MouseDrop_T(atom/movable/O as mob|obj, mob/user as mob) - if(istype(O, /obj/screen) || istype(O, /obj/hud)) //fix for HUD elements making their way into the world -Pete + if(istype(O, /obj/screen)) //fix for HUD elements making their way into the world -Pete return if(O.loc == user) return diff --git a/code/global.dm b/code/global.dm index 4bc16b979e..5b77d1acc8 100644 --- a/code/global.dm +++ b/code/global.dm @@ -4,7 +4,6 @@ var/global/obj/effect/datacore/data_core = null var/global/obj/effect/overlay/plmaster = null var/global/obj/effect/overlay/slmaster = null - //obj/hud/main_hud1 = null var/global/list/machines = list() var/global/list/processing_objects = list() diff --git a/code/modules/mob/dead/observer/hud.dm b/code/modules/mob/dead/observer/hud.dm index 3969992c4e..4290ca5d3a 100644 --- a/code/modules/mob/dead/observer/hud.dm +++ b/code/modules/mob/dead/observer/hud.dm @@ -1,3 +1,3 @@ -/obj/hud/proc/ghost_hud() +/datum/hud/proc/ghost_hud() return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/alien/humanoid/hud.dm b/code/modules/mob/living/carbon/alien/humanoid/hud.dm index 1438bf63ca..1c868282b2 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/hud.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/hud.dm @@ -1,37 +1,7 @@ -/obj/hud/proc/alien_hud() +/datum/hud/proc/alien_hud() src.adding = list( ) src.other = list( ) - src.vimpaired = list( ) - src.darkMask = list( ) - - src.g_dither = new src.h_type( src ) - src.g_dither.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.g_dither.name = "Mask" - src.g_dither.icon_state = "dither12g" - src.g_dither.layer = 18 - src.g_dither.mouse_opacity = 0 - - src.alien_view = new src.h_type(src) - src.alien_view.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.alien_view.name = "Alien" - src.alien_view.icon_state = "alien" - src.alien_view.layer = 18 - src.alien_view.mouse_opacity = 0 - - src.blurry = new src.h_type( src ) - src.blurry.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.blurry.name = "Blurry" - src.blurry.icon_state = "blurry" - src.blurry.layer = 17 - src.blurry.mouse_opacity = 0 - - src.druggy = new src.h_type( src ) - src.druggy.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.druggy.name = "Druggy" - src.druggy.icon_state = "druggy" - src.druggy.layer = 17 - src.druggy.mouse_opacity = 0 var/obj/screen/using var/obj/screen/inventory/inv_box @@ -206,42 +176,6 @@ src.adding += using */ - using = new src.h_type( src ) - using.name = null - using.icon = 'icons/mob/screen1_alien.dmi' - using.icon_state = "dither50" - using.screen_loc = "1,1 to 5,15" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - - using = new src.h_type( src ) - using.name = null - using.icon = 'icons/mob/screen1_alien.dmi' - using.icon_state = "dither50" - using.screen_loc = "5,1 to 10,5" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - - using = new src.h_type( src ) - using.name = null - using.icon = 'icons/mob/screen1_alien.dmi' - using.icon_state = "dither50" - using.screen_loc = "6,11 to 10,15" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - - using = new src.h_type( src ) - using.name = null - using.icon = 'icons/mob/screen1_alien.dmi' - using.icon_state = "dither50" - using.screen_loc = "11,1 to 15,15" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - mymob.throw_icon = new /obj/screen(null) mymob.throw_icon.icon = 'icons/mob/screen1_alien.dmi' mymob.throw_icon.icon_state = "act_throw_off" diff --git a/code/modules/mob/living/carbon/alien/humanoid/life.dm b/code/modules/mob/living/carbon/alien/humanoid/life.dm index c52be047e9..5d2f975d13 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/life.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/life.dm @@ -486,9 +486,7 @@ //NOTE: the alerts dont reset when youre out of danger. dont blame me, //blame the person who coded them. Temporary fix added. - client.screen -= hud_used.blurry - client.screen -= hud_used.druggy - client.screen -= hud_used.vimpaired + client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired) if ((blind && stat != 2)) if ((blinded)) @@ -497,13 +495,13 @@ blind.layer = 0 if (disabilities & NEARSIGHTED) - client.screen += hud_used.vimpaired + client.screen += global_hud.vimpaired if (eye_blurry) - client.screen += hud_used.blurry + client.screen += global_hud.blurry if (druggy) - client.screen += hud_used.druggy + client.screen += global_hud.druggy if (stat != 2) if (machine) diff --git a/code/modules/mob/living/carbon/alien/larva/hud.dm b/code/modules/mob/living/carbon/alien/larva/hud.dm index 62e00be6b2..e096bee7b1 100644 --- a/code/modules/mob/living/carbon/alien/larva/hud.dm +++ b/code/modules/mob/living/carbon/alien/larva/hud.dm @@ -1,39 +1,9 @@ -/obj/hud/proc/larva_hud() +/datum/hud/proc/larva_hud() src.adding = list( ) src.other = list( ) - src.vimpaired = list( ) - src.darkMask = list( ) - - src.g_dither = new src.h_type( src ) - src.g_dither.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.g_dither.name = "Mask" - src.g_dither.icon_state = "dither12g" - src.g_dither.layer = 18 - src.g_dither.mouse_opacity = 0 - - src.alien_view = new src.h_type(src) - src.alien_view.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.alien_view.name = "Alien" - src.alien_view.icon_state = "alien" - src.alien_view.layer = 18 - src.alien_view.mouse_opacity = 0 - - src.blurry = new src.h_type( src ) - src.blurry.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.blurry.name = "Blurry" - src.blurry.icon_state = "blurry" - src.blurry.layer = 17 - src.blurry.mouse_opacity = 0 - - src.druggy = new src.h_type( src ) - src.druggy.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.druggy.name = "Druggy" - src.druggy.icon_state = "druggy" - src.druggy.layer = 17 - src.druggy.mouse_opacity = 0 var/obj/screen/using @@ -108,43 +78,6 @@ src.adding += using */ - - using = new src.h_type( src ) - using.name = null - using.icon = 'icons/mob/screen1_alien.dmi' - using.icon_state = "dither50" - using.screen_loc = "1,1 to 5,15" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - - using = new src.h_type( src ) - using.name = null - using.icon = 'icons/mob/screen1_alien.dmi' - using.icon_state = "dither50" - using.screen_loc = "5,1 to 10,5" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - - using = new src.h_type( src ) - using.name = null - using.icon = 'icons/mob/screen1_alien.dmi' - using.icon_state = "dither50" - using.screen_loc = "6,11 to 10,15" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - - using = new src.h_type( src ) - using.name = null - using.icon = 'icons/mob/screen1_alien.dmi' - using.icon_state = "dither50" - using.screen_loc = "11,1 to 15,15" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - mymob.oxygen = new /obj/screen( null ) mymob.oxygen.icon = 'icons/mob/screen1_alien.dmi' mymob.oxygen.icon_state = "oxy0" diff --git a/code/modules/mob/living/carbon/alien/larva/life.dm b/code/modules/mob/living/carbon/alien/larva/life.dm index 95b5ffe6d9..052de2bd08 100644 --- a/code/modules/mob/living/carbon/alien/larva/life.dm +++ b/code/modules/mob/living/carbon/alien/larva/life.dm @@ -385,9 +385,7 @@ //blame the person who coded them. Temporary fix added. - client.screen -= hud_used.blurry - client.screen -= hud_used.druggy - client.screen -= hud_used.vimpaired + client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired) if ((blind && stat != 2)) if ((blinded)) @@ -396,13 +394,13 @@ blind.layer = 0 if (disabilities & NEARSIGHTED) - client.screen += hud_used.vimpaired + client.screen += global_hud.vimpaired if (eye_blurry) - client.screen += hud_used.blurry + client.screen += global_hud.blurry if (druggy) - client.screen += hud_used.druggy + client.screen += global_hud.druggy if (stat != 2) if (machine) diff --git a/code/modules/mob/living/carbon/brain/hud.dm b/code/modules/mob/living/carbon/brain/hud.dm index 7de140476e..2798e2059c 100644 --- a/code/modules/mob/living/carbon/brain/hud.dm +++ b/code/modules/mob/living/carbon/brain/hud.dm @@ -1,26 +1,10 @@ -/obj/hud/proc/brain_hud(var/ui_style='icons/mob/screen1_old.dmi') +/datum/hud/proc/brain_hud(var/ui_style='icons/mob/screen1_old.dmi') //ui_style='icons/mob/screen1_old.dmi' //Overriding the parameter. Only this UI style is acceptable with the 'sleek' layout. - blurry = new h_type( src ) - blurry.screen_loc = "WEST,SOUTH to EAST,NORTH" - blurry.name = "Blurry" - blurry.icon = ui_style - blurry.icon_state = "blurry" - blurry.layer = 17 - blurry.mouse_opacity = 0 - - druggy = new h_type( src ) - druggy.screen_loc = "WEST,SOUTH to EAST,NORTH" - druggy.name = "Druggy" - druggy.icon = ui_style - druggy.icon_state = "druggy" - druggy.layer = 17 - druggy.mouse_opacity = 0 - mymob.blind = new /obj/screen( null ) mymob.blind.icon = 'icons/mob/screen1_full.dmi' mymob.blind.icon_state = "blackimageoverlay" mymob.blind.name = " " mymob.blind.screen_loc = "1,1" - mymob.blind.layer = 0 \ No newline at end of file + mymob.blind.layer = 0 diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index 6bd8e9ad93..ce88de1e61 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -246,9 +246,7 @@ if(pullin) pullin.icon_state = "pull[pulling ? 1 : 0]" - client.screen -= hud_used.blurry - client.screen -= hud_used.druggy - client.screen -= hud_used.vimpaired + client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired) if ((blind && stat != 2)) if ((blinded)) @@ -257,13 +255,13 @@ blind.layer = 0 if (disabilities & NEARSIGHTED) - client.screen += hud_used.vimpaired + client.screen += global_hud.vimpaired if (eye_blurry) - client.screen += hud_used.blurry + client.screen += global_hud.blurry if (druggy) - client.screen += hud_used.druggy + client.screen += global_hud.druggy if (stat != 2) if (machine) diff --git a/code/modules/mob/living/carbon/human/hud.dm b/code/modules/mob/living/carbon/human/hud.dm index 4d017d14d5..6c454e2584 100644 --- a/code/modules/mob/living/carbon/human/hud.dm +++ b/code/modules/mob/living/carbon/human/hud.dm @@ -1,43 +1,9 @@ -/obj/hud/proc/human_hud(var/ui_style='icons/mob/screen1_old.dmi') +/datum/hud/proc/human_hud(var/ui_style='icons/mob/screen1_old.dmi') src.adding = list( ) src.other = list( ) - src.vimpaired = list( ) - src.darkMask = list( ) src.hotkeybuttons = list( ) //These can be disabled for hotkey usersx - src.g_dither = new src.h_type( src ) - src.g_dither.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.g_dither.name = "Mask" - src.g_dither.icon = ui_style - src.g_dither.icon_state = "dither12g" - src.g_dither.layer = 18 - src.g_dither.mouse_opacity = 0 - - src.alien_view = new src.h_type(src) - src.alien_view.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.alien_view.name = "Alien" - src.alien_view.icon = ui_style - src.alien_view.icon_state = "alien" - src.alien_view.layer = 18 - src.alien_view.mouse_opacity = 0 - - src.blurry = new src.h_type( src ) - src.blurry.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.blurry.name = "Blurry" - src.blurry.icon = ui_style - src.blurry.icon_state = "blurry" - src.blurry.layer = 17 - src.blurry.mouse_opacity = 0 - - src.druggy = new src.h_type( src ) - src.druggy.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.druggy.name = "Druggy" - src.druggy.icon = ui_style - src.druggy.icon_state = "druggy" - src.druggy.layer = 17 - src.druggy.mouse_opacity = 0 - var/obj/screen/using var/obj/screen/inventory/inv_box @@ -388,107 +354,6 @@ src.mov_int += using */ - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "dither50" - using.screen_loc = "1,1 to 5,15" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "dither50" - using.screen_loc = "5,1 to 10,5" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "dither50" - using.screen_loc = "6,11 to 10,15" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "dither50" - using.screen_loc = "11,1 to 15,15" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - - //welding mask dither - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "dither50" - using.screen_loc = "3,3 to 5,13" - using.layer = 17 - using.mouse_opacity = 0 - src.darkMask += using - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "dither50" - using.screen_loc = "5,3 to 10,5" - using.layer = 17 - using.mouse_opacity = 0 - src.darkMask += using - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "dither50" - using.screen_loc = "6,11 to 10,13" - using.layer = 17 - using.mouse_opacity = 0 - src.darkMask += using - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "dither50" - using.screen_loc = "11,3 to 13,13" - using.layer = 17 - using.mouse_opacity = 0 - src.darkMask += using - - //welding mask blackness - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "black" - using.screen_loc = "1,1 to 15,2" - using.layer = 17 - using.mouse_opacity = 0 - src.darkMask += using - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "black" - using.screen_loc = "1,3 to 2,15" - using.layer = 17 - using.mouse_opacity = 0 - src.darkMask += using - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "black" - using.screen_loc = "14,3 to 15,15" - using.layer = 17 - using.mouse_opacity = 0 - src.darkMask += using - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "black" - using.screen_loc = "3,14 to 13,15" - using.layer = 17 - using.mouse_opacity = 0 - src.darkMask += using - mymob.throw_icon = new /obj/screen(null) mymob.throw_icon.icon = ui_style mymob.throw_icon.icon_state = "act_throw_off" diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 71e377adca..498e9f4e19 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -926,7 +926,7 @@ if(copytext(hud.icon_state,1,4) == "hud") //ugly, but icon comparison is worse, I believe del(hud) - client.screen.Remove(hud_used.blurry, hud_used.druggy, hud_used.vimpaired, hud_used.darkMask) + client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask) update_action_buttons() @@ -1147,18 +1147,18 @@ else blind.layer = 0 if( disabilities & NEARSIGHTED && !istype(glasses, /obj/item/clothing/glasses/regular) ) - client.screen += hud_used.vimpaired - if(eye_blurry) client.screen += hud_used.blurry - if(druggy) client.screen += hud_used.druggy + client.screen += global_hud.vimpaired + if(eye_blurry) client.screen += global_hud.blurry + if(druggy) client.screen += global_hud.druggy if( istype(head, /obj/item/clothing/head/welding) ) var/obj/item/clothing/head/welding/O = head if(!O.up && tinted_weldhelh) - client.screen += hud_used.darkMask + client.screen += global_hud.darkMask if(eye_stat > 20) - if(eye_stat > 30) client.screen += hud_used.darkMask - else client.screen += hud_used.vimpaired + if(eye_stat > 30) client.screen += global_hud.darkMask + else client.screen += global_hud.vimpaired if(machine) if(!machine.check_eye(src)) reset_view(null) diff --git a/code/modules/mob/living/carbon/metroid/hud.dm b/code/modules/mob/living/carbon/metroid/hud.dm index f1d7316695..a71cbddcb3 100644 --- a/code/modules/mob/living/carbon/metroid/hud.dm +++ b/code/modules/mob/living/carbon/metroid/hud.dm @@ -5,7 +5,7 @@ del(hud) /* -/obj/hud/proc/metroid_hud() +/datum/hud/proc/metroid_hud() src.adding = list( ) src.other = list( ) diff --git a/code/modules/mob/living/carbon/monkey/hud.dm b/code/modules/mob/living/carbon/monkey/hud.dm index 4c8821b020..d397443e38 100644 --- a/code/modules/mob/living/carbon/monkey/hud.dm +++ b/code/modules/mob/living/carbon/monkey/hud.dm @@ -1,46 +1,12 @@ -/obj/hud/proc/monkey_hud(var/ui_style='icons/mob/screen1_old.dmi') +/datum/hud/proc/monkey_hud(var/ui_style='icons/mob/screen1_old.dmi') //ui_style='icons/mob/screen1_old.dmi' //Overriding the parameter. Only this UI style is acceptable with the 'sleek' layout. src.adding = list( ) src.other = list( ) - src.vimpaired = list( ) - src.darkMask = list( ) //var/icon/blocked = icon(ui_style,"blocked") - src.g_dither = new src.h_type( src ) - src.g_dither.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.g_dither.name = "Mask" - src.g_dither.icon = ui_style - src.g_dither.icon_state = "dither12g" - src.g_dither.layer = 18 - src.g_dither.mouse_opacity = 0 - - src.alien_view = new src.h_type(src) - src.alien_view.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.alien_view.name = "Alien" - src.alien_view.icon = ui_style - src.alien_view.icon_state = "alien" - src.alien_view.layer = 18 - src.alien_view.mouse_opacity = 0 - - src.blurry = new src.h_type( src ) - src.blurry.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.blurry.name = "Blurry" - src.blurry.icon = ui_style - src.blurry.icon_state = "blurry" - src.blurry.layer = 17 - src.blurry.mouse_opacity = 0 - - src.druggy = new src.h_type( src ) - src.druggy.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.druggy.name = "Druggy" - src.druggy.icon = ui_style - src.druggy.icon_state = "druggy" - src.druggy.layer = 17 - src.druggy.mouse_opacity = 0 - var/obj/screen/using var/obj/screen/inventory/inv_box @@ -357,39 +323,6 @@ src.mov_int += using */ - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "dither50" - using.screen_loc = "1,1 to 5,15" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "dither50" - using.screen_loc = "5,1 to 10,5" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "dither50" - using.screen_loc = "6,11 to 10,15" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - using = new src.h_type( src ) - using.name = null - using.icon = ui_style - using.icon_state = "dither50" - using.screen_loc = "11,1 to 15,15" - using.layer = 17 - using.mouse_opacity = 0 - src.vimpaired += using - mymob.throw_icon = new /obj/screen(null) mymob.throw_icon.icon = ui_style mymob.throw_icon.icon_state = "act_throw_off" @@ -408,18 +341,6 @@ mymob.pressure.name = "pressure" mymob.pressure.screen_loc = ui_pressure -/* - mymob.i_select = new /obj/screen( null ) - mymob.i_select.icon_state = "selector" - mymob.i_select.name = "intent" - mymob.i_select.screen_loc = "16:-11,15" - - mymob.m_select = new /obj/screen( null ) - mymob.m_select.icon_state = "selector" - mymob.m_select.name = "moving" - mymob.m_select.screen_loc = "16:-11,14" -*/ - mymob.toxin = new /obj/screen( null ) mymob.toxin.icon = ui_style mymob.toxin.icon_state = "tox0" diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index 853801cc4c..c08a53c6c1 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -532,24 +532,22 @@ else bodytemp.icon_state = "temp-4" - client.screen -= hud_used.blurry - client.screen -= hud_used.druggy - client.screen -= hud_used.vimpaired + client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired) - if ((blind && stat != 2)) - if ((blinded)) + if(blind && stat != DEAD) + if(blinded) blind.layer = 18 else blind.layer = 0 - if (disabilities & NEARSIGHTED) - client.screen += hud_used.vimpaired + if(disabilities & NEARSIGHTED) + client.screen += global_hud.vimpaired - if (eye_blurry) - client.screen += hud_used.blurry + if(eye_blurry) + client.screen += global_hud.blurry - if (druggy) - client.screen += hud_used.druggy + if(druggy) + client.screen += global_hud.druggy if (stat != 2) if (machine) diff --git a/code/modules/mob/living/silicon/ai/hud.dm b/code/modules/mob/living/silicon/ai/hud.dm index 2db6674a9a..79ca8f172b 100644 --- a/code/modules/mob/living/silicon/ai/hud.dm +++ b/code/modules/mob/living/silicon/ai/hud.dm @@ -1,2 +1,2 @@ -/obj/hud/proc/ai_hud() +/datum/hud/proc/ai_hud() return \ No newline at end of file diff --git a/code/modules/mob/living/silicon/robot/hud.dm b/code/modules/mob/living/silicon/robot/hud.dm index b04c5228e0..1789918e8e 100644 --- a/code/modules/mob/living/silicon/robot/hud.dm +++ b/code/modules/mob/living/silicon/robot/hud.dm @@ -1,38 +1,8 @@ -/obj/hud/proc/robot_hud() +/datum/hud/proc/robot_hud() src.adding = list( ) src.other = list( ) - src.vimpaired = list( ) - src.darkMask = list( ) - - src.g_dither = new src.h_type( src ) - src.g_dither.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.g_dither.name = "Mask" - src.g_dither.icon_state = "dither12g" - src.g_dither.layer = 18 - src.g_dither.mouse_opacity = 0 -// - src.alien_view = new src.h_type(src) - src.alien_view.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.alien_view.name = "Alien" - src.alien_view.icon_state = "alien" - src.alien_view.layer = 18 - src.alien_view.mouse_opacity = 0 - - src.blurry = new src.h_type( src ) - src.blurry.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.blurry.name = "Blurry" - src.blurry.icon_state = "blurry" - src.blurry.layer = 17 - src.blurry.mouse_opacity = 0 - - src.druggy = new src.h_type( src ) - src.druggy.screen_loc = "WEST,SOUTH to EAST,NORTH" - src.druggy.name = "Druggy" - src.druggy.icon_state = "druggy" - src.druggy.layer = 17 - src.druggy.mouse_opacity = 0 var/obj/screen/using diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index a74bed6ec8..40d9782e0c 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -237,23 +237,21 @@ // if (src.oxygen) src.oxygen.icon_state = "oxy[src.oxygen_alert ? 1 : 0]" // if (src.fire) src.fire.icon_state = "fire[src.fire_alert ? 1 : 0]" - src.client.screen -= src.hud_used.blurry - src.client.screen -= src.hud_used.druggy - src.client.screen -= src.hud_used.vimpaired + client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired) if ((src.blind && src.stat != 2)) - if ((src.blinded)) + if(src.blinded) src.blind.layer = 18 else src.blind.layer = 0 if (src.disabilities & NEARSIGHTED) - src.client.screen += src.hud_used.vimpaired + src.client.screen += global_hud.vimpaired if (src.eye_blurry) - src.client.screen += src.hud_used.blurry + src.client.screen += global_hud.blurry if (src.druggy) - src.client.screen += src.hud_used.druggy + src.client.screen += global_hud.druggy if (src.stat != 2) if (src.machine) diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 84b84c3067..01faecebdd 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -35,7 +35,7 @@ client.images = null //remove the images such as AIs being unable to see runes client.screen = null //remove hud items just in case if(hud_used) del(hud_used) //remove the hud objects - hud_used = new/obj/hud( src ) + hud_used = new /datum/hud(src) if(!dna) dna = new /datum/dna(null) diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 4a442e48e6..98fafccf97 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -120,7 +120,7 @@ var/seer = 0 //for cult//Carbon, probably Human - var/obj/hud/hud_used = null + var/datum/hud/hud_used = null //var/list/organs = list( ) //moved to human. var/list/grabbed_by = list( ) diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index c7921f001b..679ead3e9e 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -328,4 +328,50 @@ It's fairly easy to fix if dealing with single letters but not so much with comp else usr << "\red Inventory hiding is currently only supported for human mobs, sorry." else - usr << "\red This mob type does not use a HUD." \ No newline at end of file + usr << "\red This mob type does not use a HUD." + +//converts intent-strings into numbers and back +var/list/intents = list("help","disarm","grab","hurt") +/proc/intent_numeric(argument) + if(istext(argument)) + switch(argument) + if("help") return 0 + if("disarm") return 1 + if("grab") return 2 + else return 3 + else + switch(argument) + if(0) return "help" + if(1) return "disarm" + if(2) return "grab" + else return "hurt" + +//change a mob's act-intent. Input the intent as a string such as "help" or use "right"/"left +/mob/verb/a_intent_change(input as text) + set name = "a-intent" + set hidden = 1 + + if(ishuman(src) || istype(src,/mob/living/carbon/alien/humanoid)) + switch(input) + if("help","disarm","grab","hurt") + a_intent = input + if("right") + a_intent = intent_numeric((intent_numeric(a_intent)+1) % 4) + if("left") + a_intent = intent_numeric((intent_numeric(a_intent)+3) % 4) + if(hud_used && hud_used.action_intent) + hud_used.action_intent.icon_state = "intent_[a_intent]" + + else if(isrobot(src) || ismonkey(src) || islarva(src)) + switch(input) + if("help") + a_intent = "help" + if("hurt") + a_intent = "hurt" + if("right","left") + a_intent = intent_numeric(intent_numeric(a_intent) - 3) + if(hud_used && hud_used.action_intent) + if(a_intent == "hurt") + hud_used.action_intent.icon_state = "harm" + else + hud_used.action_intent.icon_state = "help" \ No newline at end of file diff --git a/code/modules/mob/new_player/hud.dm b/code/modules/mob/new_player/hud.dm index 3f2d074e31..67af01d645 100644 --- a/code/modules/mob/new_player/hud.dm +++ b/code/modules/mob/new_player/hud.dm @@ -1,3 +1,3 @@ -/obj/hud/proc/unplayer_hud() +/datum/hud/proc/unplayer_hud() return \ No newline at end of file diff --git a/code/modules/mob/screen.dm b/code/modules/mob/screen.dm index 4a197a606a..75fb5607d8 100644 --- a/code/modules/mob/screen.dm +++ b/code/modules/mob/screen.dm @@ -1,5 +1,5 @@ /obj/screen - name = "screen" + name = "" icon = 'icons/mob/screen1.dmi' layer = 20.0 unacidable = 1 diff --git a/interface/interface.dm b/interface/interface.dm index 21cc0e43d7..fccaed6eb3 100644 --- a/interface/interface.dm +++ b/interface/interface.dm @@ -31,53 +31,6 @@ src << browse(file(RULES_FILE), "window=rules;size=480x320") #undef RULES_FILE -//converts intent-strings into numbers and back -var/list/intents = list("help","disarm","grab","hurt") -/proc/intent_numeric(argument) - if(istext(argument)) - switch(argument) - if("help") return 0 - if("disarm") return 1 - if("grab") return 2 - else return 3 - else - switch(argument) - if(0) return "help" - if(1) return "disarm" - if(2) return "grab" - else return "hurt" - -//change a mob's act-intent. Input the intent as a string such as "help" or use "right"/"left -/mob/verb/a_intent_change(input as text) - set name = "a-intent" - set hidden = 1 - - if(ishuman(src) || istype(src,/mob/living/carbon/alien/humanoid)) - switch(input) - if("help","disarm","grab","hurt") - a_intent = input - if("right") - a_intent = intent_numeric((intent_numeric(a_intent)+1) % 4) - if("left") - a_intent = intent_numeric((intent_numeric(a_intent)+3) % 4) - if(hud_used && hud_used.action_intent) - hud_used.action_intent.icon_state = "intent_[a_intent]" - - else if(isrobot(src) || ismonkey(src) || islarva(src)) - switch(input) - if("help") - a_intent = "help" - if("hurt") - a_intent = "hurt" - if("right","left") - a_intent = intent_numeric(intent_numeric(a_intent) - 3) - if(hud_used && hud_used.action_intent) - if(a_intent == "hurt") - hud_used.action_intent.icon_state = "harm" - else - hud_used.action_intent.icon_state = "help" - - /client/verb/hotkeys_help() set name = "hotkeys-help" set category = "OOC" diff --git a/tgstation.dme b/tgstation.dme index f8b7c3a8f2..62c156a3e2 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -582,7 +582,6 @@ #include "code\game\objects\empulse.dm" #include "code\game\objects\explosion.dm" #include "code\game\objects\explosion_recursive.dm" -#include "code\game\objects\hud.dm" #include "code\game\objects\items.dm" #include "code\game\objects\objs.dm" #include "code\game\objects\structures.dm"