Made UI actualy update when ID is inserted/ejected and

disabled lot of auto ui updates formodules that don't need it.
This commit is contained in:
Karolis2011
2016-01-24 22:29:39 +02:00
parent e14a2b917d
commit dba7e7e3ec
5 changed files with 27 additions and 7 deletions

View File

@@ -10,6 +10,8 @@
var/datum/computer_file/program/active_program = null // A currently active program running on the computer. var/datum/computer_file/program/active_program = null // A currently active program running on the computer.
var/hardware_flag = 0 // A flag that describes this device type var/hardware_flag = 0 // A flag that describes this device type
var/last_power_usage = 0 var/last_power_usage = 0
var/last_battery_percent = 0 // Used for deciding if battery percentage has chandged
var/last_world_time = "00:00"
var/computer_emagged = 0 // Whether the computer is emagged. var/computer_emagged = 0 // Whether the computer is emagged.
var/base_active_power_usage = 50 // Power usage when the computer is open (screen is active) and can be interacted with. Remember hardware can use power too. var/base_active_power_usage = 50 // Power usage when the computer is open (screen is active) and can be interacted with. Remember hardware can use power too.
@@ -70,7 +72,7 @@
card_slot.stored_card.forceMove(get_turf(src)) card_slot.stored_card.forceMove(get_turf(src))
card_slot.stored_card = null card_slot.stored_card = null
nanomanager.update_uis(src) update_uis()
user << "You remove the card from \the [src]" user << "You remove the card from \the [src]"
/obj/item/modular_computer/attack_ghost(var/mob/dead/observer/user) /obj/item/modular_computer/attack_ghost(var/mob/dead/observer/user)
@@ -208,6 +210,10 @@
P.ntnet_status = get_ntnet_status() P.ntnet_status = get_ntnet_status()
P.computer_emagged = computer_emagged P.computer_emagged = computer_emagged
if(worldtime2text() != last_world_time)
last_world_time = worldtime2text()
update_uis()
handle_power() // Handles all computer power interaction handle_power() // Handles all computer power interaction
// Function used by NanoUI's to obtain data for header. All relevant entries begin with "PC_" // Function used by NanoUI's to obtain data for header. All relevant entries begin with "PC_"
@@ -382,6 +388,12 @@
if(battery_module) if(battery_module)
battery_module.battery.use(power_usage * CELLRATE) battery_module.battery.use(power_usage * CELLRATE)
var/batery_percent = battery_module.battery.percent()
if(last_battery_percent != batery_percent) //Let's update UI on percent chandge
update_uis()
last_battery_percent = batery_percent
last_power_usage = power_usage last_power_usage = power_usage
/obj/item/modular_computer/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) /obj/item/modular_computer/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
@@ -397,7 +409,7 @@
user.drop_from_inventory(I) user.drop_from_inventory(I)
card_slot.stored_card = I card_slot.stored_card = I
I.forceMove(src) I.forceMove(src)
nanomanager.update_uis(src) update_uis()
user << "You insert \the [I] into \the [src]." user << "You insert \the [I] into \the [src]."
return return
if(istype(W, /obj/item/weapon/paper)) if(istype(W, /obj/item/weapon/paper))
@@ -577,3 +589,11 @@
if(processor_unit) if(processor_unit)
all_components.Add(processor_unit) all_components.Add(processor_unit)
return all_components return all_components
/obj/item/modular_computer/proc/update_uis()
if(active_program) //Should we update program ui or computer ui?
nanomanager.update_uis(active_program)
if(active_program.NM)
nanomanager.update_uis(active_program.NM)
else
nanomanager.update_uis(src)

View File

@@ -88,7 +88,7 @@
ui.auto_update_layout = 1 ui.auto_update_layout = 1
ui.set_initial_data(data) ui.set_initial_data(data)
ui.open() ui.open()
ui.set_auto_update(1) ui.set_auto_update(0)
/datum/nano_module/card_mod/proc/format_jobs(list/jobs) /datum/nano_module/card_mod/proc/format_jobs(list/jobs)
var/obj/item/weapon/card/id/id_card = program.computer.card_slot.stored_card var/obj/item/weapon/card/id/id_card = program.computer.card_slot.stored_card

View File

@@ -60,4 +60,4 @@
ui.auto_update_layout = 1 ui.auto_update_layout = 1
ui.set_initial_data(data) ui.set_initial_data(data)
ui.open() ui.open()
ui.set_auto_update(1) ui.set_auto_update(0)

View File

@@ -236,6 +236,6 @@
ui.auto_update_layout = 1 ui.auto_update_layout = 1
ui.set_initial_data(data) ui.set_initial_data(data)
ui.open() ui.open()
ui.set_auto_update(1) ui.set_auto_update(0)

View File

@@ -48,7 +48,7 @@
ui.auto_update_layout = 1 ui.auto_update_layout = 1
ui.set_initial_data(data) ui.set_initial_data(data)
ui.open() ui.open()
ui.set_auto_update(1) ui.set_auto_update(0)
ui_ref = ui ui_ref = ui
/datum/nano_module/atmos_control/proc/generate_state(air_alarm) /datum/nano_module/atmos_control/proc/generate_state(air_alarm)