Deprecate NIF statpanel in favor of TGUI

This commit is contained in:
Aronai Sieyes
2021-05-11 23:43:22 -04:00
parent 8c427b1f05
commit c8f7709f89
14 changed files with 62 additions and 96 deletions
+1 -1
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"
+1 -1
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
+2 -3
View File
@@ -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
-79
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()
+57 -5
View File
@@ -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)
+1 -6
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

-1
View File
@@ -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"