mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +01:00
Refactors renaming things with a pen. (#14960)
* Refactors renaming things with a pen. * Farie review (thanks!!) * Derp. * Farie take 2
This commit is contained in:
@@ -83,9 +83,7 @@
|
||||
|
||||
/obj/item/reagent_containers/food/snacks/attackby(obj/item/W, mob/user, params)
|
||||
if(istype(W,/obj/item/pen))
|
||||
var/n_name = sanitize(copytext(input(usr, "What would you like to name this dish?", "Food Renaming", null) as text, 1, MAX_NAME_LEN))
|
||||
if((loc == usr && usr.stat == 0))
|
||||
name = "[n_name]"
|
||||
rename_interactive(user, W, use_prefix = FALSE, prompt = "What would you like to name this dish?")
|
||||
return
|
||||
if(istype(W,/obj/item/storage))
|
||||
..() // -> item/attackby(, params)
|
||||
|
||||
@@ -283,10 +283,9 @@
|
||||
if(P.name != "Blank Card")
|
||||
to_chat(user,"<span class='notice'>You cannot write on that card.</span>")
|
||||
return
|
||||
var/cardtext = sanitize(input(user, "What do you wish to write on the card?", "Card Editing") as text|null, MAX_PAPER_MESSAGE_LEN)
|
||||
if(!cardtext)
|
||||
return
|
||||
P.name = cardtext
|
||||
var/t = rename_interactive(user, P, use_prefix = FALSE, actually_rename = FALSE)
|
||||
if(t && P.name == "Blank Card")
|
||||
P.name = t
|
||||
// SNOWFLAKE FOR CAG, REMOVE IF OTHER CARDS ARE ADDED THAT USE THIS.
|
||||
P.card_icon = "cag_white_card"
|
||||
update_icon()
|
||||
|
||||
@@ -458,15 +458,7 @@
|
||||
/obj/item/disk/plantgene/attackby(obj/item/W, mob/user, params)
|
||||
..()
|
||||
if(istype(W, /obj/item/pen))
|
||||
var/t = stripped_input(user, "What would you like the label to be?", name, null)
|
||||
if(user.get_active_hand() != W)
|
||||
return
|
||||
if(!in_range(src, user) && loc != user)
|
||||
return
|
||||
if(t)
|
||||
name = "plant data disk - '[t]'"
|
||||
else
|
||||
name = "plant data disk"
|
||||
rename_interactive(user, W)
|
||||
|
||||
/obj/item/disk/plantgene/proc/update_name()
|
||||
if(gene)
|
||||
|
||||
@@ -33,13 +33,13 @@
|
||||
|
||||
/obj/structure/bookcase/attackby(obj/item/O as obj, mob/user as mob, params)
|
||||
if(busy) //So that you can't mess with it while deconstructing
|
||||
return 1
|
||||
return TRUE
|
||||
if(is_type_in_list(O, allowed_books))
|
||||
if(!user.drop_item())
|
||||
return
|
||||
O.forceMove(src)
|
||||
update_icon()
|
||||
return 1
|
||||
return TRUE
|
||||
else if(istype(O, /obj/item/storage/bag/books))
|
||||
var/obj/item/storage/bag/books/B = O
|
||||
for(var/obj/item/T in B.contents)
|
||||
@@ -47,28 +47,26 @@
|
||||
B.remove_from_storage(T, src)
|
||||
to_chat(user, "<span class='notice'>You empty [O] into [src].</span>")
|
||||
update_icon()
|
||||
return 1
|
||||
return TRUE
|
||||
else if(istype(O, /obj/item/wrench))
|
||||
user.visible_message("<span class='warning'>[user] starts disassembling \the [src].</span>", \
|
||||
"<span class='notice'>You start disassembling \the [src].</span>")
|
||||
playsound(get_turf(src), O.usesound, 50, 1)
|
||||
busy = 1
|
||||
busy = TRUE
|
||||
|
||||
if(do_after(user, 50 * O.toolspeed, target = src))
|
||||
playsound(get_turf(src), O.usesound, 75, 1)
|
||||
user.visible_message("<span class='warning'>[user] disassembles \the [src].</span>", \
|
||||
"<span class='notice'>You disassemble \the [src].</span>")
|
||||
busy = 0
|
||||
busy = FALSE
|
||||
density = 0
|
||||
deconstruct(TRUE)
|
||||
else
|
||||
busy = 0
|
||||
return 1
|
||||
busy = FALSE
|
||||
return TRUE
|
||||
else if(istype(O, /obj/item/pen))
|
||||
var/newname = stripped_input(user, "What would you like to title this [name]?")
|
||||
if(newname)
|
||||
name = ("bookcase ([sanitize(newname)])")
|
||||
return 1
|
||||
rename_interactive(user, O)
|
||||
return TRUE
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -29,13 +29,10 @@
|
||||
qdel(src)
|
||||
|
||||
else if(istype(W, /obj/item/pen))
|
||||
var/t = stripped_input(user, "Enter new robot name", name, created_name,MAX_NAME_LEN)
|
||||
if(!t)
|
||||
return
|
||||
if(!in_range(src, user) && loc != user)
|
||||
return
|
||||
created_name = t
|
||||
log_game("[key_name(user)] has renamed a robot to [t]")
|
||||
var/t = rename_interactive(user, W, prompt = "Enter new robot name")
|
||||
if(!isnull(t))
|
||||
created_name = t
|
||||
log_game("[key_name(user)] has renamed a robot to [t]")
|
||||
|
||||
//Edbot Assembly
|
||||
|
||||
@@ -53,13 +50,10 @@
|
||||
..()
|
||||
|
||||
if(istype(W, /obj/item/pen))
|
||||
var/t = stripped_input(user, "Enter new robot name", name, created_name,MAX_NAME_LEN)
|
||||
if(!t)
|
||||
return
|
||||
if(!in_range(src, user) && loc != user)
|
||||
return
|
||||
created_name = t
|
||||
log_game("[key_name(user)] has renamed a robot to [t]")
|
||||
var/t = rename_interactive(user, W, prompt = "Enter new robot name")
|
||||
if(!isnull(t))
|
||||
created_name = t
|
||||
log_game("[key_name(user)] has renamed a robot to [t]")
|
||||
return
|
||||
|
||||
switch(build_step)
|
||||
@@ -277,14 +271,10 @@
|
||||
qdel(src)
|
||||
|
||||
else if(istype(W, /obj/item/pen))
|
||||
var/t = stripped_input(user, "Enter new robot name", name, created_name,MAX_NAME_LEN)
|
||||
if(!t)
|
||||
return
|
||||
if(!in_range(src, user) && loc != user)
|
||||
return
|
||||
|
||||
created_name = t
|
||||
log_game("[key_name(user)] has renamed a robot to [t]")
|
||||
var/t = rename_interactive(user, W, prompt = "Enter new robot name")
|
||||
if(!isnull(t))
|
||||
created_name = t
|
||||
log_game("[key_name(user)] has renamed a robot to [t]")
|
||||
|
||||
/obj/item/toolbox_tiles/sensor/attackby(obj/item/W, mob/user, params)
|
||||
..()
|
||||
@@ -297,14 +287,10 @@
|
||||
user.unEquip(src, 1)
|
||||
qdel(src)
|
||||
else if(istype(W, /obj/item/pen))
|
||||
var/t = stripped_input(user, "Enter new robot name", name, created_name,MAX_NAME_LEN)
|
||||
if(!t)
|
||||
return
|
||||
if(!in_range(src, user) && loc != user)
|
||||
return
|
||||
|
||||
created_name = t
|
||||
log_game("[key_name(user)] has renamed a robot to [t]")
|
||||
var/t = rename_interactive(user, W, prompt = "Enter new robot name")
|
||||
if(!isnull(t))
|
||||
created_name = t
|
||||
log_game("[key_name(user)] has renamed a robot to [t]")
|
||||
|
||||
//Medbot Assembly
|
||||
/obj/item/storage/firstaid/attackby(obj/item/I, mob/user, params)
|
||||
@@ -369,13 +355,10 @@
|
||||
/obj/item/firstaid_arm_assembly/attackby(obj/item/I, mob/user, params)
|
||||
..()
|
||||
if(istype(I, /obj/item/pen))
|
||||
var/t = stripped_input(user, "Enter new robot name", name, created_name, MAX_NAME_LEN)
|
||||
if(!t)
|
||||
return
|
||||
if(!in_range(src, user) && loc != user)
|
||||
return
|
||||
created_name = t
|
||||
log_game("[key_name(user)] has renamed a robot to [t]")
|
||||
var/t = rename_interactive(user, I, prompt = "Enter new robot name")
|
||||
if(!isnull(t))
|
||||
created_name = t
|
||||
log_game("[key_name(user)] has renamed a robot to [t]")
|
||||
else
|
||||
switch(build_step)
|
||||
if(0)
|
||||
@@ -481,13 +464,10 @@
|
||||
qdel(src)
|
||||
|
||||
else if(istype(I, /obj/item/pen))
|
||||
var/t = stripped_input(user, "Enter new robot name", name, created_name,MAX_NAME_LEN)
|
||||
if(!t)
|
||||
return
|
||||
if(!in_range(src, user) && loc != user)
|
||||
return
|
||||
created_name = t
|
||||
log_game("[key_name(user)] has renamed a robot to [t]")
|
||||
var/t = rename_interactive(user, I, prompt = "Enter new robot name")
|
||||
if(!isnull(t))
|
||||
created_name = t
|
||||
log_game("[key_name(user)] has renamed a robot to [t]")
|
||||
|
||||
else if(istype(I, /obj/item/screwdriver))
|
||||
if(!build_step)
|
||||
|
||||
@@ -42,13 +42,7 @@
|
||||
to_chat(user, "<span class='notice'>You put the [W] into \the [src].</span>")
|
||||
update_icon()
|
||||
else if(istype(W, /obj/item/pen))
|
||||
var/n_name = clean_input("What would you like to label the folder?", "Folder Labelling", null)
|
||||
if(!n_name)
|
||||
return
|
||||
n_name = sanitize(copytext(n_name, 1, MAX_NAME_LEN))
|
||||
|
||||
if((loc == usr || Adjacent(usr)) && usr.stat == 0)
|
||||
name = "folder[(n_name ? text("- '[n_name]'") : null)]"
|
||||
rename_interactive(user, W)
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -103,11 +103,13 @@
|
||||
if(!usr.is_literate())
|
||||
to_chat(usr, "<span class='notice'>You don't know how to read.</span>")
|
||||
return
|
||||
var/n_name = sanitize(copytext(input(usr, "What would you like to label the paper?", "Paper Labelling", name) as text, 1, MAX_MESSAGE_LEN))
|
||||
if((loc == usr && usr.stat == 0))
|
||||
name = "[(n_name ? text("[n_name]") : initial(name))]"
|
||||
if(name != "paper")
|
||||
var/n_name = rename_interactive(usr)
|
||||
if(isnull(n_name))
|
||||
return
|
||||
if(n_name != "")
|
||||
desc = "This is a paper titled '" + name + "'."
|
||||
else
|
||||
desc = initial(desc)
|
||||
add_fingerprint(usr)
|
||||
return
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
var/pen_color_iconstate = "pencolor"
|
||||
var/pen_color_shift = 3
|
||||
|
||||
/obj/item/pen/multi/New()
|
||||
/obj/item/pen/multi/Initialize(mapload)
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
@@ -104,21 +104,6 @@
|
||||
icon_state = "fountainpen"
|
||||
pen_color_shift = 0
|
||||
|
||||
/obj/item/pen/attack(mob/living/M, mob/user)
|
||||
if(!istype(M))
|
||||
return
|
||||
|
||||
if(!force)
|
||||
if(M.can_inject(user, TRUE))
|
||||
to_chat(user, "<span class='warning'>You stab [M] with the pen.</span>")
|
||||
// to_chat(M, "<span class='danger'>You feel a tiny prick!</span>")
|
||||
. = 1
|
||||
|
||||
add_attack_logs(user, M, "Stabbed with [src]")
|
||||
|
||||
else
|
||||
. = ..()
|
||||
|
||||
/*
|
||||
* Sleepypens
|
||||
*/
|
||||
@@ -128,18 +113,26 @@
|
||||
|
||||
|
||||
/obj/item/pen/sleepy/attack(mob/living/M, mob/user)
|
||||
if(!istype(M)) return
|
||||
if(!istype(M))
|
||||
return
|
||||
|
||||
if(..())
|
||||
if(reagents.total_volume)
|
||||
if(M.reagents)
|
||||
reagents.trans_to(M, 50)
|
||||
if(!..())
|
||||
return
|
||||
|
||||
if(!M.can_inject(user, TRUE))
|
||||
return
|
||||
var/transfered = 0
|
||||
if(reagents.total_volume && M.reagents)
|
||||
transfered = reagents.trans_to(M, 50)
|
||||
to_chat(user, "<span class='warning'>You sneakily stab [M] with the pen.</span>")
|
||||
add_attack_logs(user, M, "Stabbed with (sleepy) [src]. [transfered]u of reagents transfered.")
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/pen/sleepy/New()
|
||||
/obj/item/pen/sleepy/Initialize(mapload)
|
||||
. = ..()
|
||||
create_reagents(100)
|
||||
reagents.add_reagent("ketamine", 100)
|
||||
..()
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
var/spread = 0
|
||||
var/randomspread = 1
|
||||
|
||||
var/unique_rename = 0 //allows renaming with a pen
|
||||
var/unique_reskin = 0 //allows one-time reskinning
|
||||
var/unique_rename = TRUE //allows renaming with a pen
|
||||
var/unique_reskin = TRUE //allows one-time reskinning
|
||||
var/current_skin = null //the skin choice if we had a reskin
|
||||
var/list/options = list()
|
||||
|
||||
@@ -318,7 +318,9 @@
|
||||
|
||||
if(unique_rename)
|
||||
if(istype(I, /obj/item/pen))
|
||||
rename_gun(user)
|
||||
var/t = rename_interactive(user, I, use_prefix = FALSE)
|
||||
if(!isnull(t))
|
||||
to_chat(user, "<span class='notice'>You name the gun [name]. Say hello to your new friend.</span>")
|
||||
if(istype(I, /obj/item/kitchen/knife))
|
||||
var/obj/item/kitchen/knife/K = I
|
||||
if(!can_bayonet || !K.bayonet || bayonet) //ensure the gun has an attachment point available, and that the knife is compatible with it.
|
||||
@@ -427,13 +429,6 @@
|
||||
to_chat(M, "Your gun is now skinned as [choice]. Say hello to your new friend.")
|
||||
update_icon()
|
||||
|
||||
/obj/item/gun/proc/rename_gun(mob/M)
|
||||
var/input = stripped_input(M,"What do you want to name the gun?", ,"", MAX_NAME_LEN)
|
||||
if(src && input && !M.stat && in_range(M,src) && !M.restrained() && M.canmove)
|
||||
name = input
|
||||
to_chat(M, "You name the gun [input]. Say hello to your new friend.")
|
||||
return
|
||||
|
||||
/obj/item/gun/proc/handle_suicide(mob/living/carbon/human/user, mob/living/carbon/human/target, params)
|
||||
if(!ishuman(user) || !ishuman(target))
|
||||
return
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
/obj/item/gun/projectile/revolver/detective
|
||||
desc = "A cheap Martian knock-off of a classic law enforcement firearm. Uses .38-special rounds."
|
||||
name = "\improper .38 Mars Special"
|
||||
name = ".38 Mars Special"
|
||||
icon_state = "detective"
|
||||
mag_type = /obj/item/ammo_box/magazine/internal/cylinder/rev38
|
||||
unique_rename = 1
|
||||
|
||||
@@ -107,22 +107,12 @@
|
||||
|
||||
/obj/item/reagent_containers/glass/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/pen) || istype(I, /obj/item/flashlight/pen))
|
||||
var/tmp_label = sanitize(input(user, "Enter a label for [name]","Label",label_text))
|
||||
if(length(tmp_label) > MAX_NAME_LEN)
|
||||
to_chat(user, "<span class='warning'>The label can be at most [MAX_NAME_LEN] characters long.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You set the label to \"[tmp_label]\".</span>")
|
||||
label_text = tmp_label
|
||||
update_name_label()
|
||||
var/t = rename_interactive(user, I)
|
||||
if(!isnull(t))
|
||||
label_text = t
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/reagent_containers/glass/proc/update_name_label()
|
||||
if(label_text == "")
|
||||
name = base_name
|
||||
else
|
||||
name = "[base_name] ([label_text])"
|
||||
|
||||
/obj/item/reagent_containers/glass/beaker
|
||||
name = "beaker"
|
||||
desc = "A beaker. Can hold up to 50 units."
|
||||
|
||||
@@ -149,39 +149,34 @@
|
||||
if(IV_INJECT)
|
||||
overlays += "inject"
|
||||
|
||||
/obj/item/reagent_containers/iv_bag/proc/set_label(new_label)
|
||||
name = "[initial(name)] ([new_label])"
|
||||
|
||||
/obj/item/reagent_containers/iv_bag/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/pen) || istype(I, /obj/item/flashlight/pen))
|
||||
var/tmp_label = sanitize(input(user, "Enter a label for [name]","Label",label_text))
|
||||
if(length(tmp_label) > MAX_NAME_LEN)
|
||||
to_chat(user, "<span class='warning'>The label can be at most [MAX_NAME_LEN] characters long.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You set the label to \"[tmp_label]\".</span>")
|
||||
set_label(tmp_label)
|
||||
rename_interactive(user, I)
|
||||
|
||||
// PRE-FILLED IV BAGS BELOW
|
||||
|
||||
/obj/item/reagent_containers/iv_bag/salglu
|
||||
name = "\improper IV Bag (Saline Glucose)"
|
||||
list_reagents = list("salglu_solution" = 200)
|
||||
|
||||
/obj/item/reagent_containers/iv_bag/salglu/Initialize(mapload)
|
||||
. = ..()
|
||||
name = "[initial(name)] - Saline Glucose"
|
||||
|
||||
/obj/item/reagent_containers/iv_bag/blood // Don't use this - just an abstract type to allow blood bags to have a common blood_type var for ease of creation.
|
||||
var/blood_type
|
||||
amount_per_transfer_from_this = 5 // Bloodbags are set to transfer 5 units by default.
|
||||
|
||||
/obj/item/reagent_containers/iv_bag/blood/New()
|
||||
..()
|
||||
/obj/item/reagent_containers/iv_bag/blood/Initialize(mapload)
|
||||
. = ..()
|
||||
if(blood_type != null)
|
||||
set_label(blood_type)
|
||||
name = "[initial(name)] - [blood_type]"
|
||||
reagents.add_reagent("blood", 200, list("donor"=null,"viruses"=null,"blood_DNA"=null,"blood_type"=blood_type,"resistances"=null,"trace_chem"=null))
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/reagent_containers/iv_bag/blood/random/New()
|
||||
/obj/item/reagent_containers/iv_bag/blood/random/Initialize()
|
||||
blood_type = pick("A+", "A-", "B+", "B-", "O+", "O-")
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/obj/item/reagent_containers/iv_bag/blood/APlus
|
||||
blood_type = "A+"
|
||||
@@ -202,5 +197,8 @@
|
||||
blood_type = "O-"
|
||||
|
||||
/obj/item/reagent_containers/iv_bag/slime
|
||||
name = "\improper IV Bag (Slime Jelly)"
|
||||
list_reagents = list("slimejelly" = 200)
|
||||
|
||||
/obj/item/reagent_containers/iv_bag/slime/Initialize(mapload)
|
||||
. = ..()
|
||||
name = "[initial(name)] - Slime Jelly"
|
||||
|
||||
@@ -56,12 +56,7 @@
|
||||
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
|
||||
|
||||
else if(istype(W, /obj/item/pen))
|
||||
var/str = copytext(sanitize(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='notice'>Invalid text.</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] labels [src] as [str].</span>")
|
||||
name = "[name] ([str])"
|
||||
rename_interactive(user, W)
|
||||
|
||||
else if(istype(W, /obj/item/stack/wrapping_paper) && !giftwrapped)
|
||||
var/obj/item/stack/wrapping_paper/WP = W
|
||||
@@ -132,12 +127,7 @@
|
||||
playsound(loc, 'sound/items/poster_ripped.ogg', 50, 1)
|
||||
|
||||
else if(istype(W, /obj/item/pen))
|
||||
var/str = copytext(sanitize(input(user,"Label text?","Set label","")),1,MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
to_chat(user, "<span class='notice'>Invalid text.</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] labels [src] as [str].</span>")
|
||||
name = "[name] ([str])"
|
||||
rename_interactive(user, W)
|
||||
|
||||
else if(istype(W, /obj/item/stack/wrapping_paper) && !giftwrapped)
|
||||
var/obj/item/stack/wrapping_paper/WP = W
|
||||
|
||||
Reference in New Issue
Block a user