mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-27 18:42:19 +00:00
-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
80 lines
2.3 KiB
Plaintext
80 lines
2.3 KiB
Plaintext
/mob/proc/say()
|
|
return
|
|
|
|
/mob/verb/whisper()
|
|
set name = "Whisper"
|
|
set category = "IC"
|
|
return
|
|
|
|
/mob/verb/say_verb(message as text)
|
|
set name = "Say"
|
|
set category = "IC"
|
|
usr.say(message)
|
|
|
|
/mob/verb/me_verb(message as text)
|
|
set name = "Me"
|
|
set category = "IC"
|
|
|
|
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
|
|
|
|
if(ishuman(src) || isrobot(src))
|
|
usr.emote("me",1,message)
|
|
else
|
|
usr.emote(message)
|
|
|
|
/mob/proc/say_dead(var/message)
|
|
var/name = src.real_name
|
|
var/alt_name = ""
|
|
|
|
if(original_name) //Original name is only used in ghost chat! It is not to be edited by anything!
|
|
name = src.original_name
|
|
if( original_name != real_name )
|
|
alt_name = " (died as [src.real_name])"
|
|
|
|
message = src.say_quote(message)
|
|
var/rendered = "<span class='game deadsay'><span class='prefix'>DEAD:</span> <span class='name'>[name]</span>[alt_name] <span class='message'>[message]</span></span>"
|
|
|
|
for (var/mob/M in player_list)
|
|
if (istype(M, /mob/new_player))
|
|
continue
|
|
if (M.stat == 2 || (M.client && M.client.holder && M.client.deadchat)) //admins can toggle deadchat on and off. This is a proc in admin.dm and is only give to Administrators and above
|
|
if(M.client && !M.client.STFU_ghosts) //Admin shut-off for ghosts chatter
|
|
M.show_message(rendered, 2)
|
|
return
|
|
|
|
/mob/proc/say_understands(var/mob/other)
|
|
if (src.stat == 2)
|
|
return 1
|
|
else if (istype(other, src.type))
|
|
return 1
|
|
else if(other.universal_speak || src.universal_speak)
|
|
return 1
|
|
return 0
|
|
|
|
/mob/proc/say_quote(var/text)
|
|
if(!text)
|
|
return "says, \"...\""; //not the best solution, but it will stop a large number of runtimes. The cause is somewhere in the Tcomms code
|
|
var/ending = copytext(text, length(text))
|
|
if (src.stuttering)
|
|
return "stammers, \"[text]\"";
|
|
if(isliving(src))
|
|
var/mob/living/L = src
|
|
if (L.getBrainLoss() >= 60)
|
|
return "gibbers, \"[text]\"";
|
|
if (ending == "?")
|
|
return "asks, \"[text]\"";
|
|
if (ending == "!")
|
|
return "exclaims, \"[text]\"";
|
|
|
|
return "says, \"[text]\"";
|
|
|
|
/mob/proc/emote(var/act)
|
|
return
|
|
|
|
/mob/proc/get_ear()
|
|
// returns an atom representing a location on the map from which this
|
|
// mob can hear things
|
|
|
|
// should be overloaded for all mobs whose "ear" is separate from their "mob"
|
|
|
|
return get_turf(src) |