Files
vgstation13/code/datums/emotes.dm
kane-f 84bf965ae8 Multi-z 3: With a vengeance (#30178)
* fix map

* Fixing bad syntax

* Maybe this will work

* Travis wanted me to remove this

* Unticking attempt

* Unticking attempt 2

* Removing all useless broken zshadow stuff

* Maybe now?

* Oh weird

* Adding up/down pipe sprites

* Adding darkness overlay, attempt #1

* Second attempt, now works

* Turf tweaks, now much less visually glitchy, plus walls now make blank floors above them for less weirdness

* Fix, plus keeps this floor in place

* Really bad fix that stops space looking weird

* Now everything should work normally, except lighting overlays

* Updates the map

* Consistency

* Adds new fall damage sound

* Typo

* Jetpack fun

* Better

* Less bad brackets and parantheses pain

* OHhh

* These fly too, brooms next whenever I figure those out

* Finishing pipe icons

* Making it easier to build catwalks and stuff on turfs without clicking the stuff below by mistake

* Bringing back zshadow, but with no icon

* Oh it's this issue again

* Final fix, better attempt at image relay

* Now for it looking nice, vis_contents are bad here too

* Attempt at refactoring this, light overlays are now finally underneath players, at the cost of blocking everything else, but exxion wanted to testmerge it

* Map change

* Changing it back, test server stays on box anyways

* Removing non-working solution

* Removes broken lighting overlays

* Finally fixes up floor generation above walls

* Adding bones of a 3d implementation of spiral block for git push origin multizfungit push origin multiz

* More, almost done

* Finalised

* Cube option

* Logic fix

* Syntax

* Attempting to make item fall on arc

* Compile

* Now this is no longer needed

* BRACE FOR ENABLING MULTI-Z ZAS

* Attempt at fixing glass floor tiles

* Splitting off explosion proc into destroy part, bones of calling it recursively and smaller on above and below layers, implementation of multi-z explosion suggested by DeityLink

* Missing var

* Removing unused var and fixes consistency

* Fixing logic and syntax etc, still needs testing before uncomment

* Uncommenting, some fixes too

* Makes this a seperate function otherwise it won't call at all, MULTI Z EXPLOSIONS NOW CONFIRMED WORKING

* Client proc to test this

* Adds to list

* Typo not drawing red on main layer

* Here too

* Adding debug logs for clarity

* Better

* Even better

* Experimental multi-Z EMP support, cylindrical effect for now

* Better distance falloff

* Sound/visual support on other layers?

* Z cap for EMP sound

* Booms too

* Adds back accidentally deleted file

* Muuuch more sane check

* Attempt at connecting heard speech between multi Z

* Cleaner

* Missing bracket

* Removing zshadow mobs entirely again, no need for them whatsoever

* Multi-z visible messages

* Emotes

* Fix?

* Wew

* K

* Much nicer function

* I forget about this define

* Ohhhh

* Comma fix

* Aaa

* This might fix

* Removing visible message one for now

* Trying this solution

* Typo

* RIP location, hope this won't break anything

* Actually location gets to come back, fix is here

* I give up, the tests are clearly what's borken

* Let's see what this does with those nullspaces test items (yes really)

* Indent fix, plus nice comments

* MULTI-Z SOUND???

* Woops

* Jetpack and etc trails over open space now!

* No macros, this is why we can't have nice things

* Watch how coder stops potion of levitation, broom and fairy wing wielders from falling with ONE NEAT TRICK

* Gotta make leapers not fall somehow

* Bad oversight

* Fully allows going down stairs with weird border objects

* Flying now works properly for humans on open space

* Now, fall instantly on stop

* Oversight

* Oh this function

* New helper functions

* Oversight again

* Replacing lines with abs(), multi z singulo pull attempt

* Quick supermatter fix

* Don't cut overlays

* Move down here

* Typo

* Now actually works, implementation could be better though

* Additional helper function for z distances because BYOND hates comparing z

* Reimplementing for sound

* abs() to keep positive for max comparisons in line distances

* Keeping gas overlays outside of multi-z viewing to stop some glitches

* That didn't work

* Testing removal from float planes for stuff that never needed to be on it

* Fixes gas overlays showing up all wrong in multi Z ZAS

* Gutting this controller, no longer needed period, system works fine without it

* Now glass floors look mostly perfect on open spaces

* Var name change for fun stuff later

* Knew I'd miss one

* Gravity based fall delay?

* Settle with using sleep() for now, what could go wrong?

* Lagged the game horribly, so everything

* Here all along, huh

* Just remove it for now, it kinda works but not ideally at all

* Thank you TK code for giving me a nice and working way to do this

* Comments, oversights

* No wait it was right the first time

* Now for the damage multiplier

* Knockdown too

* Nicer format

* This should still be min, plus now have a debug log and shifted around logic

* Now for mech stuff

* Clamping knockdown

* Definition fix

* Dusting this off, hopeful fix to things not falling

* Probably don't need this, I forget

* Hahaha nope, this did nothing

* Finally, a way to make fall() call in mid air after a delay without horrible lag

* Tunes pipe layering if on same zlevel, getting there

* Now fully tuned

* Adding bones for pipe item support

* Test

* z_up pipe item icon state

* z_up and z_down pipe item icon state

* Adding these to pipe dispensers

* Typo

* RCDs too

* Moved here

* Moved back

* Makes space work nicer

* Oh and here

* Fall updates

* Don't need this

* Oversights everywhere

* Fixes

* More

* More, and new stuff

* Even more

* Dampening these a bit

* So many, so moved to new file

* Forgot this

* Refactor

* Forgot to actually use

* Indentation issues

* Works better like this

* Refactors into nicer proc

* One oversight

* Stair frames, to construct into stairs

* Stack recipe for em

* Cutting useless stuff

* Fixes

* Last fixes

* Stops uncrossing at non existant aboves

* Better logic

* Better logic

* Fix

* Fixes nullspace checking runtime

* Removes redundant check on stairs

* Replaces CanPass with Cross, functionality is same and definition is duplicate of it

* Missed one

* Darkening and falling tweaks

* Better call for gravity

* Oversight

* Stops falling in space, zero-g open space movement fixes etc

* Consistency

* Fixes slipping on open spaces with catwalks (lattices make sense I guess) and stairs not being snapped down to

* Var name fix

* Much nicer system with no recursive function or last_fall variable use

* Adds buildFrom()s so z-pipes can actually be fitted, stops spam of fall() calls on enter with lock for nicer gravity

* Makes z distances pay attention to multi z support

* Maybe this is better

* Left this in

* Adding visible and hidden variants for mapping

* Counts glass floors as open space for the purpose of open space checks

* Bracket fix

* Makes it a macro for easy viewing

* Space looks much better like this honestly

* Makes schematics actually show up on RPD in multi-z

* Making these tied to WORLD_ICON_SIZE

* Changes for someone to test

* Now the fix actually works

* Removes forceMove(), nicer solution

* Giving stairs all their dirs

* Fixing stair position problem and other things

* Stair deconstruction

* Removing redundant enter() check to move()

* Some updates as requested

* .dme and map/file fixes

* .dme and map/file fixes

* Updating can_falls

* Ladder climb fix

* Some port notes updates

* Docs itself

* Removing unused edge_type var

* Removing landmark object, converts it code side

* Removing unsimmed walls doing it, not necessary

* Updated descs

* Fixing observer non-standards in file

* More file cleanup

* Jetpacks allow z-travelling

* Now they really do

* Robots too

* Updating docs

* Code cleanup

* Catch one

* Indent fix

* Not sure what that even is

* Catching these

* Applying some old fixes

* Removing unused file

* Moving nodes back to original places, or an attempt to

* Here too

* Removing unused file

* Moving these back too

* Some fixes for now

* Some more

* Even more, almost done

* Better pipe icons

* More icons

* Disposal pipe construction

* Mixup

* List optimisation, new fixes

Co-authored-by: Damian <damian@autistici.org>
Co-authored-by: kanef <kanef9x@protonmail.com>
2021-08-27 08:14:13 -05:00

216 lines
7.8 KiB
Plaintext

#define EMOTE_VISIBLE 1
#define EMOTE_AUDIBLE 2
/* Emote datums, ported from TG station. */
/datum/emote
var/key = "" //What calls the emote
var/key_third_person = "" //This will also call the emote
var/message = "" //Message displayed when emote is used
var/message_mime = "" //Message displayed if the user is a mime
var/message_alien = "" //Message displayed if the user is a grown alien
var/message_larva = "" //Message displayed if the user is an alien larva
var/message_robot = "" //Message displayed if the user is a robot
var/message_AI = "" //Message displayed if the user is an AI
var/message_monkey = "" //Message displayed if the user is a monkey
var/message_simple = "" //Message to display if the user is a simple_animal
var/message_param = "" //Message to display if a param was given
var/message_mommi = "" //Message to display if the user is a mommi. Defaults to message_robot if none specified
var/emote_type = EMOTE_VISIBLE //Whether the emote is visible or audible
var/restraint_check = FALSE //Checks if the mob is restrained before performing the emote
var/muzzle_ignore = FALSE //Will only work if the emote is EMOTE_AUDIBLE
var/list/mob_type_allowed_typelist = list(/mob) //Types that are allowed to use that emote
var/list/mob_type_blacklist_typelist //Types that are NOT allowed to use that emote
var/list/mob_type_ignore_stat_typelist
var/voxemote = TRUE //Flags if a vox CAN use an emote. Defaults to can.
var/voxrestrictedemote = FALSE //Flags if Non-Vox CANNOT use an emote. Defaults to CAN.
var/insectoidemote = TRUE
var/insectoidrestrictedemote = FALSE
var/stat_allowed = CONSCIOUS
var/hands_needed = 0//how many hands do you need to perform the emote
var/static/list/emote_list = list()
/datum/emote/New()
if(key_third_person)
emote_list[key_third_person] = src
if(!message_mommi)
message_mommi = message_robot
/datum/emote/proc/run_emote(mob/user, params, type_override, ignore_status = FALSE)
. = TRUE
if(!(type_override) && !(can_run_emote(user, !ignore_status))) // ignore_status == TRUE means that status_check should be FALSE and vise-versa
return FALSE
var/msg = select_message_type(user)
if(params && message_param)
msg = select_param(user, params)
msg = replace_pronoun(user, msg)
if(isliving(user))
var/mob/living/L = user
for(var/obj/item/weapon/implant/I in L)
I.trigger(key, L)
if(!msg)
return
var/msg_runechat = msg
msg = "<b>[user]</b> " + msg
var/obs_pass = TRUE
// Don't hear simple mobs without a client.
if (istype(user, /mob/living/simple_animal) && !user.client)
obs_pass = FALSE
if (obs_pass)
for(var/mob/M in dead_mob_list)
if(!M.client || isnewplayer(M))
continue
var/T = get_turf(user)
if(isobserver(M) && M.client && (M.client.prefs.toggles & CHAT_GHOSTSIGHT) && !(M in viewers(T)))
M.show_message("<a href='?src=\ref[M];follow=\ref[user]'>(Follow)</a> " + msg)
if (user.client && M?.client?.prefs.mob_chat_on_map && get_dist(M, user) < M?.client.view)
M.create_chat_message(user, null, msg_runechat, "", list("italics"))
if (emote_type == EMOTE_VISIBLE)
user.visible_message(msg)
for(var/z0 in GetOpenConnectedZlevels(user))
for (var/mob/O in viewers(world.view, locate(user.x,user.y,z0)))
if (user.client && O?.client?.prefs.mob_chat_on_map && O.stat != UNCONSCIOUS && !(isinvisible(user)))
O.create_chat_message(user, null, msg_runechat, "", list("italics"))
else
for(var/mob/O in get_hearers_in_view(world.view, user))
O.show_message(msg)
if (user.client && O?.client?.prefs.mob_chat_on_map && O.stat != UNCONSCIOUS && !O.is_deaf())
O.create_chat_message(user, null, msg_runechat, "", list("italics"))
var/turf/T = get_turf(user)
var/location = T ? "[T.x],[T.y],[T.z]" : "nullspace"
log_emote("[user.name]/[user.key] (@[location]): [message]")
// TODO : gender & all
/datum/emote/proc/replace_pronoun(mob/user, message)
var/mob/living/carbon/human/H = user
if (istype(H))
var/skipface = FALSE
var/list/obscured = H.check_obscured_slots()
if(H.wear_mask)
skipface |= H.check_hidden_head_flags(HIDEFACE)
if((slot_w_uniform in obscured) && skipface)
if(findtext(message, "%s"))
message = replacetext(message, "%s", "")
return message
else
switch(H.gender)
if(MALE)
if(findtext(message, "their"))
message = replacetext(message, "their", "his")
if(findtext(message, "them"))
message = replacetext(message, "them", "him")
if(findtext(message, "they"))
message = replacetext(message, "they", "he")
if(findtext(message, "%s"))
message = replacetext(message, "%s", "s")
if(FEMALE)
if(findtext(message, "their"))
message = replacetext(message, "their", "her")
if(findtext(message, "them"))
message = replacetext(message, "them", "her")
if(findtext(message, "they"))
message = replacetext(message, "they", "she")
if(findtext(message, "%s"))
message = replacetext(message, "%s", "s")
return message
/datum/emote/proc/select_message_type(mob/user)
. = message
if(!muzzle_ignore && user.is_muzzled() && emote_type == EMOTE_AUDIBLE)
return "makes a [pick("strong ", "weak ", "")]noise."
if(user.mind && ishuman(user) && user.mind.miming && message_mime)
. = message_mime
if(isalienadult(user) && message_alien)
. = message_alien
else if(islarva(user) && message_larva)
. = message_larva
else if(isAI(user) && message_AI)
. = message_AI
else if(isMoMMI(user) && message_mommi)
. = message_mommi
else if(issilicon(user) && message_robot)
. = message_robot
else if(ismonkey(user) && message_monkey)
. = message_monkey
else if(isanimal(user) && message_simple)
. = message_simple
/datum/emote/proc/select_param(mob/user, params)
return replacetext(message_param, "%t", params)
/datum/emote/proc/can_run_emote(mob/user, var/status_check = TRUE)
if(!(is_type_in_list(user, mob_type_allowed_typelist)))
return FALSE
if(is_type_in_list(user, mob_type_blacklist_typelist))
return FALSE
if((isinsectoid(user)) && insectoidrestrictedemote == TRUE)
return TRUE
if((!isinsectoid(user)) && insectoidrestrictedemote == TRUE)
return FALSE
if((isinsectoid(user)) && insectoidemote == FALSE)
return FALSE
if((isvox(user) || isskelevox(user)) && voxrestrictedemote == TRUE)
return TRUE
if((!isvox(user) || !isskelevox(user)) && voxrestrictedemote == TRUE)
return FALSE
if((isvox(user) || isskelevox(user)) && voxemote == FALSE)
return FALSE
if(!user.client && user.ckey == null) //Auto emote, like a monkey or corgi
var/someone_in_earshot=0
for(var/mob/M in get_hearers_in_view(world.view, user)) //See if anyone is in earshot
if(M.client)
someone_in_earshot=1
break
if(!someone_in_earshot)
return FALSE
if(status_check && !(is_type_in_list(user, mob_type_ignore_stat_typelist)))
if(user.stat > stat_allowed)
to_chat(user, "<span class='warning'>You cannot [key] while unconscious.</span>")
return FALSE
if(restraint_check && (user.restrained() || user.locked_to))
to_chat(user, "<span class='warning'>You cannot [key] while restrained.</span>")
return FALSE
if(isliving(user))
var/mob/living/L = user
if(L.silent)
to_chat(user, "<span class='warning'>You cannot do that while silenced.</span>")
return FALSE
return TRUE
/datum/emote/sound
var/sound //Sound to play when emote is called
var/vary = FALSE //used for the honk borg emote
mob_type_allowed_typelist = list(/mob/living/carbon/brain, /mob/living/silicon)
/datum/emote/sound/run_emote(mob/user, params, ignore_status = FALSE)
. = ..()
if(.)
playsound(user.loc, sound, 50, vary)
/mob/proc/audible_cough()
emote("coughs", message = TRUE, ignore_status = TRUE)
/mob/proc/audible_scream()
if(isvox(src) || isskelevox(src))
emote("shrieks", message = TRUE, ignore_status = TRUE)
return
if(isinsectoid(src))
emote("chitters", message = TRUE, ignore_status = TRUE)
return
else
emote("screams", message = TRUE, ignore_status = TRUE) // So it's forced