Porting some radial menu updates, and that one clown mask.

This commit is contained in:
Ghommie
2020-05-09 00:45:48 +02:00
parent 602154abe8
commit 88d86e53d0
10 changed files with 366 additions and 134 deletions

View File

@@ -6,17 +6,42 @@
icon_state = "cutout_basic"
w_class = WEIGHT_CLASS_BULKY
resistance_flags = FLAMMABLE
// Possible restyles for the cutout;
// add an entry in change_appearance() if you add to here
var/list/possible_appearances = list("Assistant", "Clown", "Mime",
"Traitor", "Nuke Op", "Cultist", "Brass Cultist", "Clockwork Cultist",
"Revolutionary", "Wizard", "Shadowling", "Xenomorph", "Xenomorph Maid", "Swarmer",
"Ash Walker", "Deathsquad Officer", "Ian", "Slaughter Demon",
"Laughter Demon", "Private Security Officer", "Securitron", "Gondola", "Monkey")
var/pushed_over = FALSE //If the cutout is pushed over and has to be righted
var/deceptive = FALSE //If the cutout actually appears as what it portray and not a discolored version
/// Possible restyles for the cutout, add an entry in change_appearance() if you add to here
var/static/list/possible_appearances
/// If the cutout is pushed over and has to be righted
var/pushed_over = FALSE
/// If the cutout actually appears as what it portray and not a discolored version
var/deceptive = FALSE
var/lastattacker = null
/obj/item/cardboard_cutout/Initialize()
. = ..()
if(possible_appearances)
return
possible_appearances = sortList(list(
"Assistant" = image(icon = src.icon, icon_state = "cutout_greytide"),
"Clown" = image(icon = src.icon, icon_state = "cutout_clown"),
"Mime" = image(icon = src.icon, icon_state = "cutout_mime"),
"Traitor" = image(icon = src.icon, icon_state = "cutout_traitor"),
"Nuke Op" = image(icon = src.icon, icon_state = "cutout_fluke"),
"Cultist" = image(icon = src.icon, icon_state = "cutout_cultist"),
"Brass Cultist" = image(icon = src.icon, icon_state = "cutout_servant"),
"Clockwork Cultist" = image(icon = src.icon, icon_state = "cutout_new_servant"),
"Revolutionary" = image(icon = src.icon, icon_state = "cutout_viva"),
"Wizard" = image(icon = src.icon, icon_state = "cutout_wizard"),
"Shadowling" = image(icon = src.icon, icon_state = "cutout_shadowling"),
"Xenomorph" = image(icon = src.icon, icon_state = "cutout_fukken_xeno"),
"Xenomorph Maid" = image(icon = src.icon, icon_state = "cutout_lusty"),
"Swarmer" = image(icon = src.icon, icon_state = "cutout_swarmer"),
"Ash Walker" = image(icon = src.icon, icon_state = "cutout_free_antag"),
"Deathsquad Officer" = image(icon = src.icon, icon_state = "cutout_deathsquad"),
"Ian" = image(icon = src.icon, icon_state = "cutout_ian"),
"Slaughter Demon" = image(icon = 'icons/mob/mob.dmi', icon_state = "daemon"),
"Laughter Demon" = image(icon = 'icons/mob/mob.dmi', icon_state = "bowmon"),
"Private Security Officer" = image(icon = src.icon, icon_state = "cutout_ntsec"),
"Securitron" = image(icon = src.icon, icon_state = "cutout_law"),
"Gondola" = image(icon = src.icon, icon_state = "cutout_gondola"),
"Monkey" = image(icon = src.icon, icon_state = "cutout_monky"),
))
//ATTACK HAND IGNORING PARENT RETURN VALUE
/obj/item/cardboard_cutout/attack_hand(mob/living/user)
@@ -76,22 +101,21 @@
push_over()
return BULLET_ACT_HIT
/**
* change_appearance: Changes a skin of the cardboard cutout based on a user's choice
*
* Arguments:
* * crayon The crayon used to change and recolor the cardboard cutout
* * user The mob choosing a skin of the cardboard cutout
*/
/obj/item/cardboard_cutout/proc/change_appearance(obj/item/toy/crayon/crayon, mob/living/user)
if(!crayon || !user)
return
if(pushed_over)
to_chat(user, "<span class='warning'>Right [src] first!</span>")
return
if(crayon.check_empty(user))
return
if(crayon.is_capped)
to_chat(user, "<span class='warning'>Take the cap off first!</span>")
return
var/new_appearance = input(user, "Choose a new appearance for [src].", "26th Century Deception") as null|anything in possible_appearances
if(!new_appearance || !crayon || !user.canUseTopic(src))
var/new_appearance = show_radial_menu(user, src, possible_appearances, custom_check = CALLBACK(src, .proc/check_menu, user, crayon), radius = 36, require_near = TRUE)
if(!new_appearance)
return
if(!do_after(user, 10, FALSE, src, TRUE))
return
return FALSE
if(!check_menu(user, crayon))
return FALSE
user.visible_message("<span class='notice'>[user] gives [src] a new look.</span>", "<span class='notice'>Voila! You give [src] a new look.</span>")
crayon.use_charges(1)
crayon.check_empty(user)
@@ -196,7 +220,33 @@
name = "monkey ([rand(1, 999)])"
desc = "A cardboard cutout of a monkey."
icon_state = "cutout_monky"
return 1
else
return FALSE
return TRUE
/**
* check_menu: Checks if we are allowed to interact with a radial menu
*
* Arguments:
* * user The mob interacting with a menu
* * crayon The crayon used to interact with a menu
*/
/obj/item/cardboard_cutout/proc/check_menu(mob/living/user, obj/item/toy/crayon/crayon)
if(!istype(user))
return FALSE
if(user.incapacitated())
return FALSE
if(pushed_over)
to_chat(user, "<span class='warning'>Right [src] first!</span>")
return FALSE
if(!crayon || !user.is_holding(crayon))
return FALSE
if(crayon.check_empty(user))
return FALSE
if(crayon.is_capped)
to_chat(user, "<span class='warning'>Take the cap off first!</span>")
return FALSE
return TRUE
/obj/item/cardboard_cutout/setDir(newdir)
dir = SOUTH

View File

@@ -850,12 +850,6 @@
#define NODESIGN "None"
#define NANOTRASEN "NanotrasenStandard"
#define SYNDI "SyndiSnacks"
#define HEART "Heart"
#define SMILEY "SmileyFace"
/obj/item/storage/box/papersack
name = "paper sack"
desc = "A sack neatly crafted out of paper."
@@ -863,7 +857,18 @@
item_state = "paperbag_None"
resistance_flags = FLAMMABLE
foldable = null
var/design = NODESIGN
/// A list of all available papersack reskins
var/list/papersack_designs = list()
/obj/item/storage/box/papersack/Initialize(mapload)
. = ..()
papersack_designs = sortList(list(
"None" = image(icon = src.icon, icon_state = "paperbag_None"),
"NanotrasenStandard" = image(icon = src.icon, icon_state = "paperbag_NanotrasenStandard"),
"SyndiSnacks" = image(icon = src.icon, icon_state = "paperbag_SyndiSnacks"),
"Heart" = image(icon = src.icon, icon_state = "paperbag_Heart"),
"SmileyFace" = image(icon = src.icon, icon_state = "paperbag_SmileyFace")
))
/obj/item/storage/box/papersack/update_icon_state()
if(contents.len == 0)
@@ -871,55 +876,64 @@
else
icon_state = "[item_state]_closed"
/obj/item/storage/box/papersack/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/pen))
//if a pen is used on the sack, dialogue to change its design appears
if(contents.len)
to_chat(user, "<span class='warning'>You can't modify [src] with items still inside!</span>")
return
var/list/designs = list(NODESIGN, NANOTRASEN, SYNDI, HEART, SMILEY, "Cancel")
var/switchDesign = input("Select a Design:", "Paper Sack Design", designs[1]) in designs
if(get_dist(usr, src) > 1)
to_chat(usr, "<span class='warning'>You have moved too far away!</span>")
return
var/choice = designs.Find(switchDesign)
if(design == designs[choice] || designs[choice] == "Cancel")
return 0
to_chat(usr, "<span class='notice'>You make some modifications to [src] using your pen.</span>")
design = designs[choice]
icon_state = "paperbag_[design]"
item_state = "paperbag_[design]"
switch(designs[choice])
if(NODESIGN)
var/choice = show_radial_menu(user, src , papersack_designs, custom_check = CALLBACK(src, .proc/check_menu, user, W), radius = 36, require_near = TRUE)
if(!choice)
return FALSE
if(icon_state == "paperbag_[choice]")
return FALSE
switch(choice)
if("None")
desc = "A sack neatly crafted out of paper."
if(NANOTRASEN)
if("NanotrasenStandard")
desc = "A standard Nanotrasen paper lunch sack for loyal employees on the go."
if(SYNDI)
if("SyndiSnacks")
desc = "The design on this paper sack is a remnant of the notorious 'SyndieSnacks' program."
if(HEART)
if("Heart")
desc = "A paper sack with a heart etched onto the side."
if(SMILEY)
if("SmileyFace")
desc = "A paper sack with a crude smile etched onto the side."
return 0
else
return FALSE
to_chat(user, "<span class='notice'>You make some modifications to [src] using your pen.</span>")
icon_state = "paperbag_[choice]"
item_state = "paperbag_[choice]"
return FALSE
else if(W.get_sharpness())
if(!contents.len)
if(item_state == "paperbag_None")
user.show_message("<span class='notice'>You cut eyeholes into [src].</span>", MSG_VISUAL)
new /obj/item/clothing/head/papersack(user.loc)
qdel(src)
return 0
return FALSE
else if(item_state == "paperbag_SmileyFace")
user.show_message("<span class='notice'>You cut eyeholes into [src] and modify the design.</span>", MSG_VISUAL)
new /obj/item/clothing/head/papersack/smiley(user.loc)
qdel(src)
return 0
return FALSE
return ..()
#undef NODESIGN
#undef NANOTRASEN
#undef SYNDI
#undef HEART
#undef SMILEY
/**
* check_menu: Checks if we are allowed to interact with a radial menu
*
* Arguments:
* * user The mob interacting with a menu
* * P The pen used to interact with a menu
*/
/obj/item/storage/box/papersack/proc/check_menu(mob/user, obj/item/pen/P)
if(!istype(user))
return FALSE
if(user.incapacitated())
return FALSE
if(contents.len)
to_chat(user, "<span class='warning'>You can't modify [src] with items still inside!</span>")
return FALSE
if(!P || !user.is_holding(P))
to_chat(user, "<span class='warning'>You need a pen to modify [src]!</span>")
return FALSE
return TRUE
/obj/item/storage/box/ingredients //This box is for the randomly chosen version the chef spawns with, it shouldn't actually exist.
name = "ingredients box"

View File

@@ -91,8 +91,13 @@
if (!is_ghost && !in_range(src, user))
return
var/list/tool_list = list(
"Up" = image(icon = 'icons/testing/turf_analysis.dmi', icon_state = "red_arrow", dir = NORTH),
"Down" = image(icon = 'icons/testing/turf_analysis.dmi', icon_state = "red_arrow", dir = SOUTH)
)
if (up && down)
var/result = alert("Go up or down [src]?", "Ladder", "Up", "Down", "Cancel")
var/result = show_radial_menu(user, src, tool_list, custom_check = CALLBACK(src, .proc/check_menu, user), require_near = TRUE, tooltips = TRUE)
if (!is_ghost && !in_range(src, user))
return // nice try
switch(result)
@@ -112,6 +117,11 @@
if(!is_ghost)
add_fingerprint(user)
/obj/structure/ladder/proc/check_menu(mob/user)
if(user.incapacitated() || !user.Adjacent(src))
return FALSE
return TRUE
/obj/structure/ladder/attack_hand(mob/user)
. = ..()
if(.)