mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-14 19:03:21 +00:00
## About The Pull Request Area contents isn't a real list, instead it involves filtering everything in world This is slow, and something we should have better support for. So instead, lets manage a list of turfs inside our area. This is simple, since we already move turfs by area contents anyway This should speed up the uses I've found, and opens us up to using this pattern more often, which should make dev work easier. By nature this is a tad fragile, so I've added a unit test to double check my work Rather then instantly removing turfs from the contained_turfs list, we enter them into a list of turfs to pull out, later. Then we just use a getter for contained_turfs rather then a var read This means we don't need to generate a lot of usage off removing turf by turf from space, and can instead do it only when we need to I've added a subsystem to manage this process as well, to ensure we don't get any out of memory errors. It goes entry by entry, ensuring we get no overtime. This allows me to keep things like space clean, while keeping high amounts of usage on a sepearate subsystem when convienient As a part of this goal of keeping space's churn as low as possible, I've setup code to ensure we do not add turfs to areas during a z level increment adjacent mapload. this saves a LOT of time, but is a tad messy I've expanded where we use contained_turfs, including into some cases that filter for objects in areas. need to see if this is sane or not. Builds sortedAreas on demand, caching until we mark the cache as violated It's faster, and it also has the same behavior I'm not posting speed changes cause frankly they're gonna be a bit scattered and I'm scared to. @Mothblocks if you'd like I can look into it. I think it'll pay for itself just off `reg_in_areas_in_z` (I looked into it. it's really hard to tell, sometimes it's a bit slower (0.7), sometimes it's 2 seconds (0.5 if you use the old master figure) faster. life is pain.) ## Why It's Good For The Game Less stupid, more flexible, more speed Co-authored-by: san7890 <the@san7890.com>
180 lines
6.2 KiB
Plaintext
180 lines
6.2 KiB
Plaintext
/client/proc/jumptoarea(area/A in get_sorted_areas())
|
|
set name = "Jump to Area"
|
|
set desc = "Area to jump to"
|
|
set category = "Admin.Game"
|
|
if(!src.holder)
|
|
to_chat(src, "Only administrators may use this command.", confidential = TRUE)
|
|
return
|
|
|
|
if(!A)
|
|
return
|
|
|
|
var/list/turfs = list()
|
|
for(var/turf/T in A)
|
|
if(T.density)
|
|
continue
|
|
turfs.Add(T)
|
|
|
|
if(length(turfs))
|
|
var/turf/T = pick(turfs)
|
|
usr.forceMove(T)
|
|
log_admin("[key_name(usr)] jumped to [AREACOORD(T)]")
|
|
message_admins("[key_name_admin(usr)] jumped to [AREACOORD(T)]")
|
|
SSblackbox.record_feedback("tally", "admin_verb", 1, "Jump To Area") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
|
else
|
|
to_chat(src, "Nowhere to jump to!", confidential = TRUE)
|
|
return
|
|
|
|
|
|
/client/proc/jumptoturf(turf/T in world)
|
|
set name = "Jump to Turf"
|
|
set category = "Admin.Game"
|
|
if(!src.holder)
|
|
to_chat(src, "Only administrators may use this command.", confidential = TRUE)
|
|
return
|
|
|
|
log_admin("[key_name(usr)] jumped to [AREACOORD(T)]")
|
|
message_admins("[key_name_admin(usr)] jumped to [AREACOORD(T)]")
|
|
usr.forceMove(T)
|
|
SSblackbox.record_feedback("tally", "admin_verb", 1, "Jump To Turf") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
|
return
|
|
|
|
/client/proc/jumptomob(mob/M in GLOB.mob_list)
|
|
set category = "Admin.Game"
|
|
set name = "Jump to Mob"
|
|
|
|
if(!src.holder)
|
|
to_chat(src, "Only administrators may use this command.", confidential = TRUE)
|
|
return
|
|
|
|
log_admin("[key_name(usr)] jumped to [key_name(M)]")
|
|
message_admins("[key_name_admin(usr)] jumped to [ADMIN_LOOKUPFLW(M)] at [AREACOORD(M)]")
|
|
if(src.mob)
|
|
var/mob/A = src.mob
|
|
var/turf/T = get_turf(M)
|
|
if(T && isturf(T))
|
|
SSblackbox.record_feedback("tally", "admin_verb", 1, "Jump To Mob") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
|
A.forceMove(M.loc)
|
|
else
|
|
to_chat(A, "This mob is not located in the game world.", confidential = TRUE)
|
|
|
|
/client/proc/jumptocoord(tx as num, ty as num, tz as num)
|
|
set category = "Admin.Game"
|
|
set name = "Jump to Coordinate"
|
|
|
|
if (!holder)
|
|
to_chat(src, "Only administrators may use this command.", confidential = TRUE)
|
|
return
|
|
|
|
if(src.mob)
|
|
var/mob/A = src.mob
|
|
var/turf/T = locate(tx,ty,tz)
|
|
A.forceMove(T)
|
|
SSblackbox.record_feedback("tally", "admin_verb", 1, "Jump To Coordiate") //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]")
|
|
|
|
/client/proc/jumptokey()
|
|
set category = "Admin.Game"
|
|
set name = "Jump to Key"
|
|
|
|
if(!src.holder)
|
|
to_chat(src, "Only administrators may use this command.", confidential = TRUE)
|
|
return
|
|
|
|
var/list/keys = list()
|
|
for(var/mob/M in GLOB.player_list)
|
|
keys += M.client
|
|
var/client/selection = input("Please, select a player!", "Admin Jumping", null, null) as null|anything in sort_key(keys)
|
|
if(!selection)
|
|
to_chat(src, "No keys found.", confidential = TRUE)
|
|
return
|
|
var/mob/M = selection.mob
|
|
log_admin("[key_name(usr)] jumped to [key_name(M)]")
|
|
message_admins("[key_name_admin(usr)] jumped to [ADMIN_LOOKUPFLW(M)]")
|
|
|
|
usr.forceMove(M.loc)
|
|
|
|
SSblackbox.record_feedback("tally", "admin_verb", 1, "Jump To Key") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
|
|
|
/client/proc/Getmob(mob/M in GLOB.mob_list - GLOB.dummy_mob_list)
|
|
set category = "Admin.Game"
|
|
set name = "Get Mob"
|
|
set desc = "Mob to teleport"
|
|
if(!src.holder)
|
|
to_chat(src, "Only administrators may use this command.", confidential = TRUE)
|
|
return
|
|
|
|
var/atom/loc = get_turf(usr)
|
|
M.admin_teleport(loc)
|
|
SSblackbox.record_feedback("tally", "admin_verb", 1, "Get Mob") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
|
|
|
|
|
/// Proc to hook user-enacted teleporting behavior and keep logging of the event.
|
|
/atom/movable/proc/admin_teleport(atom/new_location)
|
|
if(isnull(new_location))
|
|
log_admin("[key_name(usr)] teleported [key_name(src)] to nullspace")
|
|
moveToNullspace()
|
|
else
|
|
log_admin("[key_name(usr)] teleported [key_name(src)] to [AREACOORD(loc)]")
|
|
forceMove(new_location)
|
|
|
|
/mob/admin_teleport(atom/new_location)
|
|
var/msg = "[key_name_admin(usr)] teleported [ADMIN_LOOKUPFLW(src)] to [isnull(new_location) ? "nullspace" : ADMIN_VERBOSEJMP(loc)]"
|
|
message_admins(msg)
|
|
admin_ticket_log(src, msg)
|
|
return ..()
|
|
|
|
|
|
/client/proc/Getkey()
|
|
set category = "Admin.Game"
|
|
set name = "Get Key"
|
|
set desc = "Key to teleport"
|
|
|
|
if(!src.holder)
|
|
to_chat(src, "Only administrators may use this command.", confidential = TRUE)
|
|
return
|
|
|
|
var/list/keys = list()
|
|
for(var/mob/M in GLOB.player_list)
|
|
keys += M.client
|
|
var/client/selection = input("Please, select a player!", "Admin Jumping", null, null) as null|anything in sort_key(keys)
|
|
if(!selection)
|
|
return
|
|
var/mob/M = selection.mob
|
|
|
|
if(!M)
|
|
return
|
|
log_admin("[key_name(usr)] teleported [key_name(M)]")
|
|
var/msg = "[key_name_admin(usr)] teleported [ADMIN_LOOKUPFLW(M)]"
|
|
message_admins(msg)
|
|
admin_ticket_log(M, msg)
|
|
if(M)
|
|
M.forceMove(get_turf(usr))
|
|
usr.forceMove(M.loc)
|
|
SSblackbox.record_feedback("tally", "admin_verb", 1, "Get Key") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
|
|
|
/client/proc/sendmob(mob/jumper in sort_mobs())
|
|
set category = "Admin.Game"
|
|
set name = "Send Mob"
|
|
if(!src.holder)
|
|
to_chat(src, "Only administrators may use this command.", confidential = TRUE)
|
|
return
|
|
var/list/sorted_areas = get_sorted_areas()
|
|
if(!length(sorted_areas))
|
|
to_chat(src, "No areas found.", confidential = TRUE)
|
|
return
|
|
var/area/target_area = tgui_input_list(src, "Pick an area", "Send Mob", sorted_areas)
|
|
if(isnull(target_area))
|
|
return
|
|
if(!istype(target_area))
|
|
return
|
|
var/list/turfs = get_area_turfs(target_area)
|
|
if(length(turfs) && jumper.forceMove(pick(turfs)))
|
|
log_admin("[key_name(usr)] teleported [key_name(jumper)] to [AREACOORD(jumper)]")
|
|
var/msg = "[key_name_admin(usr)] teleported [ADMIN_LOOKUPFLW(jumper)] to [AREACOORD(jumper)]"
|
|
message_admins(msg)
|
|
admin_ticket_log(jumper, msg)
|
|
else
|
|
to_chat(src, "Failed to move mob to a valid location.", confidential = TRUE)
|
|
SSblackbox.record_feedback("tally", "admin_verb", 1, "Send Mob") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|