mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 08:08:49 +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:
@@ -80,7 +80,7 @@
|
||||
to_chat(user, span_notice("[src] linked to [C]."))
|
||||
|
||||
/obj/item/supplypod_beacon/AltClick(mob/user)
|
||||
if (!user.canUseTopic(src, !issilicon(user)))
|
||||
if (!user.can_perform_action(src, ALLOW_SILICON_REACH))
|
||||
return
|
||||
if (express_console)
|
||||
unlink_console()
|
||||
@@ -93,7 +93,7 @@
|
||||
var/new_beacon_name = tgui_input_text(user, "What would you like the tag to be?", "Beacon Tag", max_length = MAX_NAME_LEN)
|
||||
if(isnull(new_beacon_name))
|
||||
return
|
||||
if(!user.canUseTopic(src, be_close = TRUE))
|
||||
if(!user.can_perform_action(src))
|
||||
return
|
||||
name += " ([tag])"
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
to_chat(user, span_warning("You must be holding \the [src] to continue!"))
|
||||
return
|
||||
var/chosen_price = tgui_input_number(user, "Set price", "Price", new_custom_price)
|
||||
if(!chosen_price || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE) || loc != user)
|
||||
if(!chosen_price || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH) || loc != user)
|
||||
return
|
||||
new_custom_price = chosen_price
|
||||
to_chat(user, span_notice("[src] will now give things a [new_custom_price] cr tag."))
|
||||
|
||||
Reference in New Issue
Block a user