event based incapicated and able_to_run (#86031)

## About The Pull Request
this is a revival of #82635 . i got permission from potato to reopen
this, he did almost all the work. i only just solved the conflicts and
fixed all the bugs that were preventing the original from being merged
(but it should be TMed first)

## Why It's Good For The Game
slightly improves the performance of basic mob AI

## Changelog
🆑
LemonInTheDark
refactor: able_to_run and incapacitated have been refactored to be event
based
/🆑

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: ZephyrTFA <matthew@tfaluc.com>
This commit is contained in:
Ben10Omintrix
2024-09-04 10:02:49 -04:00
committed by GitHub
co-authored by LemonInTheDark ZephyrTFA
parent 8fe62dac3d
commit 91baa94ac5
170 changed files with 446 additions and 307 deletions
+2 -2
View File
@@ -17,8 +17,8 @@
if(!pick)
return
var/part_reference = display_names[pick]
var/obj/item/part = locate(part_reference) in parts
if(!istype(part) || user.incapacitated())
var/obj/item/part = locate(part_reference) in mod_parts
if(!istype(part) || user.incapacitated)
return
if(active || activating)
balloon_alert(user, "deactivate the suit first!")
+1 -1
View File
@@ -233,7 +233,7 @@
balloon_alert(wearer, "retract parts first!")
playsound(src, 'sound/machines/scanbuzz.ogg', 25, FALSE, SILENCED_SOUND_EXTRARANGE)
return
if(!wearer.incapacitated())
if(!wearer.incapacitated)
var/atom/movable/screen/inventory/hand/ui_hand = over_object
if(wearer.putItemFromInventoryInHandIfPossible(src, ui_hand.held_index))
add_fingerprint(user)
+1 -1
View File
@@ -126,7 +126,7 @@
mod.theme.set_skin(mod, pick)
/obj/item/mod/paint/proc/check_menu(obj/item/mod/control/mod, mob/user)
if(user.incapacitated() || !user.is_holding(src) || !mod || mod.active || mod.activating)
if(user.incapacitated || !user.is_holding(src) || !mod || mod.active || mod.activating)
return FALSE
return TRUE
+1 -1
View File
@@ -200,7 +200,7 @@
/// Called when an activated module without a device is used
/obj/item/mod/module/proc/on_select_use(atom/target)
if(!(allow_flags & MODULE_ALLOW_INCAPACITATED) && mod.wearer.incapacitated(IGNORE_GRAB))
if(!(allow_flags & MODULE_ALLOW_INCAPACITATED) && INCAPACITATED_IGNORING(mod.wearer, INCAPABLE_GRAB))
return FALSE
mod.wearer.face_atom(target)
if(!used())
+1 -1
View File
@@ -67,7 +67,7 @@
clear_grab(playsound = !deleting)
/obj/item/mod/module/anomaly_locked/kinesis/process(seconds_per_tick)
if(!mod.wearer.client || mod.wearer.incapacitated(IGNORE_GRAB))
if(!mod.wearer.client || INCAPACITATED_IGNORING(mod.wearer, INCAPABLE_GRAB))
clear_grab()
return
if(!range_check(grabbed_atom))