mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-10 23:54:14 +01:00
[MIRROR] Fixes SS13.register_signal throwing unclear errors when called on deleted datums (#27293)
* Cleans up the SS13_base lua file and adds a new lua file for easily handling multiple signals on different objects. (#82458) ## About The Pull Request Cleaned up the SS13.register_signal and SS13.unregister_signal, removing the weird list shifting. Also adds a new lua file that can be included for the use of registering different signals on various datums and being able to clear them all in 1 function. Removed the make_easy_clear_function option when registering a signal via lua because I don't think it's used by anyone and it lacks any sort of versatility. Users can just create their own function for clearing signals from a datum. Also updates the documentation for HARDDELETES.md as COMSIG_PARENT_QDELETING was renamed to COMSIG_QDELETING ## Why It's Good For The Game New handler file makes registering signals in batches a lot easier if you want to clear them in one go without clearing unrelated callbacks on the same datum. The list shifting in SS13.register_signal had pretty significant performance problems, so removing that will make registering and unregistering signals faster. ## Changelog 🆑 admin: LUA - Adds a new library called handler_group. Include it in your files by doing require('handler_group') /🆑 --------- Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com> * Fixes SS13.register_signal throwing unclear errors when called on deleted datums (#82597) ## About The Pull Request See title ## Why It's Good For The Game More descriptive error message ## Changelog 🆑 fix: LUA: Registering a signal on a deleted datum will throw a more descriptive error message. /🆑 --------- Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com> --------- Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
This commit is contained in:
@@ -109,14 +109,7 @@ GLOBAL_PROTECT(lua_usr)
|
||||
if(islist(function))
|
||||
var/list/new_function_path = list()
|
||||
for(var/path_element in function)
|
||||
if(isweakref(path_element))
|
||||
var/datum/weakref/weak_ref = path_element
|
||||
var/resolved = weak_ref.hard_resolve()
|
||||
if(!resolved)
|
||||
return list("status" = "errored", "param" = "Weakref in function path ([weak_ref] [text_ref(weak_ref)]) resolved to null.", "name" = jointext(function, "."))
|
||||
new_function_path += resolved
|
||||
else
|
||||
new_function_path += path_element
|
||||
new_function_path += path_element
|
||||
function = new_function_path
|
||||
var/msg = "[key_name(usr)] called the lua function \"[function]\" with arguments: [english_list(call_args)]"
|
||||
log_lua(msg)
|
||||
|
||||
Reference in New Issue
Block a user