Merge pull request #10005 from PsiOmegaDelta/150703-Uplinkery

Uplink Items - Part III
This commit is contained in:
Zuhayr
2015-08-20 19:19:12 +09:30
47 changed files with 851 additions and 409 deletions

View File

@@ -34,10 +34,9 @@
var/obj/item/weapon/card/id/W = new id_type(player)
if(!W) return
W.name = "[player.real_name]'s ID Card"
W.access |= default_access
W.assignment = "[assignment]"
W.registered_name = player.real_name
W.set_owner_info(player)
if(equip) player.equip_to_slot_or_del(W, slot_wear_id)
return W

View File

@@ -6,6 +6,7 @@ var/datum/antagonist/deathsquad/mercenary/commandos
role_text = "Syndicate Commando"
role_text_plural = "Commandos"
welcome_text = "You are in the employ of a criminal syndicate hostile to NanoTrasen."
id_type = /obj/item/weapon/card/id/centcom/ERT
/datum/antagonist/deathsquad/mercenary/New()
..(1)
@@ -24,7 +25,6 @@ var/datum/antagonist/deathsquad/mercenary/commandos
player.equip_to_slot_or_del(new /obj/item/weapon/rig/merc(player), slot_back)
player.equip_to_slot_or_del(new /obj/item/weapon/gun/energy/pulse_rifle(player), slot_r_hand)
var/obj/item/weapon/card/id/id = create_id("Commando", player)
id.access |= get_all_station_access()
id.icon_state = "centcom"
create_radio(SYND_FREQ, player)
create_id("Commando", player)
create_radio(SYND_FREQ, player)
return 1

View File

@@ -11,6 +11,7 @@ var/datum/antagonist/ert/ert
max_antags = 5
max_antags_round = 5 // ERT mode?
landmark_id = "Response Team"
id_type = /obj/item/weapon/card/id/centcom/ERT
flags = ANTAG_OVERRIDE_JOB | ANTAG_SET_APPEARANCE | ANTAG_HAS_LEADER | ANTAG_CHOOSE_NAME
@@ -36,10 +37,6 @@ var/datum/antagonist/ert/ert
player.equip_to_slot_or_del(new /obj/item/clothing/shoes/swat(src), slot_shoes)
player.equip_to_slot_or_del(new /obj/item/clothing/gloves/swat(src), slot_gloves)
player.equip_to_slot_or_del(new /obj/item/clothing/glasses/sunglasses(src), slot_glasses)
var/obj/item/weapon/card/id/centcom/ERT/W = new(src)
W.registered_name = player.real_name
W.name = "[player.real_name]'s ID Card ([W.assignment])"
player.equip_to_slot_or_del(W, slot_wear_id)
create_id(role_text, player)
return 1

View File

@@ -526,10 +526,9 @@ var/global/datum/controller/occupations/job_master
else
C = new /obj/item/weapon/card/id(H)
if(C)
C.registered_name = H.real_name
C.rank = rank
C.assignment = title ? title : rank
C.name = "[C.registered_name]'s ID Card ([C.assignment])"
C.set_owner_info(H)
//put the player's account number onto the ID
if(H.mind && H.mind.initial_account)

View File

@@ -623,8 +623,8 @@
return min(..(), .)
/obj/machinery/alarm/Topic(href, href_list, var/nowindow = 0, var/datum/topic_state/state)
if(..(href, href_list, nowindow, state))
/obj/machinery/alarm/Topic(href, href_list, var/datum/topic_state/state)
if(..(href, href_list, state))
return 1
// hrefs that can always be called -walter0o

View File

@@ -155,6 +155,11 @@
if(!istype(target)) return
var/mob/living/silicon/ai/U = usr
if(target == U.cameraFollow)
return
if(U.cameraFollow)
U.ai_cancel_tracking()
U.cameraFollow = target
U << "Now tracking [target.name] on camera."
target.tracking_initiated()
@@ -240,7 +245,8 @@ mob/living/proc/near_camera()
/mob/living/carbon/human/tracking_status()
//Cameras can't track people wearing an agent card or a ninja hood.
if(wear_id && istype(wear_id.GetID(), /obj/item/weapon/card/id/syndicate))
var/obj/item/weapon/card/id/id = GetIdCard(src)
if(id && id.prevent_tracking())
return TRACKING_TERMINATE
if(istype(head, /obj/item/clothing/head/helmet/space/rig))
var/obj/item/clothing/head/helmet/space/rig/helmet = head

View File

@@ -412,11 +412,11 @@ What a mess.*/
//RECORD CREATE
if ("New Record (Security)")
if ((istype(active1, /datum/data/record) && !( istype(active2, /datum/data/record) )))
active2 = CreateSecurityRecord(active1.fields["name"], active1.fields["id"])
active2 = data_core.CreateSecurityRecord(active1.fields["name"], active1.fields["id"])
screen = 3
if ("New Record (General)")
active1 = CreateGeneralRecord()
active1 = data_core.CreateGeneralRecord()
active2 = null
//FIELD FUNCTIONS

View File

@@ -303,7 +303,7 @@ What a mess.*/
if ("New Record (General)")
if(PDA_Manifest.len)
PDA_Manifest.Cut()
active1 = CreateGeneralRecord()
active1 = data_core.CreateGeneralRecord()
//FIELD FUNCTIONS
if ("Edit Field")

View File

@@ -430,11 +430,11 @@ What a mess.*/
//RECORD CREATE
if ("New Record (Security)")
if ((istype(active1, /datum/data/record) && !( istype(active2, /datum/data/record) )))
active2 = CreateSecurityRecord(active1.fields["name"], active1.fields["id"])
active2 = data_core.CreateSecurityRecord(active1.fields["name"], active1.fields["id"])
screen = 3
if ("New Record (General)")
active1 = CreateGeneralRecord()
active1 = data_core.CreateGeneralRecord()
active2 = null
//FIELD FUNCTIONS

View File

@@ -674,7 +674,7 @@ About the new airlock wires panel:
return ..()
/obj/machinery/door/airlock/Topic(href, href_list, var/nowindow = 0)
/obj/machinery/door/airlock/Topic(href, href_list)
if(..())
return 1

View File

@@ -236,7 +236,7 @@ var/list/turret_icons
return ..()
/obj/machinery/porta_turret/Topic(href, href_list, var/nowindow = 0)
/obj/machinery/porta_turret/Topic(href, href_list)
if(..())
return 1

View File

@@ -139,7 +139,7 @@
ui.open()
ui.set_auto_update(1)
/obj/machinery/turretid/Topic(href, href_list, var/nowindow = 0)
/obj/machinery/turretid/Topic(href, href_list)
if(..())
return 1

View File

@@ -46,7 +46,7 @@
ui.open()
ui.set_auto_update(1)
/obj/item/device/aicard/Topic(href, href_list, nowindow, state)
/obj/item/device/aicard/Topic(href, href_list, state)
if(..())
return 1

View File

@@ -15,6 +15,9 @@
/datum/uplink_category/ammunition
name = "Ammunition"
/datum/uplink_category/grenades
name = "Grenades and Thrown Objects"
/datum/uplink_category/visible_weapons
name = "Highly Visible and Dangerous Weapons"
@@ -36,5 +39,8 @@
/datum/uplink_category/hardsuit_modules
name = "Hardsuit Modules"
/datum/uplink_category/services
name = "Services"
/datum/uplink_category/badassery
name = "Badassery"

View File

@@ -9,6 +9,7 @@ var/datum/uplink/uplink = new()
items_assoc = list()
items = init_subtypes(/datum/uplink_item)
categories = init_subtypes(/datum/uplink_category)
categories = dd_sortedObjectList(categories)
for(var/datum/uplink_item/item in items)
if(!item.name)
@@ -38,15 +39,31 @@ var/datum/uplink/uplink = new()
..()
antag_roles = list()
/datum/uplink_item/proc/buy(var/obj/item/device/uplink/U, var/mob/user)
purchase_log(U)
var/cost = cost(U.uses)
var/goods = get_goods(U, get_turf(user))
/datum/uplink_item/proc/buy(var/obj/item/device/uplink/U, var/mob/user)
var/extra_args = extra_args(user)
if(!extra_args)
return
if(!can_buy(U))
return
var/cost = cost(U.uses)
var/goods = get_goods(U, get_turf(user), user, extra_args)
if(!goods)
return
purchase_log(U)
U.uses -= cost
U.used_TC += cost
return goods
// Any additional arguments you wish to send to the get_goods
/datum/uplink_item/proc/extra_args(var/mob/user)
return 1
/datum/uplink_item/proc/can_buy(obj/item/device/uplink/U)
if(cost(U.uses) > U.uses)
return 0
@@ -90,11 +107,14 @@ datum/uplink_item/dd_SortValue()
/********************************
* *
* Physical Uplink Entires *
* Physical Uplink Entries *
* *
********************************/
/datum/uplink_item/item/buy(var/obj/item/device/uplink/U, var/mob/user)
var/obj/item/I = ..()
if(!I)
return
if(istype(I, /list))
var/list/L = I
if(L.len) I = L[1]
@@ -156,11 +176,6 @@ datum/uplink_item/dd_SortValue()
/datum/uplink_item/item/visible_weapons
category = /datum/uplink_category/visible_weapons
/datum/uplink_item/item/visible_weapons/emp
name = "5xEMP Grenades"
item_cost = 3
path = /obj/item/weapon/storage/box/emps
/datum/uplink_item/item/visible_weapons/energy_sword
name = "Energy Sword"
item_cost = 4
@@ -452,6 +467,27 @@ datum/uplink_item/dd_SortValue()
item_cost = 8
path = /obj/item/rig_module/mounted
/***********
* Grenades *
************/
/datum/uplink_item/item/grenades
category = /datum/uplink_category/grenades
/datum/uplink_item/item/grenades/anti_photon
name = "5xPhoton Disruption Grenades"
item_cost = 2
path = /obj/item/weapon/storage/box/anti_photons
/datum/uplink_item/item/grenades/emp
name = "5xEMP Grenades"
item_cost = 3
path = /obj/item/weapon/storage/box/emps
/datum/uplink_item/item/grenades/smoke
name = "5xSmoke Grenades"
item_cost = 2
path = /obj/item/weapon/storage/box/smokes
/************
* Badassery *
************/
@@ -531,6 +567,124 @@ datum/uplink_item/dd_SortValue()
return "\icon[icon]"
/********************************
* *
* Abstract Uplink Entries *
* *
********************************/
var/image/default_abstract_uplink_icon
/datum/uplink_item/abstract/log_icon()
if(!default_abstract_uplink_icon)
default_abstract_uplink_icon = image('icons/obj/pda.dmi', "pda-syn")
return "\icon[default_abstract_uplink_icon]"
/****************
* Announcements *
*****************/
/datum/uplink_item/abstract/announcements
category = /datum/uplink_category/services
/datum/uplink_item/abstract/announcements/buy(var/obj/item/device/uplink/U, var/mob/user)
. = ..()
if(.)
log_and_message_admins("has triggered a falsified [src]", user)
/datum/uplink_item/abstract/announcements/fake_centcom
item_cost = DEFAULT_TELECRYSTAL_AMOUNT / 2
/datum/uplink_item/abstract/announcements/fake_centcom/New()
..()
name = "[command_name()] Update Announcement"
desc = "Causes a falsified [command_name()] Update. Triggers immediately after supplying additional data."
antag_roles = list(MODE_MERCENARY)
/datum/uplink_item/abstract/announcements/fake_centcom/get_goods(var/obj/item/device/uplink/U, var/loc, var/mob/user, var/list/args)
command_announcement.Announce(args.["message"], args.["title"])
return 1
/datum/uplink_item/abstract/announcements/fake_crew_arrival
name = "Crew Arrival Announcement/Records"
desc = "Creates a fake crew arrival announcement as well as fake crew records, using your current appearance (including held items!) and worn id card. Trigger with care!"
item_cost = 4
/datum/uplink_item/abstract/announcements/fake_crew_arrival/New()
..()
antag_roles = list(MODE_MERCENARY)
/datum/uplink_item/abstract/announcements/fake_crew_arrival/get_goods(var/obj/item/device/uplink/U, var/loc, var/mob/user, var/list/args)
if(!user)
return 0
var/obj/item/weapon/card/id/I = GetIdCard(user)
var/datum/data/record/random_general_record
var/datum/data/record/random_medical_record
if(data_core.general.len)
random_general_record = pick(data_core.general)
random_medical_record = find_medical_record("id", random_general_record.fields["id"])
var/datum/data/record/general = data_core.CreateGeneralRecord(user)
if(I)
general.fields["age"] = I.age
general.fields["rank"] = I.assignment
general.fields["real_rank"] = I.assignment
general.fields["name"] = I.registered_name
general.fields["sex"] = I.sex
else
var/mob/living/carbon/human/H
if(istype(user,/mob/living/carbon/human))
H = user
general.fields["age"] = H.age
else
general.fields["age"] = initial(H.age)
var/assignment = GetAssignment(user)
general.fields["rank"] = assignment
general.fields["real_rank"] = assignment
general.fields["name"] = user.real_name
general.fields["sex"] = capitalize(user.gender)
general.fields["species"] = user.get_species()
var/datum/data/record/medical = data_core.CreateMedicalRecord(general.fields["name"], general.fields["id"])
data_core.CreateSecurityRecord(general.fields["name"], general.fields["id"])
if(!random_general_record)
general.fields["citizenship"] = random_general_record.fields["citizenship"]
general.fields["faction"] = random_general_record.fields["faction"]
general.fields["fingerprint"] = random_general_record.fields["fingerprint"]
general.fields["home_system"] = random_general_record.fields["home_system"]
general.fields["religion"] = random_general_record.fields["religion"]
if(random_medical_record)
medical.fields["b_type"] = random_medical_record.fields["b_type"]
medical.fields["b_dna"] = random_medical_record.fields["b_type"]
if(I)
general.fields["fingerprint"] = I.fingerprint_hash
medical.fields["b_type"] = I.blood_type
medical.fields["b_dna"] = I.dna_hash
AnnounceArrivalSimple(general.fields["name"], general.fields["rank"])
return 1
/datum/uplink_item/abstract/announcements/fake_ion_storm
name = "Ion Storm Announcement"
desc = "Interferes with the station's ion sensors. Triggers immediately upon investment."
item_cost = 1
/datum/uplink_item/abstract/announcements/fake_ion_storm/get_goods(var/obj/item/device/uplink/U, var/loc)
ion_storm_announcement()
return 1
/datum/uplink_item/abstract/announcements/fake_radiation
name = "Radiation Storm Announcement"
desc = "Interferes with the station's radiation sensors. Triggers immediately upon investment."
item_cost = 3
/datum/uplink_item/abstract/announcements/fake_radiation/get_goods(var/obj/item/device/uplink/U, var/loc)
var/datum/event_meta/EM = new(EVENT_LEVEL_MUNDANE, "Fake Radiation Storm", add_to_queue = 0)
new/datum/event/radiation_storm/syndicate(EM)
return 1
/****************
* Support procs *
****************/

View File

@@ -44,7 +44,7 @@ var/datum/uplink_random_selection/default_uplink_selection = new/datum/uplink_ra
items += new/datum/uplink_random_item(/datum/uplink_item/item/ammo/a357)
items += new/datum/uplink_random_item(/datum/uplink_item/item/visible_weapons/heavysniper, 15, 0)
items += new/datum/uplink_random_item(/datum/uplink_item/item/ammo/sniperammo, 15, 0)
items += new/datum/uplink_random_item(/datum/uplink_item/item/visible_weapons/emp, 50)
items += new/datum/uplink_random_item(/datum/uplink_item/item/grenades/emp, 50)
items += new/datum/uplink_random_item(/datum/uplink_item/item/visible_weapons/crossbow, 33)
items += new/datum/uplink_random_item(/datum/uplink_item/item/visible_weapons/energy_sword, 75)

View File

@@ -97,27 +97,75 @@
var/registered_name = "Unknown" // The name registered_name on the card
slot_flags = SLOT_ID
var/age = "\[UNSET\]"
var/blood_type = "\[UNSET\]"
var/dna_hash = "\[UNSET\]"
var/fingerprint_hash = "\[UNSET\]"
var/sex = "\[UNSET\]"
var/icon/front
var/icon/side
//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/dorm = 0 // determines if this ID has claimed a dorm already
/obj/item/weapon/card/id/New()
..()
spawn(30)
if(istype(loc, /mob/living/carbon/human))
var/mob/living/carbon/human/H = loc
blood_type = H.dna.b_type
dna_hash = H.dna.unique_enzymes
fingerprint_hash = md5(H.dna.uni_identity)
/obj/item/weapon/card/id/examine(mob/user)
set src in oview(1)
if(in_range(usr, src))
show(usr)
usr << desc
else
usr << "<span class='warning'>It is too far away.</span>"
/obj/item/weapon/card/id/proc/prevent_tracking()
return 0
/obj/item/weapon/card/id/proc/show(mob/user as mob)
user << browse_rsc(front, "front.png")
user << browse_rsc(side, "side.png")
var/datum/browser/popup = new(user, "idcard", name, 600, 250)
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/proc/update_name()
name = "[src.registered_name]'s ID Card ([src.assignment])"
/obj/item/weapon/card/id/proc/set_id_photo(var/mob/M)
front = getFlatIcon(M, SOUTH, always_use_defdir = 1)
side = getFlatIcon(M, WEST, always_use_defdir = 1)
/obj/item/weapon/card/id/proc/set_owner_info(var/mob/living/carbon/human/H)
if(!H || !H.dna)
return
age = H.age
blood_type = H.dna.b_type
dna_hash = H.dna.unique_enzymes
fingerprint_hash = md5(H.dna.uni_identity)
registered_name = H.real_name
sex = capitalize(H.gender)
set_id_photo(H)
update_name()
/obj/item/weapon/card/id/proc/dat()
var/dat = ("<table><tr><td>")
dat += text("Name: []</A><BR>", registered_name)
dat += text("Sex: []</A><BR>\n", sex)
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)
if(front && side)
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>"
dat += "</tr></table>"
return dat
/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)
user.visible_message("\The [user] shows you: \icon[src] [src.name]. The assignment on the card: [src.assignment]",\
"You flash your ID card: \icon[src] [src.name]. The assignment on the card: [src.assignment]")
src.add_fingerprint(user)
return
@@ -139,7 +187,6 @@
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."
@@ -152,75 +199,6 @@
icon_state = "gold"
item_state = "gold_id"
/obj/item/weapon/card/id/syndicate
name = "agent card"
access = list(access_maint_tunnels, access_syndicate, access_external_airlocks)
origin_tech = list(TECH_ILLEGAL = 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 << "<span class='notice'>The card's microscanners activate as you pass it over the ID, copying its access.</span>"
/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 = sanitizeName(input(user, "What name would you like to put on this card?", "Agent card name", ishuman(user) ? user.real_name : user.name), MAX_NAME_LEN)
if(!t) //Same as mob/new_player/prefrences.dm
alert("Invalid name.")
return
src.registered_name = t
var u = 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", "Agent"), MAX_LNAME_LEN)
if(!u)
alert("Invalid assignment.")
src.registered_name = ""
return
src.assignment = u
src.name = "[src.registered_name]'s ID Card ([src.assignment])"
user << "<span class='notice'>You successfully forge the ID card.</span>"
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 = sanitize(input(user, "What name would you like to put on this card?", "Agent card name", ishuman(user) ? user.real_name : user.name), 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 = 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"))
if(!u)
alert("Invalid assignment.")
return
src.assignment = u
src.name = "[src.registered_name]'s ID Card ([src.assignment])"
user << "<span class='notice'>You successfully forge the ID card.</span>"
return
if("Show")
..()
else
..()
/obj/item/weapon/card/id/syndicate_command
name = "syndicate ID card"
desc = "An ID straight from the Syndicate."
@@ -255,4 +233,4 @@
/obj/item/weapon/card/id/centcom/ERT/New()
..()
access += get_all_station_access()
access |= get_all_station_access()

View File

@@ -0,0 +1,204 @@
var/global/list/syndicate_ids = list()
/obj/item/weapon/card/id/syndicate
name = "agent card"
assignment = "Agent"
origin_tech = list(TECH_ILLEGAL = 3)
var/electronic_warfare = 1
var/registered_user = null
var/list/initial_access = list(access_maint_tunnels, access_syndicate, access_external_airlocks)
/obj/item/weapon/card/id/syndicate/New(mob/user as mob)
syndicate_ids += src
..()
access = initial_access.Copy()
/obj/item/weapon/card/id/syndicate/Destroy()
syndicate_ids -= src
registered_user = null
return ..()
// On mob destruction, ensure any references are cleared
/mob/Destroy()
for(var/obj/item/weapon/card/id/syndicate/SID in syndicate_ids)
if(SID.registered_user == src)
SID.registered_user = null
return ..()
/obj/item/weapon/card/id/syndicate/prevent_tracking()
return electronic_warfare
/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(player_is_antag(user))
user << "<span class='notice'>The microscanner activate as you pass it over the ID, copying its access.</span>"
/obj/item/weapon/card/id/syndicate/attack_self(mob/user as mob)
if(!registered_user)
registered_user = user
set_owner_info(user)
user << "<span class='notice'>The microscanner marks you as its owner, preventing others some accessing its internals.</span>"
if(registered_user == user)
switch(alert("Would you like edit the ID, or show it?","Show or Edit?", "Edit","Show"))
if("Edit")
ui_interact(user)
if("Show")
..()
else
..()
/obj/item/weapon/card/id/syndicate/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
var/entries[0]
entries[++entries.len] = list("name" = "Age", "value" = age)
entries[++entries.len] = list("name" = "Appearance", "value" = "Set")
entries[++entries.len] = list("name" = "Assignment", "value" = assignment)
entries[++entries.len] = list("name" = "Blood Type", "value" = blood_type)
entries[++entries.len] = list("name" = "DNA Hash", "value" = dna_hash)
entries[++entries.len] = list("name" = "Fingerprint Hash", "value" = fingerprint_hash)
entries[++entries.len] = list("name" = "Name", "value" = registered_name)
entries[++entries.len] = list("name" = "Photo", "value" = "Update")
entries[++entries.len] = list("name" = "Sex", "value" = sex)
entries[++entries.len] = list("name" = "Factory Reset", "value" = "Use With Care")
data["electronic_warfare"] = electronic_warfare
data["entries"] = entries
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "agent_id_card.tmpl", "Agent id", 600, 400)
ui.set_initial_data(data)
ui.open()
/obj/item/weapon/card/id/syndicate/CanUseTopic(mob/user)
if(user != registered_user)
return STATUS_CLOSE
return ..()
/obj/item/weapon/card/id/syndicate/Topic(href, href_list, var/datum/topic_state/state)
if(..())
return 1
var/user = usr
if(href_list["electronic_warfare"])
electronic_warfare = text2num(href_list["electronic_warfare"])
user << "<span class='notice'>Electronic warfare [electronic_warfare ? "enabled" : "disabled"].</span>"
else if(href_list["set"])
switch(href_list["set"])
if("Age")
var/new_age = input(user,"What age would you like to put on this card?","Agent Card Age", age) as null|num
if(!isnull(new_age) && CanUseTopic(user, state))
if(new_age < 0)
age = initial(age)
else
age = new_age
user << "<span class='notice'>Age has been set to '[age]'.</span>"
. = 1
if("Appearance")
var/datum/card_state/choice = input(user, "Select the appearance for this card.", "Agent Card Appearance") as null|anything in id_card_states()
if(choice && CanUseTopic(user, state))
src.icon_state = choice.icon_state
src.item_state = choice.item_state
usr << "<span class='notice'>Appearance changed to [choice].</span>"
. = 1
if("Assignment")
var/new_job = sanitize(input(user,"What assignment would you like to put on this card?\nChanging assignment will not grant or remove any access levels.","Agent Card Assignment", assignment) as null|text)
if(!isnull(new_job) && CanUseTopic(user, state))
src.assignment = new_job
user << "<span class='notice'>Occupation changed to '[new_job]'.</span>"
update_name()
. = 1
if("Blood Type")
var/default = blood_type
if(default == initial(blood_type) && ishuman(user))
var/mob/living/carbon/human/H = user
if(H.dna)
default = H.dna.b_type
var/new_blood_type = sanitize(input(user,"What blood type would you like to be written on this card?","Agent Card Blood Type",default) as null|text)
if(!isnull(new_blood_type) && CanUseTopic(user, state))
src.blood_type = new_blood_type
user << "<span class='notice'>Blood type changed to '[new_blood_type]'.</span>"
. = 1
if("DNA Hash")
var/default = dna_hash
if(default == initial(dna_hash) && ishuman(user))
var/mob/living/carbon/human/H = user
if(H.dna)
default = H.dna.unique_enzymes
var/new_dna_hash = sanitize(input(user,"What DNA hash would you like to be written on this card?","Agent Card DNA Hash",default) as null|text)
if(!isnull(new_dna_hash) && CanUseTopic(user, state))
src.dna_hash = new_dna_hash
user << "<span class='notice'>DNA hash changed to '[new_dna_hash]'.</span>"
. = 1
if("Fingerprint Hash")
var/default = fingerprint_hash
if(default == initial(fingerprint_hash) && ishuman(user))
var/mob/living/carbon/human/H = user
if(H.dna)
default = md5(H.dna.uni_identity)
var/new_fingerprint_hash = sanitize(input(user,"What fingerprint hash would you like to be written on this card?","Agent Card Fingerprint Hash",default) as null|text)
if(!isnull(new_fingerprint_hash) && CanUseTopic(user, state))
src.fingerprint_hash = new_fingerprint_hash
user << "<span class='notice'>Fingerprint hash changed to '[new_fingerprint_hash]'.</span>"
. = 1
if("Name")
var/new_name = sanitizeName(input(user,"What name would you like to put on this card?","Agent Card Name", registered_name) as null|text)
if(!isnull(new_name) && CanUseTopic(user, state))
src.registered_name = new_name
update_name()
user << "<span class='notice'>Name changed to '[new_name]'.</span>"
. = 1
if("Photo")
set_id_photo(user)
user << "<span class='notice'>Photo changed.</span>"
. = 1
if("Sex")
var/new_sex = sanitize(input(user,"What sex would you like to put on this card?","Agent Card Sex", sex) as null|text)
if(!isnull(new_sex) && CanUseTopic(user, state))
src.sex = new_sex
user << "<span class='notice'>Sex changed to '[new_sex]'.</span>"
. = 1
if("Factory Reset")
if(alert("This will factory reset the card, including access and owner. Continue?", "Factory Reset", "No", "Yes") == "Yes" && CanUseTopic(user, state))
age = initial(age)
access = initial_access.Copy()
assignment = initial(assignment)
blood_type = initial(blood_type)
dna_hash = initial(dna_hash)
electronic_warfare = initial(electronic_warfare)
fingerprint_hash = initial(fingerprint_hash)
icon_state = initial(icon_state)
name = initial(name)
registered_name = initial(registered_name)
registered_user = null
sex = initial(sex)
user << "<span class='notice'>All information has been deleted from \the [src].</span>"
. = 1
// Always update the UI, or buttons will spin indefinitely
nanomanager.update_uis(src)
/var/global/list/id_card_states
/proc/id_card_states()
if(!id_card_states)
id_card_states = list()
for(var/path in typesof(/obj/item/weapon/card/id))
var/obj/item/weapon/card/id/ID = path
var/datum/card_state/CS = new()
CS.icon_state = initial(ID.icon_state)
CS.item_state = initial(ID.item_state)
CS.name = initial(ID.name) + " - " + initial(ID.icon_state)
id_card_states += CS
id_card_states = dd_sortedObjectList(id_card_states)
return id_card_states
/datum/card_state
var/name
var/icon_state
var/item_state
/datum/card_state/dd_SortValue()
return name

View File

@@ -0,0 +1,23 @@
/obj/item/weapon/grenade/anti_photon
desc = "An experimental device for temporarily removing light in a limited area."
name = "pgoton disruption grenade"
icon = 'icons/obj/grenade.dmi'
icon_state = "emp"
item_state = "emp"
det_time = 20
origin_tech = list(TECH_BLUESPACE = 4, TECH_MATERIAL = 4)
/obj/item/weapon/grenade/anti_photon/prime()
playsound(src.loc, 'sound/effects/phasein.ogg', 50, 1, 5)
set_light(10, -10, "#FFFFFF")
var/extra_delay = rand(0,90)
spawn(extra_delay)
spawn(200)
if(prob(10+extra_delay))
set_light(10, 10, "#[num2hex(rand(64,255))][num2hex(rand(64,255))][num2hex(rand(64,255))]")
spawn(210)
..()
playsound(src.loc, 'sound/effects/bang.ogg', 50, 1, 5)
qdel(src)

View File

@@ -298,6 +298,31 @@
new /obj/item/weapon/grenade/empgrenade(src)
new /obj/item/weapon/grenade/empgrenade(src)
/obj/item/weapon/storage/box/smokes
name = "box of smoke bombs"
desc = "A box containing 5 smoke bombs."
icon_state = "flashbang"
/obj/item/weapon/storage/box/smokes/New()
..()
new /obj/item/weapon/grenade/smokebomb(src)
new /obj/item/weapon/grenade/smokebomb(src)
new /obj/item/weapon/grenade/smokebomb(src)
new /obj/item/weapon/grenade/smokebomb(src)
new /obj/item/weapon/grenade/smokebomb(src)
/obj/item/weapon/storage/box/anti_photons
name = "box of anti-photon grenades"
desc = "A box containing 5 experimental photon disruption grenades."
icon_state = "flashbang"
/obj/item/weapon/storage/box/anti_photon/New()
..()
new /obj/item/weapon/grenade/anti_photon(src)
new /obj/item/weapon/grenade/anti_photon(src)
new /obj/item/weapon/grenade/anti_photon(src)
new /obj/item/weapon/grenade/anti_photon(src)
new /obj/item/weapon/grenade/anti_photon(src)
/obj/item/weapon/storage/box/trackimp
name = "boxed tracking implant kit"
@@ -638,4 +663,4 @@
max_w_class = 3
can_hold = list(/obj/item/organ, /obj/item/weapon/reagent_containers/food, /obj/item/weapon/reagent_containers/glass)
max_storage_space = 21
use_to_pickup = 1 // for picking up broken bulbs, not that most people will try
use_to_pickup = 1 // for picking up broken bulbs, not that most people will try

View File

@@ -19,9 +19,8 @@
nanomanager.close_uis(src)
return ..()
/obj/Topic(href, href_list, var/nowindow = 0, var/datum/topic_state/state = default_state)
// Calling Topic without a corresponding window open causes runtime errors
if(!nowindow && ..())
/obj/Topic(href, href_list, var/datum/topic_state/state = default_state)
if(usr && ..())
return 1
// In the far future no checks are made in an overriding Topic() beyond if(..()) return
@@ -144,4 +143,4 @@
return
/obj/proc/show_message(msg, type, alt, alt_type)//Message, type of message (1 or 2), alternative message, alt message type (1 or 2)
return
return