mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-29 19:11:51 +00:00
Support for null loc pool-gets + Pooling Miauw's Say() virtualspeakers
This commit is contained in:
@@ -213,7 +213,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
|
||||
|
||||
var/list/radios = list()
|
||||
|
||||
var/atom/movable/virtualspeaker/virt = new(null)
|
||||
var/atom/movable/virtualspeaker/virt = PoolOrNew(/atom/movable/virtualspeaker,null)
|
||||
virt.name = name
|
||||
virt.job = job
|
||||
virt.languages = AM.languages
|
||||
@@ -295,7 +295,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
|
||||
blackbox.messages += blackbox_msg
|
||||
|
||||
spawn(50)
|
||||
qdel(virt)
|
||||
PlaceInPool(virt)
|
||||
|
||||
/proc/Broadcast_SimpleMessage(var/source, var/frequency, var/text, var/data, var/mob/M, var/compression, var/level)
|
||||
|
||||
|
||||
@@ -21,14 +21,21 @@ var/global/list/GlobalPool = list()
|
||||
//Goes into the pool
|
||||
|
||||
/proc/PoolOrNew(var/get_type,var/new_loc)
|
||||
if(!get_type || !new_loc)
|
||||
if(!get_type)
|
||||
return
|
||||
|
||||
var/atom/movable/AM = GetFromPool(get_type,new_loc)
|
||||
var/atom/movable/AM
|
||||
if(new_loc)
|
||||
AM = GetFromPool(get_type,new_loc)
|
||||
else
|
||||
AM = GetFromPool(get_type,null)
|
||||
|
||||
if(!AM)
|
||||
if(ispath(get_type))
|
||||
if(new_loc)
|
||||
AM = new get_type (new_loc)
|
||||
else
|
||||
AM = new get_type (null)
|
||||
|
||||
if(AM)
|
||||
return AM
|
||||
@@ -36,7 +43,7 @@ var/global/list/GlobalPool = list()
|
||||
|
||||
|
||||
/proc/GetFromPool(var/get_type,var/new_loc)
|
||||
if(!get_type || !new_loc)
|
||||
if(!get_type)
|
||||
return 0
|
||||
|
||||
if(isnull(GlobalPool[get_type]))
|
||||
@@ -48,6 +55,7 @@ var/global/list/GlobalPool = list()
|
||||
var/atom/movable/AM = pick_n_take(GlobalPool[get_type])
|
||||
if(AM)
|
||||
AM.ResetVars()
|
||||
if(new_loc)
|
||||
AM.loc = new_loc
|
||||
return AM
|
||||
return 0
|
||||
|
||||
@@ -304,7 +304,9 @@ datum/signal
|
||||
|
||||
//SAY REWRITE RELATED CODE.
|
||||
//This code is a little hacky, but it *should* work. Even though it'll result in a virtual speaker referencing another virtual speaker. vOv
|
||||
var/atom/movable/virtualspeaker/virt = new(null)
|
||||
//var/atom/movable/virtualspeaker/virt = new(null) //REMIE POOL
|
||||
var/atom/movable/virtualspeaker/virt = PoolOrNew(/atom/movable/virtualspeaker,null)
|
||||
world << "Virtual speaker collected/created from pool |Telecomms.dm|"
|
||||
virt.name = source
|
||||
virt.job = job
|
||||
virt.faketrack = 1
|
||||
|
||||
Reference in New Issue
Block a user