(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!

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

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

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().

Login to reply.