From 8ce7ac885429909ed061c43b34e49ca87ede044a Mon Sep 17 00:00:00 2001 From: Seris02 Date: Tue, 14 Jan 2020 22:10:41 +0800 Subject: [PATCH 1/3] custom reagent creampie --- code/__DEFINES/admin.dm | 1 + code/modules/admin/verbs/randomverbs.dm | 32 ++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/code/__DEFINES/admin.dm b/code/__DEFINES/admin.dm index 3acd1443af..268a367e2a 100644 --- a/code/__DEFINES/admin.dm +++ b/code/__DEFINES/admin.dm @@ -73,6 +73,7 @@ #define ADMIN_PUNISHMENT_SUPPLYPOD "Supply Pod" #define ADMIN_PUNISHMENT_MAZING "Puzzle" #define ADMIN_PUNISHMENT_PIE "Cream Pie" +#define ADMIN_PUNISHMENT_CUSTOM_PIE "Custom Cream Pie" #define AHELP_ACTIVE 1 #define AHELP_CLOSED 2 diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 1437555af1..e05f4ee255 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -1249,7 +1249,7 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits if(!check_rights(R_ADMIN) || !check_rights(R_FUN)) return - var/list/punishment_list = list(ADMIN_PUNISHMENT_PIE, ADMIN_PUNISHMENT_FIREBALL, ADMIN_PUNISHMENT_LIGHTNING, ADMIN_PUNISHMENT_BRAINDAMAGE, ADMIN_PUNISHMENT_BSA, ADMIN_PUNISHMENT_GIB, ADMIN_PUNISHMENT_SUPPLYPOD_QUICK, ADMIN_PUNISHMENT_SUPPLYPOD, ADMIN_PUNISHMENT_MAZING, ADMIN_PUNISHMENT_ROD) + var/list/punishment_list = list(ADMIN_PUNISHMENT_PIE, ADMIN_PUNISHMENT_CUSTOM_PIE, ADMIN_PUNISHMENT_FIREBALL, ADMIN_PUNISHMENT_LIGHTNING, ADMIN_PUNISHMENT_BRAINDAMAGE, ADMIN_PUNISHMENT_BSA, ADMIN_PUNISHMENT_GIB, ADMIN_PUNISHMENT_SUPPLYPOD_QUICK, ADMIN_PUNISHMENT_SUPPLYPOD, ADMIN_PUNISHMENT_MAZING, ADMIN_PUNISHMENT_ROD) var/punishment = input("Choose a punishment", "DIVINE SMITING") as null|anything in punishment_list @@ -1314,6 +1314,36 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits if(ADMIN_PUNISHMENT_PIE) var/obj/item/reagent_containers/food/snacks/pie/cream/nostun/creamy = new(get_turf(target)) creamy.splat(target) + if (ADMIN_PUNISHMENT_CUSTOM_PIE) + var/obj/item/reagent_containers/food/snacks/pie/cream/nostun/A = new(get_turf(target)) + if(!A.reagents) + var/amount = input(usr, "Specify the reagent size of [A]", "Set Reagent Size", 50) as num + if(amount) + A.create_reagents(amount) + if(A.reagents) + var/chosen_id + switch(alert(usr, "Choose a method.", "Add Reagents", "Search", "Choose from a list")) + if("Search") + var/valid_id + while(!valid_id) + chosen_id = input(usr, "Enter the ID of the reagent you want to add.", "Search reagents") as null|text + if(isnull(chosen_id)) //Get me out of here! + break + if(!ispath(text2path(chosen_id))) + chosen_id = pick_closest_path(chosen_id, make_types_fancy(subtypesof(/datum/reagent))) + if(ispath(chosen_id)) + valid_id = TRUE + else + valid_id = TRUE + if(!valid_id) + to_chat(usr, "A reagent with that ID doesn't exist!") + if("Choose from a list") + chosen_id = input(usr, "Choose a reagent to add.", "Choose a reagent.") as null|anything in subtypesof(/datum/reagent) + if(chosen_id) + var/amount = input(usr, "Choose the amount to add.", "Choose the amount.", A.reagents.maximum_volume) as num + if(amount) + A.reagents.add_reagent(chosen_id, amount) + A.splat(target) punish_log(target, punishment) From 0ea3e275e33843e93f702ad4a46aba5f140bbd56 Mon Sep 17 00:00:00 2001 From: Seris02 Date: Sun, 19 Jan 2020 16:54:46 +0800 Subject: [PATCH 2/3] yep --- code/__HELPERS/reagents.dm | 21 +++++++++++++++++++++ code/datums/datumvars.dm | 21 +-------------------- code/modules/admin/verbs/randomverbs.dm | 19 +------------------ 3 files changed, 23 insertions(+), 38 deletions(-) diff --git a/code/__HELPERS/reagents.dm b/code/__HELPERS/reagents.dm index f1208abdd3..49d6b5825e 100644 --- a/code/__HELPERS/reagents.dm +++ b/code/__HELPERS/reagents.dm @@ -72,3 +72,24 @@ if(!GLOB.chemical_reactions_list[primary_reagent]) GLOB.chemical_reactions_list[primary_reagent] = list() GLOB.chemical_reactions_list[primary_reagent] += R + +/proc/choose_reagent_id(mob/user) + var/chosen_id + switch(alert(user, "Choose a method.", "Add Reagents", "Search", "Choose from a list")) + if("Search") + var/valid_id + while(!valid_id) + chosen_id = input(user, "Enter the ID of the reagent you want to add.", "Search reagents") as null|text + if(isnull(chosen_id)) //Get me out of here! + break + if(!ispath(text2path(chosen_id))) + chosen_id = pick_closest_path(chosen_id, make_types_fancy(subtypesof(/datum/reagent))) + if(ispath(chosen_id)) + valid_id = TRUE + else + valid_id = TRUE + if(!valid_id) + to_chat(user, "A reagent with that ID doesn't exist!") + if("Choose from a list") + chosen_id = input(user, "Choose a reagent to add.", "Choose a reagent.") as null|anything in subtypesof(/datum/reagent) + return chosen_id \ No newline at end of file diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index 5caa491e4c..26a0ba71b3 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -946,26 +946,7 @@ A.create_reagents(amount) if(A.reagents) - var/chosen_id - switch(alert(usr, "Choose a method.", "Add Reagents", "Search", "Choose from a list", "I'm feeling lucky")) - if("Search") - var/valid_id - while(!valid_id) - chosen_id = input(usr, "Enter the ID of the reagent you want to add.", "Search reagents") as null|text - if(isnull(chosen_id)) //Get me out of here! - break - if(!ispath(text2path(chosen_id))) - chosen_id = pick_closest_path(chosen_id, make_types_fancy(subtypesof(/datum/reagent))) - if(ispath(chosen_id)) - valid_id = TRUE - else - valid_id = TRUE - if(!valid_id) - to_chat(usr, "A reagent with that ID doesn't exist!") - if("Choose from a list") - chosen_id = input(usr, "Choose a reagent to add.", "Choose a reagent.") as null|anything in subtypesof(/datum/reagent) - if("I'm feeling lucky") - chosen_id = pick(subtypesof(/datum/reagent)) + var/chosen_id = choose_reagent_id(usr) if(chosen_id) var/amount = input(usr, "Choose the amount to add.", "Choose the amount.", A.reagents.maximum_volume) as num if(amount) diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index e05f4ee255..8b20eabb1b 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -1321,24 +1321,7 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits if(amount) A.create_reagents(amount) if(A.reagents) - var/chosen_id - switch(alert(usr, "Choose a method.", "Add Reagents", "Search", "Choose from a list")) - if("Search") - var/valid_id - while(!valid_id) - chosen_id = input(usr, "Enter the ID of the reagent you want to add.", "Search reagents") as null|text - if(isnull(chosen_id)) //Get me out of here! - break - if(!ispath(text2path(chosen_id))) - chosen_id = pick_closest_path(chosen_id, make_types_fancy(subtypesof(/datum/reagent))) - if(ispath(chosen_id)) - valid_id = TRUE - else - valid_id = TRUE - if(!valid_id) - to_chat(usr, "A reagent with that ID doesn't exist!") - if("Choose from a list") - chosen_id = input(usr, "Choose a reagent to add.", "Choose a reagent.") as null|anything in subtypesof(/datum/reagent) + var/chosen_id = choose_reagent_id(usr) if(chosen_id) var/amount = input(usr, "Choose the amount to add.", "Choose the amount.", A.reagents.maximum_volume) as num if(amount) From 70c41e5bd7052dbb6e04459bc693abcde0a8bb06 Mon Sep 17 00:00:00 2001 From: Seris02 Date: Fri, 31 Jan 2020 15:08:16 +0800 Subject: [PATCH 3/3] happy now --- code/__HELPERS/reagents.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/__HELPERS/reagents.dm b/code/__HELPERS/reagents.dm index 49d6b5825e..50c866b30b 100644 --- a/code/__HELPERS/reagents.dm +++ b/code/__HELPERS/reagents.dm @@ -75,7 +75,7 @@ /proc/choose_reagent_id(mob/user) var/chosen_id - switch(alert(user, "Choose a method.", "Add Reagents", "Search", "Choose from a list")) + switch(alert(user, "Choose a method.", "Add Reagents", "Search", "Choose from a list", "I'm feeling lucky")) if("Search") var/valid_id while(!valid_id) @@ -92,4 +92,6 @@ to_chat(user, "A reagent with that ID doesn't exist!") if("Choose from a list") chosen_id = input(user, "Choose a reagent to add.", "Choose a reagent.") as null|anything in subtypesof(/datum/reagent) + if("I'm feeling lucky") + chosen_id = pick(subtypesof(/datum/reagent)) return chosen_id \ No newline at end of file