Files
Paradise/code/modules/admin/verbs/adminjump.dm
sieve32@gmail.com 7bf6788082 -OPTIMIZATION TIME
-Almost every instance of 'for(mob in world)' has been killed. Because GODDAMN was it being run a bunch. Instead, a series of global lists have been made, and they are all handled auto-magically through New()'s, Del()'s, Login()'s, death()'s, etc...

Lists are as follows:
-mob_list : Contains all atom/mobs by ref
-player_list : Like mob_list, but only contains mobs with clients attached
-admin_list : Like player_list, but holds all mobs with clients attached and admin status
-living_mob_list : Contains all mobs that ARE alive, regardless of client status
-dead_mob_list : Contains all mobs that are dead, which comes down to corpses and ghosts
-cable_list : A list containing every obj/structure/cable in existence
Note: There is an object (/obj/item/debuglist) that you can use to check the contents of each of the lists except for cables (Since getting a message saying "a cable," x9001 isn't very helpful)

These lists have been tested as much as I could on my own, and have been mostly implemented. There are still places where they could be used, but for now it's important that the core is working. If this all checks out I would really like to implement it into the MC as well, simply so it doesn't check call Life() on every mob by checking for all the ones in world every damn tick.

Just testing locally I was able to notice improvements with certain aspects, like admin verbs being MUCH more responsive (They checked for every mob in the world every time they were clicked), many sources of needless lag were cut out (Like Adminwho and Who checking every single mob when clicked), and due to the cable_list powernet rebuilding is MUCH more efficient, because instead of checking for every cable in the world every time a powernet was broken (read: A cable was deleted), it runs though the pre-made list, and even with a singulo tearing all the way across the station, the powernet load was VERY small compared to pretty much everything else.

If you want to know how any of this works, check global_lists.dm, there I have it rigorously commented, and it should provide an understanding of what's going on.

Mob related in worlds before this commit: 1262
After: 4
I'm helping


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4179 316c924e-a436-60f5-8080-3fe189b3f50e
2012-07-26 03:04:05 +00:00

154 lines
5.0 KiB
Plaintext

/client/proc/Jump(var/area/A in world)
set name = "Jump to Area"
set desc = "Area to jump to"
set category = "Admin"
if(!src.holder)
src << "Only administrators may use this command."
return
if(config.allow_admin_jump)
usr.loc = pick(get_area_turfs(A))
log_admin("[key_name(usr)] jumped to [A]")
message_admins("[key_name_admin(usr)] jumped to [A]", 1)
feedback_add_details("admin_verb","JA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else
alert("Admin jumping disabled")
/client/proc/jumptoturf(var/turf/T in world)
set name = "Jump to Turf"
set category = "Admin"
if(!src.holder)
src << "Only administrators may use this command."
return
if(config.allow_admin_jump)
log_admin("[key_name(usr)] jumped to [T.x],[T.y],[T.z] in [T.loc]")
message_admins("[key_name_admin(usr)] jumped to [T.x],[T.y],[T.z] in [T.loc]", 1)
usr.loc = T
feedback_add_details("admin_verb","JT") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else
alert("Admin jumping disabled")
return
/client/proc/jumptomob(var/mob/M in mob_list)
set category = "Admin"
set name = "Jump to Mob"
if(!src.holder)
src << "Only administrators may use this command."
return
if(config.allow_admin_jump)
log_admin("[key_name(usr)] jumped to [key_name(M)]")
message_admins("[key_name_admin(usr)] jumped to [key_name_admin(M)]", 1)
if(src.mob)
var/mob/A = src.mob
var/turf/T = get_turf(M)
if(T && isturf(T))
feedback_add_details("admin_verb","JM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
A.loc = T
else
A << "This mob is not located in the game world."
else
alert("Admin jumping disabled")
/client/proc/jumptocoord(tx as num, ty as num, tz as num)
set category = "Admin"
set name = "Jump to Coordinate"
if (!holder)
src << "Only administrators may use this command."
return
if (config.allow_admin_jump)
if(src.mob)
var/mob/A = src.mob
A.x = tx
A.y = ty
A.z = tz
feedback_add_details("admin_verb","JC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
message_admins("[key_name_admin(usr)] jumped to coordinates [tx], [ty], [tz]")
else
alert("Admin jumping disabled")
/client/proc/jumptokey()
set category = "Admin"
set name = "Jump to Key"
if(!src.holder)
src << "Only administrators may use this command."
return
if(config.allow_admin_jump)
var/list/keys = list()
for(var/mob/M in player_list)
keys += M.client
var/selection = input("Please, select a player!", "Admin Jumping", null, null) as null|anything in keys
if(!selection)
return
var/mob/M = selection:mob
log_admin("[key_name(usr)] jumped to [key_name(M)]")
message_admins("[key_name_admin(usr)] jumped to [key_name_admin(M)]", 1)
usr.loc = M.loc
feedback_add_details("admin_verb","JK") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else
alert("Admin jumping disabled")
/client/proc/Getmob(var/mob/M in mob_list)
set category = "Admin"
set name = "Get Mob"
set desc = "Mob to teleport"
if(!src.holder)
src << "Only administrators may use this command."
return
if(config.allow_admin_jump)
log_admin("[key_name(usr)] teleported [key_name(M)]")
message_admins("[key_name_admin(usr)] teleported [key_name_admin(M)]", 1)
M.loc = get_turf(usr)
feedback_add_details("admin_verb","GM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else
alert("Admin jumping disabled")
/client/proc/Getkey()
set category = "Admin"
set name = "Get Key"
set desc = "Key to teleport"
if(!src.holder)
src << "Only administrators may use this command."
return
if(config.allow_admin_jump)
var/list/keys = list()
for(var/mob/M in player_list)
keys += M.client
var/selection = input("Please, select a player!", "Admin Jumping", null, null) as null|anything in keys
if(!selection)
return
var/mob/M = selection:mob
if(!M)
return
log_admin("[key_name(usr)] teleported [key_name(M)]")
message_admins("[key_name_admin(usr)] teleported [key_name(M)]", 1)
if(M)
M.loc = get_turf(usr)
feedback_add_details("admin_verb","GK") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else
alert("Admin jumping disabled")
/client/proc/sendmob(var/mob/M in mob_list, var/area/A in world)
set category = "Admin"
set name = "Send Mob"
if(!src.holder)
src << "Only administrators may use this command."
return
if(config.allow_admin_jump)
M.loc = pick(get_area_turfs(A))
feedback_add_details("admin_verb","SMOB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
log_admin("[key_name(usr)] teleported [key_name(M)] to [A]")
message_admins("[key_name_admin(usr)] teleported [key_name_admin(M)] to [A]", 1)
else
alert("Admin jumping disabled")