Adds Timeclock Terminals: A machine for viewing your PTO balance.

* Timeclock machine and NanoUI template.
* Circuit board for construction.
* Frame datum for construction on walls.
* Sprites by VerySoft
This commit is contained in:
Leshana
2018-02-18 20:42:22 -05:00
parent c36d01939c
commit 31b8e30aac
5 changed files with 219 additions and 1 deletions
@@ -0,0 +1,127 @@
/////////////////////////////////////////////
//Time Clock Terminal////////////////////////
/////////////////////////////////////////////
//
// Timeclock terminal machine itself
//
/obj/machinery/computer/timeclock
name = "timeclock terminal"
icon = 'icons/obj/machines/timeclock_vr.dmi'
icon_state = "timeclock"
icon_keyboard = null
light_color = "#0099ff"
light_power_on = 0.5
layer = ABOVE_WINDOW_LAYER
density = FALSE
circuit = /obj/item/weapon/circuitboard/timeclock
var/obj/item/weapon/card/id/card // Inserted Id card
/obj/machinery/computer/timeclock/Destroy()
if(card)
card.forceMove(get_turf(src))
card = null
. = ..()
/obj/machinery/computer/timeclock/update_icon()
if(inoperable())
icon_state = "[initial(icon_state)]_off"
else if(card)
icon_state = "[initial(icon_state)]_card"
else
icon_state = "[initial(icon_state)]"
/obj/machinery/computer/timeclock/power_change()
var/old_stat = stat
. = ..()
if(old_stat != stat)
update_icon()
if(stat & NOPOWER)
set_light(0)
else
set_light(light_range_on, light_power_on)
/obj/machinery/computer/timeclock/attackby(obj/I, mob/user)
if(istype(I, /obj/item/weapon/card/id))
if(!card && user.unEquip(I))
I.forceMove(src)
card = I
nanomanager.update_uis(src)
update_icon()
else if(card)
to_chat(user, "<span class='warning'>There is already ID card inside.</span>")
return
. = ..()
/obj/machinery/computer/timeclock/attack_hand(var/mob/user as mob)
if(..())
return
user.set_machine(src)
ui_interact(user)
/obj/machinery/computer/timeclock/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
user.set_machine(src)
var/list/data = list()
// Okay, data for showing the user's OWN PTO stuff
if(user.client)
data["department_hours"] = SANITIZE_LIST(user.client.department_hours)
data["user_name"] = "[user]"
// Data about the card that we put into it.
if(card)
data["card"] = "[card]"
data["assignment"] = card.assignment
var/datum/job/job = job_master.GetJob(card.rank)
if (job)
data["job_datum"] = list(
"title" = job.title,
"department" = job.department,
"selection_color" = job.selection_color,
"economic_modifier" = job.economic_modifier,
"head_position" = job.head_position,
"timeoff_factor" = job.timeoff_factor
)
// TODO - Once job changing is implemented, we will want to list jobs to change into.
// if(job && job.timeoff_factor < 0) // Currently are Off Duty, so gotta lookup what on-duty jobs are open
// data["job_choices"] = getOpenOnDutyJobs(user, job.department)
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "timeclock_vr.tmpl", capitalize(src.name), 500, 520)
ui.set_initial_data(data)
ui.open()
/obj/machinery/computer/timeclock/Topic(href, href_list)
if(..())
return 1
usr.set_machine(src)
src.add_fingerprint(usr)
if (href_list["id"])
if (card)
usr.put_in_hands(card)
card = null
else
var/obj/item/I = usr.get_active_hand()
if (istype(I, /obj/item/weapon/card/id) && usr.unEquip(I))
I.forceMove(src)
card = I
update_icon()
return 1 // Return 1 to update UI
//
// Frame type for construction
//
/datum/frame/frame_types/timeclock_terminal
name = "Timeclock Terminal"
frame_class = FRAME_CLASS_DISPLAY
frame_size = 2
frame_style = FRAME_STYLE_WALL
x_offset = 30
y_offset = 30
icon_override = 'icons/obj/machines/timeclock_vr.dmi'
/datum/frame/frame_types/timeclock_terminal/get_icon_state(var/state)
return "timeclock_b[state]"
@@ -45,4 +45,11 @@
origin_tech = list(TECH_PHORON = 3, TECH_DATA = 2, TECH_MAGNET = 2)
req_components = list(
/obj/item/weapon/stock_parts/matter_bin/adv = 1,
/obj/item/weapon/stock_parts/scanning_module = 5)
/obj/item/weapon/stock_parts/scanning_module = 5)
// Board for the timeclock terminal in timeclock_vr.dm
/obj/item/weapon/circuitboard/timeclock
name = T_BOARD("timeclock")
build_path = /obj/machinery/computer/timeclock
board_type = new /datum/frame/frame_types/timeclock_terminal
matter = list(DEFAULT_WALL_MATERIAL = 50, "glass" = 50)
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

+83
View File
@@ -0,0 +1,83 @@
<!--
Timeclock UI
See: code/game/machinery/computer/timeclock_vr.dm
-->
<!-- Always show person's status display -->
<div class="statusDisplay">
<h3>Time Off Balance for {{:config.user.name}}</h3>
{{props data.department_hours}}
<div class="line">
<div class="statusLabel">{{:key}}</div>
<div class="statusValue {{:value > 6 ? 'good' : value < 1 ? 'bad' : 'average'}}">{{:helper.fixed(value)}} {{:helper.fixed(value) == 1.0 ? 'hour' : 'hours'}}</div>
</div>
{{empty}}
<div class='notice'>No Hours Accrued</div>
{{/props}}
</div>
<h3>Employment Information</h3>
<div class='itemGroup'>
<div class='item'>
<div class='itemLabel'>Employee ID:</div>
{{:helper.link(data.card ? data.card : 'Insert ID', 'person', {'id' : 1})}}
</div>
{{if data.job_datum }}
<div class='item'>
<div class='itemLabel'>Rank:</div>
<div class='itemContent'>
<span style='padding: 2px 8px; border-radius: 4px; background-color: {{:data.job_datum.selection_color}};'>{{:data.job_datum.title}}</span>
</div>
</div>
<div class='item'>
<div class='itemLabel'>Department:</div>
<div class='itemContent'>{{:data.job_datum.department}}</div>
</div>
<div class='item'>
<div class='itemLabel'>Pay Scale:</div>
<div class='itemContent'>{{:data.job_datum.economic_modifier}}</div>
</div>
<div class='item'>
<div class='itemLabel'>PTO Eligibility:</div>
{{if data.job_datum.timeoff_factor > 0 }}
<div class='itemContent' title='Hours working this position will earn time off for its department.' style='cursor: help;'>
Earns PTO
</div>
{{else data.job_datum.timeoff_factor < 0}}
<div class='itemContent' title='Hours spent in this position are deducted from your time off for its department.' style='cursor: help;'>
Requires PTO
</div>
{{else}}
<div class='itemContent' title='This job neither requires nor earnts time off hours.' style='cursor: help;'>
Neutral
</div>
{{/if}}
</div>
{{/if}}
</div>
{{if data.allow_change_job && data.job_datum && data.job_datum.timeoff_factor != 0 }}
<h3>Employment Actions</h3>
<div class='itemGroup'>
<div class='item'>
{{if data.job_datum.head_position }}
<i class='uiIcon16 icon-alert'></i>
<span class='average'>NT policy does not permit head positions to go off duty mid-shift.</span>
{{else (data.job_datum.timeoff_factor > 0) }}
{{if helper.round(data.department_hours[data.job_datum.department]) > 0 }}
{{:helper.link('Go Off Duty', 'alert', {'switch-to-offduty': 1})}}
{{else}}
<i class='uiIcon16 icon-alert-red'></i>
<span class='bad'>Insufficent Time Off Accrued</span>
{{/if}}
{{else (data.job_datum.timeoff_factor < 0) }}
{{for data.job_choices }}
<div class='itemLabelWide'>{{:value}}</div>
<div class='itemContentMedium'>{{:helper.link("Issue Guest Pass", 'suitcase', {'guest-pass' : value})}}</div>
{{empty}}
<div class='notice'>No Open Positions - See Head of Personnel</div>
{{/for}}
{{/if}}
</div>
</div>
{{/if}}
+1
View File
@@ -735,6 +735,7 @@
#include "code\game\machinery\computer\station_alert.dm"
#include "code\game\machinery\computer\supply.dm"
#include "code\game\machinery\computer\syndicate_specops_shuttle.dm"
#include "code\game\machinery\computer\timeclock_vr.dm"
#include "code\game\machinery\computer\~computer_vr.dm"
#include "code\game\machinery\computer3\bios.dm"
#include "code\game\machinery\computer3\buildandrepair.dm"