diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm index df78fd5df8f..44037305dda 100644 --- a/code/_onclick/hud/_defines.dm +++ b/code/_onclick/hud/_defines.dm @@ -188,4 +188,4 @@ #define ui_mech_deco1_f "WEST+2:-7, SOUTH+8" #define ui_mech_deco2_f "WEST+2:-7, SOUTH+9" -#define ui_crafting "EAST-4:22,SOUTH:5" \ No newline at end of file +#define ui_smallquad "EAST-4:22,SOUTH:5" \ No newline at end of file diff --git a/code/datums/components/crafting/crafting.dm b/code/datums/components/crafting/crafting.dm index 4ff5dadb7c0..9f39990afd9 100644 --- a/code/datums/components/crafting/crafting.dm +++ b/code/datums/components/crafting/crafting.dm @@ -504,4 +504,4 @@ name = "crafting menu" icon = 'icons/mob/screen/midnight.dmi' icon_state = "craft" - screen_loc = ui_crafting \ No newline at end of file + screen_loc = ui_smallquad \ No newline at end of file diff --git a/code/modules/nifsoft/nif.dm b/code/modules/nifsoft/nif.dm index c185283b0e7..b028db88ad2 100644 --- a/code/modules/nifsoft/nif.dm +++ b/code/modules/nifsoft/nif.dm @@ -103,9 +103,6 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable //Draw me yo. update_icon() - if(!our_statclick) - our_statclick = new(null, "Open", src) - //Destructor cleans up references /obj/item/device/nif/Destroy() human = null @@ -128,6 +125,7 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable human.nif = src stat = NIF_INSTALLING H.verbs |= /mob/living/carbon/human/proc/set_nif_examine + menu = H.AddComponent(/datum/component/nif_menu) return TRUE return FALSE @@ -166,6 +164,7 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable stat = NIF_PREINSTALL vis_update() H.verbs -= /mob/living/carbon/human/proc/set_nif_examine + qdel_null(menu) H.nif = null human = null install_done = null diff --git a/code/modules/nifsoft/nif_statpanel.dm b/code/modules/nifsoft/nif_statpanel.dm deleted file mode 100644 index 00e928429fb..00000000000 --- a/code/modules/nifsoft/nif_statpanel.dm +++ /dev/null @@ -1,79 +0,0 @@ -/mob/living/carbon/human/Stat() - . = ..() - if(nif && statpanel("NIF")) - SetupNifStat() - -/mob/living/carbon/human/proc/SetupNifStat() - var/nif_status = "" - var/nif_percent = round((nif.durability/initial(nif.durability))*100) - switch(nif.stat) - if(NIF_WORKING) - if(nif_percent < 20) - nif_status = "Service Needed Soon" - else - nif_status = "Operating Normally" - if(NIF_POWFAIL) - nif_status = "Insufficient Energy!" - if(NIF_TEMPFAIL) - nif_status = "System Failure!" - if(NIF_INSTALLING) - nif_status = "Adapting To User" - else - nif_status = "Unknown - Error" - nif_status += " (Condition: [nif_percent]%)" - stat("NIF Status", nif_status) - stat("UI", nif.our_statclick) // TGUI Hook - - if(nif.stat == NIF_WORKING) - stat("- Modules -", "LMB: Toggle, Shift+LMB: Info/Uninstall") - for(var/nifsoft in nif.nifsofts) - if(!nifsoft) continue - var/datum/nifsoft/NS = nifsoft - var/obj/effect/nif_stat/stat_line = NS.stat_line - stat("[stat_line.nifsoft_name]",stat_line.atom_button_text()) - -/////////////////// -// Stat Line Object -/obj/effect/nif_stat - name = "" - var/nifsoft_name //Prevents deeper lookups, and the name won't change - var/datum/nifsoft/nifsoft //Reference to our nifsoft - var/toggleable = FALSE //Won't change, prevents looking it up deeper - -/obj/effect/nif_stat/New(var/datum/nifsoft/new_soft) - ..() - nifsoft = new_soft - nifsoft_name = new_soft.name - name = new_soft.name - -/obj/effect/nif_stat/Destroy() - nifsoft = null - return ..() - -/obj/effect/nif_stat/proc/atom_button_text() - name = nifsoft.stat_text() - return src - -/obj/effect/nif_stat/Click(var/location, var/control, var/params) - if(usr != nifsoft.nif.human) return - - var/list/clickprops = params2list(params) - var/opts = clickprops["shift"] - - if(opts) - var/choice = alert("Select an option","[nifsoft_name]","Display Info","Cancel","Uninstall") - switch(choice) - if("Display Info") - nifsoft.nif.notify("[nifsoft_name]: [nifsoft.desc] - It consumes [nifsoft.p_drain] energy units \ - while installed, and [nifsoft.a_drain] additionally while active. It is [nifsoft.illegal ? "NOT " : ""]\ - a legal software package. The MSRP of the package is [nifsoft.cost] Thalers. The difficulty to construct \ - the associated implant is Rating [nifsoft.wear].") - if("Uninstall") - var/confirm = alert("Really uninstall [nifsoft_name]?","Are you sure?","Cancel","Uninstall","Cancel") - if(confirm == "Uninstall") - nifsoft.uninstall() - else if(nifsoft.activates) - if(nifsoft.active) - nifsoft.deactivate() - else - nifsoft.activate() diff --git a/code/modules/nifsoft/nif_tgui.dm b/code/modules/nifsoft/nif_tgui.dm index 23d8102f793..8566fbb506f 100644 --- a/code/modules/nifsoft/nif_tgui.dm +++ b/code/modules/nifsoft/nif_tgui.dm @@ -15,15 +15,67 @@ "retro", "syndicate" ) - var/tmp/obj/effect/statclick/nif_open/our_statclick var/tmp/last_notification + var/tmp/datum/component/nif_menu/menu /** - * Special stat button for the interface + * Small helper component to manage the HUD icon */ -/obj/effect/statclick/nif_open -/obj/effect/statclick/nif_open/Click(location, control, params) - var/obj/item/device/nif/N = target +/datum/component/nif_menu + var/obj/screen/nif/screen_icon + +/datum/component/nif_menu/Initialize() + . = ..() + if(ismob(parent)) + RegisterSignal(parent, COMSIG_MOB_CLIENT_LOGIN, .proc/create_mob_button) + var/mob/owner = parent + if(owner.client) + create_mob_button(parent) + +/datum/component/nif_menu/Destroy() + if(ishuman(parent)) + var/mob/living/carbon/human/H = parent + H.verbs -= /mob/living/carbon/human/proc/nif_menu + if(screen_icon) + H.client?.screen -= screen_icon + qdel_null(screen_icon) + return ..() + +/datum/component/nif_menu/proc/create_mob_button(mob/user) + var/datum/hud/HUD = user.hud_used + if(!screen_icon) + screen_icon = new() + screen_icon.icon = HUD.ui_style + HUD.other += screen_icon + user.client?.screen += screen_icon + + user.verbs |= /mob/living/carbon/human/proc/nif_menu + + RegisterSignal(screen_icon, COMSIG_CLICK, .proc/nif_menu_click) + +/datum/component/nif_menu/proc/nif_menu_click(atom/movable/screen/nif/image, location, control, params, user) + var/mob/living/carbon/human/H = user + if(istype(H) && H.nif) + INVOKE_ASYNC(H.nif, .proc/tgui_interact, user) + +/** + * Screen object for NIF menu access + */ +/obj/screen/nif + name = "nif menu" + icon = 'icons/mob/screen/midnight.dmi' + icon_state = "nif" + screen_loc = ui_smallquad + +/** + * Verb to open the interface + */ +/mob/living/carbon/human/proc/nif_menu() + set name = "NIF Menu" + set category = "IC" + set desc = "Open the NIF user interface." + + var/obj/item/device/nif/N = nif if(istype(N)) N.tgui_interact(usr) diff --git a/code/modules/nifsoft/nifsoft.dm b/code/modules/nifsoft/nifsoft.dm index ca1d0199a69..951e2932183 100644 --- a/code/modules/nifsoft/nifsoft.dm +++ b/code/modules/nifsoft/nifsoft.dm @@ -39,15 +39,11 @@ var/list/incompatible_with = null // List of NIFSofts that are disabled when this one is enabled - var/obj/effect/nif_stat/stat_line // The stat line in the statpanel for this NIFSoft - - //Constructor accepts the NIF it's being loaded into /datum/nifsoft/New(var/obj/item/device/nif/nif_load) ASSERT(nif_load) nif = nif_load - stat_line = new(src) if(!install(nif)) qdel(src) @@ -56,7 +52,6 @@ if(nif) uninstall() nif = null - QDEL_NULL(stat_line) return ..() //Called when the software is installed in the NIF @@ -138,7 +133,7 @@ /datum/nifsoft/proc/disk_install(var/mob/living/carbon/human/target,var/mob/living/carbon/human/user) return TRUE -//Stat-line clickable text +//Status text for menu /datum/nifsoft/proc/stat_text() if(activates) return "[active ? "Active" : "Disabled"]" diff --git a/icons/mob/screen/holo.dmi b/icons/mob/screen/holo.dmi index a0fff5d7819..8acd77b9b26 100644 Binary files a/icons/mob/screen/holo.dmi and b/icons/mob/screen/holo.dmi differ diff --git a/icons/mob/screen/midnight.dmi b/icons/mob/screen/midnight.dmi index b1f37cb2239..db6197abd9e 100644 Binary files a/icons/mob/screen/midnight.dmi and b/icons/mob/screen/midnight.dmi differ diff --git a/icons/mob/screen/minimalist.dmi b/icons/mob/screen/minimalist.dmi index a60c9b196ae..48ff4008640 100644 Binary files a/icons/mob/screen/minimalist.dmi and b/icons/mob/screen/minimalist.dmi differ diff --git a/icons/mob/screen/old-noborder.dmi b/icons/mob/screen/old-noborder.dmi index ddc72353ee3..b11c0b0d529 100644 Binary files a/icons/mob/screen/old-noborder.dmi and b/icons/mob/screen/old-noborder.dmi differ diff --git a/icons/mob/screen/old.dmi b/icons/mob/screen/old.dmi index f165b01b5bf..93d51e042a4 100644 Binary files a/icons/mob/screen/old.dmi and b/icons/mob/screen/old.dmi differ diff --git a/icons/mob/screen/orange.dmi b/icons/mob/screen/orange.dmi index d0b52d10d4a..c50d41b49b5 100644 Binary files a/icons/mob/screen/orange.dmi and b/icons/mob/screen/orange.dmi differ diff --git a/icons/mob/screen/white.dmi b/icons/mob/screen/white.dmi index 0a1a31bc31e..cf232ae5c36 100644 Binary files a/icons/mob/screen/white.dmi and b/icons/mob/screen/white.dmi differ diff --git a/vorestation.dme b/vorestation.dme index b883ec6234e..aac8ba93e52 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -3157,7 +3157,6 @@ #include "code\modules\news\newspaper_layout.dm" #include "code\modules\nifsoft\nif.dm" #include "code\modules\nifsoft\nif_softshop.dm" -#include "code\modules\nifsoft\nif_statpanel.dm" #include "code\modules\nifsoft\nif_tgui.dm" #include "code\modules\nifsoft\nifsoft.dm" #include "code\modules\nifsoft\software\01_vision.dm"