mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 16:14:13 +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
491 lines
11 KiB
Plaintext
491 lines
11 KiB
Plaintext
/mob/living/carbon/human/emote(var/act,var/m_type=1,var/message = null)
|
|
var/param = null
|
|
|
|
if (findtext(act, "-", 1, null))
|
|
var/t1 = findtext(act, "-", 1, null)
|
|
param = copytext(act, t1 + 1, length(act) + 1)
|
|
act = copytext(act, 1, t1)
|
|
|
|
var/muzzled = istype(src.wear_mask, /obj/item/clothing/mask/muzzle)
|
|
//var/m_type = 1
|
|
|
|
for (var/obj/item/weapon/implant/I in src)
|
|
if (I.implanted)
|
|
I.trigger(act, src)
|
|
|
|
if(src.stat == 2.0 && (act != "deathgasp"))
|
|
return
|
|
switch(act)
|
|
if ("airguitar")
|
|
if (!src.restrained())
|
|
message = "<B>[src]</B> is strumming the air and headbanging like a safari chimp."
|
|
m_type = 1
|
|
|
|
if ("blink")
|
|
message = "<B>[src]</B> blinks."
|
|
m_type = 1
|
|
|
|
if ("blink_r")
|
|
message = "<B>[src]</B> blinks rapidly."
|
|
m_type = 1
|
|
|
|
if ("bow")
|
|
if (!src.buckled)
|
|
var/M = null
|
|
if (param)
|
|
for (var/mob/A in view(null, null))
|
|
if (param == A.name)
|
|
M = A
|
|
break
|
|
if (!M)
|
|
param = null
|
|
|
|
if (param)
|
|
message = "<B>[src]</B> bows to [param]."
|
|
else
|
|
message = "<B>[src]</B> bows."
|
|
m_type = 1
|
|
|
|
if ("custom")
|
|
var/input = copytext(sanitize(input("Choose an emote to display.") as text|null),1,MAX_MESSAGE_LEN)
|
|
if (!input)
|
|
return
|
|
var/input2 = input("Is this a visible or hearable emote?") in list("Visible","Hearable")
|
|
if (input2 == "Visible")
|
|
m_type = 1
|
|
else if (input2 == "Hearable")
|
|
if (src.miming)
|
|
return
|
|
m_type = 2
|
|
else
|
|
alert("Unable to use this emote, must be either hearable or visible.")
|
|
return
|
|
message = "<B>[src]</B> [input]"
|
|
|
|
if ("me")
|
|
if(silent)
|
|
return
|
|
if (src.client)
|
|
if (client.muted_ic)
|
|
src << "\red You cannot send IC messages (muted by admins)."
|
|
return
|
|
if (src.client.handle_spam_prevention(message,MUTE_IC))
|
|
return
|
|
if (stat)
|
|
return
|
|
if(!(message))
|
|
return
|
|
else
|
|
message = "<B>[src]</B> [message]"
|
|
|
|
if ("salute")
|
|
if (!src.buckled)
|
|
var/M = null
|
|
if (param)
|
|
for (var/mob/A in view(null, null))
|
|
if (param == A.name)
|
|
M = A
|
|
break
|
|
if (!M)
|
|
param = null
|
|
|
|
if (param)
|
|
message = "<B>[src]</B> salutes to [param]."
|
|
else
|
|
message = "<B>[src]</b> salutes."
|
|
m_type = 1
|
|
|
|
if ("choke")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> chokes!"
|
|
m_type = 2
|
|
else
|
|
message = "<B>[src]</B> makes a strong noise."
|
|
m_type = 2
|
|
|
|
if ("clap")
|
|
if (!src.restrained())
|
|
message = "<B>[src]</B> claps."
|
|
m_type = 2
|
|
if ("flap")
|
|
if (!src.restrained())
|
|
message = "<B>[src]</B> flaps his wings."
|
|
m_type = 2
|
|
|
|
if ("aflap")
|
|
if (!src.restrained())
|
|
message = "<B>[src]</B> flaps his wings ANGRILY!"
|
|
m_type = 2
|
|
|
|
if ("drool")
|
|
message = "<B>[src]</B> drools."
|
|
m_type = 1
|
|
|
|
if ("eyebrow")
|
|
message = "<B>[src]</B> raises an eyebrow."
|
|
m_type = 1
|
|
|
|
if ("chuckle")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> chuckles."
|
|
m_type = 2
|
|
else
|
|
message = "<B>[src]</B> makes a noise."
|
|
m_type = 2
|
|
|
|
if ("twitch")
|
|
message = "<B>[src]</B> twitches violently."
|
|
m_type = 1
|
|
|
|
if ("twitch_s")
|
|
message = "<B>[src]</B> twitches."
|
|
m_type = 1
|
|
|
|
if ("faint")
|
|
message = "<B>[src]</B> faints."
|
|
if(src.sleeping)
|
|
return //Can't faint while asleep
|
|
src.sleeping += 10 //Short-short nap
|
|
m_type = 1
|
|
|
|
if ("cough")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> coughs!"
|
|
m_type = 2
|
|
else
|
|
message = "<B>[src]</B> makes a strong noise."
|
|
m_type = 2
|
|
|
|
if ("frown")
|
|
message = "<B>[src]</B> frowns."
|
|
m_type = 1
|
|
|
|
if ("nod")
|
|
message = "<B>[src]</B> nods."
|
|
m_type = 1
|
|
|
|
if ("blush")
|
|
message = "<B>[src]</B> blushes."
|
|
m_type = 1
|
|
|
|
if ("wave")
|
|
message = "<B>[src]</B> waves."
|
|
m_type = 1
|
|
|
|
if ("gasp")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> gasps!"
|
|
m_type = 2
|
|
else
|
|
message = "<B>[src]</B> makes a weak noise."
|
|
m_type = 2
|
|
|
|
if ("deathgasp")
|
|
message = "<B>[src]</B> seizes up and falls limp, \his eyes dead and lifeless..."
|
|
m_type = 1
|
|
|
|
if ("giggle")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> giggles."
|
|
m_type = 2
|
|
else
|
|
message = "<B>[src]</B> makes a noise."
|
|
m_type = 2
|
|
|
|
if ("glare")
|
|
var/M = null
|
|
if (param)
|
|
for (var/mob/A in view(null, null))
|
|
if (param == A.name)
|
|
M = A
|
|
break
|
|
if (!M)
|
|
param = null
|
|
|
|
if (param)
|
|
message = "<B>[src]</B> glares at [param]."
|
|
else
|
|
message = "<B>[src]</B> glares."
|
|
|
|
if ("stare")
|
|
var/M = null
|
|
if (param)
|
|
for (var/mob/A in view(null, null))
|
|
if (param == A.name)
|
|
M = A
|
|
break
|
|
if (!M)
|
|
param = null
|
|
|
|
if (param)
|
|
message = "<B>[src]</B> stares at [param]."
|
|
else
|
|
message = "<B>[src]</B> stares."
|
|
|
|
if ("look")
|
|
var/M = null
|
|
if (param)
|
|
for (var/mob/A in view(null, null))
|
|
if (param == A.name)
|
|
M = A
|
|
break
|
|
|
|
if (!M)
|
|
param = null
|
|
|
|
if (param)
|
|
message = "<B>[src]</B> looks at [param]."
|
|
else
|
|
message = "<B>[src]</B> looks."
|
|
m_type = 1
|
|
|
|
if ("grin")
|
|
message = "<B>[src]</B> grins."
|
|
m_type = 1
|
|
|
|
if ("cry")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> cries."
|
|
m_type = 2
|
|
else
|
|
message = "<B>[src]</B> makes a weak noise. \He frowns."
|
|
m_type = 2
|
|
|
|
if ("sigh")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> sighs."
|
|
m_type = 2
|
|
else
|
|
message = "<B>[src]</B> makes a weak noise."
|
|
m_type = 2
|
|
|
|
if ("laugh")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> laughs."
|
|
m_type = 2
|
|
else
|
|
message = "<B>[src]</B> makes a noise."
|
|
m_type = 2
|
|
|
|
if ("mumble")
|
|
message = "<B>[src]</B> mumbles!"
|
|
m_type = 2
|
|
|
|
if ("grumble")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> grumbles!"
|
|
m_type = 2
|
|
else
|
|
message = "<B>[src]</B> makes a noise."
|
|
m_type = 2
|
|
|
|
if ("groan")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> groans!"
|
|
m_type = 2
|
|
else
|
|
message = "<B>[src]</B> makes a loud noise."
|
|
m_type = 2
|
|
|
|
if ("moan")
|
|
message = "<B>[src]</B> moans!"
|
|
m_type = 2
|
|
|
|
if ("johnny")
|
|
var/M
|
|
if (param)
|
|
M = param
|
|
if (!M)
|
|
param = null
|
|
else
|
|
message = "<B>[src]</B> says, \"[M], please. He had a family.\" [src.name] takes a drag from a cigarette and blows his name out in smoke."
|
|
m_type = 2
|
|
|
|
if ("point")
|
|
if (!src.restrained())
|
|
var/mob/M = null
|
|
if (param)
|
|
for (var/atom/A as mob|obj|turf|area in view(null, null))
|
|
if (param == A.name)
|
|
M = A
|
|
break
|
|
|
|
if (!M)
|
|
message = "<B>[src]</B> points."
|
|
else
|
|
M.point()
|
|
|
|
if (M)
|
|
message = "<B>[src]</B> points to [M]."
|
|
else
|
|
m_type = 1
|
|
|
|
if ("raise")
|
|
if (!src.restrained())
|
|
message = "<B>[src]</B> raises a hand."
|
|
m_type = 1
|
|
|
|
if("shake")
|
|
message = "<B>[src]</B> shakes \his head."
|
|
m_type = 1
|
|
|
|
if ("shrug")
|
|
message = "<B>[src]</B> shrugs."
|
|
m_type = 1
|
|
|
|
if ("signal")
|
|
if (!src.restrained())
|
|
var/t1 = round(text2num(param))
|
|
if (isnum(t1))
|
|
if (t1 <= 5 && (!src.r_hand || !src.l_hand))
|
|
message = "<B>[src]</B> raises [t1] finger\s."
|
|
else if (t1 <= 10 && (!src.r_hand && !src.l_hand))
|
|
message = "<B>[src]</B> raises [t1] finger\s."
|
|
m_type = 1
|
|
|
|
if ("smile")
|
|
message = "<B>[src]</B> smiles."
|
|
m_type = 1
|
|
|
|
if ("shiver")
|
|
message = "<B>[src]</B> shivers."
|
|
m_type = 2
|
|
|
|
if ("pale")
|
|
message = "<B>[src]</B> goes pale for a second."
|
|
m_type = 1
|
|
|
|
if ("tremble")
|
|
message = "<B>[src]</B> trembles in fear!"
|
|
m_type = 1
|
|
|
|
if ("sneeze")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> sneezes."
|
|
m_type = 2
|
|
else
|
|
message = "<B>[src]</B> makes a strange noise."
|
|
m_type = 2
|
|
|
|
if ("sniff")
|
|
message = "<B>[src]</B> sniffs."
|
|
m_type = 2
|
|
|
|
if ("snore")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> snores."
|
|
m_type = 2
|
|
else
|
|
message = "<B>[src]</B> makes a noise."
|
|
m_type = 2
|
|
|
|
if ("whimper")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> whimpers."
|
|
m_type = 2
|
|
else
|
|
message = "<B>[src]</B> makes a weak noise."
|
|
m_type = 2
|
|
|
|
if ("wink")
|
|
message = "<B>[src]</B> winks."
|
|
m_type = 1
|
|
|
|
if ("yawn")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> yawns."
|
|
m_type = 2
|
|
|
|
if ("collapse")
|
|
Paralyse(2)
|
|
message = "<B>[src]</B> collapses!"
|
|
m_type = 2
|
|
|
|
if("hug")
|
|
m_type = 1
|
|
if (!src.restrained())
|
|
var/M = null
|
|
if (param)
|
|
for (var/mob/A in view(1, null))
|
|
if (param == A.name)
|
|
M = A
|
|
break
|
|
if (M == src)
|
|
M = null
|
|
|
|
if (M)
|
|
message = "<B>[src]</B> hugs [M]."
|
|
else
|
|
message = "<B>[src]</B> hugs \himself."
|
|
|
|
if ("handshake")
|
|
m_type = 1
|
|
if (!src.restrained() && !src.r_hand)
|
|
var/mob/M = null
|
|
if (param)
|
|
for (var/mob/A in view(1, null))
|
|
if (param == A.name)
|
|
M = A
|
|
break
|
|
if (M == src)
|
|
M = null
|
|
|
|
if (M)
|
|
if (M.canmove && !M.r_hand && !M.restrained())
|
|
message = "<B>[src]</B> shakes hands with [M]."
|
|
else
|
|
message = "<B>[src]</B> holds out \his hand to [M]."
|
|
|
|
if("daps")
|
|
m_type = 1
|
|
if (!src.restrained())
|
|
var/M = null
|
|
if (param)
|
|
for (var/mob/A in view(1, null))
|
|
if (param == A.name)
|
|
M = A
|
|
break
|
|
if (M)
|
|
message = "<B>[src]</B> gives daps to [M]."
|
|
else
|
|
message = "<B>[src]</B> sadly can't find anybody to give daps to, and daps \himself. Shameful."
|
|
|
|
if ("scream")
|
|
if (!muzzled)
|
|
message = "<B>[src]</B> screams!"
|
|
m_type = 2
|
|
else
|
|
message = "<B>[src]</B> makes a very loud noise."
|
|
m_type = 2
|
|
|
|
if ("help")
|
|
src << "blink, blink_r, blush, bow-(none)/mob, burp, choke, chuckle, clap, collapse, cough,\ncry, custom, deathgasp, drool, eyebrow, frown, gasp, giggle, groan, grumble, handshake, hug-(none)/mob, glare-(none)/mob,\ngrin, laugh, look-(none)/mob, moan, mumble, nod, pale, point-atom, raise, salute, shake, shiver, shrug,\nsigh, signal-#1-10, smile, sneeze, sniff, snore, stare-(none)/mob, tremble, twitch, twitch_s, whimper,\nwink, yawn"
|
|
|
|
else
|
|
src << "\blue Unusable emote '[act]'. Say *help for a list."
|
|
|
|
|
|
|
|
|
|
|
|
if (message)
|
|
log_emote("[name]/[key] : [message]")
|
|
|
|
//Hearing gasp and such every five seconds is not good emotes were not global for a reason.
|
|
// Maybe some people are okay with that.
|
|
|
|
for(var/mob/M in dead_mob_list)
|
|
if (!M.client)
|
|
continue //skip monkeys and leavers
|
|
if(M.stat == 2 && M.client.ghost_sight && !(M in viewers(src,null)))
|
|
M.show_message(message)
|
|
|
|
|
|
if (m_type & 1)
|
|
for (var/mob/O in viewers(src, null))
|
|
O.show_message(message, m_type)
|
|
else if (m_type & 2)
|
|
for (var/mob/O in hearers(src.loc, null))
|
|
O.show_message(message, m_type)
|
|
|