Fixes Multitool Buffer Clearing and Adds Multitool Linking Balloon Alerts (#78309)

## About The Pull Request
I was working on a feature that required the buffer of a multitool to be
cleared out after linking two devices, when I noticed it wasn't possible
to clear the multitool's buffer. The change to multitools in #77639 made
it impossible to set the buffer of a multitool to null without
destroying the stored object, yet many objects still tried to have the
multitool clear it's buffer after a successful linkage. This creates a
new proc, clear_buffer() dedicated just to clearing the buffer of a
multitool.

Also made all of the multitool linkage messages balloon alerts.

If there's any issues or things I can improve please let me know, I'm a
bit new to BYOND and DM but I'm working on learning so I can make some
more ambitious projects! _(I think I got the signaling right)_
## Why It's Good For The Game
Some objects aren't meant to be saved in the multitool's buffer after
the initial linking, this should fix that.
Also balloon alerts are nice.
## Changelog
🆑
fix: Nanotrasen has finally recalled their faulty multitools and
replaced them with working ones! The multitool's buffer now properly
clears itself.
qol: Moved multitool link messages to balloon alerts
/🆑

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
Moose1002
2023-09-18 18:18:06 +00:00
committed by GitHub
co-authored by Ghom
parent 439b1dcdc0
commit 8464ef9727
17 changed files with 35 additions and 23 deletions
+14 -3
View File
@@ -41,14 +41,25 @@
user.visible_message(span_suicide("[user] puts the [src] to [user.p_their()] chest. It looks like [user.p_theyre()] trying to pulse [user.p_their()] heart off!"))
return OXYLOSS//theres a reason it wasn't recommended by doctors
/**
* Sets the multitool internal object buffer
*
* Arguments:
* * buffer - the new object to assign to the multitool's buffer
*/
/obj/item/multitool/proc/set_buffer(datum/buffer)
if(src.buffer)
UnregisterSignal(src.buffer, COMSIG_QDELETING)
if(QDELETED(buffer))
return
src.buffer = buffer
RegisterSignal(buffer, COMSIG_QDELETING, PROC_REF(on_buffer_del))
if(!QDELETED(buffer))
RegisterSignal(buffer, COMSIG_QDELETING, PROC_REF(on_buffer_del))
/**
* Called when the buffer's stored object is deleted
*
* This proc does not clear the buffer of the multitool, it is here to
* handle the deletion of the object the buffer references
*/
/obj/item/multitool/proc/on_buffer_del(datum/source)
SIGNAL_HANDLER
buffer = null