Skip to content

Commit

Permalink
Merge pull request Baystation12#34222 from SierraKomodo/refactor/conf…
Browse files Browse the repository at this point in the history
…used-vv-handler

Add VV handlers for /mob/confused
  • Loading branch information
Spookerton authored Oct 11, 2023
2 parents 1ec7b45 + 11094e7 commit 65df214
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2089,6 +2089,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"
Expand Down
5 changes: 5 additions & 0 deletions code/_helpers/functional.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions code/modules/mob/vv_handlers.dm
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 65df214

Please sign in to comment.