Adds battery status icon to NTOS
- Laptops now have status icon which shows status of their internal battery. - Adds support for "status bar" - allows more status icons in future (such as, network connection? time? whatever), status bar icons should be 16x16px
@@ -165,6 +165,8 @@
|
||||
|
||||
<body><div style='width:640px;height:480px; border:2px solid black;padding:8px;background-position:center;background-image:url(\ref['nano/images/uiBackground.png'])'>"}
|
||||
|
||||
|
||||
dat += generate_status_bar()
|
||||
var/list/files = list_files()
|
||||
if(current)
|
||||
dat +=window(current.name,buttonbar(),filegrid(files))
|
||||
@@ -176,6 +178,32 @@
|
||||
usr << browse(dat, "window=\ref[computer];size=670x510")
|
||||
onclose(usr, "\ref[computer]")
|
||||
|
||||
// STATUS BAR
|
||||
// Small 16x16 icons representing status of components, etc.
|
||||
// Currently only used by battery icon
|
||||
// TODO: Add more icons!
|
||||
/datum/file/program/ntos/proc/generate_status_bar()
|
||||
var/dat = ""
|
||||
|
||||
// Battery level icon
|
||||
switch(computer.check_battery_status())
|
||||
if(-1)
|
||||
dat += "<img src=\ref['icons/ntos/battery_icons/batt_none.gif']>"
|
||||
if(0 to 5)
|
||||
dat += "<img src=\ref['icons/ntos/battery_icons/batt_5.gif']>"
|
||||
if(6 to 20)
|
||||
dat += "<img src=\ref['icons/ntos/battery_icons/batt_20.gif']>"
|
||||
if(21 to 40)
|
||||
dat += "<img src=\ref['icons/ntos/battery_icons/batt_40.gif']>"
|
||||
if(41 to 60)
|
||||
dat += "<img src=\ref['icons/ntos/battery_icons/batt_60.gif']>"
|
||||
if(61 to 80)
|
||||
dat += "<img src=\ref['icons/ntos/battery_icons/batt_80.gif']>"
|
||||
if(81 to 100)
|
||||
dat += "<img src=\ref['icons/ntos/battery_icons/batt_100.gif']>"
|
||||
dat += "<br>"
|
||||
return dat
|
||||
|
||||
/datum/file/program/ntos/Topic(href, list/href_list)
|
||||
if(!interactable() || ..(href,href_list))
|
||||
return
|
||||
|
||||
@@ -449,6 +449,16 @@
|
||||
overlays += kb
|
||||
name = initial(name) + " (orange screen of death)"
|
||||
|
||||
//Returns percentage of battery charge remaining. Returns -1 if no battery is installed.
|
||||
proc/check_battery_status()
|
||||
if (battery)
|
||||
var/obj/item/weapon/cell/B = battery
|
||||
return round(B.charge / (B.maxcharge / 100))
|
||||
else
|
||||
return -1
|
||||
|
||||
|
||||
|
||||
/obj/machinery/computer3/wall_comp
|
||||
name = "terminal"
|
||||
icon = 'icons/obj/computer3.dmi'
|
||||
|
||||
BIN
icons/NTOS/battery_icons/batt_100.gif
Normal file
|
After Width: | Height: | Size: 102 B |
BIN
icons/NTOS/battery_icons/batt_20.gif
Normal file
|
After Width: | Height: | Size: 200 B |
BIN
icons/NTOS/battery_icons/batt_40.gif
Normal file
|
After Width: | Height: | Size: 123 B |
BIN
icons/NTOS/battery_icons/batt_5.gif
Normal file
|
After Width: | Height: | Size: 279 B |
BIN
icons/NTOS/battery_icons/batt_60.gif
Normal file
|
After Width: | Height: | Size: 122 B |
BIN
icons/NTOS/battery_icons/batt_80.gif
Normal file
|
After Width: | Height: | Size: 120 B |
BIN
icons/NTOS/battery_icons/batt_none.gif
Normal file
|
After Width: | Height: | Size: 132 B |