mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-11 16:14:08 +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:
@@ -237,7 +237,7 @@
|
||||
|
||||
if (!input_message || !sending_and_receiving)
|
||||
return
|
||||
if(!user.canUseTopic(computer, be_close = TRUE))
|
||||
if(!user.can_perform_action(computer))
|
||||
return
|
||||
return sanitize(input_message)
|
||||
|
||||
@@ -400,7 +400,7 @@
|
||||
if(computer.active_program != src)
|
||||
if(!computer.open_program(usr, src))
|
||||
return
|
||||
if(!href_list["close"] && usr.canUseTopic(computer, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))
|
||||
if(!href_list["close"] && usr.can_perform_action(computer, FORBID_TELEKINESIS_REACH))
|
||||
switch(href_list["choice"])
|
||||
if("Message")
|
||||
send_message(usr, list(locate(href_list["target"])))
|
||||
|
||||
Reference in New Issue
Block a user