Fixes callbacks and invoke time args failing when pushUsr was used (#35395)

* Fixes callbacks and invoke time args failing when pushUsr was used

* y u do dis byond
This commit is contained in:
Kyle Spier-Swenson
2018-02-07 10:38:07 -08:00
committed by CitadelStationBot
parent d6f916f37b
commit 07e10c38e1
2 changed files with 13 additions and 6 deletions

View File

@@ -1506,10 +1506,13 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
// Makes a call in the context of a different usr
// Use sparingly
/world/proc/PushUsr(mob/M, datum/callback/CB)
/world/proc/PushUsr(mob/M, datum/callback/CB, ...)
var/temp = usr
usr = M
. = CB.Invoke()
if (length(args) > 2)
. = CB.Invoke(arglist(args.Copy(3)))
else
. = CB.Invoke()
usr = temp
//Returns a list of all servants of Ratvar and observers.

View File

@@ -78,11 +78,13 @@
if(W)
var/mob/M = W.resolve()
if(M)
if (length(args))
return world.PushUsr(arglist(list(M, src) + args))
return world.PushUsr(M, src)
if (!object)
return
var/list/calling_arguments = arguments
if (length(args))
if (length(arguments))
@@ -104,11 +106,13 @@
if(W)
var/mob/M = W.resolve()
if(M)
if (length(args))
return world.PushUsr(arglist(list(M, src) + args))
return world.PushUsr(M, src)
if (!object)
return
var/list/calling_arguments = arguments
if (length(args))
if (length(arguments))