From 0ab1d0cf38b08743fc04f84d6c1b479bb1d73bd0 Mon Sep 17 00:00:00 2001 From: Kocma-san Date: Thu, 28 Nov 2024 23:04:46 +0700 Subject: [PATCH] onenewbuttoninvv --- code/__DEFINES/~ff_defines/vv.dm | 1 + .../modules/extra_vv/extra_carbon_vv.dm | 33 +++++++++++++++++++ tgstation.dme | 2 ++ 3 files changed, 36 insertions(+) create mode 100644 code/__DEFINES/~ff_defines/vv.dm create mode 100644 tff_modular/modules/extra_vv/extra_carbon_vv.dm diff --git a/code/__DEFINES/~ff_defines/vv.dm b/code/__DEFINES/~ff_defines/vv.dm new file mode 100644 index 00000000000..38464b5fac4 --- /dev/null +++ b/code/__DEFINES/~ff_defines/vv.dm @@ -0,0 +1 @@ +#define VV_HK_GIVE_ADDICTION "give_addiction" diff --git a/tff_modular/modules/extra_vv/extra_carbon_vv.dm b/tff_modular/modules/extra_vv/extra_carbon_vv.dm new file mode 100644 index 00000000000..85566d8b1e0 --- /dev/null +++ b/tff_modular/modules/extra_vv/extra_carbon_vv.dm @@ -0,0 +1,33 @@ +/** + * EXTRA CARBON VV + */ +/mob/living/carbon/vv_get_dropdown() + . = ..() + VV_DROPDOWN_OPTION(VV_HK_GIVE_ADDICTION, "Give/Remove Addiction") + +/mob/living/carbon/vv_do_topic(list/href_list) + . = ..() + + if(href_list[VV_HK_GIVE_ADDICTION]) + if(!check_rights(R_VAREDIT)) + return + if(!mind) //Addictions are stored in the mind... + return + + switch(tgui_alert(usr, "Give or Remove addictions?", "Addictions", list("Give", "Remove", "Cancel"))) + if("Give") + var/chosen_addiction = input(usr, "Choose an addiction to add.", "Choose an addiction.") as null|anything in sort_list(SSaddiction.all_addictions, GLOBAL_PROC_REF(cmp_typepaths_asc)) + var/addiction_points = input(usr, "Choose the amount to add.\nAt least 600 are required to obtain an addiction.", "Choose the amount.", MAX_ADDICTION_POINTS) as num|null + if(chosen_addiction && addiction_points) + mind.add_addiction_points(chosen_addiction, addiction_points) + return + if("Remove") + if(!mind.active_addictions) + tgui_alert(usr, "No active addictions.", "Remove addictions") + return + var/chosen_addiction = input(usr, "Choose an addiction to remove.", "Choose an addiction.") as null|anything in sort_list(mind.active_addictions, GLOBAL_PROC_REF(cmp_typepaths_asc)) + if(chosen_addiction) + mind.remove_addiction_points(chosen_addiction, MAX_ADDICTION_POINTS) + return + if("Cancel") + return diff --git a/tgstation.dme b/tgstation.dme index 3af75c0408f..8ff313eb214 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -401,6 +401,7 @@ #include "code\__DEFINES\~ff_defines\nabber_clothes_pathes.dm" #include "code\__DEFINES\~ff_defines\say.dm" #include "code\__DEFINES\~ff_defines\text.dm" +#include "code\__DEFINES\~ff_defines\vv.dm" #include "code\__DEFINES\~ff_defines\__HELPERS\global_lists.dm" #include "code\__DEFINES\~ff_defines\__HELPERS\ishelpers.dm" #include "code\__DEFINES\~ff_defines\__HELPERS\names.dm" @@ -8808,6 +8809,7 @@ #include "tff_modular\modules\drinks\skrelluq\reaction.dm" #include "tff_modular\modules\drinks\skrelluq\reagent.dm" #include "tff_modular\modules\drone\code\droneDispenser.dm" +#include "tff_modular\modules\extra_vv\extra_carbon_vv.dm" #include "tff_modular\modules\holidays_decor\halloween\halloween-craft.dm" #include "tff_modular\modules\holidays_decor\halloween\halloween-decor.dm" #include "tff_modular\modules\holidays_decor\new_year\decorations.dm"