Wire up client mobs to the spatial grid (#31330)

* Add client mobs to the spatial grid

* reviews

* apparently having a mob is not guaranteed
This commit is contained in:
Toastical
2026-01-10 22:20:36 +02:00
committed by GitHub
parent 7787a26328
commit 2df60ba208
6 changed files with 67 additions and 1 deletions
+1
View File
@@ -484,6 +484,7 @@
holder.owner = null
GLOB.admins -= src
mob?.become_uncliented()
GLOB.directory -= ckey
GLOB.clients -= src
#ifdef MULTIINSTANCE
+13 -1
View File
@@ -1491,6 +1491,19 @@ GLOBAL_LIST_INIT(holy_areas, typecacheof(list(
if(.)
set_typing_indicator(FALSE)
/// Cleanup proc that's called when a mob loses a client, either through client destroy or logout
/// Logout happens post client del, so we can't just copypaste this there. This keeps things clean and consistent
/mob/proc/become_uncliented()
if(!canon_client)
return
if(canon_client?.movingmob)
LAZYREMOVE(canon_client.movingmob.client_mobs_in_contents, src)
canon_client.movingmob = null
clear_important_client_contents()
canon_client = null
///Makes a call in the context of a different usr. Use sparingly
/world/proc/invoke_callback_with_usr(mob/user_mob, datum/callback/invoked_callback, ...)
var/temp = usr
@@ -1656,4 +1669,3 @@ GLOBAL_LIST_INIT(holy_areas, typecacheof(list(
. *= 0.5
if(5 to 6)
return 0
+3
View File
@@ -60,6 +60,9 @@
// For us, (1,1,1) is a space tile. This means roughly 200,000! calls to Move()
// You do not want this
canon_client = client
enable_client_mobs_in_contents(client)
SEND_SIGNAL(src, COMSIG_MOB_LOGIN)
reset_perspective(loc)
+1
View File
@@ -22,5 +22,6 @@
GLOB.discord_manager.send2discord_simple(DISCORD_WEBHOOK_MENTOR, "[key_name(src)] logged out - 0 active mentors, [mentorcounter[2]] non-mentor staff, [mentorcounter[3]] inactive mentors.")
..()
become_uncliented()
update_morgue()
return 1
+5
View File
@@ -8,6 +8,11 @@
pressure_resistance = 8
throwforce = 10
var/datum/mind/mind
/// The current client inhabiting this mob. Managed by login/logout
/// This exists so we can do cleanup in logout for occasions where a client was transfere rather then destroyed
/// We need to do this because the mob on logout never actually has a reference to client
/// We also need to clear this var/do other cleanup in client/Destroy, since that happens before logout
var/client/canon_client
blocks_emissive = EMISSIVE_BLOCK_GENERIC
rad_insulation_beta = RAD_MOB_INSULATION
rad_insulation_gamma = RAD_MOB_INSULATION