mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-26 13:37:58 +01:00
makes the card console no longer autoupdate (#23342)
This commit is contained in:
@@ -21,6 +21,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
var/mode = 0
|
||||
var/target_dept = 0 //Which department this computer has access to. 0=all departments
|
||||
var/obj/item/radio/Radio
|
||||
var/reset_timer
|
||||
|
||||
//Cooldown for closing positions in seconds
|
||||
//if set to -1: No cooldown... probably a bad idea
|
||||
@@ -137,6 +138,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
scan.forceMove(get_turf(src))
|
||||
scan = null
|
||||
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
|
||||
SStgui.update_uis(src)
|
||||
return
|
||||
else if(modify)
|
||||
to_chat(user, "<span class='notice'>You remove \the [modify] from \the [src].</span>")
|
||||
@@ -146,6 +148,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
modify.forceMove(get_turf(src))
|
||||
modify = null
|
||||
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
|
||||
SStgui.update_uis(src)
|
||||
else
|
||||
to_chat(user, "There is nothing to remove from the console.")
|
||||
|
||||
@@ -310,10 +313,21 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
/obj/machinery/computer/card/ui_state(mob/user)
|
||||
return GLOB.default_state
|
||||
|
||||
/obj/machinery/computer/card/proc/change_ui_autoupdate(value, mob/user)
|
||||
var/datum/tgui/ui = SStgui.try_update_ui(user, src, "main")
|
||||
reset_timer = null
|
||||
if(ui)
|
||||
ui.set_autoupdate(value)
|
||||
|
||||
/obj/machinery/computer/card/ui_interact(mob/user, datum/tgui/ui = null)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "CardComputer", name)
|
||||
var/delta = (world.time / 10) - GLOB.time_last_changed_position
|
||||
if(change_position_cooldown < delta && !reset_timer)
|
||||
ui.set_autoupdate(FALSE)
|
||||
else
|
||||
reset_timer = addtimer(CALLBACK(src, PROC_REF(change_ui_autoupdate), FALSE, user), delta SECONDS)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/card/ui_data(mob/user)
|
||||
@@ -582,6 +596,9 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
return FALSE
|
||||
if(opened_positions[edit_job_target] >= 0)
|
||||
GLOB.time_last_changed_position = world.time / 10
|
||||
change_ui_autoupdate(TRUE, usr)
|
||||
reset_timer = addtimer(CALLBACK(src, PROC_REF(change_ui_autoupdate), FALSE, usr), GLOB.time_last_changed_position SECONDS)
|
||||
|
||||
j.total_positions++
|
||||
opened_positions[edit_job_target]++
|
||||
log_game("[key_name(usr)] ([scan.assignment]) has opened a job slot for job \"[j.title]\".")
|
||||
@@ -599,6 +616,8 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
|
||||
//Allow instant closing without cooldown if a position has been opened before
|
||||
if(opened_positions[edit_job_target] <= 0)
|
||||
GLOB.time_last_changed_position = world.time / 10
|
||||
change_ui_autoupdate(TRUE, usr)
|
||||
reset_timer = addtimer(CALLBACK(src, PROC_REF(change_ui_autoupdate), FALSE, usr), (GLOB.time_last_changed_position + 1) SECONDS)
|
||||
j.total_positions--
|
||||
opened_positions[edit_job_target]--
|
||||
log_game("[key_name(usr)] ([scan.assignment]) has closed a job slot for job \"[j.title]\".")
|
||||
|
||||
Reference in New Issue
Block a user