mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2026-08-31 00:26:56 +01:00
Merge remote-tracking branch 'venus/master' into content-stuff
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -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
|
||||
@@ -0,0 +1,93 @@
|
||||
/datum/component/manual_breathing
|
||||
dupe_mode = COMPONENT_DUPE_UNIQUE
|
||||
|
||||
var/obj/item/organ/lungs/L
|
||||
var/warn_grace = FALSE
|
||||
var/warn_dying = FALSE
|
||||
var/last_breath
|
||||
var/check_every = 12 SECONDS
|
||||
var/grace_period = 6 SECONDS
|
||||
var/damage_rate = 1 // organ damage taken per tick
|
||||
var/datum/emote/next_breath_type = /datum/emote/inhale
|
||||
|
||||
/datum/component/manual_breathing/Initialize()
|
||||
if(!iscarbon(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
var/mob/living/carbon/C = parent
|
||||
L = C.getorganslot(ORGAN_SLOT_LUNGS)
|
||||
|
||||
if(L)
|
||||
START_PROCESSING(SSdcs, src)
|
||||
last_breath = world.time
|
||||
to_chat(C, "<span class='notice'>You suddenly realize you're breathing manually.</span>")
|
||||
|
||||
/datum/component/manual_breathing/Destroy(force, silent)
|
||||
L = null
|
||||
STOP_PROCESSING(SSdcs, src)
|
||||
to_chat(parent, "<span class='notice'>You revert back to automatic breathing.</span>")
|
||||
return ..()
|
||||
|
||||
/datum/component/manual_breathing/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_breathing/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_breathing/proc/restart()
|
||||
START_PROCESSING(SSdcs, src)
|
||||
|
||||
/datum/component/manual_breathing/proc/pause()
|
||||
STOP_PROCESSING(SSdcs, src)
|
||||
|
||||
/datum/component/manual_breathing/process()
|
||||
var/mob/living/carbon/C = parent
|
||||
|
||||
var/next_text = initial(next_breath_type.key)
|
||||
if(world.time > (last_breath + check_every + grace_period))
|
||||
if(!warn_dying)
|
||||
to_chat(C, "<span class='userdanger'>You begin to suffocate, you need to [next_text]!</span>")
|
||||
warn_dying = TRUE
|
||||
|
||||
L.applyOrganDamage(damage_rate)
|
||||
C.losebreath += 0.8
|
||||
else if(world.time > (last_breath + check_every))
|
||||
if(!warn_grace)
|
||||
to_chat(C, "<span class='danger'>You feel a need to [next_text]!</span>")
|
||||
warn_grace = TRUE
|
||||
|
||||
/datum/component/manual_breathing/proc/check_added_organ(mob/who_cares, obj/item/organ/O)
|
||||
var/obj/item/organ/eyes/new_lungs = O
|
||||
|
||||
if(istype(new_lungs,/obj/item/organ/lungs))
|
||||
L = new_lungs
|
||||
START_PROCESSING(SSdcs, src)
|
||||
|
||||
/datum/component/manual_breathing/proc/check_removed_organ(mob/who_cares, obj/item/organ/O)
|
||||
var/obj/item/organ/lungs/old_lungs = O
|
||||
|
||||
if(istype(old_lungs, /obj/item/organ/lungs))
|
||||
L = null
|
||||
STOP_PROCESSING(SSdcs, src)
|
||||
|
||||
/datum/component/manual_breathing/proc/check_emote(mob/living/carbon/user, datum/emote/emote)
|
||||
if(emote.type == next_breath_type)
|
||||
if(next_breath_type == /datum/emote/inhale)
|
||||
next_breath_type = /datum/emote/exhale
|
||||
else
|
||||
next_breath_type = /datum/emote/inhale
|
||||
|
||||
warn_grace = FALSE
|
||||
warn_dying = FALSE
|
||||
last_breath = world.time
|
||||
|
||||
var/mob/living/carbon/C = parent
|
||||
C.losebreath = max(0, C.losebreath - 0.4)
|
||||
Reference in New Issue
Block a user