Merge pull request #7273 from Cyantime/obs

Observing improvements
This commit is contained in:
Atermonera
2020-06-22 12:15:07 -07:00
committed by Leshana
parent f7cab660e8
commit 736fdab6e3
3 changed files with 1603 additions and 1626 deletions

View File

@@ -453,29 +453,7 @@ Turf and target are seperate in case you want to teleport some distance from a t
//Returns a list of all mobs with their name //Returns a list of all mobs with their name
/proc/getmobs() /proc/getmobs()
return observe_list_format(sortmobs())
var/list/mobs = sortmobs()
var/list/names = list()
var/list/creatures = list()
var/list/namecounts = list()
for(var/mob/M in mobs)
var/name = M.name
if (name in names)
namecounts[name]++
name = "[name] ([namecounts[name]])"
else
names.Add(name)
namecounts[name] = 1
if (M.real_name && M.real_name != M.name)
name += " \[[M.real_name]\]"
if (M.stat == 2)
if(istype(M, /mob/observer/dead/))
name += " \[ghost\]"
else
name += " \[dead\]"
creatures[name] = M
return creatures
//Orders mobs by type then by name //Orders mobs by type then by name
/proc/sortmobs() /proc/sortmobs()
@@ -509,6 +487,34 @@ Turf and target are seperate in case you want to teleport some distance from a t
// mob_list.Add(M) // mob_list.Add(M)
return moblist return moblist
/proc/observe_list_format(input_list)
if(!islist(input_list))
return
var/list/names = list()
var/list/output_list = list()
var/list/namecounts = list()
var/name
for(var/atom/A in input_list)
name = A.name
if(name in names)
namecounts[name]++
name = "[name] ([namecounts[name]])"
else
names.Add(name)
namecounts[name] = 1
if(ismob(A))
var/mob/M = A
if(M.real_name && M.real_name != M.name)
name += " \[[M.real_name]\]"
if(M.stat == DEAD)
if(istype(M, /mob/observer/dead/))
name += " \[ghost\]"
else
name += " \[dead\]"
output_list[name] = A
return output_list
// Format a power value in W, kW, MW, or GW. // Format a power value in W, kW, MW, or GW.
/proc/DisplayPower(powerused) /proc/DisplayPower(powerused)
if(powerused < 1000) //Less than a kW if(powerused < 1000) //Less than a kW

View File

@@ -437,56 +437,26 @@
if(is_admin && stat == DEAD) if(is_admin && stat == DEAD)
is_admin = 0 is_admin = 0
var/list/names = list() var/list/targets = list()
var/list/namecounts = list()
var/list/creatures = list()
for(var/obj/O in world) //EWWWWWWWWWWWWWWWWWWWWWWWW ~needs to be optimised
if(!O.loc)
continue
if(istype(O, /obj/item/weapon/disk/nuclear))
var/name = "Nuclear Disk"
if (names.Find(name))
namecounts[name]++
name = "[name] ([namecounts[name]])"
else
names.Add(name)
namecounts[name] = 1
creatures[name] = O
if(istype(O, /obj/singularity))
var/name = "Singularity"
if (names.Find(name))
namecounts[name]++
name = "[name] ([namecounts[name]])"
else
names.Add(name)
namecounts[name] = 1
creatures[name] = O
for(var/mob/M in sortAtom(mob_list))
var/name = M.name
if (names.Find(name))
namecounts[name]++
name = "[name] ([namecounts[name]])"
else
names.Add(name)
namecounts[name] = 1
creatures[name] = M
targets += observe_list_format(nuke_disks)
targets += observe_list_format(all_singularities)
targets += getmobs()
targets += observe_list_format(sortAtom(mechas_list))
targets += observe_list_format(SSshuttles.ships)
client.perspective = EYE_PERSPECTIVE client.perspective = EYE_PERSPECTIVE
var/eye_name = null var/eye_name = null
var/ok = "[is_admin ? "Admin Observe" : "Observe"]" var/ok = "[is_admin ? "Admin Observe" : "Observe"]"
eye_name = input("Please, select a player!", ok, null, null) as null|anything in creatures eye_name = input("Please, select a player!", ok, null, null) as null|anything in targets
if (!eye_name) if (!eye_name)
return return
var/mob/mob_eye = creatures[eye_name] var/mob/mob_eye = targets[eye_name]
if(client && mob_eye) if(client && mob_eye)
client.eye = mob_eye client.eye = mob_eye

View File

@@ -119,6 +119,7 @@
if(!loc) if(!loc)
return return
var/obj/singularity/energy_ball/EB = new(loc, 0, TRUE) var/obj/singularity/energy_ball/EB = new(loc, 0, TRUE)
all_singularities -= EB //why are these miniballs even singularities in the first place, they don't do anything
EB.transform *= pick(0.3, 0.4, 0.5, 0.6, 0.7) EB.transform *= pick(0.3, 0.4, 0.5, 0.6, 0.7)
var/icon/I = icon(icon,icon_state,dir) var/icon/I = icon(icon,icon_state,dir)