mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
[MIRROR] go go gadget hat [MDB IGNORE] (#23758)
* go go gadget hat (#78293) ## About The Pull Request adds a hat that you can say a phrase for it to put something in your hands * go go gadget hat --------- Co-authored-by: jimmyl <70376633+mc-oofert@users.noreply.github.com>
This commit is contained in:
@@ -183,6 +183,7 @@
|
||||
new /obj/item/pinpointer/crew(src)
|
||||
new /obj/item/binoculars(src)
|
||||
new /obj/item/storage/box/rxglasses/spyglasskit(src)
|
||||
new /obj/item/clothing/head/fedora/inspector_hat(src)
|
||||
|
||||
/obj/structure/closet/secure_closet/injection
|
||||
name = "lethal injections"
|
||||
|
||||
@@ -206,6 +206,116 @@
|
||||
/obj/item/clothing/head/fedora/det_hat/minor
|
||||
flask_path = /obj/item/reagent_containers/cup/glass/flask/det/minor
|
||||
|
||||
///Detectives Fedora, but like Inspector Gadget. Not a subtype to not inherit candy corn stuff
|
||||
/obj/item/clothing/head/fedora/inspector_hat
|
||||
name = "inspector's fedora"
|
||||
desc = "There's only one man can try to stop an evil villian."
|
||||
armor_type = /datum/armor/fedora_det_hat
|
||||
icon_state = "detective"
|
||||
inhand_icon_state = "det_hat"
|
||||
dog_fashion = /datum/dog_fashion/head/detective
|
||||
///prefix our phrases must begin with
|
||||
var/prefix = "go go gadget"
|
||||
///an assoc list of phrase = item (like gun = revolver)
|
||||
var/list/items_by_phrase = list()
|
||||
///how many gadgets can we hold
|
||||
var/max_items = 4
|
||||
///items above this weight cannot be put in the hat
|
||||
var/max_weight = WEIGHT_CLASS_NORMAL
|
||||
|
||||
/obj/item/clothing/head/fedora/inspector_hat/Initialize(mapload)
|
||||
. = ..()
|
||||
become_hearing_sensitive(ROUNDSTART_TRAIT)
|
||||
QDEL_NULL(atom_storage)
|
||||
|
||||
/obj/item/clothing/head/fedora/inspector_hat/examine(mob/user)
|
||||
. = ..()
|
||||
. += span_notice("You can put items inside, and get them out by saying a phrase, or using it in-hand!")
|
||||
. += span_notice("The prefix is <b>[prefix]</b>, and you can change it with alt-click!\n")
|
||||
for(var/phrase in items_by_phrase)
|
||||
var/obj/item/item = items_by_phrase[phrase]
|
||||
. += span_notice("[icon2html(item, user)] You can remove [item] by saying <b>\"[prefix] [phrase]\"</b>!")
|
||||
|
||||
/obj/item/clothing/head/fedora/inspector_hat/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, list/message_mods = list(), message_range)
|
||||
. = ..()
|
||||
var/mob/living/carbon/wearer = loc
|
||||
if(!istype(wearer) || speaker != wearer) //if we are worn
|
||||
return FALSE
|
||||
|
||||
raw_message = htmlrendertext(raw_message)
|
||||
var/prefix_index = findtext(raw_message, prefix)
|
||||
if(prefix_index != 1)
|
||||
return FALSE
|
||||
|
||||
var/the_phrase = trim_left(replacetext(raw_message, prefix, ""))
|
||||
var/obj/item/result = items_by_phrase[the_phrase]
|
||||
if(!result)
|
||||
return FALSE
|
||||
|
||||
if(wearer.put_in_active_hand(result))
|
||||
wearer.visible_message(span_warning("[src] drops [result] into the hands of [wearer]!"))
|
||||
else
|
||||
balloon_alert(wearer, "cant put in hands!")
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/item/clothing/head/fedora/inspector_hat/attackby(obj/item/item, mob/user, params)
|
||||
. = ..()
|
||||
|
||||
if(LAZYLEN(contents) >= max_items)
|
||||
balloon_alert(user, "full!")
|
||||
return
|
||||
if(item.w_class > max_weight)
|
||||
balloon_alert(user, "too big!")
|
||||
return
|
||||
|
||||
var/input = tgui_input_text(user, "What is the activation phrase?", "Activation phrase", "gadget", max_length = 26)
|
||||
if(!input)
|
||||
return
|
||||
if(input in items_by_phrase)
|
||||
balloon_alert(user, "already used!")
|
||||
return
|
||||
|
||||
if(item.loc != user || !user.transferItemToLoc(item, src))
|
||||
return
|
||||
|
||||
to_chat(user, span_notice("You install [item] into the [thtotext(contents.len)] slot in [src]."))
|
||||
playsound(src, 'sound/machines/click.ogg', 30, TRUE)
|
||||
items_by_phrase[input] = item
|
||||
|
||||
/obj/item/clothing/head/fedora/inspector_hat/attack_self(mob/user)
|
||||
. = ..()
|
||||
var/phrase = tgui_input_list(user, "What item do you want to remove by phrase?", "Item Removal", items_by_phrase)
|
||||
if(!phrase)
|
||||
return
|
||||
user.put_in_inactive_hand(items_by_phrase[phrase])
|
||||
|
||||
/obj/item/clothing/head/fedora/inspector_hat/AltClick(mob/user)
|
||||
. = ..()
|
||||
var/new_prefix = tgui_input_text(user, "What should be the new prefix?", "Activation prefix", prefix, max_length = 24)
|
||||
if(!new_prefix)
|
||||
return
|
||||
prefix = new_prefix
|
||||
|
||||
/obj/item/clothing/head/fedora/inspector_hat/Exited(atom/movable/gone, direction)
|
||||
. = ..()
|
||||
for(var/phrase in items_by_phrase)
|
||||
var/obj/item/result = items_by_phrase[phrase]
|
||||
if(gone == result)
|
||||
items_by_phrase -= phrase
|
||||
return
|
||||
|
||||
/obj/item/clothing/head/fedora/inspector_hat/atom_destruction(damage_flag)
|
||||
for(var/phrase in items_by_phrase)
|
||||
var/obj/item/result = items_by_phrase[phrase]
|
||||
result.forceMove(drop_location())
|
||||
items_by_phrase = null
|
||||
return ..()
|
||||
|
||||
/obj/item/clothing/head/fedora/inspector_hat/Destroy()
|
||||
QDEL_LIST_ASSOC(items_by_phrase)
|
||||
return ..()
|
||||
|
||||
//Mime
|
||||
/obj/item/clothing/head/beret
|
||||
name = "beret"
|
||||
|
||||
Reference in New Issue
Block a user