From a2c90c56551d46c81802cb4ab49ab4029e1b2c20 Mon Sep 17 00:00:00 2001 From: SierraKomodo <11140088+SierraKomodo@users.noreply.github.com> Date: Wed, 11 Oct 2023 18:32:35 +0300 Subject: [PATCH] [MIRROR] Add VV handlers for /mob/confused --- baystation12.dme | 1 + code/_helpers/functional.dm | 5 +++++ code/modules/mob/vv_handlers.dm | 9 +++++++++ 3 files changed, 15 insertions(+) create mode 100644 code/modules/mob/vv_handlers.dm diff --git a/baystation12.dme b/baystation12.dme index a89c50930b9db..d5a4062b76e0a 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -2090,6 +2090,7 @@ #include "code\modules\mob\say.dm" #include "code\modules\mob\transform_procs.dm" #include "code\modules\mob\update_icons.dm" +#include "code\modules\mob\vv_handlers.dm" #include "code\modules\mob\grab\grab_datum.dm" #include "code\modules\mob\grab\grab_object.dm" #include "code\modules\mob\grab\grab_readme.dm" diff --git a/code/_helpers/functional.dm b/code/_helpers/functional.dm index 6663a19ccc6ab..44ad12c2273c3 100644 --- a/code/_helpers/functional.dm +++ b/code/_helpers/functional.dm @@ -42,6 +42,11 @@ if(!. && feedback_receiver) to_chat(feedback_receiver, SPAN_WARNING("Value must be a numeral.")) +/proc/is_int_predicate(value, feedback_receiver) + . = value == round(value) + if (!. && feedback_receiver) + to_chat(feedback_receiver, SPAN_WARNING("Value must be a whole number.")) + /proc/is_non_zero_predicate(value, feedback_receiver) . = value != 0 if (!. && feedback_receiver) diff --git a/code/modules/mob/vv_handlers.dm b/code/modules/mob/vv_handlers.dm new file mode 100644 index 0000000000000..c151ffffada3f --- /dev/null +++ b/code/modules/mob/vv_handlers.dm @@ -0,0 +1,9 @@ +/singleton/vv_set_handler/mob_confused + handled_type = /mob + predicates = list(/proc/is_num_predicate, /proc/is_non_negative_predicate, /proc/is_int_predicate) + handled_vars = list("confused") + + +/singleton/vv_set_handler/mob_confused/handle_set_var(datum/O, variable, var_value, client) + var/mob/mob = O + mob.set_confused(var_value)