Skip to content

Commit

Permalink
Merge pull request #1204 from SPLURT-Station/content-stuff
Browse files Browse the repository at this point in the history
Emote Refractoring
  • Loading branch information
MosleyTheMalO authored Oct 24, 2024
2 parents 8c12c8c + cd03ca1 commit 76661cc
Show file tree
Hide file tree
Showing 78 changed files with 2,159 additions and 1,022 deletions.
21 changes: 0 additions & 21 deletions code/__DEFINES/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,6 @@
#define ADMIN_VERBOSEJMP(src) "[src ? "[AREACOORD(src)] [ADMIN_JMP(src)]" : "nonexistent location"]"
#define ADMIN_INDIVIDUALLOG(user) "(<a href='?_src_=holder;[HrefToken(TRUE)];individuallog=[REF(user)]'>LOGS</a>)"

#define ADMIN_PUNISHMENT_LIGHTNING "Lightning bolt"
#define ADMIN_PUNISHMENT_BRAINDAMAGE "Brain damage"
#define ADMIN_PUNISHMENT_GIB "Gib"
#define ADMIN_PUNISHMENT_BSA "Bluespace Artillery Device"
#define ADMIN_PUNISHMENT_FIREBALL "Fireball"
#define ADMIN_PUNISHMENT_ROD "Immovable Rod"
#define ADMIN_PUNISHMENT_SUPPLYPOD_QUICK "Supply Pod (Quick)"
#define ADMIN_PUNISHMENT_SUPPLYPOD "Supply Pod"
#define ADMIN_PUNISHMENT_MAZING "Puzzle"
#define ADMIN_PUNISHMENT_PIE "Cream Pie"
#define ADMIN_PUNISHMENT_CUSTOM_PIE "Custom Cream Pie"
#define ADMIN_PUNISHMENT_SHOES "Knot Shoes"
#define ADMIN_PUNISHMENT_CRACK ":B:oneless"
#define ADMIN_PUNISHMENT_BLEED ":B:loodless"
#define ADMIN_PUNISHMENT_SCARIFY "Scarify"
#define ADMIN_PUNISHMENT_PICKLE "Pickle-ify"
#define ADMIN_PUNISHMENT_FRY "Fry"
#define ADMIN_PUNISHMENT_PERFORATE ":B:erforate"
#define ADMIN_PUNISHMENT_CLUWNE "Cluwne"
#define ADMIN_PUNISHMENT_GOODBYE "Their final message" //sandstorm

#define AHELP_ACTIVE 1
#define AHELP_CLOSED 2
#define AHELP_RESOLVED 3
Expand Down
8 changes: 8 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -712,3 +712,11 @@
#define COMSIG_ALARM_TRIGGERED "comsig_alarm_triggered"
///Send when an alarm source is cleared (alarm_type, area/source_area)
#define COMSIG_ALARM_CLEARED "comsig_alarm_clear"

/// Admin helps
/// From /datum/admin_help/RemoveActive().
/// Fired when an adminhelp is made inactive either due to closing or resolving.
#define COMSIG_ADMIN_HELP_MADE_INACTIVE "admin_help_made_inactive"

/// Called when the player replies. From /client/proc/cmd_admin_pm().
#define COMSIG_ADMIN_HELP_REPLIED "admin_help_replied"
3 changes: 3 additions & 0 deletions code/__DEFINES/layers_planes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -200,5 +200,8 @@
#define SPLASHSCREEN_PLANE 90
#define SPLASHSCREEN_RENDER_TARGET "SPLASHSCREEN_PLANE"

// Admin popup layer
#define ADMIN_POPUP_LAYER 1

///Layer for screentips
#define SCREENTIP_LAYER 40
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
6 changes: 0 additions & 6 deletions code/__SPLURTCODE/DEFINES/admin.dm

This file was deleted.

8 changes: 8 additions & 0 deletions code/_globalvars/lists/admin.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/proc/init_smites()
var/list/smites = list()
for (var/_smite_path in subtypesof(/datum/smite))
var/datum/smite/smite_path = _smite_path
smites[initial(smite_path.name)] = smite_path
return smites

GLOBAL_LIST_INIT_TYPED(smites, /datum/smite, init_smites())
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
3 changes: 3 additions & 0 deletions code/controllers/configuration/entries/general.dm
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,6 @@
default = list()

/datum/config_entry/flag/toast_notification_on_init

/// Gives the ability to send players a maptext popup.
/datum/config_entry/flag/popup_admin_pm
3 changes: 2 additions & 1 deletion code/controllers/subsystem/traumas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ SUBSYSTEM_DEF(traumas)
"mimes" = strings(PHOBIA_FILE, "mimes"),
"cats" = strings(PHOBIA_FILE, "cats"),
"syndicate"= strings(PHOBIA_FILE, "syndicate"),
"eye" = strings(PHOBIA_FILE, "eye")
"eye" = strings(PHOBIA_FILE, "eye"),
"ocky icky" = strings(PHOBIA_FILE, "ocky icky")
)

phobia_mobs = list("spiders" = typecacheof(list(/mob/living/simple_animal/hostile/poison/giant_spider)),
Expand Down
4 changes: 4 additions & 0 deletions code/datums/brain_damage/phobia.dm
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,7 @@
/datum/brain_trauma/mild/phobia/conspiracies
phobia_type = "conspiracies"
random_gain = FALSE

/datum/brain_trauma/mild/phobia/ocky_icky
phobia_type = "ocky icky"
random_gain = FALSE
125 changes: 125 additions & 0 deletions code/datums/components/admin_popup.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/// Applied to clients when they receive an admin popup, alerting them to
/// their ticket.
/datum/component/admin_popup
/// The user's most active ticket. If this is resolved, closed, or replied to,
/// then the component will delete itself.
var/datum/admin_help/ticket

var/atom/movable/screen/admin_popup/admin_popup

/datum/component/admin_popup/Initialize(datum/admin_help/ticket)
if (!istype(parent, /client))
return COMPONENT_INCOMPATIBLE

if (!istype(ticket))
return COMPONENT_INCOMPATIBLE

create_notice()

RegisterSignal(
ticket,
list(
COMSIG_ADMIN_HELP_MADE_INACTIVE,
COMSIG_ADMIN_HELP_REPLIED,
COMSIG_PARENT_QDELETING,
),
PROC_REF(delete_self),
)

/datum/component/admin_popup/Destroy(force)
var/client/parent_client = parent

parent_client?.screen -= admin_popup
QDEL_NULL(admin_popup)

if (!QDELETED(ticket))
UnregisterSignal(ticket, list(
COMSIG_ADMIN_HELP_MADE_INACTIVE,
COMSIG_ADMIN_HELP_REPLIED,
COMSIG_PARENT_QDELETING,
))

ticket = null

return ..()

/datum/component/admin_popup/proc/create_notice()
if(admin_popup)
qdel(admin_popup)
admin_popup = new

var/client/parent_client = parent
admin_popup.maptext_width = view_to_pixels(parent_client.view_size.getView())[1]
parent_client.screen += admin_popup

/datum/component/admin_popup/proc/delete_self()
SIGNAL_HANDLER
qdel(src)

/// The UI element for admin popups
/atom/movable/screen/admin_popup
icon = null
icon_state = null
plane = ABOVE_HUD_PLANE
layer = ADMIN_POPUP_LAYER
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
screen_loc = "TOP-5,LEFT"
maptext_height = 480
maptext_width = 480
maptext = ""

var/static/list/colors = list(
COLOR_RED,
COLOR_ORANGE,
COLOR_YELLOW,
COLOR_LIME,
COLOR_CYAN,
COLOR_PURPLE,
)

/// The last color chosen in the animation, sourced from the static list colors.
var/last_color_index = 0

/// The `world.time` when the last color update occurred.
var/last_update_time = 0

/atom/movable/screen/admin_popup/Initialize(mapload, datum/hud/hud_owner, ...)
. = ..()

START_PROCESSING(SSobj, src)
update_text()

/atom/movable/screen/admin_popup/Destroy()
STOP_PROCESSING(SSobj, src)
return ..()

/atom/movable/screen/admin_popup/process(seconds_per_tick)
update_text()

/atom/movable/screen/admin_popup/proc/update_text()
// Even if processing time changes, we want this to remain slow.
// We want to pester them into reading their ticket, not give them a seizure!
if (world.time - last_update_time < 2 SECONDS)
return

last_color_index = (last_color_index % colors.len) + 1

var/message = "<span style='color: [colors[last_color_index]]; text-align: center; font-size: 24pt'>"
message += "HEY!<br>An admin is trying to talk to you!<br>Check your chat window,<br>and click their name to respond!"
message += "</span>"

maptext = MAPTEXT(message)
last_update_time = world.time

/// Tries to give the target an admin popup.
/// If it fails, will send the error to the passed admin.
/proc/give_admin_popup(client/target, client/admin, message)
log_admin("[key_name(admin)] sent an admin popup to [key_name(target)].")

var/datum/admin_help/current_ticket = target.current_ticket
if (!current_ticket)
to_chat(admin, span_warning("[key_name(target)] had no active ahelp, aborting."))
return

admin.cmd_admin_pm(target, message)
target.AddComponent(/datum/component/admin_popup, current_ticket)
83 changes: 83 additions & 0 deletions code/datums/components/manual_blinking.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/datum/component/manual_blinking
dupe_mode = COMPONENT_DUPE_UNIQUE

var/obj/item/organ/eyes/E
var/warn_grace = FALSE
var/warn_dying = FALSE
var/last_blink
var/check_every = 20 SECONDS
var/grace_period = 6 SECONDS
var/damage_rate = 1 // organ damage taken per tick
var/list/valid_emotes = list(/datum/emote/living/carbon/blink, /datum/emote/living/carbon/blink_r)

/datum/component/manual_blinking/Initialize()
if(!iscarbon(parent))
return COMPONENT_INCOMPATIBLE

var/mob/living/carbon/C = parent
E = C.getorganslot(ORGAN_SLOT_EYES)

if(E)
START_PROCESSING(SSdcs, src)
last_blink = world.time
to_chat(C, "<span class='notice'>You suddenly realize you're blinking manually.</span>")

/datum/component/manual_blinking/Destroy(force, silent)
E = null
STOP_PROCESSING(SSdcs, src)
to_chat(parent, "<span class='notice'>You revert back to automatic blinking.</span>")
return ..()

/datum/component/manual_blinking/RegisterWithParent()
RegisterSignal(parent, COMSIG_MOB_EMOTE, .proc/check_emote)
RegisterSignal(parent, COMSIG_ORGAN_INSERTED, .proc/check_added_organ)
RegisterSignal(parent, COMSIG_ORGAN_REMOVED, .proc/check_removed_organ)
RegisterSignal(parent, COMSIG_LIVING_REVIVE, .proc/restart)
RegisterSignal(parent, COMSIG_MOB_DEATH, .proc/pause)

/datum/component/manual_blinking/UnregisterFromParent()
UnregisterSignal(parent, COMSIG_MOB_EMOTE)
UnregisterSignal(parent, COMSIG_ORGAN_INSERTED)
UnregisterSignal(parent, COMSIG_ORGAN_REMOVED)
UnregisterSignal(parent, COMSIG_LIVING_REVIVE)
UnregisterSignal(parent, COMSIG_MOB_DEATH)

/datum/component/manual_blinking/proc/restart()
START_PROCESSING(SSdcs, src)

/datum/component/manual_blinking/proc/pause()
STOP_PROCESSING(SSdcs, src)

/datum/component/manual_blinking/process()
var/mob/living/carbon/C = parent

if(world.time > (last_blink + check_every + grace_period))
if(!warn_dying)
to_chat(C, "<span class='userdanger'>Your eyes begin to wither, you need to blink!</span>")
warn_dying = TRUE

E.applyOrganDamage(damage_rate)
else if(world.time > (last_blink + check_every))
if(!warn_grace)
to_chat(C, "<span class='danger'>You feel a need to blink!</span>")
warn_grace = TRUE

/datum/component/manual_blinking/proc/check_added_organ(mob/who_cares, obj/item/organ/O)
var/obj/item/organ/eyes/new_eyes = O

if(istype(new_eyes,/obj/item/organ/eyes))
E = new_eyes
START_PROCESSING(SSdcs, src)

/datum/component/manual_blinking/proc/check_removed_organ(mob/who_cares, obj/item/organ/O)
var/obj/item/organ/eyes/bye_beyes = O // oh come on, that's pretty good

if(istype(bye_beyes, /obj/item/organ/eyes))
E = null
STOP_PROCESSING(SSdcs, src)

/datum/component/manual_blinking/proc/check_emote(mob/living/carbon/user, datum/emote/emote)
if(emote.type in valid_emotes)
warn_grace = FALSE
warn_dying = FALSE
last_blink = world.time
Loading

0 comments on commit 76661cc

Please sign in to comment.