Merge pull request #10303 from VOREStation/Arokha/removeoldnifmenu

Deprecate NIF statpanel in favor of TGUI
This commit is contained in:
Novacat
2021-05-12 13:46:26 -04:00
committed by Chompstation Bot
parent 600122cfb3
commit 86ab1a8363
15 changed files with 73 additions and 99 deletions

View File

@@ -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"
#define ui_smallquad "EAST-4:22,SOUTH:5"

View File

@@ -504,4 +504,4 @@
name = "crafting menu"
icon = 'icons/mob/screen/midnight.dmi'
icon_state = "craft"
screen_loc = ui_crafting
screen_loc = ui_smallquad

View File

@@ -50,11 +50,11 @@
. += "<b>tgui Window Mode:</b> <a href='?src=\ref[src];tgui_fancy=1'><b>[(pref.tgui_fancy) ? "Fancy (default)" : "Compatible (slower)"]</b></a><br>"
. += "<b>tgui Window Placement:</b> <a href='?src=\ref[src];tgui_lock=1'><b>[(pref.tgui_lock) ? "Primary Monitor" : "Free (default)"]</b></a><br>"
if(can_select_ooc_color(user))
. += "<b>OOC Color:</b><EFBFBD>"
. += "<b>OOC Color:</b>"
if(pref.ooccolor == initial(pref.ooccolor))
. += "<a href='?src=\ref[src];select_ooc_color=1'><b>Using Default</b></a><br>"
else
. += "<a href='?src=\ref[src];select_ooc_color=1'><b>[pref.ooccolor]</b></a> [color_square(hex = pref.ooccolor)]<EFBFBD><a href='?src=\ref[src];reset=ooc'>reset</a><br>"
. += "<a href='?src=\ref[src];select_ooc_color=1'><b>[pref.ooccolor]</b></a> [color_square(hex = pref.ooccolor)]<a href='?src=\ref[src];reset=ooc'>reset</a><br>"
/datum/category_item/player_setup_item/player_global/ui/OnTopic(var/href,var/list/href_list, var/mob/user)
if(href_list["select_style"])

View File

@@ -102,9 +102,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
@@ -127,6 +124,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)
if(starting_software)
for(var/path in starting_software)
new path(src)
@@ -169,6 +167,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

View File

@@ -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()

View File

@@ -15,15 +15,75 @@
"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))
return COMPONENT_INCOMPATIBLE
. = ..()
/datum/component/nif_menu/RegisterWithParent()
. = ..()
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/UnregisterFromParent()
. = ..()
UnregisterSignal(parent, COMSIG_MOB_CLIENT_LOGIN)
if(ismob(parent))
var/mob/owner = parent
if(screen_icon)
owner?.client?.screen -= screen_icon
UnregisterSignal(screen_icon, COMSIG_CLICK)
qdel_null(screen_icon)
if(ishuman(parent))
owner.verbs -= /mob/living/carbon/human/proc/nif_menu
/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)

View File

@@ -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"]"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -3398,7 +3398,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"