Files
Paradise/code/game/objects/items/weapons/cards_ids.dm
Loganbacca 083cd19c6a New vehicle framework
- Implements a new vehicle framework
- Adds cargo trains

Conflicts:
	code/modules/mob/living/carbon/human/human.dm
2014-06-14 22:14:53 -04:00

395 lines
12 KiB
Plaintext

/* Cards
* Contains:
* DATA CARD
* ID CARD
* FINGERPRINT CARD HOLDER
* FINGERPRINT CARD
*/
/*
* DATA CARDS - Used for the teleporter
*/
/obj/item/weapon/card
name = "card"
desc = "Does card things."
icon = 'icons/obj/card.dmi'
w_class = 1.0
var/associated_account_number = 0
var/list/files = list( )
/obj/item/weapon/card/data
name = "data card"
desc = "A disk of data."
icon_state = "data"
var/function = "storage"
var/data = "null"
var/special = null
item_state = "card-id"
/obj/item/weapon/card/data/verb/label(t as text)
set name = "Label Disk"
set category = "Object"
set src in usr
if (t)
src.name = text("Data Disk- '[]'", t)
else
src.name = "Data Disk"
src.add_fingerprint(usr)
return
/obj/item/weapon/card/data/clown
name = "coordinates to clown planet"
icon_state = "data"
item_state = "card-id"
layer = 3
level = 2
desc = "This card contains coordinates to the fabled Clown Planet. Handle with care."
function = "teleporter"
data = "Clown Land"
/*
* ID CARDS
*/
/obj/item/weapon/card/emag_broken
desc = "It's a card with a magnetic strip attached to some circuitry. It looks too busted to be used for anything but salvage."
name = "broken cryptographic sequencer"
icon_state = "emag"
item_state = "card-id"
origin_tech = "magnets=2;syndicate=2"
/obj/item/weapon/card/emag
desc = "It's a card with a magnetic strip attached to some circuitry."
name = "cryptographic sequencer"
icon_state = "emag"
item_state = "card-id"
origin_tech = "magnets=2;syndicate=2"
var/uses = 10
// List of devices that cost a use to emag.
var/list/devices = list(
/obj/item/robot_parts,
/obj/item/weapon/storage/lockbox,
/obj/item/weapon/storage/secure,
/obj/item/weapon/circuitboard,
/obj/item/device/eftpos,
/obj/item/device/lightreplacer,
/obj/item/device/taperecorder,
/obj/item/device/hailer,
/obj/item/clothing/tie/holobadge,
/obj/structure/closet/crate/secure,
/obj/structure/closet/secure_closet,
/obj/machinery/librarycomp,
/obj/machinery/computer,
/obj/machinery/power,
/obj/machinery/suspension_gen,
/obj/machinery/shield_capacitor,
/obj/machinery/shield_gen,
// /obj/machinery/zero_point_emitter,
/obj/machinery/clonepod,
/obj/machinery/deployable,
/obj/machinery/door_control,
/obj/machinery/porta_turret,
/obj/machinery/shieldgen,
/obj/machinery/turretid,
/obj/machinery/vending,
/obj/machinery/bot,
/obj/machinery/door,
/obj/machinery/telecomms,
/obj/machinery/mecha_part_fabricator,
/obj/vehicle
)
/obj/item/weapon/card/emag/afterattack(var/obj/item/weapon/O as obj, mob/user as mob)
for(var/type in devices)
if(istype(O,type))
uses--
break
if(uses<1)
user.visible_message("[src] fizzles and sparks - it seems it's been used once too often, and is now broken.")
user.drop_item()
var/obj/item/weapon/card/emag_broken/junk = new(user.loc)
junk.add_fingerprint(user)
del(src)
return
..()
/obj/item/weapon/card/id
name = "identification card"
desc = "A card used to provide ID and determine access across the station."
icon_state = "id"
item_state = "card-id"
var/mining_points = 0 //For redeeming at mining equipment lockers
var/access = list()
var/registered_name = "Unknown" // The name registered_name on the card
slot_flags = SLOT_ID
var/blood_type = "\[UNSET\]"
var/dna_hash = "\[UNSET\]"
var/fingerprint_hash = "\[UNSET\]"
//alt titles are handled a bit weirdly in order to unobtrusively integrate into existing ID system
var/assignment = null //can be alt title or the actual job
var/rank = null //actual job
var/dorm = 0 // determines if this ID has claimed a dorm already
var/datum/data/record/active1 = null
var/sex
var/age
var/photo
var/icon/front
var/icon/side
var/dat
var/stamped=0
/obj/item/weapon/card/id/New()
..()
spawn(30)
if(istype(loc, /mob/living/carbon/human))
blood_type = loc:dna:b_type
dna_hash = loc:dna:unique_enzymes
fingerprint_hash = md5(loc:dna:uni_identity)
dat = ("<table><tr><td>")
dat +=text("Name: []</A><BR>", registered_name)
dat +=text("Sex: []</A><BR>\n", name)
dat +=text("Age: []</A><BR>\n", age)
dat +=text("Rank: []</A><BR>\n", assignment)
dat +=text("Fingerprint: []</A><BR>\n", fingerprint_hash)
dat +=text("Blood Type: []<BR>\n", blood_type)
dat +=text("DNA Hash: []<BR><BR>\n", dna_hash)
dat +="<td align = center valign = top>Photo:<br><img src=front.png height=80 width=80 border=4> \
<img src=side.png height=80 width=80 border=4></td></tr></table>"
/obj/item/weapon/card/id/examine()
set src in oview(1)
if(in_range(usr, src))
show(usr)
usr << desc
else
usr << "<span class='notice'>It is too far away.</span>"
/obj/item/weapon/card/id/proc/show(mob/user as mob)
if(!front)
front = new(photo, dir = SOUTH)
if(!side)
side = new(photo, dir = WEST)
user << browse_rsc(front, "front.png")
user << browse_rsc(side, "side.png")
var/datum/browser/popup = new(user, "idcard", name, 600, 400)
popup.set_content(dat)
popup.set_title_image(usr.browse_rsc_icon(src.icon, src.icon_state))
popup.open()
return
/obj/item/weapon/card/id/attack_self(mob/user as mob)
for(var/mob/O in viewers(user, null))
O.show_message(text("[] shows you: \icon[] []: assignment: []", user, src, src.name, src.assignment), 1)
if(mining_points)
user << "There's [mining_points] mining equipment redemption points loaded onto this card."
src.add_fingerprint(user)
return
/obj/item/weapon/card/id/GetAccess()
return access
/obj/item/weapon/card/id/GetID()
return src
/obj/item/weapon/card/id/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
if(istype(W,/obj/item/weapon/id_wallet))
user << "You slip [src] into [W]."
src.name = "[src.registered_name]'s [W.name] ([src.assignment])"
src.desc = W.desc
src.icon = W.icon
src.icon_state = W.icon_state
del(W)
return
else if(istype (W,/obj/item/weapon/stamp))
if(!stamped)
dat+="<img src=large_[W.icon_state].png>"
stamped = 1
usr << "You stamp the ID card!"
else
usr << "This ID has already been stamped!"
/obj/item/weapon/card/id/verb/read()
set name = "Read ID Card"
set category = "Object"
set src in usr
usr << text("\icon[] []: The current assignment on the card is [].", src, src.name, src.assignment)
usr << "The blood type on the card is [blood_type]."
usr << "The DNA hash on the card is [dna_hash]."
usr << "The fingerprint hash on the card is [fingerprint_hash]."
return
/obj/item/weapon/card/id/silver
name = "identification card"
desc = "A silver card which shows honour and dedication."
icon_state = "silver"
item_state = "silver_id"
/obj/item/weapon/card/id/gold
name = "identification card"
desc = "A golden card which shows power and might."
icon_state = "gold"
item_state = "gold_id"
/obj/item/weapon/card/id/syndicate
name = "agent card"
access = list(access_maint_tunnels, access_syndicate)
origin_tech = "syndicate=3"
var/registered_user=null
/obj/item/weapon/card/id/syndicate/New(mob/user as mob)
..()
if(!isnull(user)) // Runtime prevention on laggy starts or where users log out because of lag at round start.
registered_name = ishuman(user) ? user.real_name : user.name
else
registered_name = "Agent Card"
assignment = "Agent"
name = "[registered_name]'s ID Card ([assignment])"
/obj/item/weapon/card/id/syndicate/afterattack(var/obj/item/weapon/O as obj, mob/user as mob, proximity)
if(!proximity) return
if(istype(O, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/I = O
src.access |= I.access
if(istype(user, /mob/living) && user.mind)
if(user.mind.special_role)
usr << "\blue The card's microscanners activate as you pass it over the ID, copying its access."
/obj/item/weapon/card/id/syndicate/attack_self(mob/user as mob)
if(!src.registered_name)
//Stop giving the players unsanitized unputs! You are giving ways for players to intentionally crash clients! -Nodrak
var t = reject_bad_name(input(user, "What name would you like to put on this card?", "Agent card name", ishuman(user) ? user.real_name : user.name))
if(!t) //Same as mob/new_player/prefrences.dm
alert("Invalid name.")
return
src.registered_name = t
var u = copytext(sanitize(input(user, "What occupation would you like to put on this card?\nNote: This will not grant any access levels other than Maintenance.", "Agent card job assignment", "Assistant")),1,MAX_MESSAGE_LEN)
if(!u)
alert("Invalid assignment.")
src.registered_name = ""
return
src.assignment = u
src.name = "[src.registered_name]'s ID Card ([src.assignment])"
user << "\blue You successfully forge the ID card."
registered_user = user
else if(!registered_user || registered_user == user)
if(!registered_user) registered_user = user //
switch(alert("Would you like to display the ID, or retitle it?","Choose.","Rename","Show"))
if("Rename")
var t = copytext(sanitize(input(user, "What name would you like to put on this card?", "Agent card name", ishuman(user) ? user.real_name : user.name)),1,26)
if(!t || t == "Unknown" || t == "floor" || t == "wall" || t == "r-wall") //Same as mob/new_player/prefrences.dm
alert("Invalid name.")
return
src.registered_name = t
var u = copytext(sanitize(input(user, "What occupation would you like to put on this card?\nNote: This will not grant any access levels other than Maintenance.", "Agent card job assignment", "Assistant")),1,MAX_MESSAGE_LEN)
if(!u)
alert("Invalid assignment.")
src.registered_name = ""
return
src.assignment = u
src.name = "[src.registered_name]'s ID Card ([src.assignment])"
user << "\blue You successfully forge the ID card."
return
if("Show")
..()
else
..()
/obj/item/weapon/card/id/syndicate_command
name = "syndicate ID card"
desc = "An ID straight from the Syndicate."
registered_name = "Syndicate"
assignment = "Syndicate Overlord"
access = list(access_syndicate, access_external_airlocks)
/obj/item/weapon/card/id/captains_spare
name = "captain's spare ID"
desc = "The spare ID of the High Lord himself."
icon_state = "gold"
item_state = "gold_id"
registered_name = "Captain"
assignment = "Captain"
New()
var/datum/job/captain/J = new/datum/job/captain
access = J.get_access()
..()
/obj/item/weapon/card/id/centcom
name = "\improper CentCom. ID"
desc = "An ID straight from Cent. Com."
icon_state = "centcom"
registered_name = "Central Command"
assignment = "General"
New()
access = get_all_centcom_access()
..()
/obj/item/weapon/card/id/prisoner
name = "prisoner ID card"
desc = "You are a number, you are not a free man."
icon_state = "orange"
item_state = "orange-id"
assignment = "Prisoner"
registered_name = "Scum"
var/goal = 0 //How far from freedom?
var/points = 0
/obj/item/weapon/card/id/prisoner/attack_self(mob/user as mob)
usr << "You have accumulated [points] out of the [goal] points you need for freedom."
/obj/item/weapon/card/id/prisoner/one
name = "Prisoner #13-001"
registered_name = "Prisoner #13-001"
/obj/item/weapon/card/id/prisoner/two
name = "Prisoner #13-002"
registered_name = "Prisoner #13-002"
/obj/item/weapon/card/id/prisoner/three
name = "Prisoner #13-003"
registered_name = "Prisoner #13-003"
/obj/item/weapon/card/id/prisoner/four
name = "Prisoner #13-004"
registered_name = "Prisoner #13-004"
/obj/item/weapon/card/id/prisoner/five
name = "Prisoner #13-005"
registered_name = "Prisoner #13-005"
/obj/item/weapon/card/id/prisoner/six
name = "Prisoner #13-006"
registered_name = "Prisoner #13-006"
/obj/item/weapon/card/id/prisoner/seven
name = "Prisoner #13-007"
registered_name = "Prisoner #13-007"
/obj/item/weapon/card/id/salvage_captain
name = "Captain's ID"
registered_name = "Captain"
icon_state = "centcom"
desc = "Finders, keepers."
access = list(access_salvage_captain)