Merge resolution.

This commit is contained in:
Zuhayr
2014-07-21 16:17:15 +09:30
52 changed files with 719 additions and 430 deletions
+43 -14
View File
@@ -22,20 +22,21 @@
var/dat = "<table border='0' align='left'>"
var/i = 0
for(var/datum/file/F in filelist)
i++
if(i==1)
dat += "<tr>"
if(i>= 6)
i = 0
dat += "</tr>"
continue
dat += {"
<td>
<center><a href='?src=\ref[src];[fileop]=\ref[F]'>
<img src=\ref[F.image]><br>
<span>[F.name]</span>
</a></center>
</td>"}
if(!F.hidden_file)
i++
if(i==1)
dat += "<tr>"
if(i>= 6)
i = 0
dat += "</tr>"
continue
dat += {"
<td>
<center><a href='?src=\ref[src];[fileop]=\ref[F]'>
<img src=\ref[F.image]><br>
<span>[F.name]</span>
</a></center>
</td>"}
dat += "</tr></table>"
return dat
@@ -164,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))
@@ -175,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
+125 -19
View File
@@ -91,29 +91,127 @@
return
..(I,user)
proc/insert(var/obj/item/weapon/card/card)
// cardslot.insert(card, slot)
// card: The card obj you want to insert (usually your ID)
// slot: Which slot to insert into (1: reader, 2: writer, 3: auto), 3 default
proc/insert(var/obj/item/weapon/card/card, var/slot = 3)
if(!computer)
return 0
if(reader != null)
usr << "There is already something in the slot!"
// This shouldn't happen, just in case..
if(slot == 2 && !dualslot)
usr << "This device has only one card slot"
return 0
if(istype(card,/obj/item/weapon/card/emag)) // emag reader slot
usr << "You insert \the [card], and the computer grinds, sparks, and beeps. After a moment, the card ejects itself."
computer.emagged = 1
return 1
var/mob/living/L = usr
L.drop_item()
card.loc = src
reader = card
proc/remove()
reader.loc = loc
var/mob/living/carbon/human/user = usr
if(istype(user) && !user.get_active_hand())
user.put_in_hands(reader)
else
reader.loc = computer.loc
reader = null
if(istype(card,/obj/item/weapon/card/emag)) // emag reader slot
if(!writer)
usr << "You insert \the [card], and the computer grinds, sparks, and beeps. After a moment, the card ejects itself."
computer.emagged = 1
return 1
else
usr << "You are unable to insert \the [card], as the reader slot is occupied"
var/mob/living/L = usr
switch(slot)
if(1)
if(equip_to_reader(card, L))
usr << "You insert the card into reader slot"
else
usr << "There is already something in the reader slot."
if(2)
if(equip_to_writer(card, L))
usr << "You insert the card into writer slot"
else
usr << "There is already something in the reader slot."
if(3)
if(equip_to_reader(card, L))
usr << "You insert the card into reader slot"
else if (equip_to_writer(card, L) && dualslot)
usr << "You insert the card into writer slot"
else if (dualslot)
usr << "There is already something in both slots."
else
usr << "There is already something in the reader slot."
// Usage of insert() preferred, as it also tells result to the user.
proc/equip_to_reader(var/obj/item/weapon/card/card, var/mob/living/L)
if(!reader)
L.drop_item()
card.loc = src
reader = card
return 1
return 0
proc/equip_to_writer(var/obj/item/weapon/card/card, var/mob/living/L)
if(!writer && dualslot)
L.drop_item()
card.loc = src
writer = card
return 1
return 0
// cardslot.remove(slot)
// slot: Which slot to remove card(s) from (1: reader only, 2: writer only, 3: both [works even with one card], 4: reader and if empty then writer ), 3 default
proc/remove(var/slot = 3)
var/mob/living/L = usr
switch(slot)
if(1)
if (remove_reader(L))
L << "You remove the card from reader slot"
else
L << "There is no card in the reader slot"
if(2)
if (remove_writer(L))
L << "You remove the card from writer slot"
else
L << "There is no card in the writer slot"
if(3)
if (remove_reader(L))
if (remove_writer(L))
L << "You remove cards from both slots"
else
L << "You remove the card from reader slot"
else
if(remove_writer(L))
L << "You remove the card from writer slot"
else
L << "There are no cards in both slots"
if(4)
if (!remove_reader(L))
if (remove_writer(L))
L << "You remove the card from writer slot"
else if (!dualslot)
L << "There is no card in the reader slot"
else
L << "There are no cards in both slots"
else
L << "You remove the card from reader slot"
proc/remove_reader(var/mob/living/L)
if(reader)
reader.loc = loc
if(istype(L) && !L.get_active_hand())
L.put_in_hands(reader)
else
reader.loc = computer.loc
reader = null
return 1
return 0
proc/remove_writer(var/mob/living/L)
if(writer && dualslot)
writer.loc = loc
if(istype(L) && !L.get_active_hand())
L.put_in_hands(writer)
else
writer.loc = computer.loc
writer = null
return 1
return 0
// Authorizes the user based on the computer's requirements
proc/authenticate()
@@ -133,6 +231,13 @@
desc = "Contains slots for inserting magnetic swipe cards for reading and writing."
dualslot = 1
/*
// Atlantis: Reworked card manipulation a bit.
// No need for separated code for dual and single readers.
// Both is handled in single-slot reader code now, thanks to the "dualslot" var.
// Leaving this code here if someone wants to somehow use it, just uncomment.
insert(var/obj/item/weapon/card/card,var/slot = 0)
if(!computer)
return 0
@@ -194,5 +299,6 @@
user.put_in_hands(card)
else
card.loc = computer.loc
*/
+10
View File
@@ -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'
@@ -275,3 +275,7 @@
else
usr << "The screen turns to static."
return
// Atlantis: Required for camnetkeys to work.
/datum/file/program/security/hidden
hidden_file = 1
@@ -253,9 +253,9 @@
if("remove" in href_list)
var/which = href_list["remove"]
if(which == "writer")
computer.cardslot.remove(computer.cardslot.writer)
computer.cardslot.remove(2)
else
computer.cardslot.remove(computer.cardslot.reader)
computer.cardslot.remove(1)
auth = 0
if("insert" in href_list)
@@ -264,9 +264,9 @@
var/which = href_list["insert"]
if(which == "writer")
computer.cardslot.insert(card,1)
else
computer.cardslot.insert(card,2)
else
computer.cardslot.insert(card,1)
if("print" in href_list)
if (printing)
@@ -23,6 +23,7 @@
req_one_access = list(access_medical, access_forensics_lockers)
var/obj/item/weapon/card/id/scan = null
var/obj/item/weapon/card/id/scan2 = null
var/authenticated = null
var/rank = null
var/screen = null
@@ -56,7 +57,12 @@
if (temp)
dat = text("<TT>[src.temp]</TT><BR><BR><A href='?src=\ref[src];temp=1'>Clear Screen</A>")
else
dat = text("Confirm Identity: <A href='?src=\ref[];scan=1'>[]</A><HR>", src, (src.scan ? text("[]", src.scan.name) : "----------"))
dat = text("Confirm Identity (R): <A href='?src=\ref[];cardr=1'>[]</A><HR>", src, (scan ? text("[]", scan.name) : "----------"))
if (computer.cardslot.dualslot)
dat += text("Check Identity (W): <A href='?src=\ref[];cardw=1'>[]</A><BR>", src, (scan2 ? text("[]", scan2.name) : "----------"))
if(scan2 && !scan)
dat += text("<div class='notice'>Insert card into reader slot to log in.</div><br>")
if (src.authenticated)
switch(src.screen)
if(1.0)
@@ -165,19 +171,32 @@
if (href_list["temp"])
src.temp = null
if (href_list["scan"])
if (href_list["cardr"])
if (scan)
if(istype(usr,/mob/living/carbon/human) && !usr.get_active_hand())
computer.cardslot.remove(scan)
computer.cardslot.remove(1)
else
scan.loc = get_turf(src)
scan = null
else
var/obj/item/I = usr.get_active_hand()
if (istype(I, /obj/item/weapon/card/id))
computer.cardslot.insert(I)
computer.cardslot.insert(I, 1)
scan = I
if (href_list["cardw"])
if (scan2)
if(istype(usr,/mob/living/carbon/human) && !usr.get_active_hand())
computer.cardslot.remove(2)
else
scan2.loc = get_turf(src)
scan2 = null
else
var/obj/item/I = usr.get_active_hand()
if (istype(I, /obj/item/weapon/card/id))
computer.cardslot.insert(I, 2)
scan2 = I
else if (href_list["logout"])
src.authenticated = null
src.screen = null
@@ -19,6 +19,7 @@
req_one_access = list(access_security, access_forensics_lockers)
var/obj/item/weapon/card/id/scan = null
var/obj/item/weapon/card/id/scan2 = null
var/authenticated = null
var/rank = null
var/screen = null
@@ -49,9 +50,13 @@
return
usr.set_machine(src)
scan = computer.cardslot.reader
if (computer.cardslot.dualslot)
scan2 = computer.cardslot.writer
if(!interactable())
return
return
if (computer.z > 6)
usr << "\red <b>Unable to establish a connection</b>: \black You're too far away from the station!"
return
@@ -60,7 +65,11 @@
if (temp)
dat = text("<TT>[]</TT><BR><BR><A href='?src=\ref[];choice=Clear Screen'>Clear Screen</A>", temp, src)
else
dat = text("Confirm Identity: <A href='?src=\ref[];choice=Confirm Identity'>[]</A><HR>", src, (scan ? text("[]", scan.name) : "----------"))
dat = text("Confirm Identity (R): <A href='?src=\ref[];choice=Confirm Identity R'>[]</A><HR>", src, (scan ? text("[]", scan.name) : "----------"))
if (computer.cardslot.dualslot)
dat += text("Check Identity (W): <A href='?src=\ref[];choice=Confirm Identity W'>[]</A><BR>", src, (scan2 ? text("[]", scan2.name) : "----------"))
if(scan2 && !scan)
dat += text("<div class='notice'>Insert card into reader slot to log in.</div><br>")
if (authenticated)
switch(screen)
if(1.0)
@@ -100,9 +109,9 @@
if("Released")
background = "'background-color:#3BB9FF;'"
if("None")
background = "'background-color:#00FF7F;'"
if("")
background = "'background-color:#00FF00;'"
if("")
background = "'background-color:#00FF7F;'"
crimstat = "No Record."
dat += text("<tr style=[]><td><A href='?src=\ref[];choice=Browse Record;d_rec=\ref[]'>[]</a></td>", background, src, R, R.fields["name"])
dat += text("<td>[]</td>", R.fields["id"])
@@ -236,19 +245,32 @@ What a mess.*/
active1 = null
active2 = null
if("Confirm Identity")
if("Confirm Identity R")
if (scan)
if(istype(usr,/mob/living/carbon/human) && !usr.get_active_hand())
computer.cardslot.remove(scan)
computer.cardslot.remove(1)
else
scan.loc = get_turf(src)
scan = null
else
var/obj/item/I = usr.get_active_hand()
if (istype(I, /obj/item/weapon/card/id))
computer.cardslot.insert(I)
computer.cardslot.insert(I, 1)
scan = I
if("Confirm Identity W")
if (scan2)
if(istype(usr,/mob/living/carbon/human) && !usr.get_active_hand())
computer.cardslot.remove(2)
else
scan2.loc = get_turf(src)
scan2 = null
else
var/obj/item/I = usr.get_active_hand()
if (istype(I, /obj/item/weapon/card/id))
computer.cardslot.insert(I, 2)
scan2 = I
if("Log Out")
authenticated = null
screen = null
+1 -1
View File
@@ -13,7 +13,7 @@
var/image = 'icons/ntos/file.png' // determines the icon to use, found in icons/ntos
var/obj/machinery/computer3/computer // the parent computer, if fixed
var/obj/item/part/computer/storage/device // the device that is containing this file
var/hidden_file = 0 // Prevents file from showing up on NTOS program list.
var/drm = 0 // Copy protection, called by copy() and move()
var/readonly = 0 // Edit protection, called by edit(), which is just a failcheck proc
+109 -94
View File
@@ -213,58 +213,66 @@
if (istype(I, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/C = I
visible_message("<span class='info'>[usr] swipes a card through [src].</span>")
if(vendor_account)
var/attempt_pin = input("Enter pin code", "Vendor transaction") as num
var/datum/money_account/D = attempt_account_access(C.associated_account_number, attempt_pin, 2)
if(D)
var/transaction_amount = total()
if(transaction_amount <= D.money)
//transfer the money
D.money -= transaction_amount
vendor_account.money += transaction_amount
//Transaction logs
var/datum/transaction/T = new()
T.target_name = "[vendor_account.owner_name] (via [src.name])"
T.purpose = "Purchase of Laptop"
if(transaction_amount > 0)
T.amount = "([transaction_amount])"
else
T.amount = "[transaction_amount]"
T.source_terminal = src.name
T.date = current_date_string
T.time = worldtime2text()
D.transaction_log.Add(T)
//
T = new()
T.target_name = D.owner_name
T.purpose = "Purchase of Laptop"
T.amount = "[transaction_amount]"
T.source_terminal = src.name
T.date = current_date_string
T.time = worldtime2text()
vendor_account.transaction_log.Add(T)
newlap = new /obj/machinery/computer3/laptop/vended(src.loc)
choose_progs(C)
vend()
popup.close()
newlap.close_computer()
newlap = null
cardreader = 0
floppy = 0
radionet = 0
camera = 0
network = 0
power = 0
var/datum/money_account/CH = get_account(C.associated_account_number)
if(CH.security_level != 0) //If card requires pin authentication (ie seclevel 1 or 2)
if(vendor_account)
var/attempt_pin = input("Enter pin code", "Vendor transaction") as num
var/datum/money_account/D = attempt_account_access(C.associated_account_number, attempt_pin, 2)
if(D)
transfer_and_vend(D, C)
else
usr << "\icon[src]<span class='warning'>You don't have that much money!</span>"
usr << "\icon[src]<span class='warning'>Unable to access account. Check security settings and try again.</span>"
else
usr << "\icon[src]<span class='warning'>Unable to access account. Check security settings and try again.</span>"
usr << "\icon[src]<span class='warning'>Unable to access vendor account. Please record the machine ID and call CentComm Support.</span>"
else
usr << "\icon[src]<span class='warning'>Unable to access vendor account. Please record the machine ID and call CentComm Support.</span>"
transfer_and_vend(CH, C)
// Transfers money and vends the laptop.
/obj/machinery/lapvend/proc/transfer_and_vend(var/datum/money_account/D, var/obj/item/weapon/card/C)
var/transaction_amount = total()
if(transaction_amount <= D.money)
//transfer the money
D.money -= transaction_amount
vendor_account.money += transaction_amount
//Transaction logs
var/datum/transaction/T = new()
T.target_name = "[vendor_account.owner_name] (via [src.name])"
T.purpose = "Purchase of Laptop"
if(transaction_amount > 0)
T.amount = "([transaction_amount])"
else
T.amount = "[transaction_amount]"
T.source_terminal = src.name
T.date = current_date_string
T.time = worldtime2text()
D.transaction_log.Add(T)
//
T = new()
T.target_name = D.owner_name
T.purpose = "Purchase of Laptop"
T.amount = "[transaction_amount]"
T.source_terminal = src.name
T.date = current_date_string
T.time = worldtime2text()
vendor_account.transaction_log.Add(T)
newlap = new /obj/machinery/computer3/laptop/vended(src.loc)
choose_progs(C)
vend()
popup.close()
newlap.close_computer()
newlap = null
cardreader = 0
floppy = 0
radionet = 0
camera = 0
network = 0
power = 0
else
usr << "\icon[src]<span class='warning'>You don't have that much money!</span>"
/obj/machinery/lapvend/proc/total()
var/total = 0
@@ -305,9 +313,10 @@
newlap.spawn_files += (/datum/file/program/card_comp)
if(access_heads in C.access)
newlap.spawn_files += (/datum/file/program/communications)
if(access_medical in C.access)
newlap.spawn_files += (/datum/file/program/crew)
if((access_medical in C.access) || (access_forensics_lockers in C.access)) //Gives detective the medical records program, but not the crew monitoring one.
newlap.spawn_files += (/datum/file/program/med_data)
if (access_medical in C.access)
newlap.spawn_files += (/datum/file/program/crew)
if(access_engine in C.access)
newlap.spawn_files += (/datum/file/program/powermon)
if(access_research in C.access)
@@ -320,6 +329,8 @@
newlap.spawn_files += (/datum/file/camnet_key/creed)
newlap.spawn_files += (/datum/file/program/arcade)
newlap.spawn_files += (/datum/file/camnet_key/entertainment)
//Atlantis: Each laptop gets "invisible" program/security - REQUIRED for camnetkeys to work.
newlap.spawn_files += (/datum/file/program/security/hidden)
newlap.update_spawn_files()
/obj/machinery/lapvend/proc/calc_reimburse(var/obj/item/device/laptop/L)
@@ -350,49 +361,53 @@
if (istype(I, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/C = I
visible_message("<span class='info'>[usr] swipes a card through [src].</span>")
if(vendor_account)
var/attempt_pin = input("Enter pin code", "Vendor transaction") as num
var/datum/money_account/D = attempt_account_access(C.associated_account_number, attempt_pin, 2)
if(D)
var/transaction_amount = total()
//transfer the money
D.money += transaction_amount
vendor_account.money -= transaction_amount
//Transaction logs
var/datum/transaction/T = new()
T.target_name = "[vendor_account.owner_name] (via [src.name])"
T.purpose = "Return purchase of Laptop"
if(transaction_amount > 0)
T.amount = "([transaction_amount])"
var/datum/money_account/CH = get_account(C.associated_account_number)
if(CH.security_level != 0) //If card requires pin authentication (ie seclevel 1 or 2)
if(vendor_account)
var/attempt_pin = input("Enter pin code", "Vendor transaction") as num
var/datum/money_account/D = attempt_account_access(C.associated_account_number, attempt_pin, 2)
if(D)
transfer_and_reimburse(D)
else
T.amount = "[transaction_amount]"
T.source_terminal = src.name
T.date = current_date_string
T.time = worldtime2text()
D.transaction_log.Add(T)
//
T = new()
T.target_name = D.owner_name
T.purpose = "Return purchase of Laptop"
T.amount = "[transaction_amount]"
T.source_terminal = src.name
T.date = current_date_string
T.time = worldtime2text()
vendor_account.transaction_log.Add(T)
del(relap)
vendmode = 0
cardreader = 0
floppy = 0
radionet = 0
camera = 0
network = 0
power = 0
usr << "\icon[src]<span class='warning'>Unable to access account. Check security settings and try again.</span>"
else
usr << "\icon[src]<span class='warning'>Unable to access account. Check security settings and try again.</span>"
usr << "\icon[src]<span class='warning'>Unable to access vendor account. Please record the machine ID and call CentComm Support.</span>"
else
usr << "\icon[src]<span class='warning'>Unable to access vendor account. Please record the machine ID and call CentComm Support.</span>"
transfer_and_reimburse(CH)
/obj/machinery/lapvend/proc/transfer_and_reimburse(var/datum/money_account/D)
var/transaction_amount = total()
//transfer the money
D.money += transaction_amount
vendor_account.money -= transaction_amount
//Transaction logs
var/datum/transaction/T = new()
T.target_name = "[vendor_account.owner_name] (via [src.name])"
T.purpose = "Return purchase of Laptop"
if(transaction_amount > 0)
T.amount = "([transaction_amount])"
else
T.amount = "[transaction_amount]"
T.source_terminal = src.name
T.date = current_date_string
T.time = worldtime2text()
D.transaction_log.Add(T)
//
T = new()
T.target_name = D.owner_name
T.purpose = "Return purchase of Laptop"
T.amount = "[transaction_amount]"
T.source_terminal = src.name
T.date = current_date_string
T.time = worldtime2text()
vendor_account.transaction_log.Add(T)
del(relap)
vendmode = 0
cardreader = 0
floppy = 0
radionet = 0
camera = 0
network = 0
power = 0