mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
Fixes some lua problems, specifically with qdeling callbacks and adds lua utility functions (#77468)
## About The Pull Request See title. Callbacks were getting deleted in SS13.lua which is non-ideal. They should be automatically collected by the garbage collector. Also adds some utility lua functions like SS13.is_valid, SS13.stop_tracking, SS13.new_untracked, SS13.type and SS13.qdel ## Why It's Good For The Game Fixes some harddel issues, as well as callbacks clogging up the garbage subsystem. ## Changelog 🆑 admin: Added new lua functions: SS13.is_valid, SS13.stop_tracking, SS13.new_untracked, SS13.type and SS13.qdel /🆑 --------- Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
This commit is contained in:
co-authored by
Watermelon914
parent
616ef99954
commit
c4763f2621
@@ -168,10 +168,16 @@ GLOBAL_PROTECT(lua_usr)
|
||||
for(var/datum/lua_editor/editor as anything in editor_list)
|
||||
SStgui.update_uis(editor)
|
||||
|
||||
// Called by lua scripts when they add an atom to var/list/references so that it gets cleared up on delete.
|
||||
/// Called by lua scripts when they add an atom to var/list/references so that it gets cleared up on delete.
|
||||
/datum/lua_state/proc/clear_on_delete(datum/to_clear)
|
||||
RegisterSignal(to_clear, COMSIG_QDELETING, PROC_REF(on_delete))
|
||||
|
||||
/// Called by lua scripts when an atom they've added should soft delete and this state should stop tracking it.
|
||||
/// Needs to unregister all signals.
|
||||
/datum/lua_state/proc/let_soft_delete(datum/to_clear)
|
||||
UnregisterSignal(to_clear, COMSIG_QDELETING, PROC_REF(on_delete))
|
||||
references -= to_clear
|
||||
|
||||
/datum/lua_state/proc/on_delete(datum/to_clear)
|
||||
SIGNAL_HANDLER
|
||||
references -= to_clear
|
||||
|
||||
Reference in New Issue
Block a user