mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 06:00:16 +01:00
[MIRROR] Addiction rework (#3445)
* Addiction rework * a Co-authored-by: Qustinnus <Floydje123@hotmail.com> Co-authored-by: Gandalf2k15 <jzo123@hotmail.com>
This commit is contained in:
co-authored by
Qustinnus
Gandalf2k15
parent
43febe3145
commit
3b85cf1430
@@ -202,7 +202,7 @@
|
||||
message.maptext = MAPTEXT(complete_text)
|
||||
|
||||
// View the message
|
||||
LAZYADDASSOC(owned_by.seen_messages, message_loc, src)
|
||||
LAZYADDASSOCLIST(owned_by.seen_messages, message_loc, src)
|
||||
owned_by.images |= message
|
||||
animate(message, alpha = 255, time = CHAT_MESSAGE_SPAWN_TIME)
|
||||
|
||||
|
||||
@@ -257,6 +257,8 @@
|
||||
add_event(null, "jolly", /datum/mood_event/jolly)
|
||||
|
||||
|
||||
|
||||
|
||||
///Sets sanity to the specified amount and applies effects.
|
||||
/datum/component/mood/proc/setSanity(amount, minimum=SANITY_INSANE, maximum=SANITY_GREAT, override = FALSE)
|
||||
// If we're out of the acceptable minimum-maximum range move back towards it in steps of 0.7
|
||||
@@ -478,5 +480,18 @@
|
||||
add_event(null, "slipped", /datum/mood_event/slipped)
|
||||
|
||||
|
||||
/datum/component/mood/proc/HandleAddictions()
|
||||
if(!iscarbon(parent))
|
||||
return
|
||||
|
||||
var/mob/living/carbon/affected_carbon = parent
|
||||
|
||||
if(sanity < SANITY_GREAT) ///Sanity is low, stay addicted.
|
||||
return
|
||||
|
||||
for(var/addiction_type in affected_carbon.mind.addiction_points)
|
||||
var/datum/addiction/addiction_to_remove = SSaddiction.all_addictions[type]
|
||||
affected_carbon.mind.remove_addiction_points(type, addiction_to_remove.high_sanity_addiction_loss) //If true was returned, we lost the addiction!
|
||||
|
||||
#undef MINOR_INSANITY_PEN
|
||||
#undef MAJOR_INSANITY_PEN
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
adjusted_climb_time *= 0.25 //aliens are terrifyingly fast
|
||||
if(HAS_TRAIT(user, TRAIT_FREERUNNING)) //do you have any idea how fast I am???
|
||||
adjusted_climb_time *= 0.8
|
||||
LAZYADDASSOC(current_climbers, climbed_thing, user)
|
||||
LAZYADDASSOCLIST(current_climbers, climbed_thing, user)
|
||||
if(do_after(user, adjusted_climb_time, climbed_thing))
|
||||
if(QDELETED(climbed_thing)) //Checking if structure has been destroyed
|
||||
return
|
||||
|
||||
@@ -83,6 +83,11 @@
|
||||
/// A lazy list of statuses to add next to this mind in the traitor panel
|
||||
var/list/special_statuses
|
||||
|
||||
///Assoc list of addiction values, key is the type of withdrawal (as singleton type), and the value is the amount of addiction points (as number)
|
||||
var/list/addiction_points
|
||||
///Assoc list of key active addictions and value amount of cycles that it has been active.
|
||||
var/list/active_addictions
|
||||
|
||||
/datum/mind/New(_key)
|
||||
key = _key
|
||||
martial_art = default_martial_art
|
||||
@@ -826,6 +831,18 @@
|
||||
return martial_art
|
||||
return FALSE
|
||||
|
||||
///Adds addiction points to the specified addiction
|
||||
/datum/mind/proc/add_addiction_points(type, amount)
|
||||
LAZYSET(addiction_points, type, min(LAZYACCESS(addiction_points, type) + amount, MAX_ADDICTION_POINTS))
|
||||
var/datum/addiction/affected_addiction = SSaddiction.all_addictions[type]
|
||||
return affected_addiction.on_gain_addiction_points(src)
|
||||
|
||||
///Adds addiction points to the specified addiction
|
||||
/datum/mind/proc/remove_addiction_points(type, amount)
|
||||
LAZYSET(addiction_points, type, max(LAZYACCESS(addiction_points, type) - amount, 0))
|
||||
var/datum/addiction/affected_addiction = SSaddiction.all_addictions[type]
|
||||
return affected_addiction.on_lose_addiction_points(src)
|
||||
|
||||
/mob/dead/new_player/sync_mind()
|
||||
return
|
||||
|
||||
|
||||
@@ -128,6 +128,10 @@
|
||||
description = "<span class='warning'>It sure is dark around here...</span>\n"
|
||||
mood_change = -3
|
||||
|
||||
/datum/mood_event/bright_light
|
||||
description = "<span class='boldwarning'>I hate it in the light...I need to find a darker place...</span>\n"
|
||||
mood_change = -12
|
||||
|
||||
/datum/mood_event/family_heirloom_missing
|
||||
description = "<span class='warning'>I'm missing my family heirloom...</span>\n"
|
||||
mood_change = -4
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
bar.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
|
||||
user = User
|
||||
|
||||
LAZYADDASSOC(user.progressbars, bar_loc, src)
|
||||
LAZYADDASSOCLIST(user.progressbars, bar_loc, src)
|
||||
var/list/bars = user.progressbars[bar_loc]
|
||||
listindex = bars.len
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
var/obj/item/organ/eyes/eyes = H.getorgan(/obj/item/organ/eyes)
|
||||
if(!eyes || eyes.lighting_alpha)
|
||||
return
|
||||
eyes.Insert(H) //refresh their eyesight and vision
|
||||
eyes.refresh() //refresh their eyesight and vision
|
||||
|
||||
/datum/quirk/selfaware
|
||||
name = "Self-Aware"
|
||||
|
||||
@@ -583,7 +583,8 @@
|
||||
if (!reagent_type)
|
||||
reagent_type = pick(drug_list)
|
||||
reagent_instance = new reagent_type()
|
||||
LAZYADD(H.reagents.addiction_list, reagent_instance)
|
||||
for(var/addiction in reagent_instance.addiction_types)
|
||||
H.mind.add_addiction_points(addiction, 1000) ///Max that shit out
|
||||
var/current_turf = get_turf(quirk_holder)
|
||||
if (!drug_container_type)
|
||||
drug_container_type = /obj/item/storage/pill_bottle
|
||||
@@ -615,7 +616,8 @@
|
||||
|
||||
/datum/quirk/junkie/remove()
|
||||
if(quirk_holder && reagent_instance)
|
||||
quirk_holder.reagents.remove_addiction(reagent_instance) //chat feedback here. No need of lose_text.
|
||||
for(var/addiction_type in subtypesof(/datum/addiction))
|
||||
quirk_holder.mind.remove_addiction_points(addiction_type, MAX_ADDICTION_POINTS) //chat feedback here. No need of lose_text.
|
||||
|
||||
/datum/quirk/junkie/proc/announce_drugs()
|
||||
to_chat(quirk_holder, "<span class='boldnotice'>There is a [initial(drug_container_type.name)] of [initial(reagent_type.name)] [where_drug]. Better hope you don't run out...</span>")
|
||||
@@ -627,13 +629,17 @@
|
||||
if(world.time > next_process)
|
||||
next_process = world.time + process_interval
|
||||
var/deleted = QDELETED(reagent_instance)
|
||||
if(deleted || !LAZYFIND(H.reagents.addiction_list, reagent_instance))
|
||||
var/missing_addiction = FALSE
|
||||
for(var/addiction_type in reagent_instance.addiction_types)
|
||||
if(!LAZYACCESS(H.mind.active_addictions, addiction_type))
|
||||
missing_addiction = TRUE
|
||||
if(deleted || missing_addiction)
|
||||
if(deleted)
|
||||
reagent_instance = new reagent_type()
|
||||
else
|
||||
reagent_instance.addiction_stage = 0
|
||||
LAZYADD(H.reagents.addiction_list, reagent_instance)
|
||||
to_chat(quirk_holder, "<span class='danger'>You thought you kicked it, but you suddenly feel like you need [reagent_instance.name] again...</span>")
|
||||
to_chat(quirk_holder, "<span class='danger'>You thought you kicked it, but you feel like you're falling back onto bad habits..</span>")
|
||||
for(var/addiction in reagent_instance.addiction_types)
|
||||
H.mind.add_addiction_points(addiction, 1000) ///Max that shit out
|
||||
|
||||
|
||||
/datum/quirk/junkie/smoker
|
||||
name = "Smoker"
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/datum/status_effect/woozy
|
||||
id = "woozy"
|
||||
tick_interval = -1
|
||||
status_type = STATUS_EFFECT_UNIQUE
|
||||
alert_type = /atom/movable/screen/alert/status_effect/woozy
|
||||
|
||||
|
||||
/datum/status_effect/woozy/nextmove_modifier()
|
||||
return 1.5
|
||||
|
||||
/atom/movable/screen/alert/status_effect/woozy
|
||||
name = "Woozy"
|
||||
desc = "You feel a bit slower than usual, it seems doing things with your hands takes longer than it usually does"
|
||||
icon_state = "woozy"
|
||||
|
||||
|
||||
/datum/status_effect/high_blood_pressure
|
||||
id = "high_blood_pressure"
|
||||
tick_interval = -1
|
||||
status_type = STATUS_EFFECT_UNIQUE
|
||||
alert_type = /atom/movable/screen/alert/status_effect/high_blood_pressure
|
||||
|
||||
/datum/status_effect/high_blood_pressure/on_apply()
|
||||
if(ishuman(owner))
|
||||
var/mob/living/carbon/human/human_owner = owner
|
||||
human_owner.physiology.bleed_mod *= 1.25
|
||||
|
||||
/datum/status_effect/high_blood_pressure/on_remove()
|
||||
if(ishuman(owner))
|
||||
var/mob/living/carbon/human/human_owner = owner
|
||||
human_owner.physiology.bleed_mod /= 1.25
|
||||
|
||||
/atom/movable/screen/alert/status_effect/high_blood_pressure
|
||||
name = "High blood pressure"
|
||||
desc = "This stuff is driving my blood pressure up the wall...I'll probably bleed like crazy."
|
||||
icon_state = "highbloodpressure"
|
||||
|
||||
|
||||
|
||||
/datum/status_effect/seizure
|
||||
id = "seizure"
|
||||
tick_interval = -1
|
||||
status_type = STATUS_EFFECT_UNIQUE
|
||||
alert_type = /atom/movable/screen/alert/status_effect/seizure
|
||||
|
||||
/datum/status_effect/seizure/on_apply()
|
||||
if(!iscarbon(owner))
|
||||
return FALSE
|
||||
var/amplitude = rand(1 SECONDS, 3 SECONDS)
|
||||
duration = amplitude
|
||||
owner.Jitter(50)
|
||||
owner.Paralyze(duration)
|
||||
owner.visible_message("<span class='warning'>[owner] drops to the ground as [owner.p_they()] start seizing up.</span>", \
|
||||
"<span class='warning'>[pick("You can't collect your thoughts...", "You suddenly feel extremely dizzy...", "You cant think straight...","You can't move your face properly anymore...")]</span>")
|
||||
return TRUE
|
||||
|
||||
/atom/movable/screen/alert/status_effect/seizure
|
||||
name = "Seizure"
|
||||
desc = "FJOIWEHUWQEFGYUWDGHUIWHUIDWEHUIFDUWGYSXQHUIODSDBNJKVBNKDML <--- this is you right now"
|
||||
icon_state = "paralysis"
|
||||
Reference in New Issue
Block a user