Added preliminary skeleton for zone control console, and timeout.

This commit is contained in:
Leshana
2017-02-13 21:57:41 -05:00
parent c47a2cae13
commit 7ebe3fc6d2
3 changed files with 122 additions and 5 deletions
+4 -1
View File
@@ -32,7 +32,10 @@ var/datum/controller/rogue/rm_controller = new()
var/diffstep = 1
//The current mining zone that the shuttle goes to and whatnot
var/area/current
var/datum/rogue/zonemaster/current = null
// The world.time at which the scanner was last run (for cooldown)
var/last_scan = 0
var/debugging = 0
+70 -4
View File
@@ -13,10 +13,76 @@
idle_power_usage = 250
active_power_usage = 500
circuit = /obj/item/weapon/circuitboard/roguezones
var/datum/nano_module/rogueconsole/nano_rc
/datum/nano_module/rogueconsole
//You should put actual code here for the nanoui thing.
/obj/machinery/computer/roguezones/attack_ai(mob/user as mob)
return attack_hand(user)
/obj/machinery/computer/roguezones/attack_hand(mob/user as mob)
add_fingerprint(user)
if(stat & (BROKEN|NOPOWER))
return
user.set_machine(src)
ui_interact(user)
/obj/machinery/computer/roguezones/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
user.set_machine(src)
var/chargePercent = max(100, (world.time - rm_controller.last_scan) / (10 MINUTES) * 100)
var/list/data = list()
data["timeout_percent"] = chargePercent
data["diffstep"] = rm_controller.diffstep
data["difficulty"] = rm_controller.diffstep_strs[rm_controller.diffstep]
data["occupied"] = rm_controller.current == null ? 0 : rm_controller.current.is_occupied()
var/obj/machinery/computer/shuttle_control/belter/belter = locate()
if(belter.z == 5)
data["shuttle_location"] = "outpost"
data["shuttle_at_station"] = 1
else if(belter.z == 2)
data["shuttle_location"] = "transit"
data["shuttle_at_station"] = 0
else if(belter.z == 7)
data["shuttle_location"] = "belt"
data["shuttle_at_station"] = 0
// Check this stuff
if(data["shuttle_at_station"] == 1 && data["occupied"] == 0 && chargePercent >= 100)
data["scan_ready"] = 1
else
data["scan_ready"] = 0
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "zone_console.tmpl", src.name, 400, 450)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(5)
/obj/machinery/computer/roguezones/Topic(href, href_list)
if(..())
return 1
usr.set_machine(src)
if (href_list["action"])
switch(href_list["action"])
if ("scan_for_new")
scan_for_new_zone()
if ("point_at_old")
point_at_old_zone()
src.add_fingerprint(usr)
nanomanager.update_uis(src)
/obj/machinery/computer/roguezones/proc/scan_for_new_zone()
// TODO - Actually do something
return
/obj/machinery/computer/roguezones/proc/point_at_old_zone()
// TODO - Actually do something
return
/obj/item/weapon/circuitboard/roguezones
//You should probably actually define this too.
name = T_BOARD("asteroid belt scanning computer")
build_path = /obj/machinery/computer/roguezones
origin_tech = list(TECH_DATA = 3, TECH_BLUESPACE = 1)
+48
View File
@@ -0,0 +1,48 @@
<div class="item" style="padding-top: 10px">
<div class="item">
<div class="itemLabel">
Scanner Ramestat Core Charge:
</div>
<div class="itemContent">
{{:helper.displayBar(data.timeout_percent, 0, 100, (data.timeout_percent < 75) ? 'bad' : (data.timeout_percent < 100) ? 'average' : 'good')}}
</div>
</div>
</div>
<div class="item">
<div class="itemLabel">
Difficulty:
</div>
<div class="itemContent">
{{:data.difficulty}}
</div>
</div>
</div>
<div class="item">
<div class="itemLabel">
Shuttle Location:
</div>
<div class="itemContent">
{{:data.shuttle_location}}
</div>
</div>
{{if data.occupied > 0}}
<div class="item">
<div class="itemLabel">
WARNING:
</div>
<div class="itemContent">
Area Occupied by {{:data.occupied}} personell!
</div>
</div>
{{/if}}
<h3>Scanner Operation</h3>
<div class="item">
<div class="itemLabel">
Scanner Activation:
</div>
<div class="itemContent">
{{:helper.link('Scan For Asteroids', 'power', {'action' : 'scan_for_new'}, data.scan_ready ? null : 'disabled')}}
</div>
</div>