Skip to content

Commit

Permalink
[MIRROR] Add VV handlers for /mob/confused
Browse files Browse the repository at this point in the history
  • Loading branch information
SierraKomodo authored and SuhEugene committed Oct 11, 2023
1 parent 2db241f commit a2c90c5
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 @@ -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"
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 a2c90c5

Please sign in to comment.