mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-06 15:02:29 +00:00
* Changes the values of the pen colour variable from color name to hexadecimal (#65553) About The Pull Request See the title. Hexadecimal values are better than color names for programming since they can be sanitized and are more easily converted to RGB(A) or HSV. Color names aren't really meant to be used in some functions and methods about colors. TL;DR: color names don't work with the Color common package in the TGUI folder. Why It's Good For The Game This will remove the need of a hacky bandaid from /obj/item/canvas/proc/get_paint_tool_color that only covers about half the pen colors anyway. Changelog cl fix: Fixed certain pens breaking painting on a canvas because of their peculiar colors. /cl * Changes the values of the pen colour variable from color name to hexadecimal. Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
318 lines
11 KiB
Plaintext
318 lines
11 KiB
Plaintext
/* Pens!
|
|
* Contains:
|
|
* Pens
|
|
* Sleepy Pens
|
|
* Parapens
|
|
* Edaggers
|
|
*/
|
|
|
|
|
|
/*
|
|
* Pens
|
|
*/
|
|
/obj/item/pen
|
|
desc = "It's a normal black ink pen."
|
|
name = "pen"
|
|
icon = 'icons/obj/bureaucracy.dmi'
|
|
icon_state = "pen"
|
|
inhand_icon_state = "pen"
|
|
worn_icon_state = "pen"
|
|
slot_flags = ITEM_SLOT_BELT | ITEM_SLOT_EARS
|
|
throwforce = 0
|
|
w_class = WEIGHT_CLASS_TINY
|
|
throw_speed = 3
|
|
throw_range = 7
|
|
custom_materials = list(/datum/material/iron=10)
|
|
pressure_resistance = 2
|
|
grind_results = list(/datum/reagent/iron = 2, /datum/reagent/iodine = 1)
|
|
var/colour = "#000000" //what colour the ink is!
|
|
var/degrees = 0
|
|
var/font = PEN_FONT
|
|
embedding = list(embed_chance = 50)
|
|
sharpness = SHARP_POINTY
|
|
|
|
/obj/item/pen/suicide_act(mob/user)
|
|
user.visible_message(span_suicide("[user] is scribbling numbers all over [user.p_them()]self with [src]! It looks like [user.p_theyre()] trying to commit sudoku..."))
|
|
return(BRUTELOSS)
|
|
|
|
/obj/item/pen/blue
|
|
desc = "It's a normal blue ink pen."
|
|
icon_state = "pen_blue"
|
|
colour = "#0000FF"
|
|
|
|
/obj/item/pen/red
|
|
desc = "It's a normal red ink pen."
|
|
icon_state = "pen_red"
|
|
colour = "#FF0000"
|
|
throw_speed = 4 // red ones go faster (in this case, fast enough to embed!)
|
|
|
|
/obj/item/pen/invisible
|
|
desc = "It's an invisible pen marker."
|
|
icon_state = "pen"
|
|
colour = "#FFFFFF"
|
|
|
|
/obj/item/pen/fourcolor
|
|
desc = "It's a fancy four-color ink pen, set to black."
|
|
name = "four-color pen"
|
|
icon_state = "pen_4color"
|
|
colour = "#000000"
|
|
|
|
/obj/item/pen/fourcolor/attack_self(mob/living/carbon/user)
|
|
. = ..()
|
|
var/chosen_color = "black"
|
|
switch(colour)
|
|
if("#000000")
|
|
colour = "#FF0000"
|
|
chosen_color = "red"
|
|
throw_speed++
|
|
if("#FF0000")
|
|
colour = "#00FF00"
|
|
chosen_color = "green"
|
|
throw_speed = initial(throw_speed)
|
|
if("#00FF00")
|
|
colour = "#0000FF"
|
|
chosen_color = "blue"
|
|
else
|
|
colour = "#000000"
|
|
to_chat(user, span_notice("\The [src] will now write in [chosen_color]."))
|
|
desc = "It's a fancy four-color ink pen, set to [chosen_color]."
|
|
|
|
/obj/item/pen/fountain
|
|
name = "fountain pen"
|
|
desc = "It's a common fountain pen, with a faux wood body."
|
|
icon_state = "pen-fountain"
|
|
font = FOUNTAIN_PEN_FONT
|
|
|
|
/obj/item/pen/charcoal
|
|
name = "charcoal stylus"
|
|
desc = "It's just a wooden stick with some compressed ash on the end. At least it can write."
|
|
icon_state = "pen-charcoal"
|
|
colour = "#696969"
|
|
font = CHARCOAL_FONT
|
|
custom_materials = null
|
|
grind_results = list(/datum/reagent/ash = 5, /datum/reagent/cellulose = 10)
|
|
|
|
/datum/crafting_recipe/charcoal_stylus
|
|
name = "Charcoal Stylus"
|
|
result = /obj/item/pen/charcoal
|
|
reqs = list(/obj/item/stack/sheet/mineral/wood = 1, /datum/reagent/ash = 30)
|
|
time = 30
|
|
category = CAT_PRIMAL
|
|
|
|
/obj/item/pen/fountain/captain
|
|
name = "captain's fountain pen"
|
|
desc = "It's an expensive Oak fountain pen. The nib is quite sharp."
|
|
icon_state = "pen-fountain-o"
|
|
force = 5
|
|
throwforce = 5
|
|
throw_speed = 4
|
|
colour = "#DC143C"
|
|
custom_materials = list(/datum/material/gold = 750)
|
|
sharpness = SHARP_EDGED
|
|
resistance_flags = FIRE_PROOF
|
|
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"
|
|
)
|
|
embedding = list("embed_chance" = 75)
|
|
|
|
/obj/item/pen/fountain/captain/Initialize(mapload)
|
|
. = ..()
|
|
AddComponent(/datum/component/butchering, 200, 115) //the pen is mightier than the sword
|
|
|
|
/obj/item/pen/fountain/captain/reskin_obj(mob/M)
|
|
..()
|
|
if(current_skin)
|
|
desc = "It's an expensive [current_skin] fountain pen. The nib is quite sharp."
|
|
|
|
/obj/item/pen/attack_self(mob/living/carbon/user)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
if(loc != user)
|
|
to_chat(user, span_warning("You must be holding the pen to continue!"))
|
|
return
|
|
var/deg = tgui_input_number(user, "What angle would you like to rotate the pen head to? (0-360)", "Rotate Pen Head", max_value = 360)
|
|
if(isnull(deg) || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK) || loc != user)
|
|
return
|
|
degrees = deg
|
|
to_chat(user, span_notice("You rotate the top of the pen to [deg] degrees."))
|
|
SEND_SIGNAL(src, COMSIG_PEN_ROTATED, deg, user)
|
|
|
|
/obj/item/pen/attack(mob/living/M, mob/user, params)
|
|
if(force) // If the pen has a force value, call the normal attack procs. Used for e-daggers and captain's pen mostly.
|
|
return ..()
|
|
if(!M.try_inject(user, injection_flags = INJECT_TRY_SHOW_ERROR_MESSAGE))
|
|
return FALSE
|
|
to_chat(user, span_warning("You stab [M] with the pen."))
|
|
to_chat(M, span_danger("You feel a tiny prick!"))
|
|
log_combat(user, M, "stabbed", src)
|
|
return TRUE
|
|
|
|
/obj/item/pen/afterattack(obj/O, mob/living/user, proximity)
|
|
. = ..()
|
|
//Changing name/description of items. Only works if they have the UNIQUE_RENAME object flag set
|
|
if(isobj(O) && proximity && (O.obj_flags & UNIQUE_RENAME))
|
|
var/penchoice = tgui_input_list(user, "What would you like to edit?", "Pen Setting", list("Rename", "Description", "Reset"))
|
|
if(QDELETED(O) || !user.canUseTopic(O, BE_CLOSE))
|
|
return
|
|
if(penchoice == "Rename")
|
|
var/input = tgui_input_text(user, "What do you want to name [O]?", "Object Name", "[O.name]", MAX_NAME_LEN)
|
|
var/oldname = O.name
|
|
if(QDELETED(O) || !user.canUseTopic(O, BE_CLOSE))
|
|
return
|
|
if(input == oldname || !input)
|
|
to_chat(user, span_notice("You changed [O] to... well... [O]."))
|
|
else
|
|
O.AddComponent(/datum/component/rename, input, O.desc)
|
|
var/datum/component/label/label = O.GetComponent(/datum/component/label)
|
|
if(label)
|
|
label.remove_label()
|
|
label.apply_label()
|
|
to_chat(user, span_notice("You have successfully renamed \the [oldname] to [O]."))
|
|
O.renamedByPlayer = TRUE
|
|
|
|
if(penchoice == "Description")
|
|
var/input = tgui_input_text(user, "Describe [O]", "Description", "[O.desc]", 140)
|
|
var/olddesc = O.desc
|
|
if(QDELETED(O) || !user.canUseTopic(O, BE_CLOSE))
|
|
return
|
|
if(input == olddesc || !input)
|
|
to_chat(user, span_notice("You decide against changing [O]'s description."))
|
|
else
|
|
O.AddComponent(/datum/component/rename, O.name, input)
|
|
to_chat(user, span_notice("You have successfully changed [O]'s description."))
|
|
O.renamedByPlayer = TRUE
|
|
|
|
if(penchoice == "Reset")
|
|
if(QDELETED(O) || !user.canUseTopic(O, BE_CLOSE))
|
|
return
|
|
|
|
qdel(O.GetComponent(/datum/component/rename))
|
|
|
|
//reapply any label to name
|
|
var/datum/component/label/label = O.GetComponent(/datum/component/label)
|
|
if(label)
|
|
label.remove_label()
|
|
label.apply_label()
|
|
|
|
to_chat(user, span_notice("You have successfully reset [O]'s name and description."))
|
|
O.renamedByPlayer = FALSE
|
|
|
|
/*
|
|
* Sleepypens
|
|
*/
|
|
|
|
/obj/item/pen/sleepy/attack(mob/living/M, mob/user, params)
|
|
. = ..()
|
|
if(!.)
|
|
return
|
|
if(!reagents.total_volume)
|
|
return
|
|
if(!M.reagents)
|
|
return
|
|
reagents.trans_to(M, reagents.total_volume, transfered_by = user, methods = INJECT)
|
|
|
|
|
|
/obj/item/pen/sleepy/Initialize(mapload)
|
|
. = ..()
|
|
create_reagents(45, OPENCONTAINER)
|
|
reagents.add_reagent(/datum/reagent/toxin/chloralhydrate, 20)
|
|
reagents.add_reagent(/datum/reagent/toxin/mutetoxin, 15)
|
|
reagents.add_reagent(/datum/reagent/toxin/staminatoxin, 10)
|
|
|
|
/*
|
|
* (Alan) Edaggers
|
|
*/
|
|
/obj/item/pen/edagger
|
|
attack_verb_continuous = list("slashes", "stabs", "slices", "tears", "lacerates", "rips", "dices", "cuts") //these won't show up if the pen is off
|
|
attack_verb_simple = list("slash", "stab", "slice", "tear", "lacerate", "rip", "dice", "cut")
|
|
sharpness = SHARP_POINTY
|
|
/// The real name of our item when extended.
|
|
var/hidden_name = "energy dagger"
|
|
/// The real desc of our item when extended.
|
|
var/hidden_desc = "It's a normal black ink pen."
|
|
/// The real icons used when extended.
|
|
var/hidden_icon = "edagger"
|
|
/// Whether or pen is extended
|
|
var/extended = FALSE
|
|
|
|
/obj/item/pen/edagger/Initialize(mapload)
|
|
. = ..()
|
|
AddComponent(/datum/component/butchering, _speed = 6 SECONDS, _butcher_sound = 'sound/weapons/blade1.ogg')
|
|
AddComponent(/datum/component/transforming, \
|
|
force_on = 18, \
|
|
throwforce_on = 35, \
|
|
throw_speed_on = 4, \
|
|
sharpness_on = SHARP_EDGED, \
|
|
w_class_on = WEIGHT_CLASS_NORMAL)
|
|
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, .proc/on_transform)
|
|
|
|
/obj/item/pen/edagger/suicide_act(mob/user)
|
|
. = BRUTELOSS
|
|
if(extended)
|
|
user.visible_message(span_suicide("[user] forcefully rams the pen into their mouth!"))
|
|
else
|
|
user.visible_message(span_suicide("[user] is holding a pen up to their mouth! It looks like [user.p_theyre()] trying to commit suicide!"))
|
|
attack_self(user)
|
|
|
|
/*
|
|
* Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM].
|
|
*
|
|
* Handles swapping their icon files to edagger related icon files -
|
|
* as they're supposed to look like a normal pen.
|
|
*/
|
|
/obj/item/pen/edagger/proc/on_transform(obj/item/source, mob/user, active)
|
|
SIGNAL_HANDLER
|
|
|
|
extended = active
|
|
if(active)
|
|
name = hidden_name
|
|
desc = hidden_desc
|
|
icon_state = hidden_icon
|
|
inhand_icon_state = hidden_icon
|
|
lefthand_file = 'icons/mob/inhands/weapons/swords_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/weapons/swords_righthand.dmi'
|
|
embedding = list(embed_chance = 100) // Rule of cool
|
|
else
|
|
name = initial(name)
|
|
desc = initial(desc)
|
|
icon_state = initial(icon_state)
|
|
inhand_icon_state = initial(inhand_icon_state)
|
|
lefthand_file = initial(lefthand_file)
|
|
righthand_file = initial(righthand_file)
|
|
embedding = list(embed_chance = EMBED_CHANCE)
|
|
|
|
updateEmbedding()
|
|
balloon_alert(user, "[hidden_name] [active ? "active":"concealed"]")
|
|
playsound(user ? user : src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 5, TRUE)
|
|
return COMPONENT_NO_DEFAULT_MESSAGE
|
|
|
|
///syndicate prototype for smuggling missions
|
|
/obj/item/pen/edagger/prototype
|
|
name = "odd pen"
|
|
desc = "It's an abnormal black ink pen, with weird chunks of metal sticking out of it..."
|
|
hidden_name = "prototype hardlight dagger"
|
|
hidden_desc = "Waffle Corp R&D's prototype for energy daggers. Hardlight may be inferior \
|
|
to energy weapons, but it's still surprisingly deadly."
|
|
hidden_icon = "eprototypedagger"
|
|
|
|
/obj/item/pen/survival
|
|
name = "survival pen"
|
|
desc = "The latest in portable survival technology, this pen was designed as a miniature diamond pickaxe. Watchers find them very desirable for their diamond exterior."
|
|
icon = 'icons/obj/bureaucracy.dmi'
|
|
icon_state = "digging_pen"
|
|
inhand_icon_state = "pen"
|
|
worn_icon_state = "pen"
|
|
force = 3
|
|
w_class = WEIGHT_CLASS_TINY
|
|
custom_materials = list(/datum/material/iron=10, /datum/material/diamond=100, /datum/material/titanium = 10)
|
|
pressure_resistance = 2
|
|
grind_results = list(/datum/reagent/iron = 2, /datum/reagent/iodine = 1)
|
|
tool_behaviour = TOOL_MINING //For the classic "digging out of prison with a spoon but you're in space so this analogy doesn't work" situation.
|
|
toolspeed = 10 //You will never willingly choose to use one of these over a shovel.
|
|
font = FOUNTAIN_PEN_FONT
|
|
colour = "#0000FF"
|