Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emote Refractoring #1204

Merged
merged 66 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
6c83862
what's an imp
MosleyTheMalO Sep 21, 2024
123552e
Revert "Change this cyborg"
MosleyTheMalO Sep 21, 2024
75205db
Reverts 85f0f61, 9e8b4f3 & e252a00
Just-Sim Sep 26, 2024
128aec7
Purge & Merge Emotes
Just-Sim Sep 26, 2024
cea6604
Removes Burps.
Just-Sim Sep 26, 2024
46a4d70
quick fixes
Just-Sim Sep 26, 2024
bc6603d
quick fixes
Just-Sim Sep 26, 2024
68d2c7a
Merge pull request #10 from Just-Sim/meow-emotes
ariaworld Sep 26, 2024
dd0d2e0
Automatic changelog generation for PR #10 [ci skip]
SPLURT-Station-Bot Sep 26, 2024
fcd8300
Automatic changelog compile [ci skip]
actions-user Sep 26, 2024
8825218
initial commit
Just-Sim Sep 27, 2024
47092f7
Merge branch 'master' into content-stuff
MosleyTheMalO Sep 27, 2024
9712521
Merge remote-tracking branch 'venus/master' into content-stuff
MosleyTheMalO Sep 27, 2024
1886ca4
update *burp, delete vore constants
Just-Sim Sep 28, 2024
f402b1a
Update emotes.dm
Just-Sim Sep 28, 2024
a0d9b26
Merge branch 'the-great-culling' into tgui-emote-2
Just-Sim Sep 28, 2024
0ed05ea
Merge pull request #11 from Just-Sim/the-great-culling
ariaworld Sep 28, 2024
0cb41c7
Automatic changelog generation for PR #11 [ci skip]
SPLURT-Station-Bot Sep 28, 2024
7c93f0e
Automatic changelog compile [ci skip]
actions-user Sep 28, 2024
64becde
Ports the Emote Panel
Just-Sim Oct 1, 2024
1a2a843
Merge branch 'master' into tgui-emote-2
Just-Sim Oct 1, 2024
660bbaf
runtime fix
Just-Sim Oct 1, 2024
c5173b9
Merge branch 'tgui-emote-2' of https://github.com/Just-Sim/VENUS-Stat…
Just-Sim Oct 1, 2024
7eb38be
changed cit_emotes to new audio system
Just-Sim Oct 1, 2024
7d5a802
Merge pull request #13 from Just-Sim/tgui-emote-2
ariaworld Oct 1, 2024
8a7d048
Automatic changelog generation for PR #13 [ci skip]
SPLURT-Station-Bot Oct 1, 2024
8289acd
Automatic changelog compile [ci skip]
actions-user Oct 1, 2024
f37074f
silicons can now use the emote panel
Just-Sim Oct 5, 2024
0657c12
Merge pull request #14 from Just-Sim/emote-fix
ariaworld Oct 5, 2024
e5d8ac6
Automatic changelog generation for PR #14 [ci skip]
SPLURT-Station-Bot Oct 5, 2024
92b0014
Automatic changelog compile [ci skip]
actions-user Oct 5, 2024
264c94d
emote guide
Just-Sim Oct 5, 2024
5d83deb
Merge branch 'VENUS-Station:master' into emote-fix
Just-Sim Oct 5, 2024
b467dfb
Update emotes.dm
ariaworld Oct 5, 2024
4e56c38
Update emotes.dm
ariaworld Oct 5, 2024
863aa14
Update emotes.dm
Just-Sim Oct 5, 2024
75ab56f
Merge branch 'emote-fix' of https://github.com/Just-Sim/VENUS-Station…
Just-Sim Oct 5, 2024
4c4e482
Merge pull request #15 from Just-Sim/emote-fix
ariaworld Oct 5, 2024
14380b6
Merge remote-tracking branch 'venus/master' into content-stuff
MosleyTheMalO Oct 7, 2024
5776449
Revert "Merge pull request #11 from Just-Sim/the-great-culling"
MosleyTheMalO Oct 8, 2024
c8ec168
Update emotes.dm
MosleyTheMalO Oct 8, 2024
a55e4a9
Merge branch 'master' into content-stuff
MosleyTheMalO Oct 8, 2024
fe54fd6
some fixes
MosleyTheMalO Oct 8, 2024
6e57a23
[MIRROR] Popup Notice tgstation/tgstation#61010
Just-Sim Oct 8, 2024
c762535
Merge branch 'VENUS-Station:master' into admin-stuff
Just-Sim Oct 8, 2024
c8983e1
Did you know Mosley pulls from downstreams without knowing what he pu…
Just-Sim Oct 8, 2024
df41f4c
anthro facial hair fix
cyfause Oct 8, 2024
3e4f8da
[Port] The Ocky Icky Phobia from tgstation/tgstation#57450 & tgstatio…
Just-Sim Oct 8, 2024
6cbc3a7
Adds Rejuvenate to the Context Menu
Just-Sim Oct 8, 2024
50c16cc
[PORT] Adds Immersion from tgstation/tgstation/47704
Just-Sim Oct 8, 2024
9396a11
Merge pull request #16 from cyfause/master
ariaworld Oct 8, 2024
99b901e
Automatic changelog generation for PR #16 [ci skip]
SPLURT-Station-Bot Oct 8, 2024
9027e74
Automatic changelog compile [ci skip]
actions-user Oct 8, 2024
2ed0e20
Fixes Lightning Smite
Just-Sim Oct 8, 2024
43b523b
Merge branch 'VENUS-Station:master' into admin-stuff
Just-Sim Oct 8, 2024
1cc099f
Merge pull request #17 from Just-Sim/admin-stuff
ariaworld Oct 8, 2024
a60a88e
Automatic changelog generation for PR #17 [ci skip]
SPLURT-Station-Bot Oct 8, 2024
3885d21
Automatic changelog compile [ci skip]
actions-user Oct 8, 2024
7f4d26f
Update FUNDING.yml
ariaworld Oct 9, 2024
587299b
Update FUNDING.yml
ariaworld Oct 9, 2024
4cda05e
Update README.md
ariaworld Oct 9, 2024
928b4c6
Merge remote-tracking branch 'venus/master' into content-stuff
MosleyTheMalO Oct 11, 2024
16f0aa2
*click* ported
MosleyTheMalO Oct 11, 2024
f9c16b4
thanks for porting these too btw
MosleyTheMalO Oct 11, 2024
7c8cbd3
Merge branch 'master' into content-stuff
MosleyTheMalO Oct 16, 2024
cd03ca1
Merge branch 'master' into content-stuff
MosleyTheMalO Oct 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions code/__HELPERS/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@
for(var/path in subtypesof(/datum/surgery))
GLOB.surgeries_list += new path()

//Emotes
for(var/path in subtypesof(/datum/emote))
var/datum/emote/E = new path()
E.emote_list[E.key] = E

for(var/path in subtypesof(/datum/bark))
var/datum/bark/B = new path()
GLOB.bark_list[B.id] = path
Expand All @@ -96,7 +91,7 @@

// Keybindings
init_keybindings()

GLOB.emote_list = init_emote_list()
init_subtypes(/datum/crafting_recipe, GLOB.crafting_recipes)

INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(init_ref_coin_values)) //so the current procedure doesn't sleep because of UNTIL()
Expand Down
20 changes: 20 additions & 0 deletions code/_globalvars/lists/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ GLOBAL_LIST_EMPTY(sentient_disease_instances)

GLOBAL_LIST_EMPTY(latejoin_ai_cores)

GLOBAL_LIST_EMPTY(emote_list)

GLOBAL_LIST_EMPTY(mob_config_movespeed_type_lookup)
GLOBAL_LIST_EMPTY(mob_config_movespeed_type_lookup_floating)

Expand Down Expand Up @@ -99,6 +101,24 @@ GLOBAL_LIST_EMPTY(pre_setup_antags) //minds that have been picked as antag by th
var/mob/M = i
M.update_config_movespeed()

/proc/init_emote_list()
. = list()
for(var/path in subtypesof(/datum/emote))
var/datum/emote/E = new path()
if(E.key)
if(!.[E.key])
.[E.key] = list(E)
else
.[E.key] += E
else if(E.message) //Assuming all non-base emotes have this
stack_trace("Keyless emote: [E.type]")

if(E.key_third_person) //This one is optional
if(!.[E.key_third_person])
.[E.key_third_person] = list(E)
else
.[E.key_third_person] |= E

//blood types
GLOBAL_LIST_INIT(regular_bloods,list(
"O-",
Expand Down
64 changes: 59 additions & 5 deletions code/datums/emotes.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/datum/emote
var/key = "" //What calls the emote
var/key_third_person = "" //This will also call the emote
var/name = "" // Needed for more user-friendly emote names, so emotes with keys like "aflap" will show as "flap angry". Defaulted to key.
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
Expand All @@ -11,21 +12,19 @@
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/emote_type = EMOTE_VISIBLE //Whether the emote is visible or audible
var/sound
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_typecache = /mob //Types that are allowed to use that emote
var/list/mob_type_blacklist_typecache //Types that are NOT allowed to use that emote
var/list/mob_type_ignore_stat_typecache
var/stat_allowed = CONSCIOUS
var/static/list/emote_list = list()
var/static/regex/stop_bad_mime = regex(@"says|exclaims|yells|asks")

var/chat_popup = TRUE //Skyrat edit
var/image_popup

/datum/emote/New()
if(key_third_person)
emote_list[key_third_person] = src
if (ispath(mob_type_allowed_typecache))
switch (mob_type_allowed_typecache)
if (/mob)
Expand All @@ -39,6 +38,9 @@
mob_type_blacklist_typecache = typecacheof(mob_type_blacklist_typecache)
mob_type_ignore_stat_typecache = typecacheof(mob_type_ignore_stat_typecache)

if(!name)
name = key

/datum/emote/proc/run_emote(mob/user, params, type_override, intentional = FALSE)
. = TRUE
if(!can_run_emote(user, TRUE, intentional))
Expand Down Expand Up @@ -81,6 +83,9 @@
flick_emote_popup_on_mob(user, image_popup, 40)
//End of skyrat changes

/datum/emote/proc/get_sound(mob/living/user)
return sound //by default just return this var.

/datum/emote/proc/replace_pronoun(mob/user, message)
if(findtext(message, "their"))
message = replacetext(message, "their", user.p_their())
Expand Down Expand Up @@ -149,12 +154,61 @@
return FALSE

/datum/emote/sound
var/sound //Sound to play when emote is called
var/vary = FALSE //used for the honk borg emote
var/volume = 50
// Default time before using another audio emote
var/emote_cooldown = 1 SECONDS

// Default volume of the emote
var/emote_volume = 50

// Default range modifier
var/emote_range = -1
var/emote_distance_multiplier = SOUND_DEFAULT_DISTANCE_MULTIPLIER
var/emote_distance_multiplier_min_range = SOUND_DEFAULT_MULTIPLIER_EFFECT_RANGE

// Default pitch variance
var/emote_pitch_variance = 1

// Default audio falloff settings
var/emote_falloff_exponent = SOUND_FALLOFF_EXPONENT
var/emote_falloff_distance = SOUND_DEFAULT_FALLOFF_DISTANCE

// Default frequency
var/emote_frequency = null

// Default channel
var/emote_channel = 0

// Should the emote consider atmospheric pressure?
var/emote_check_pressure = TRUE

// Should the emote ignore walls?
var/emote_ignore_walls = FALSE

// Default wet and dry settings (???)
var/emote_wetness = -10000
var/emote_dryness = 0
mob_type_allowed_typecache = list(/mob/living/brain, /mob/living/silicon, /mob/camera/aiEye)

/datum/emote/sound/can_run_emote(mob/living/user, status_check, intentional = FALSE)
. = ..()

// Check parent return
if(!.)
return FALSE

// Check cooldown
if(user?.nextsoundemote >= world.time)
return FALSE

// Allow use
return TRUE

/datum/emote/sound/run_emote(mob/user, params)
. = ..()
if(.)
playsound(user.loc, sound, volume, vary)
playsound(user.loc, sound, emote_volume, emote_pitch_variance, emote_range, emote_falloff_exponent, emote_frequency, emote_channel, emote_check_pressure, emote_ignore_walls, emote_falloff_distance, emote_wetness, emote_dryness, emote_distance_multiplier, emote_distance_multiplier_min_range)

//Cooldown.
user.nextsoundemote = world.time + emote_cooldown
6 changes: 3 additions & 3 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1229,9 +1229,9 @@
if(obj_integrity < max_integrity)
if(!W.tool_start_check(user, amount=0))
return
user.visible_message("[user] чинит шлюз сваркой.", \
"<span class='notice'>Вы начинаете чинить шлюз...</span>", \
"<span class='italics'>Вы слышите звук сварки.</span>")
user.visible_message("[user] is welding the airlock.", \
"<span class='notice'>You begin repairing the airlock...</span>", \
"<span class='italics'>You hear welding.</span>")
if(W.use_tool(src, user, 40, volume=50, extra_checks = CALLBACK(src, PROC_REF(weld_checks), W, user)))
obj_integrity = max_integrity
machine_stat &= ~BROKEN
Expand Down
64 changes: 64 additions & 0 deletions code/modules/emote_panel/emote_panel.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/datum/emote_panel
var/list/blacklisted_emotes = list("me", "help")

/datum/emote_panel/ui_static_data(mob/user)
var/list/data = list()

var/list/emotes = list()
var/list/keys = list()

for(var/key in GLOB.emote_list)
for(var/datum/emote/emote in GLOB.emote_list[key])
if(emote.key in keys)
continue
if(emote.key in blacklisted_emotes)
continue
if(emote.can_run_emote(user, status_check = FALSE))
keys += emote.key
emotes += list(list(
"key" = emote.key,
"name" = emote.name,
"hands" = emote.restraint_check,
"visible" = emote.emote_type & (EMOTE_VISIBLE || EMOTE_BOTH || EMOTE_OMNI),
"audible" = emote.emote_type & (EMOTE_AUDIBLE || EMOTE_BOTH || EMOTE_OMNI),
"sound" = !isnull(emote.get_sound(user)),
"use_params" = emote.message_param,
))

data["emotes"] = emotes

return data

/datum/emote_panel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
switch(action)
if("play_emote")
var/emote_key = params["emote_key"]
if(isnull(emote_key) || !GLOB.emote_list[emote_key])
return
var/use_params = params["use_params"]
var/datum/emote/emote = GLOB.emote_list[emote_key][1]
var/emote_param
if(emote.message_param && use_params)
emote_param = tgui_input_text(ui.user, "Add params to the emote...", emote.message_param)
ui.user.emote(emote_key, message = emote_param, intentional = TRUE)

/datum/emote_panel/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "EmotePanel")
ui.open()

/datum/emote_panel/ui_state(mob/user)
return GLOB.always_state

/mob/living/verb/emote_panel()
set name = "Emote Panel"
set category = "IC"

var/static/datum/emote_panel/emote_panel
if(isnull(emote_panel))
emote_panel = new
emote_panel.ui_interact(src)
12 changes: 7 additions & 5 deletions code/modules/mob/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
param = copytext(act, custom_param + length(act[custom_param]))
act = copytext(act, 1, custom_param)

var/datum/emote/E
E = E.emote_list[act]
if(!E)
to_chat(src, "<span class='notice'>Unusable emote '[act]'. Say *help for a list.</span>")
var/list/key_emotes = GLOB.emote_list[act]
for(var/datum/emote/emote in key_emotes)
if(!emote.can_run_emote(src, TRUE, intentional, param))
continue
emote.run_emote(src, param, m_type, intentional)
if(!key_emotes)
to_chat(src, span_notice("Unusable emote '[act]'. Say *help for a list."))
return
E.run_emote(src, param, m_type, intentional)

/datum/emote/flip
key = "flip"
Expand Down
16 changes: 4 additions & 12 deletions code/modules/mob/living/carbon/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,20 @@

/datum/emote/living/carbon/blink_r
key = "blink_r"
name = "blink rapidly"
message = "blinks rapidly."

/datum/emote/living/carbon/clap
/datum/emote/sound/human/clap
key = "clap"
key_third_person = "claps"
message = "claps."
muzzle_ignore = TRUE
restraint_check = TRUE
emote_type = EMOTE_AUDIBLE

/datum/emote/living/carbon/clap/run_emote(mob/living/user, params)
/datum/emote/sound/human/clap/run_emote(mob/user, params)
sound = pick('sound/misc/clap1.ogg', 'sound/misc/clap2.ogg', 'sound/misc/clap3.ogg', 'sound/misc/clap4.ogg')
. = ..()
if (.)
if (ishuman(user))
// Need hands to clap
if (!user.get_bodypart(BODY_ZONE_L_ARM) || !user.get_bodypart(BODY_ZONE_R_ARM))
return
var/clap = pick('sound/misc/clap1.ogg',
'sound/misc/clap2.ogg',
'sound/misc/clap3.ogg',
'sound/misc/clap4.ogg')
playsound(user, clap, 50, 1, -1)

/datum/emote/living/carbon/gnarl
key = "gnarl"
Expand Down
7 changes: 4 additions & 3 deletions code/modules/mob/living/carbon/human/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
else
H.dna.species.stop_wagging_tail(H)

/datum/emote/living/carbon/human/wag/can_run_emote(mob/user, status_check = TRUE)
/datum/emote/living/carbon/human/wag/can_run_emote(mob/user, status_check = TRUE, intentional = FALSE)
if(!..() || !ishuman(user))
return FALSE
var/mob/living/carbon/human/H = user
Expand Down Expand Up @@ -135,7 +135,7 @@
else
. = "closes " + message

/datum/emote/living/carbon/human/wing/can_run_emote(mob/user, status_check = TRUE)
/datum/emote/living/carbon/human/wing/can_run_emote(mob/user, status_check = TRUE, intentional = FALSE)
if(!..() || !ishuman(user))
return FALSE
var/mob/living/carbon/human/H = user
Expand All @@ -162,7 +162,7 @@
T.Entered(src)

/datum/emote/sound/human
mob_type_allowed_typecache = list(/mob/living/carbon/human)
mob_type_allowed_typecache = list(/mob/living/) // /sound/human/ became the global emote type, so this is now the only valid typecache
emote_type = EMOTE_AUDIBLE

/datum/emote/sound/human/buzz
Expand Down Expand Up @@ -247,6 +247,7 @@

//the actual emotes
/datum/emote/living/carbon/human/rockpaperscissors
key = "rps" // Give rockpaperscissors a key so it STOPS RUNTIMING
message = "is attempting to play rock paper scissors!"

/datum/emote/living/carbon/human/rockpaperscissors/rock
Expand Down
16 changes: 7 additions & 9 deletions code/modules/mob/living/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
/datum/emote/living/audio_emote
emote_type = EMOTE_AUDIBLE

/datum/emote/living/audio_emote/can_run_emote(mob/living/user, status_check = TRUE)
/datum/emote/living/audio_emote/can_run_emote(mob/living/user, status_check = TRUE, intentional = FALSE)
. = ..()
if(. && iscarbon(user))
var/mob/living/carbon/C = user
Expand Down Expand Up @@ -508,14 +508,12 @@
var/list/keys = list()
var/list/message = list("Available emotes, you can use them with say \"*emote\": ")

var/datum/emote/E
var/list/emote_list = E.emote_list
for(var/e in emote_list)
if(e in keys)
continue
E = emote_list[e]
if(E.can_run_emote(user, status_check = FALSE))
keys += E.key
for(var/key in GLOB.emote_list)
for(var/datum/emote/emote_action in GLOB.emote_list[key])
if(emote_action.key in keys)
continue
if(emote_action.can_run_emote(user, status_check = FALSE , intentional = TRUE))
keys += emote_action.key

keys = sort_list(keys)

Expand Down
9 changes: 9 additions & 0 deletions html/changelogs/archive/2024-09.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,12 @@
- rscadd: New space ruins
- tweak: several edits to simplemobs such as seeing their health
- imageadd: TG sprites for doors, floors and other items
ariaworld:
- rscadd: Added some safeguards to RD console & design datums.
- rscadd: Added Beach, Forest, Jungle, Prison, and Winter apartments to infinidorm.
2024-09-26:
Just-Sim:
- bugfix: Fixed cluttercode.
2024-09-28:
Just-Sim:
- code_imp: Changed a lot of emotes.
8 changes: 8 additions & 0 deletions html/changelogs/archive/2024-10.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2024-10-01:
Just-Sim:
- rscadd: Added Emote Panel
- rscdel: Remove herobrine.
- refactor: refactored emote code.
2024-10-05:
Just-Sim:
- bugfix: fixes bugs brought about by the emote panel
2024-10-07:
SaraSayomi:
- bugfix: Crop top
Expand Down
Loading
Loading