ID:2475678
 
(See the best response by Spevacus.)
Does anyone know why this might be? The admins have a lot of verbs that look like this: SomeVerb(mob/m in players). I suspect this is somehow lagging anyone who gets near them by the sheer number of admin verbs?
Best response
I figure the lag comes from the ability for these verbs to be used on players through a person with these verbs' right click menu.

A workaround would be to make the required target be declared later, rather than when you define the verb.

You'd need to refactor it such that...

//We'd be going from this...

mob/verb/SomeVerb(mob/m in players)
//Your code

//To this!

mob/verb/SomeVerb()
switch(input(src,"Select a target","SomeVerbTitle") in players += "Cancel")
if("Cancel")
return
//Rest of your code here.


If you dislike switch( statements, this accomplishes the same thing, and is a little less wordy.

mob/verb/Someverb()
var/mob/Target = input("Select a target") as null|anything in players += "Cancel"
if(Target == "Cancel"||!Target) return
//Your code here.


Others will tell you to just not have verbs specifically, and instead refactor into an interface or something a bit less... Rip-y. This'll work for how I figure your game works.

My personal suggestion to you would be to get rid of as many admin verbs as you can. There's no reason you should have over 100 admin verbs. Shift that power to the players.

Edit: Added something for if you hate switch().
Why... are we not addressing the fact that this guy has "admin" verbs as just normal mob verbs? Every verb that's /mob/verb will be given to every mob in the entire game (even your /mob type NPCs). Same thing happens with /client/verb, except just for clients connected to the game.

To fix this guy's issue the proper way, would be to actually have an admin "system" in place that only gives these verbs TO admins...
I just used the /mob/verb directory as an example.

Of course you should have them under an extra type, like /mob/Admin/verb or something. I'm sure he does.

All I wanted to illustrate was the changing of the target to inside of the verb's body rather than outside.
Using the popup_menu=0 setting on all those admin verbs would fix his issue as well then. Or even enabling the right-click setting on his primary map element. Anything that prevents the context menus from getting humongous for no reason, right?
Yessir, I imagine that'd work as well.