From 40de86de351f4ccc01a2107cd8a052b143936eee Mon Sep 17 00:00:00 2001 From: Really-Good-Soda-Flavor Date: Wed, 21 Jun 2017 14:19:17 -0400 Subject: [PATCH] Moves reskinning items to /obj (#28558) --- code/game/objects/objs.dm | 24 +++++++++- code/modules/paperwork/pen.dm | 26 ++++------- code/modules/projectiles/gun.dm | 25 ---------- .../projectiles/guns/ballistic/revolver.dm | 46 ++++++++----------- 4 files changed, 51 insertions(+), 70 deletions(-) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 1d8ca793cbe..549c1ebf0c1 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -23,7 +23,8 @@ var/persistence_replacement //have something WAY too amazing to live to the next round? Set a new path here. Overuse of this var will make me upset. var/unique_rename = FALSE // can you customize the description/name of the thing? - + var/current_skin //Has the item been reskinned? + var/list/unique_reskin //List of options to reskin. var/dangerous_possession = FALSE //Admin possession yes/no /obj/vv_edit_var(vname, vval) @@ -196,6 +197,27 @@ ..() if(unique_rename) to_chat(user, "Use a pen on it to rename it or change its description.") + if(unique_reskin && !current_skin) + to_chat(user, "Alt-click it to reskin it.") + +/obj/AltClick(mob/user) + . = ..() + if(unique_reskin && !current_skin && in_range(user,src)) + if(user.incapacitated()) + to_chat(user, "You can't do that right now!") + return + reskin_obj(user) + +/obj/proc/reskin_obj(mob/M) + if(!LAZYLEN(unique_reskin)) + return + var/choice = input(M,"Warning, you can only reskin [src] once!","Reskin Object") as null|anything in unique_reskin + if(!QDELETED(src) && choice && !current_skin && !M.incapacitated() && in_range(M,src)) + if(!unique_reskin[choice]) + return + current_skin = choice + icon_state = unique_reskin[choice] + to_chat(M, "[src] is now skinned as '[choice].'") /obj/proc/gang_contraband_value() return 0 diff --git a/code/modules/paperwork/pen.dm b/code/modules/paperwork/pen.dm index 0fceeb5a9d3..5f5a8b32d55 100644 --- a/code/modules/paperwork/pen.dm +++ b/code/modules/paperwork/pen.dm @@ -82,25 +82,17 @@ materials = list(MAT_GOLD = 750) sharpness = IS_SHARP resistance_flags = FIRE_PROOF - var/unique_reskin = TRUE - var/list/skins = list("Oak" = "pen-fountain-o", "Gold" = "pen-fountain-g", "Rosewood" = "pen-fountain-r", "Black and Silver" = "pen-fountain-b","Command Blue" = "pen-fountain-cb") + unique_reskin = list("Oak" = "pen-fountain-o", + "Gold" = "pen-fountain-g", + "Rosewood" = "pen-fountain-r", + "Black and Silver" = "pen-fountain-b", + "Command Blue" = "pen-fountain-cb" + ) -/obj/item/weapon/pen/fountain/captain/AltClick() - var/mob/living/carbon/user = usr - if(!istype(user)) - return - if(unique_reskin) - var/choice = input(user,"Choose the finish for your pen.","Reskin Pen") as null|anything in skins - if(!QDELETED(src) && choice && !user.incapacitated() && in_range(user,src)) - icon_state = skins[choice] - unique_reskin = FALSE - to_chat(user, "Your pen now has a [choice] finish.") - desc = "It's an expensive [choice] fountain pen. The nib is quite sharp." - -/obj/item/weapon/pen/fountain/captain/examine(mob/user) +/obj/item/weapon/pen/fountain/captain/reskin_obj(mob/M) ..() - if(unique_reskin) - to_chat(user, "This item can be reskinned. Alt-click to select a skin.") + if(current_skin) + desc = "It's an expensive [current_skin] fountain pen. The nib is quite sharp." /obj/item/weapon/pen/attack_self(mob/living/carbon/user) var/deg = input(user, "What angle would you like to rotate the pen head to? (1-360)", "Rotate Pen Head") as null|num diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 742a2287905..5a21c92f799 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -37,9 +37,6 @@ var/weapon_weight = WEAPON_LIGHT var/spread = 0 //Spread induced by the gun itself. var/randomspread = 1 //Set to 0 for shotguns. This is used for weapons that don't fire all their bullets at once. - var/unique_reskin = 0 //allows one-time reskinning - var/current_skin = null //the skin choice if we had a reskin - var/list/options = list() lefthand_file = 'icons/mob/inhands/guns_lefthand.dmi' righthand_file = 'icons/mob/inhands/guns_righthand.dmi' @@ -93,8 +90,6 @@ to_chat(user, "It has [pin] installed.") else to_chat(user, "It doesn't have a firing pin installed, and won't fire.") - if(unique_reskin && !current_skin) - to_chat(user, "Alt-click it to reskin it.") //called after the gun has successfully fired its chambered ammo. /obj/item/weapon/gun/proc/process_chamber() @@ -400,26 +395,6 @@ if(alight) alight.Remove(user) - -/obj/item/weapon/gun/AltClick(mob/user) - ..() - if(user.incapacitated()) - to_chat(user, "You can't do that right now!") - return - if(unique_reskin && !current_skin && loc == user) - reskin_gun(user) - - -/obj/item/weapon/gun/proc/reskin_gun(mob/M) - var/choice = input(M,"Warning, you can only reskin your weapon once!","Reskin Gun") in options - - if(src && choice && !current_skin && !M.incapacitated() && in_range(M,src)) - if(options[choice] == null) - return - current_skin = options[choice] - to_chat(M, "Your gun is now skinned as [choice]. Say hello to your new friend.") - update_icon() - /obj/item/weapon/gun/proc/handle_suicide(mob/living/carbon/human/user, mob/living/carbon/human/target, params) if(!ishuman(user) || !ishuman(target)) return diff --git a/code/modules/projectiles/guns/ballistic/revolver.dm b/code/modules/projectiles/guns/ballistic/revolver.dm index b79dd64675f..a9f0e4914e8 100644 --- a/code/modules/projectiles/guns/ballistic/revolver.dm +++ b/code/modules/projectiles/guns/ballistic/revolver.dm @@ -92,17 +92,13 @@ desc = "A cheap Martian knock-off of a classic law enforcement firearm. Uses .38-special rounds." icon_state = "detective" mag_type = /obj/item/ammo_box/magazine/internal/cylinder/rev38 - unique_rename = 1 - unique_reskin = 1 - -/obj/item/weapon/gun/ballistic/revolver/detective/Initialize() - . = ..() - options["Default"] = "detective" - options["Leopard Spots"] = "detective_leopard" - options["Black Panther"] = "detective_panther" - options["Gold Trim"] = "detective_gold" - options["The Peacemaker"] = "detective_peacemaker" - options["Cancel"] = null + unique_rename = TRUE + unique_reskin = list("Default" = "detective", + "Leopard Spots" = "detective_leopard", + "Black Panther" = "detective_panther", + "Gold Trim" = "detective_gold", + "The Peacemaker" = "detective_peacemaker" + ) /obj/item/weapon/gun/ballistic/revolver/detective/process_fire(atom/target as mob|obj|turf, mob/living/user as mob|obj, message = 1, params, zone_override = "") if(magazine.caliber != initial(magazine.caliber)) @@ -269,18 +265,14 @@ slot_flags = SLOT_BACK mag_type = /obj/item/ammo_box/magazine/internal/shot/dual sawn_desc = "Omar's coming!" - unique_rename = 1 - unique_reskin = 1 - -/obj/item/weapon/gun/ballistic/revolver/doublebarrel/Initialize() - . = ..() - options["Default"] = "dshotgun" - options["Dark Red Finish"] = "dshotgun-d" - options["Ash"] = "dshotgun-f" - options["Faded Grey"] = "dshotgun-g" - options["Maple"] = "dshotgun-l" - options["Rosewood"] = "dshotgun-p" - options["Cancel"] = null + unique_rename = TRUE + unique_reskin = list("Default" = "dshotgun", + "Dark Red Finish" = "dshotgun-d", + "Ash" = "dshotgun-f", + "Faded Grey" = "dshotgun-g", + "Maple" = "dshotgun-1", + "Rosewood" = "dshotgun-p" + ) /obj/item/weapon/gun/ballistic/revolver/doublebarrel/attackby(obj/item/A, mob/user, params) ..() @@ -319,9 +311,9 @@ slot_flags = null mag_type = /obj/item/ammo_box/magazine/internal/shot/improvised sawn_desc = "I'm just here for the gasoline." - unique_rename = 0 - unique_reskin = 0 - var/slung = 0 + unique_rename = FALSE + unique_reskin = null + var/slung = FALSE /obj/item/weapon/gun/ballistic/revolver/doublebarrel/improvised/attackby(obj/item/A, mob/user, params) ..() @@ -330,7 +322,7 @@ if(C.use(10)) slot_flags = SLOT_BACK to_chat(user, "You tie the lengths of cable to the shotgun, making a sling.") - slung = 1 + slung = TRUE update_icon() else to_chat(user, "You need at least ten lengths of cable if you want to make a sling!")