mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 12:08:55 +01:00
Converts drunkness and dizziness to status effects. Refactors status effect examine text (and, subsequently, stabilized black extracts). (#66340)
* Refactors dizziness into a status effect * Refactors the dizziness setter to use the new kind * Drunkness. - Should drunk continue to work off of a magic value or be swapped to duration? I've not yet decided: For understandability it's preferabale for "drunk" to use a timer (they are drunk for 3 more minutes), but both adding drunk and decreasing drunk currently use weird calculations which would be difficult to carry over. - Ballmer is a liver trait * Dizzy was a setter, not an adjuster * Does all the drunk effects over - refactors examine text fully - refactors stabilized blacks because of this * Removed * repaths, fixes some issues * Minor fixes * Some erroneous changes * Fixes some dizziness errors * Consistency thing * Warning * Undoes this change, I dont like its implementation * max_duration * Max amount * Should be a negative * max duration * drunk doesn't tick on death * Rework dizziness strength * Erroneous dizzy change * Fixes return type
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
///How often a carbon becomes penalized
|
||||
#define BEYBLADE_DIZZINESS_PROBABILITY 20
|
||||
///How long the screenshake lasts
|
||||
#define BEYBLADE_DIZZINESS_VALUE 10
|
||||
#define BEYBLADE_DIZZINESS_DURATION 20 SECONDS
|
||||
///How much confusion a carbon gets when penalized
|
||||
#define BEYBLADE_CONFUSION_INCREMENT 10
|
||||
///A max for how penalized a carbon will be for beyblading
|
||||
@@ -121,13 +121,13 @@
|
||||
return
|
||||
if(prob(BEYBLADE_DIZZINESS_PROBABILITY))
|
||||
to_chat(user, span_warning("You feel woozy from spinning."))
|
||||
user.Dizzy(BEYBLADE_DIZZINESS_VALUE)
|
||||
user.set_timed_status_effect(BEYBLADE_DIZZINESS_DURATION, /datum/status_effect/dizziness, only_if_higher = TRUE)
|
||||
if(current_confusion < BEYBLADE_CONFUSION_LIMIT)
|
||||
user.add_confusion(BEYBLADE_CONFUSION_INCREMENT)
|
||||
|
||||
#undef BEYBLADE_PUKE_THRESHOLD
|
||||
#undef BEYBLADE_PUKE_NUTRIENT_LOSS
|
||||
#undef BEYBLADE_DIZZINESS_PROBABILITY
|
||||
#undef BEYBLADE_DIZZINESS_VALUE
|
||||
#undef BEYBLADE_DIZZINESS_DURATION
|
||||
#undef BEYBLADE_CONFUSION_INCREMENT
|
||||
#undef BEYBLADE_CONFUSION_LIMIT
|
||||
|
||||
@@ -86,8 +86,6 @@
|
||||
var/next_hallucination = 0
|
||||
var/damageoverlaytemp = 0
|
||||
|
||||
///Overall drunkenness
|
||||
var/drunkenness = 0
|
||||
///used to halt stamina regen temporarily
|
||||
var/stam_regen_start_time = 0
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ GLOBAL_LIST_EMPTY(dead_players_during_shift)
|
||||
|
||||
. = ..()
|
||||
|
||||
dizziness = 0
|
||||
jitteriness = 0
|
||||
if(client && !suiciding && !(client in GLOB.dead_players_during_shift))
|
||||
GLOB.dead_players_during_shift += client
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
. = list("<span class='info'>*---------*\nThis is <EM>[!obscure_name ? name : "Unknown"]</EM>!")
|
||||
|
||||
var/obscured = check_obscured_slots()
|
||||
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
|
||||
|
||||
|
||||
//uniform
|
||||
if(w_uniform && !(obscured & ITEM_SLOT_ICLOTHING) && !(w_uniform.item_flags & EXAMINE_SKIP))
|
||||
@@ -98,7 +96,7 @@
|
||||
. += wear_id.get_id_examine_strings(user)
|
||||
|
||||
//Status effects
|
||||
var/list/status_examines = status_effect_examines()
|
||||
var/list/status_examines = get_status_effect_examinations()
|
||||
if (length(status_examines))
|
||||
. += status_examines
|
||||
|
||||
@@ -304,21 +302,6 @@
|
||||
msg += "[t_He] [t_is]n't responding to anything around [t_him] and seem[p_s()] to be asleep.\n"
|
||||
|
||||
if(!appears_dead)
|
||||
if(drunkenness && !skipface) //Drunkenness
|
||||
switch(drunkenness)
|
||||
if(11 to 21)
|
||||
msg += "[t_He] [t_is] slightly flushed.\n"
|
||||
if(21.01 to 41) //.01s are used in case drunkenness ends up to be a small decimal
|
||||
msg += "[t_He] [t_is] flushed.\n"
|
||||
if(41.01 to 51)
|
||||
msg += "[t_He] [t_is] quite flushed and [t_his] breath smells of alcohol.\n"
|
||||
if(51.01 to 61)
|
||||
msg += "[t_He] [t_is] very flushed and [t_his] movements jerky, with breath reeking of alcohol.\n"
|
||||
if(61.01 to 91)
|
||||
msg += "[t_He] look[p_s()] like a drunken mess.\n"
|
||||
if(91.01 to INFINITY)
|
||||
msg += "[t_He] [t_is] a shitfaced, slobbering wreck.\n"
|
||||
|
||||
if(src != user)
|
||||
if(HAS_TRAIT(user, TRAIT_EMPATH))
|
||||
if (combat_mode)
|
||||
@@ -430,18 +413,23 @@
|
||||
|
||||
SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .)
|
||||
|
||||
/mob/living/proc/status_effect_examines(pronoun_replacement) //You can include this in any mob's examine() to show the examine texts of status effects!
|
||||
var/list/dat = list()
|
||||
if(!pronoun_replacement)
|
||||
pronoun_replacement = p_they(TRUE)
|
||||
for(var/V in status_effects)
|
||||
var/datum/status_effect/E = V
|
||||
if(E.examine_text)
|
||||
var/new_text = replacetext(E.examine_text, "SUBJECTPRONOUN", pronoun_replacement)
|
||||
new_text = replacetext(new_text, "[pronoun_replacement] is", "[pronoun_replacement] [p_are()]") //To make sure something become "They are" or "She is", not "They are" and "She are"
|
||||
dat += "[new_text]\n" //dat.Join("\n") doesn't work here, for some reason
|
||||
if(dat.len)
|
||||
return dat.Join()
|
||||
/**
|
||||
* Shows any and all examine text related to any status effects the user has.
|
||||
*/
|
||||
/mob/living/proc/get_status_effect_examinations()
|
||||
var/list/examine_list = list()
|
||||
|
||||
for(var/datum/status_effect/effect as anything in status_effects)
|
||||
var/effect_text = effect.get_examine_text()
|
||||
if(!effect_text)
|
||||
continue
|
||||
|
||||
examine_list += effect_text
|
||||
|
||||
if(!length(examine_list))
|
||||
return
|
||||
|
||||
return examine_list.Join("\n")
|
||||
|
||||
/mob/living/carbon/human/examine_more(mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -759,7 +759,6 @@
|
||||
regenerate_organs()
|
||||
remove_all_embedded_objects()
|
||||
set_heartattack(FALSE)
|
||||
drunkenness = 0
|
||||
for(var/datum/mutation/human/HM in dna.mutations)
|
||||
if(HM.quality != POSITIVE)
|
||||
dna.remove_mutation(HM.name)
|
||||
|
||||
@@ -426,39 +426,6 @@ All effects don't start immediately, but rather get worse over time; the rate is
|
||||
|
||||
var/restingpwr = 0.5 + 2 * resting
|
||||
|
||||
//Dizziness
|
||||
if(dizziness)
|
||||
var/old_dizzy = dizziness
|
||||
dizziness = max(dizziness - (restingpwr * delta_time), 0)
|
||||
|
||||
if(client)
|
||||
//Want to be able to offset things by the time the animation should be "playing" at
|
||||
var/time = world.time
|
||||
var/delay = 0
|
||||
var/pixel_x_diff = 0
|
||||
var/pixel_y_diff = 0
|
||||
|
||||
var/amplitude = old_dizzy*(sin(old_dizzy * (time)) + 1) // This shit is annoying at high strengthvar/pixel_x_diff = 0
|
||||
var/x_diff = amplitude * sin(old_dizzy * time)
|
||||
var/y_diff = amplitude * cos(old_dizzy * time)
|
||||
pixel_x_diff += x_diff
|
||||
pixel_y_diff += y_diff
|
||||
// Brief explanation. We're basically snapping between different pixel_x/ys instantly, with delays between
|
||||
// Doing this with relative changes. This way we don't override any existing pixel_x/y values
|
||||
// We use EASE_OUT here for similar reasons, we want to act at the end of the delay, not at its start
|
||||
// Relative animations are weird, so we do actually need this
|
||||
animate(client, pixel_x = x_diff, pixel_y = y_diff, 3, easing = JUMP_EASING | EASE_OUT, flags = ANIMATION_RELATIVE)
|
||||
delay += 0.3 SECONDS // This counts as a 0.3 second wait, so we need to shift the sine wave by that much
|
||||
|
||||
x_diff = amplitude * sin(dizziness * (time + delay))
|
||||
y_diff = amplitude * cos(dizziness * (time + delay))
|
||||
pixel_x_diff += x_diff
|
||||
pixel_y_diff += y_diff
|
||||
animate(pixel_x = x_diff, pixel_y = y_diff, 3, easing = JUMP_EASING | EASE_OUT, flags = ANIMATION_RELATIVE)
|
||||
|
||||
// Now we reset back to our old pixel_x/y, since these animates are relative
|
||||
animate(pixel_x = -pixel_x_diff, pixel_y = -pixel_y_diff, 3, easing = JUMP_EASING | EASE_OUT, flags = ANIMATION_RELATIVE)
|
||||
|
||||
if(drowsyness)
|
||||
adjust_drowsyness(-1 * restingpwr * delta_time)
|
||||
blur_eyes(1 * delta_time)
|
||||
@@ -479,71 +446,6 @@ All effects don't start immediately, but rather get worse over time; the rate is
|
||||
if(hallucination)
|
||||
handle_hallucinations(delta_time, times_fired)
|
||||
|
||||
if(drunkenness)
|
||||
drunkenness = max(drunkenness - ((0.005 + (drunkenness * 0.02)) * delta_time), 0)
|
||||
if(drunkenness >= 6)
|
||||
SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "drunk", /datum/mood_event/drunk)
|
||||
if(DT_PROB(16, delta_time))
|
||||
adjust_timed_status_effect(4 SECONDS, /datum/status_effect/speech/slurring/drunk)
|
||||
jitteriness = max(jitteriness - (1.5 * delta_time), 0)
|
||||
throw_alert(ALERT_DRUNK, /atom/movable/screen/alert/drunk)
|
||||
sound_environment_override = SOUND_ENVIRONMENT_PSYCHOTIC
|
||||
else
|
||||
SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "drunk")
|
||||
clear_alert(ALERT_DRUNK)
|
||||
sound_environment_override = SOUND_ENVIRONMENT_NONE
|
||||
|
||||
if(drunkenness >= 11)
|
||||
var/datum/status_effect/speech/slurring/drunk/already_slurring = has_status_effect(/datum/status_effect/speech/slurring/drunk)
|
||||
if(!already_slurring || already_slurring.duration - world.time <= 10 SECONDS)
|
||||
adjust_timed_status_effect(1.2 SECONDS * delta_time, /datum/status_effect/speech/slurring/drunk)
|
||||
|
||||
if(mind && (is_scientist_job(mind.assigned_role) || is_research_director_job(mind.assigned_role)))
|
||||
if(SSresearch.science_tech)
|
||||
if(drunkenness >= 12.9 && drunkenness <= 13.8)
|
||||
drunkenness = round(drunkenness, 0.01)
|
||||
if(DT_PROB(2.5, delta_time))
|
||||
say(pick_list_replacements(VISTA_FILE, "ballmer_good_msg"), forced = "ballmer")
|
||||
if(drunkenness > 26) // by this point you're into windows ME territory
|
||||
if(DT_PROB(2.5, delta_time))
|
||||
say(pick_list_replacements(VISTA_FILE, "ballmer_windows_me_msg"), forced = "ballmer")
|
||||
|
||||
if(drunkenness >= 41)
|
||||
if(DT_PROB(16, delta_time))
|
||||
add_confusion(2)
|
||||
Dizzy(5 * delta_time)
|
||||
|
||||
if(drunkenness >= 51)
|
||||
if(DT_PROB(1.5, delta_time))
|
||||
add_confusion(15)
|
||||
vomit() // vomiting clears toxloss, consider this a blessing
|
||||
Dizzy(12.5 * delta_time)
|
||||
|
||||
if(drunkenness >= 61)
|
||||
if(DT_PROB(30, delta_time))
|
||||
blur_eyes(5)
|
||||
|
||||
if(drunkenness >= 71)
|
||||
blur_eyes(2.5 * delta_time)
|
||||
|
||||
if(drunkenness >= 81)
|
||||
adjustToxLoss(0.5 * delta_time)
|
||||
if(!stat && DT_PROB(2.5, delta_time))
|
||||
to_chat(src, span_warning("Maybe you should lie down for a bit..."))
|
||||
|
||||
if(drunkenness >= 91)
|
||||
adjustToxLoss(0.5 * delta_time)
|
||||
adjustOrganLoss(ORGAN_SLOT_BRAIN, 0.2 * delta_time)
|
||||
if(DT_PROB(10, delta_time) && !stat)
|
||||
if(SSshuttle.emergency.mode == SHUTTLE_DOCKED && is_station_level(z)) //QoL mainly
|
||||
to_chat(src, span_warning("You're so tired... but you can't miss that shuttle..."))
|
||||
else
|
||||
to_chat(src, span_warning("Just a quick nap..."))
|
||||
Sleeping(900)
|
||||
|
||||
if(drunkenness >= 101)
|
||||
adjustToxLoss(1 * delta_time) //Let's be honest you shouldn't be alive by now
|
||||
|
||||
/// Base carbon environment handler, adds natural stabilization
|
||||
/mob/living/carbon/handle_environment(datum/gas_mixture/environment, delta_time, times_fired)
|
||||
var/areatemp = get_temperature(environment)
|
||||
|
||||
@@ -833,7 +833,6 @@
|
||||
bodytemperature = get_body_temp_normal(apply_change=FALSE)
|
||||
set_blindness(0)
|
||||
set_blurriness(0)
|
||||
set_dizziness(0)
|
||||
cure_nearsighted()
|
||||
cure_blind()
|
||||
cure_husk()
|
||||
@@ -842,7 +841,6 @@
|
||||
extinguish_mob()
|
||||
fire_stacks = 0
|
||||
set_confusion(0)
|
||||
dizziness = 0
|
||||
set_drowsyness(0)
|
||||
jitteriness = 0
|
||||
stop_sound_channel(CHANNEL_HEARTBEAT)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
var/obj/act_module = get_active_held_item()
|
||||
if(act_module)
|
||||
. += "It is holding [icon2html(act_module, user)] \a [act_module]."
|
||||
. += status_effect_examines()
|
||||
. += get_status_effect_examinations()
|
||||
if (getBruteLoss())
|
||||
if (getBruteLoss() < maxHealth*0.5)
|
||||
. += span_warning("It looks slightly dented.")
|
||||
|
||||
@@ -211,7 +211,7 @@ Difficulty: Hard
|
||||
animate(src, pixel_z = rand(5, 15), time = 1, loop = 20)
|
||||
animate(pixel_z = 0, time = 1)
|
||||
for(var/mob/living/dizzy_target in get_hearers_in_view(7, src) - src)
|
||||
dizzy_target.Dizzy(6)
|
||||
dizzy_target.set_timed_status_effect(12 SECONDS, /datum/status_effect/dizziness, only_if_higher = TRUE)
|
||||
to_chat(dizzy_target, span_danger("The wendigo screams loudly!"))
|
||||
SLEEP_CHECK_DEATH(1 SECONDS, src)
|
||||
spiral_attack()
|
||||
|
||||
@@ -727,3 +727,49 @@
|
||||
|
||||
else if(duration > 0)
|
||||
apply_status_effect(effect, duration)
|
||||
|
||||
/**
|
||||
* Adjust the "drunk value" the mob is currently experiencing,
|
||||
* or applies a drunk effect if the mob isn't currently drunk (or tipsy)
|
||||
*
|
||||
* The drunk effect doesn't have a set duration, like dizziness or drugginess,
|
||||
* but instead relies on a value that decreases every status effect tick (2 seconds) by:
|
||||
* 4% the current drunk_value + 0.01
|
||||
*
|
||||
* A "drunk value" of 6 is the border between "tipsy" and "drunk".
|
||||
*
|
||||
* amount - the amount of "drunkness" to apply to the mob.
|
||||
* down_to - the lower end of the clamp, when adding the value
|
||||
* up_to - the upper end of the clamp, when adding the value
|
||||
*/
|
||||
/mob/living/proc/adjust_drunk_effect(amount, down_to = 0, up_to = INFINITY)
|
||||
if(!isnum(amount))
|
||||
CRASH("adjust_drunk_effect: called with an invalid amount. (Got: [amount])")
|
||||
|
||||
var/datum/status_effect/inebriated/inebriation = has_status_effect(/datum/status_effect/inebriated)
|
||||
if(inebriation)
|
||||
inebriation.set_drunk_value(clamp(inebriation.drunk_value + amount, down_to, up_to))
|
||||
else if(amount > 0)
|
||||
apply_status_effect(/datum/status_effect/inebriated/tipsy, amount)
|
||||
|
||||
|
||||
/**
|
||||
* Directly sets the "drunk value" the mob is currently experiencing to the passed value,
|
||||
* or applies a drunk effect with the passed value if the mob isn't currently drunk
|
||||
*
|
||||
* set_to - the amount of "drunkness" to set on the mob.
|
||||
*/
|
||||
/mob/living/proc/set_drunk_effect(set_to)
|
||||
if(!isnum(set_to) || set_to < 0)
|
||||
CRASH("set_drunk_effect: called with an invalid value. (Got: [set_to])")
|
||||
|
||||
var/datum/status_effect/inebriated/inebriation = has_status_effect(/datum/status_effect/inebriated)
|
||||
if(inebriation)
|
||||
inebriation.set_drunk_value(set_to)
|
||||
else if(set_to > 0)
|
||||
apply_status_effect(/datum/status_effect/inebriated/tipsy, set_to)
|
||||
|
||||
/// Helper to get the amount of drunkness the mob's currently experiencing.
|
||||
/mob/living/proc/get_drunk_amount()
|
||||
var/datum/status_effect/inebriated/inebriation = has_status_effect(/datum/status_effect/inebriated)
|
||||
return inebriation?.drunk_value || 0
|
||||
|
||||
@@ -1289,9 +1289,6 @@
|
||||
if(NAMEOF(src, stat))
|
||||
set_stat(var_value)
|
||||
. = TRUE
|
||||
if(NAMEOF(src, dizziness))
|
||||
set_dizziness(var_value)
|
||||
. = TRUE
|
||||
if(NAMEOF(src, eye_blind))
|
||||
set_blindness(var_value)
|
||||
. = TRUE
|
||||
|
||||
@@ -108,8 +108,6 @@
|
||||
var/old_bodytemperature = 0
|
||||
/// Drowsyness level of the mob
|
||||
var/drowsyness = 0//Carbon
|
||||
/// Dizziness level of the mob
|
||||
var/dizziness = 0//Carbon
|
||||
/// Jitteryness level of the mob
|
||||
var/jitteriness = 0//Carbon
|
||||
/// Hunger level of the mob
|
||||
|
||||
@@ -7,18 +7,6 @@
|
||||
/mob/proc/Jitter(amount)
|
||||
jitteriness = max(jitteriness,amount,0)
|
||||
|
||||
/**
|
||||
* Set the dizzyness of a mob to a passed in amount
|
||||
*
|
||||
* Except if dizziness is already higher in which case it does nothing
|
||||
*/
|
||||
/mob/proc/Dizzy(amount)
|
||||
dizziness = max(dizziness,amount,0)
|
||||
|
||||
///FOrce set the dizzyness of a mob
|
||||
/mob/proc/set_dizziness(amount)
|
||||
dizziness = max(amount, 0)
|
||||
|
||||
/**
|
||||
* Set drowsyness of a mob to passed value
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user