From 1759d492f04fa4a5e4e39c405e747956800a52dc Mon Sep 17 00:00:00 2001 From: xxalpha Date: Wed, 22 Jul 2015 20:15:13 +0100 Subject: [PATCH 1/2] Made Agent IDs rewrittable. Added antag check for forging. --- code/game/objects/items/weapons/cards_ids.dm | 34 ++++++++++---------- html/changelogs/xxalpha-rw_agent.yml | 6 ++++ 2 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 html/changelogs/xxalpha-rw_agent.yml diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 0b4a0a45c51..3fd876a43f4 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -141,24 +141,24 @@ update_label("John Doe", "Clowny") if(user.mind.special_role) usr << "The card's microscanners activate as you pass it over the ID, copying its access." +/obj/item/weapon/card/id/syndicate/CtrlClick(mob/user) + if(loc == user) + if(istype(user, /mob/living) && user.mind) + if(user.mind.special_role) + var t = copytext(sanitize(input(user, "What name would you like to put on this card?", "Agent card name", registered_name ? registered_name : (ishuman(user) ? user.real_name : user.name))as text | null),1,26) + if(!t || t == "Unknown" || t == "floor" || t == "wall" || t == "r-wall") //Same as mob/new_player/prefrences.dm + if (t) + alert("Invalid name.") + return + registered_name = t -/obj/item/weapon/card/id/syndicate/attack_self(mob/user) - if(!src.registered_name) - //Stop giving the players unsanitized unputs! You are giving ways for players to intentionally crash clients! -Nodrak - 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)as text | null),1,26) - if(!t || t == "Unknown" || t == "floor" || t == "wall" || t == "r-wall") //Same as mob/new_player/prefrences.dm - if (t) - 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")as text | null),1,MAX_MESSAGE_LEN) - if(!u) - src.registered_name = "" - return - src.assignment = u - update_label() - user << "You successfully forge the ID card." + 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")as text | null),1,MAX_MESSAGE_LEN) + if(!u) + registered_name = "" + return + assignment = u + update_label() + user << "You successfully forge the ID card." else ..() diff --git a/html/changelogs/xxalpha-rw_agent.yml b/html/changelogs/xxalpha-rw_agent.yml new file mode 100644 index 00000000000..558b3868ae0 --- /dev/null +++ b/html/changelogs/xxalpha-rw_agent.yml @@ -0,0 +1,6 @@ +author: xxalpha + +delete-after: True + +changes: + - tweak: "Agent IDs are now rewrittable. Use Ctrl+Click to forge!" From 2aa05fdc45641da2fba3de5b2790bac974c7f6c2 Mon Sep 17 00:00:00 2001 From: xxalpha Date: Thu, 23 Jul 2015 04:22:25 +0100 Subject: [PATCH 2/2] Changed input method Edit changelog --- code/game/objects/items/weapons/cards_ids.dm | 12 ++++++------ html/changelogs/xxalpha-rw_agent.yml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 3fd876a43f4..f1c7722dd53 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -141,10 +141,10 @@ update_label("John Doe", "Clowny") if(user.mind.special_role) usr << "The card's microscanners activate as you pass it over the ID, copying its access." -/obj/item/weapon/card/id/syndicate/CtrlClick(mob/user) - if(loc == user) - if(istype(user, /mob/living) && user.mind) - if(user.mind.special_role) +/obj/item/weapon/card/id/syndicate/attack_self(mob/user) + if(istype(user, /mob/living) && user.mind) + if(user.mind.special_role) + if(alert(user, "Action", "Agent ID", "Show", "Forge") == "Forge") var t = copytext(sanitize(input(user, "What name would you like to put on this card?", "Agent card name", registered_name ? registered_name : (ishuman(user) ? user.real_name : user.name))as text | null),1,26) if(!t || t == "Unknown" || t == "floor" || t == "wall" || t == "r-wall") //Same as mob/new_player/prefrences.dm if (t) @@ -159,8 +159,8 @@ update_label("John Doe", "Clowny") assignment = u update_label() user << "You successfully forge the ID card." - else - ..() + return + ..() /obj/item/weapon/card/id/syndicate_command name = "syndicate ID card" diff --git a/html/changelogs/xxalpha-rw_agent.yml b/html/changelogs/xxalpha-rw_agent.yml index 558b3868ae0..878e309d2e5 100644 --- a/html/changelogs/xxalpha-rw_agent.yml +++ b/html/changelogs/xxalpha-rw_agent.yml @@ -3,4 +3,4 @@ author: xxalpha delete-after: True changes: - - tweak: "Agent IDs are now rewrittable. Use Ctrl+Click to forge!" + - tweak: "Agent IDs are now rewrittable."