mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
Refactor, improve, and rename canUseTopic to be can_perform_action (#73434)
This builds on what #69790 did and improved the code even further. Notable things: - `Topic()` is a deprecated proc in our codebase (replaced with Javascript tgui) so it makes sense to rename `canUseTopic` to `can_perform_action` which is more straightforward in what it does. - Positional and named arguments have been converted into a easier to use `action_bitflag` - The bitflags adds some new checks you can use like: `NEED_GRAVITY | NEED_LITERACY | NEED_LIGHT` when you want to perform an action. - Redundant, duplicate, or dead code has been removed. - Fixes several runtimes where `canUseTopic` was being called without a proper target (IV drips, gibber, food processor) - Better documentation for the proc and bitflags with examples
This commit is contained in:
@@ -83,7 +83,7 @@
|
||||
safe_scan(user, atom_to_scan = A)
|
||||
return . | AFTERATTACK_PROCESSED_ITEM
|
||||
|
||||
/**
|
||||
/**
|
||||
* safe_scan - a wrapper proc for scan()
|
||||
*
|
||||
* calls scan(), and should a runtime occur within we can still reset the 'busy' state
|
||||
@@ -96,7 +96,7 @@
|
||||
balloon_alert(user, "scanner error!") // but in case it does, we 'error' instead of just bricking the scanner
|
||||
scanner_busy = FALSE
|
||||
|
||||
/**
|
||||
/**
|
||||
* scan - scans an atom for forensic data and outputs it to the mob holding the scanner
|
||||
*
|
||||
* This should always return TRUE barring a runtime
|
||||
@@ -107,7 +107,7 @@
|
||||
return TRUE
|
||||
|
||||
scanner_busy = TRUE
|
||||
|
||||
|
||||
|
||||
user.visible_message(
|
||||
span_notice("\The [user] points the [src.name] at \the [scanned_atom] and performs a forensic scan."),
|
||||
@@ -220,7 +220,7 @@
|
||||
|
||||
/obj/item/detective_scanner/AltClick(mob/living/user)
|
||||
// Best way for checking if a player can use while not incapacitated, etc
|
||||
if(!user.canUseTopic(src, be_close=TRUE))
|
||||
if(!user.can_perform_action(src))
|
||||
return
|
||||
if(!LAZYLEN(log))
|
||||
balloon_alert(user, "no logs!")
|
||||
|
||||
Reference in New Issue
Block a user