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>
This commit is contained in:
Watermelon914
2024-04-12 17:48:13 +00:00
committed by GitHub
parent 1456aecdb4
commit 64ddd492f7

View File

@@ -81,6 +81,10 @@ function SS13.register_signal(datum, signal, func)
if not SS13.istype(datum, "/datum") then
return
end
if not SS13.is_valid(datum) then
error("Tried to register a signal on a deleted datum!", 2)
return
end
local datumWeakRef = dm.global_proc("WEAKREF", datum)
if not __SS13_signal_handlers[datumWeakRef] then
__SS13_signal_handlers[datumWeakRef] = {}