Merge pull request #702 from ArchieBeepBoop/idbullshitpart3

Cleaning up ID Console code and other tweaks - The "I want to die" edition
This commit is contained in:
Dahlular
2020-11-21 23:00:50 -07:00
committed by GitHub
38 changed files with 581 additions and 716 deletions

View File

@@ -80,6 +80,7 @@
righthand_file = 'icons/mob/inhands/equipment/idcards_righthand.dmi'
item_flags = NO_MAT_REDEMPTION | NOBLUDGEON
var/prox_check = TRUE //If the emag requires you to be in range
var/uses = 10
/obj/item/card/emag/bluespace
name = "bluespace cryptographic sequencer"
@@ -93,39 +94,55 @@
/obj/item/card/emag/afterattack(atom/target, mob/user, proximity)
. = ..()
var/atom/A = target
if(!proximity && prox_check)
if(!proximity && prox_check || !(isobj(A) || issilicon(A) || isbot(A) || isdrone(A)))
return
if(istype(A, /obj/item/storage) && !(istype(A, /obj/item/storage/lockbox) || istype(A, /obj/item/storage/pod)))
return
//Citadel changes: modular code misfiring, so we're bypassing into main code.
if(!uses)
user.visible_message("<span class='warning'>[src] emits a weak spark. It's burnt out!</span>")
playsound(src, 'sound/effects/light_flicker.ogg', 100, 1)
return
else if(uses <= 3)
playsound(src, 'sound/effects/light_flicker.ogg', 30, 1) //Tiiiiiiny warning sound to let ya know your emag's almost dead
if(isturf(A))
if(!A.emag_act(user))
return
if(istype(A,/obj/item/storage/lockbox) || istype(A, /obj/item/storage/pod))
A.emag_act(user)
uses = max(uses - 1, 0)
if(!uses)
user.visible_message("<span class='warning'>[src] fizzles and sparks. It seems like it's out of charges.</span>")
playsound(src, 'sound/effects/light_flicker.ogg', 100, 1)
if(istype(A,/obj/item/storage))
return
if(!(isobj(A) || issilicon(A) || isbot(A) || isdrone(A)))
return
else
A.emag_act(user)
uses = max(uses - 1, 0)
if(!uses)
user.visible_message("<span class='warning'>[src] fizzles and sparks. It seems like it's out of charges.</span>")
playsound(src, 'sound/effects/light_flicker.ogg', 100, 1)
uses = max(uses - 1, 0)
if(!uses)
user.visible_message("<span class='warning'>[src] fizzles and sparks. It seems like it's out of charges.</span>")
playsound(src, 'sound/effects/light_flicker.ogg', 100, 1)
/obj/item/card/emag/examine(mob/user)
. = ..()
. += "<span class='notice'>It has <b>[uses ? uses : "no"]</b> charges left.</span>"
/obj/item/card/emag/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/emagrecharge))
var/obj/item/emagrecharge/ER = W
if(ER.uses)
uses += ER.uses
to_chat(user, "<span class='notice'>You have added [ER.uses] charges to [src]. It now has [uses] charges.</span>")
playsound(src, "sparks", 100, 1)
ER.uses = 0
else
to_chat(user, "<span class='warning'>[ER] has no charges left.</span>")
return
. = ..()
/obj/item/emagrecharge
name = "electromagnet charging device"
desc = "A small cell with two prongs lazily jabbed into it. It looks like it's made for charging the small batteries found in electromagnetic devices, sadly this can't be recharged like a normal cell."
icon = 'icons/obj/module.dmi'
icon_state = "cell_mini"
item_flags = NOBLUDGEON
var/uses = 5 //Dictates how many charges the device adds to compatible items
/obj/item/emagrecharge/examine(mob/user)
. = ..()
if(uses)
. += "<span class='notice'>It can add up to [uses] charges to compatible devices</span>"
else
. += "<span class='warning'>It has a small, red, blinking light coming from inside of it. It's spent.</span>"
/obj/item/card/emagfake
desc = "It's a card with a magnetic strip attached to some circuitry. Closer inspection shows that this card is a poorly made replica, with a \"DonkCo\" logo stamped on the back."
name = "cryptographic sequencer"
@@ -186,6 +203,9 @@
/obj/item/card/id/GetID()
return src
/obj/item/card/id/RemoveID()
return src
/*
Usage:
update_label()
@@ -357,12 +377,41 @@ update_label("John Doe", "Clowny")
lefthand_file = 'icons/mob/inhands/equipment/idcards_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/idcards_righthand.dmi'
assignment = "Prisoner"
registered_name = "Scum"
access = list(ACCESS_ENTER_GENPOP)
//Lavaland labor camp
var/goal = 0 //How far from freedom?
var/points = 0
//Genpop
var/sentence = 0 //When world.time is greater than this number, the card will have its ACCESS_ENTER_GENPOP access replaced with ACCESS_LEAVE_GENPOP the next time it's checked, unless this value is 0/null
var/crime= "\[REDACTED\]"
/obj/item/card/id/prisoner/attack_self(mob/user)
to_chat(usr, "<span class='notice'>You have accumulated [points] out of the [goal] points you need for freedom.</span>")
/obj/item/card/id/prisoner/GetAccess()
if((sentence && world.time >= sentence) || (goal && points >= goal))
access = list(ACCESS_LEAVE_GENPOP)
return ..()
/obj/item/card/id/prisoner/process()
if(!sentence)
STOP_PROCESSING(SSobj, src)
return
if(world.time >= sentence)
playsound(loc, 'sound/machines/ping.ogg', 50, 1)
if(isliving(loc))
to_chat(loc, "<span class='boldnotice'>[src]</span><span class='notice'> buzzes: You have served your sentence! You may now exit prison through the turnstiles and collect your belongings.</span>")
STOP_PROCESSING(SSobj, src)
return
/obj/item/card/id/prisoner/examine(mob/user)
. = ..()
if(sentence && world.time < sentence)
. += "<span class='notice'>You're currently serving a sentence for [crime]. <b>[DisplayTimeText(sentence - world.time)]</b> left.</span>"
else if(goal)
. += "<span class='notice'>You have accumulated [points] out of the [goal] points you need for freedom.</span>"
else if(!sentence)
. += "<span class='warning'>You are currently serving a permanent sentence for [crime].</span>"
else
. += "<span class='notice'>Your sentence is up! You're free!</span>"
/obj/item/card/id/prisoner/one
name = "Prisoner #13-001"
@@ -438,10 +487,60 @@ update_label("John Doe", "Clowny")
desc = "A special ID card that allows access to APC terminals."
access = list(ACCESS_ENGINE_EQUIP)
/obj/item/card/id/away/snowdin
name = "a perfectly generic identification card"
desc = "A perfectly generic identification card. Looks like it could use some flavor."
icon_state = "centcom"
//Polychromatic Knight Badge
/obj/item/card/id/knight
var/id_color = "#00FF00" //defaults to green
name = "knight badge"
icon_state = "knight"
desc = "A badge denoting the owner as a knight! It has a strip for swiping like an ID"
/obj/item/card/id/knight/update_label(newname, newjob)
if(newname || newjob)
name = "[(!newname) ? "knight badge" : "[newname]'s Knight Badge"][(!newjob) ? "" : " ([newjob])"]"
return
name = "[(!registered_name) ? "knight badge" : "[registered_name]'s Knight Badge"][(!assignment) ? "" : " ([assignment])"]"
/obj/item/card/id/knight/update_icon()
var/mutable_appearance/id_overlay = mutable_appearance(icon, "knight_overlay")
if(id_color)
id_overlay.color = id_color
cut_overlays()
add_overlay(id_overlay)
/obj/item/card/id/knight/AltClick(mob/living/user)
. = ..()
if(!in_range(src, user)) //Basic checks to prevent abuse
return
if(user.incapacitated() || !istype(user))
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
return
if(alert("Are you sure you want to recolor your id?", "Confirm Repaint", "Yes", "No") == "Yes")
var/energy_color_input = input(usr,"","Choose Energy Color",id_color) as color|null
if(!in_range(src, user) || !energy_color_input)
return
if(user.incapacitated() || !istype(user))
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
return
id_color = sanitize_hexcolor(energy_color_input, desired_format=6, include_crunch=1)
update_icon()
/obj/item/card/id/knight/Initialize()
. = ..()
update_icon()
/obj/item/card/id/knight/examine(mob/user)
. = ..()
. += "<span class='notice'>Alt-click to recolor it.</span>"
/obj/item/card/id/knight/blue
id_color = "#0000FF"
/obj/item/card/id/knight/captain
id_color = "#FFD700"
/obj/item/card/id/away/snowdin/eng
name = "Arctic Station Engineer's ID card"

View File

@@ -63,7 +63,7 @@
name = "Department Management Console (Computer Board)"
build_path = /obj/machinery/computer/card/minor
var/target_dept = 1
var/list/dept_list = list("General","Security","Medical","Science","Engineering")
var/list/dept_list = list("Civilian","Security","Medical","Science","Engineering","Cargo")
/obj/item/circuitboard/computer/card/minor/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/screwdriver))

View File

@@ -139,7 +139,7 @@ GLOBAL_LIST_EMPTY(PDAs)
var/choice = input(M, "Choose the a reskin for [src]","Reskin Object") as null|anything in GLOB.pda_reskins
var/new_icon = GLOB.pda_reskins[choice]
if(QDELETED(src) || isnull(new_icon) || new_icon == icon || M.incapacitated() || !in_range(M,src))
if(QDELETED(src) || isnull(new_icon) || new_icon == icon || !M.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
icon = new_icon
update_icon(FALSE, TRUE)
@@ -199,6 +199,18 @@ GLOBAL_LIST_EMPTY(PDAs)
/obj/item/pda/GetID()
return id
/obj/item/pda/RemoveID()
return do_remove_id()
/obj/item/pda/InsertID(obj/item/inserting_item)
var/obj/item/card/inserting_id = inserting_item.RemoveID()
if(!inserting_id)
return
insert_id(inserting_id)
if(id == inserting_id)
return TRUE
return FALSE
/obj/item/pda/update_icon(alert = FALSE, new_overlays = FALSE)
if(new_overlays)
set_new_overlays()
@@ -273,7 +285,7 @@ GLOBAL_LIST_EMPTY(PDAs)
dat += text("<br><a href='?src=[REF(src)];choice=UpdateInfo'>[id ? "Update PDA Info" : ""]</A><br><br>")
dat += "[STATION_TIME_TIMESTAMP("hh:mm:ss")]<br>" //:[world.time / 100 % 6][world.time / 100 % 10]"
dat += "[time2text(world.realtime, "MMM DD")] [GLOB.year_integer+540]"
dat += "[time2text(world.realtime, "MMM DD")] [GLOB.year_integer]"
dat += "<br><br>"
@@ -687,15 +699,27 @@ GLOBAL_LIST_EMPTY(PDAs)
return
/obj/item/pda/proc/remove_id()
if(issilicon(usr) || !usr.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
do_remove_id(usr)
if (id)
usr.put_in_hands(id)
to_chat(usr, "<span class='notice'>You remove the ID from the [name].</span>")
id = null
update_icon()
/obj/item/pda/proc/do_remove_id(mob/user)
if(!id)
return
if(user)
user.put_in_hands(id)
to_chat(user, "<span class='notice'>You remove the ID from the [name].</span>")
else
id.forceMove(get_turf(src))
. = id
id = null
update_icon()
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
if(H.wear_id == src)
H.sec_hud_set_ID()
/obj/item/pda/proc/msg_input(mob/living/U = usr)
var/t = stripped_input(U, "Please enter message", name)
@@ -877,17 +901,27 @@ GLOBAL_LIST_EMPTY(PDAs)
if(istype(C))
I = C
if(I && I.registered_name)
if(I?.registered_name)
if(!user.transferItemToLoc(I, src))
return FALSE
var/obj/old_id = id
id = I
if(old_id)
user.put_in_hands(old_id)
insert_id(I, user)
update_icon()
playsound(src, 'sound/machines/button.ogg', 50, 1)
return TRUE
/obj/item/pda/proc/insert_id(obj/item/card/id/inserting_id, mob/user)
var/obj/old_id = id
id = inserting_id
if(ishuman(loc))
var/mob/living/carbon/human/human_wearer = loc
if(human_wearer.wear_id == src)
human_wearer.sec_hud_set_ID()
if(old_id)
if(user)
user.put_in_hands(old_id)
else
old_id.forceMove(get_turf(src))
// access to status display signals
/obj/item/pda/attackby(obj/item/C, mob/user, params)
if(istype(C, /obj/item/cartridge) && !cartridge)

View File

@@ -67,6 +67,21 @@
/obj/item/storage/wallet/GetID()
return front_id
/obj/item/storage/wallet/RemoveID()
if(!front_id)
return
. = front_id
front_id.forceMove(get_turf(src))
/obj/item/storage/wallet/InsertID(obj/item/inserting_item)
var/obj/item/card/inserting_id = inserting_item.RemoveID()
if(!inserting_id)
return FALSE
attackby(inserting_id)
if(inserting_id in contents)
return TRUE
return FALSE
/obj/item/storage/wallet/GetAccess()
if(LAZYLEN(combined_access))
return combined_access