diff --git a/code/__DEFINES/status_effects.dm b/code/__DEFINES/status_effects.dm
index 8919af19b39..31002789930 100644
--- a/code/__DEFINES/status_effects.dm
+++ b/code/__DEFINES/status_effects.dm
@@ -88,6 +88,11 @@
#define STATUS_EFFECT_AMOK /datum/status_effect/amok //Makes the target automatically strike out at adjecent non-heretics.
#define STATUS_EFFECT_CLOUDSTRUCK /datum/status_effect/cloudstruck //blinds and applies an overlay.
+
+/// Makes the mob move randomly.
+/// Read the documentation for /datum/status_effect/confusion for more information.
+#define STATUS_EFFECT_CONFUSION /datum/status_effect/confusion
+
/////////////
// NEUTRAL //
/////////////
diff --git a/code/datums/brain_damage/mild.dm b/code/datums/brain_damage/mild.dm
index a890aef3139..d6ae576e181 100644
--- a/code/datums/brain_damage/mild.dm
+++ b/code/datums/brain_damage/mild.dm
@@ -90,7 +90,7 @@
if(2,3)
owner.dizziness += 10
if(4,5)
- owner.confused += 10
+ owner.add_confusion(10)
owner.blur_eyes(10)
if(6 to 9)
owner.slurring += 30
diff --git a/code/datums/brain_damage/phobia.dm b/code/datums/brain_damage/phobia.dm
index f23e08f8d13..dd8b4c60a1a 100644
--- a/code/datums/brain_damage/phobia.dm
+++ b/code/datums/brain_damage/phobia.dm
@@ -118,7 +118,7 @@
owner.blind_eyes(10)
if(4)
owner.dizziness += 10
- owner.confused += 10
+ owner.add_confusion(10)
owner.Jitter(10)
owner.stuttering += 10
diff --git a/code/datums/brain_damage/severe.dm b/code/datums/brain_damage/severe.dm
index 4874fd3581e..77747f2c853 100644
--- a/code/datums/brain_damage/severe.dm
+++ b/code/datums/brain_damage/severe.dm
@@ -190,12 +190,12 @@
if(!high_stress)
to_chat(owner, "You can't stop shaking...")
owner.dizziness += 20
- owner.confused += 20
+ owner.add_confusion(20)
owner.Jitter(20)
else
to_chat(owner, "You feel weak and scared! If only you weren't alone...")
owner.dizziness += 20
- owner.confused += 20
+ owner.add_confusion(20)
owner.Jitter(20)
owner.adjustStaminaLoss(50)
diff --git a/code/datums/components/tackle.dm b/code/datums/components/tackle.dm
index 84124c9878c..01fec505fbc 100644
--- a/code/datums/components/tackle.dm
+++ b/code/datums/components/tackle.dm
@@ -388,7 +388,7 @@
user.visible_message("[user] slams head-first into [hit], suffering major cranial trauma!", "You slam head-first into [hit], and the world explodes around you!")
user.adjustStaminaLoss(30)
user.adjustBruteLoss(30)
- user.confused += 15
+ user.add_confusion(15)
if(prob(80))
user.gain_trauma(/datum/brain_trauma/mild/concussion)
user.playsound_local(get_turf(user), 'sound/weapons/flashbang.ogg', 100, TRUE, 8, 0.9)
@@ -401,7 +401,7 @@
user.visible_message("[user] slams hard into [hit], knocking [user.p_them()] senseless!", "You slam hard into [hit], knocking yourself senseless!")
user.adjustStaminaLoss(30)
user.adjustBruteLoss(10)
- user.confused += 10
+ user.add_confusion(10)
user.Knockdown(30)
shake_camera(user, 3, 4)
diff --git a/code/datums/components/wet_floor.dm b/code/datums/components/wet_floor.dm
index 2e3dce74558..2d3452d335a 100644
--- a/code/datums/components/wet_floor.dm
+++ b/code/datums/components/wet_floor.dm
@@ -69,7 +69,7 @@
/datum/component/wet_floor/proc/AfterSlip(mob/living/L)
if(highest_strength == TURF_WET_LUBE)
- L.confused = max(L.confused, 8)
+ L.set_confusion(max(L.get_confusion(), 8))
/datum/component/wet_floor/proc/update_flags()
var/intensity
diff --git a/code/datums/diseases/advance/symptoms/confusion.dm b/code/datums/diseases/advance/symptoms/confusion.dm
index 07166f3509a..cd6303d51d8 100644
--- a/code/datums/diseases/advance/symptoms/confusion.dm
+++ b/code/datums/diseases/advance/symptoms/confusion.dm
@@ -16,7 +16,6 @@ Bonus
*/
/datum/symptom/confusion
-
name = "Confusion"
desc = "The virus interferes with the proper function of the neural system, leading to bouts of confusion and erratic movement."
stealth = 1
@@ -45,6 +44,10 @@ Bonus
if(A.properties["stealth"] >= 4)
suppress_warning = TRUE
+/datum/symptom/confusion/End(datum/disease/advance/A)
+ A.affected_mob.set_confusion(0)
+ return ..()
+
/datum/symptom/confusion/Activate(datum/disease/advance/A)
if(!..())
return
@@ -55,8 +58,7 @@ Bonus
to_chat(M, "[pick("Your head hurts.", "Your mind blanks for a moment.")]")
else
to_chat(M, "You can't think straight!")
- if(M.confused < 100)
- M.confused += (16 * power)
+ M.add_confusion(16 * power)
if(brain_damage)
M.adjustOrganLoss(ORGAN_SLOT_BRAIN, 3 * power, 80)
M.updatehealth()
diff --git a/code/datums/diseases/advance/symptoms/sensory.dm b/code/datums/diseases/advance/symptoms/sensory.dm
index 6542b919222..1b55b3722a0 100644
--- a/code/datums/diseases/advance/symptoms/sensory.dm
+++ b/code/datums/diseases/advance/symptoms/sensory.dm
@@ -37,7 +37,7 @@
M.dizziness = max(0, M.dizziness - 2)
M.drowsyness = max(0, M.drowsyness - 2)
M.slurring = max(0, M.slurring - 2)
- M.confused = max(0, M.confused - 2)
+ M.set_confusion(max(0, M.get_confusion() - 2))
if(purge_alcohol)
M.reagents.remove_all_type(/datum/reagent/consumable/ethanol, 3)
if(ishuman(M))
diff --git a/code/datums/diseases/anxiety.dm b/code/datums/diseases/anxiety.dm
index cf810b9fdbe..c3f2e06e3db 100644
--- a/code/datums/diseases/anxiety.dm
+++ b/code/datums/diseases/anxiety.dm
@@ -24,14 +24,14 @@
to_chat(affected_mob, "You feel panicky.")
if(prob(2))
to_chat(affected_mob, "You're overtaken with panic!")
- affected_mob.confused += (rand(2,3))
+ affected_mob.add_confusion(rand(2,3))
if(4)
if(prob(10))
to_chat(affected_mob, "You feel butterflies in your stomach.")
if(prob(5))
affected_mob.visible_message("[affected_mob] stumbles around in a panic.", \
"You have a panic attack!")
- affected_mob.confused += (rand(6,8))
+ affected_mob.add_confusion(rand(6,8))
affected_mob.jitteriness += (rand(6,8))
if(prob(2))
affected_mob.visible_message("[affected_mob] coughs up butterflies!", \
diff --git a/code/datums/diseases/heart_failure.dm b/code/datums/diseases/heart_failure.dm
index c4af5b1f7d2..2214f7707f0 100644
--- a/code/datums/diseases/heart_failure.dm
+++ b/code/datums/diseases/heart_failure.dm
@@ -32,7 +32,7 @@
to_chat(H, "You feel [pick("discomfort", "pressure", "a burning sensation", "pain")] in your chest.")
if(prob(2))
to_chat(H, "You feel dizzy.")
- H.confused += 6
+ H.add_confusion(6)
if(prob(3))
to_chat(H, "You feel [pick("full", "nauseated", "sweaty", "weak", "tired", "short on breath", "uneasy")].")
if(3 to 4)
@@ -48,7 +48,7 @@
H.losebreath += 4
if(prob(3))
to_chat(H, "You feel very weak and dizzy...")
- H.confused += 8
+ H.add_confusion(8)
H.adjustStaminaLoss(40)
H.emote("cough")
if(5)
diff --git a/code/datums/diseases/transformation.dm b/code/datums/diseases/transformation.dm
index 9827914c1da..4d7b067ac62 100644
--- a/code/datums/diseases/transformation.dm
+++ b/code/datums/diseases/transformation.dm
@@ -134,7 +134,7 @@
if(3)
if(prob(4))
to_chat(affected_mob, "You feel a stabbing pain in your head.")
- affected_mob.confused += 10
+ affected_mob.add_confusion(10)
if(4)
if(prob(3))
affected_mob.say(pick("Eeek, ook ook!", "Eee-eeek!", "Eeee!", "Ungh, ungh."), forced = "jungle fever")
diff --git a/code/datums/diseases/tuberculosis.dm b/code/datums/diseases/tuberculosis.dm
index 02a417ee06f..9cab5799a6a 100644
--- a/code/datums/diseases/tuberculosis.dm
+++ b/code/datums/diseases/tuberculosis.dm
@@ -46,7 +46,7 @@
affected_mob.AdjustSleeping(100)
if(prob(2))
to_chat(affected_mob, "You feel your mind relax and your thoughts drift!")
- affected_mob.confused = min(100, affected_mob.confused + 8)
+ affected_mob.set_confusion(min(100, affected_mob.get_confusion() + 8))
if(prob(10))
affected_mob.vomit(20)
if(prob(3))
diff --git a/code/datums/mutations/body.dm b/code/datums/mutations/body.dm
index 24a788a5e0e..99326abacdd 100644
--- a/code/datums/mutations/body.dm
+++ b/code/datums/mutations/body.dm
@@ -447,7 +447,7 @@
H.Stun(20)
H.blur_eyes(20)
eyes?.applyOrganDamage(5)
- H.confused += 3
+ H.add_confusion(3)
for(var/mob/living/silicon/S in view(2,owner))
to_chat(S, "Your sensors are disabled by a shower of blood!")
S.Paralyze(60)
diff --git a/code/datums/mutations/touch.dm b/code/datums/mutations/touch.dm
index 39205c2d9b0..00746e51788 100644
--- a/code/datums/mutations/touch.dm
+++ b/code/datums/mutations/touch.dm
@@ -35,7 +35,7 @@
if(C.electrocute_act(15, user, 1, SHOCK_NOSTUN))//doesnt stun. never let this stun
C.dropItemToGround(C.get_active_held_item())
C.dropItemToGround(C.get_inactive_held_item())
- C.confused += 15
+ C.add_confusion(15)
C.visible_message("[user] electrocutes [target]!","[user] electrocutes you!")
return ..()
else
diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm
index 231da81b4f5..0fe0f081657 100644
--- a/code/datums/status_effects/buffs.dm
+++ b/code/datums/status_effects/buffs.dm
@@ -323,7 +323,7 @@
if(owner.can_hear())
owner.dizziness = max(0, owner.dizziness - 2)
owner.jitteriness = max(0, owner.jitteriness - 2)
- owner.confused = max(0, owner.confused - 1)
+ owner.set_confusion(max(0, owner.get_confusion() - 1))
SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "goodmusic", /datum/mood_event/goodmusic)
/obj/screen/alert/status_effect/regenerative_core
diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm
index b039c02fc41..a31203acd62 100644
--- a/code/datums/status_effects/debuffs.dm
+++ b/code/datums/status_effects/debuffs.dm
@@ -390,6 +390,22 @@
I.take_damage(100)
return ..()
+/// A status effect used for specifying confusion on a living mob.
+/// Created automatically with /mob/living/set_confusion.
+/datum/status_effect/confusion
+ id = "confusion"
+ alert_type = null
+ var/strength
+
+/datum/status_effect/confusion/tick()
+ strength -= 1
+ if (strength <= 0)
+ owner.remove_status_effect(STATUS_EFFECT_CONFUSION)
+ return
+
+/datum/status_effect/confusion/proc/set_strength(new_strength)
+ strength = new_strength
+
/datum/status_effect/stacking/saw_bleed
id = "saw_bleed"
tick_interval = 6
diff --git a/code/game/machinery/hypnochair.dm b/code/game/machinery/hypnochair.dm
index 608ba529eb7..5a3a0d56f50 100644
--- a/code/game/machinery/hypnochair.dm
+++ b/code/game/machinery/hypnochair.dm
@@ -148,17 +148,17 @@
var/time_diff = world.time - start_time
switch(time_diff)
if(0 to 100)
- victim.confused += 10
+ victim.add_confusion(10)
victim.Dizzy(100)
victim.blur_eyes(5)
if(101 to 200)
- victim.confused += 15
+ victim.add_confusion(15)
victim.Dizzy(200)
victim.blur_eyes(10)
if(prob(25))
victim.apply_status_effect(/datum/status_effect/trance, rand(50,150), FALSE)
if(201 to INFINITY)
- victim.confused += 20
+ victim.add_confusion(20)
victim.Dizzy(300)
victim.blur_eyes(15)
if(prob(65))
diff --git a/code/game/objects/items/grenades/hypno.dm b/code/game/objects/items/grenades/hypno.dm
index 0412b1ec49d..f8f9cedd0b2 100644
--- a/code/game/objects/items/grenades/hypno.dm
+++ b/code/game/objects/items/grenades/hypno.dm
@@ -62,6 +62,6 @@
C.apply_status_effect(/datum/status_effect/trance, 100, TRUE)
else
to_chat(C, "The light is so pretty...")
- C.confused += min(C.confused + 10, 20)
+ C.add_confusion(min(C.get_confusion() + 10, 20))
C.dizziness += min(C.dizziness + 10, 20)
C.drowsyness += min(C.drowsyness + 10, 20)
diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm
index 22d7900ffa9..1993930826c 100644
--- a/code/game/objects/items/robot/robot_items.dm
+++ b/code/game/objects/items/robot/robot_items.dm
@@ -303,7 +303,7 @@
"The siren pierces your hearing!")
for(var/mob/living/carbon/M in get_hearers_in_view(9, user))
if(M.get_ear_protection() == FALSE)
- M.confused += 6
+ M.add_confusion(6)
audible_message("HUMAN HARM")
playsound(get_turf(src), 'sound/ai/harmalarm.ogg', 70, 3)
cooldown = world.time + 200
@@ -320,12 +320,12 @@
var/bang_effect = C.soundbang_act(2, 0, 0, 5)
switch(bang_effect)
if(1)
- C.confused += 5
+ C.add_confusion(5)
C.stuttering += 10
C.Jitter(10)
if(2)
C.Paralyze(40)
- C.confused += 10
+ C.add_confusion(10)
C.stuttering += 15
C.Jitter(25)
playsound(get_turf(src), 'sound/machines/warning-buzzer.ogg', 130, 3)
diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm
index b395f6d42b9..9471ae615cf 100644
--- a/code/game/objects/items/stunbaton.dm
+++ b/code/game/objects/items/stunbaton.dm
@@ -224,7 +224,7 @@
/// After a target is hit, we do a chunk of stamina damage, along with other effects.
/// After a period of time, we then check to see what stun duration we give.
L.Jitter(20)
- L.confused = max(confusion_amt, L.confused)
+ L.set_confusion(max(confusion_amt, L.get_confusion()))
L.stuttering = max(8, L.stuttering)
L.apply_damage(stamina_loss_amt, STAMINA, BODY_ZONE_CHEST)
diff --git a/code/modules/antagonists/abductor/equipment/glands/mindshock.dm b/code/modules/antagonists/abductor/equipment/glands/mindshock.dm
index fa63e2c82ad..bcad4bac557 100644
--- a/code/modules/antagonists/abductor/equipment/glands/mindshock.dm
+++ b/code/modules/antagonists/abductor/equipment/glands/mindshock.dm
@@ -21,7 +21,7 @@
H.Stun(50)
if(2)
to_chat(H, "You hear an annoying buzz in your head.")
- H.confused += 15
+ H.add_confusion(15)
H.adjustOrganLoss(ORGAN_SLOT_BRAIN, 10, 160)
if(3)
H.hallucination += 60
diff --git a/code/modules/antagonists/changeling/powers/headcrab.dm b/code/modules/antagonists/changeling/powers/headcrab.dm
index f525272ab73..05bb3558a2e 100644
--- a/code/modules/antagonists/changeling/powers/headcrab.dm
+++ b/code/modules/antagonists/changeling/powers/headcrab.dm
@@ -25,7 +25,7 @@
H.Stun(20)
H.blur_eyes(20)
eyes?.applyOrganDamage(5)
- H.confused += 3
+ H.add_confusion(3)
for(var/mob/living/silicon/S in range(2,user))
to_chat(S, "Your sensors are disabled by a shower of blood!")
S.Paralyze(60)
diff --git a/code/modules/antagonists/changeling/powers/shriek.dm b/code/modules/antagonists/changeling/powers/shriek.dm
index 45d1af1dfe5..b4a5ffcec36 100644
--- a/code/modules/antagonists/changeling/powers/shriek.dm
+++ b/code/modules/antagonists/changeling/powers/shriek.dm
@@ -17,7 +17,7 @@
var/obj/item/organ/ears/ears = C.getorganslot(ORGAN_SLOT_EARS)
if(ears)
ears.adjustEarDamage(0, 30)
- C.confused += 25
+ C.add_confusion(25)
C.Jitter(50)
else
SEND_SOUND(C, sound('sound/effects/screech.ogg'))
diff --git a/code/modules/antagonists/revenant/revenant_blight.dm b/code/modules/antagonists/revenant/revenant_blight.dm
index 3c789f339f7..abe34b14c23 100644
--- a/code/modules/antagonists/revenant/revenant_blight.dm
+++ b/code/modules/antagonists/revenant/revenant_blight.dm
@@ -31,7 +31,7 @@
return
if(prob(stage*3))
to_chat(affected_mob, "You suddenly feel [pick("sick and tired", "disoriented", "tired and confused", "nauseated", "faint", "dizzy")]...")
- affected_mob.confused += 8
+ affected_mob.add_confusion(8)
affected_mob.adjustStaminaLoss(20)
new /obj/effect/temp_visual/revenant(affected_mob.loc)
if(stagedamage < stage)
diff --git a/code/modules/antagonists/traitor/syndicate_contract.dm b/code/modules/antagonists/traitor/syndicate_contract.dm
index 04530431cca..973ec69091d 100644
--- a/code/modules/antagonists/traitor/syndicate_contract.dm
+++ b/code/modules/antagonists/traitor/syndicate_contract.dm
@@ -164,7 +164,7 @@
M.reagents.add_reagent(/datum/reagent/medicine/omnizine, 20)
M.flash_act()
- M.confused += 10
+ M.add_confusion(10)
M.blur_eyes(5)
to_chat(M, "You feel strange...")
sleep(60)
@@ -173,7 +173,7 @@
sleep(65)
to_chat(M, "Your head pounds... It feels like it's going to burst out your skull!")
M.flash_act()
- M.confused += 20
+ M.add_confusion(20)
M.blur_eyes(3)
sleep(30)
to_chat(M, "Your head pounds...")
@@ -185,7 +185,7 @@
so it's only a matter of time before we ship you back...\"")
M.blur_eyes(10)
M.Dizzy(15)
- M.confused += 20
+ M.add_confusion(20)
// We're returning the victim
/datum/syndicate_contract/proc/returnVictim(var/mob/living/M)
@@ -224,7 +224,7 @@
M.flash_act()
M.blur_eyes(30)
M.Dizzy(35)
- M.confused += 20
+ M.add_confusion(20)
new /obj/effect/pod_landingzone(possible_drop_loc[pod_rand_loc], return_pod)
else
diff --git a/code/modules/assembly/flash.dm b/code/modules/assembly/flash.dm
index 6fb381e9764..b8f03f16f1e 100644
--- a/code/modules/assembly/flash.dm
+++ b/code/modules/assembly/flash.dm
@@ -116,9 +116,9 @@
to_chat(M, "[src] emits a blinding light!")
if(targeted)
if(M.flash_act(1, 1))
- if(M.confused < power)
- var/diff = power * CONFUSION_STACK_MAX_MULTIPLIER - M.confused
- M.confused += min(power, diff)
+ if(M.get_confusion() < power)
+ var/diff = power * CONFUSION_STACK_MAX_MULTIPLIER - M.get_confusion()
+ M.add_confusion(min(power, diff))
if(user)
terrible_conversion_proc(M, user)
visible_message("[user] blinds [M] with the flash!")
@@ -135,8 +135,8 @@
to_chat(M, "[src] fails to blind you!")
else
if(M.flash_act())
- var/diff = power * CONFUSION_STACK_MAX_MULTIPLIER - M.confused
- M.confused += min(power, diff)
+ var/diff = power * CONFUSION_STACK_MAX_MULTIPLIER - M.get_confusion()
+ M.add_confusion(min(power, diff))
/obj/item/assembly/flash/attack(mob/living/M, mob/user)
if(!try_use_flash(user))
@@ -149,8 +149,8 @@
log_combat(user, R, "flashed", src)
update_icon(1)
R.Paralyze(rand(80,120))
- var/diff = 5 * CONFUSION_STACK_MAX_MULTIPLIER - M.confused
- R.confused += min(5, diff)
+ var/diff = 5 * CONFUSION_STACK_MAX_MULTIPLIER - M.get_confusion()
+ R.add_confusion(min(5, diff))
R.flash_act(affect_silicon = 1)
user.visible_message("[user] overloads [R]'s sensors with the flash!", "You overload [R]'s sensors with the flash!")
return TRUE
@@ -279,7 +279,7 @@
if(!hypnosis)
to_chat(M, "The light makes you feel oddly relaxed...")
- M.confused += min(M.confused + 10, 20)
+ M.add_confusion(min(M.get_confusion() + 10, 20))
M.dizziness += min(M.dizziness + 10, 20)
M.drowsyness += min(M.drowsyness + 10, 20)
M.apply_status_effect(STATUS_EFFECT_PACIFY, 100)
@@ -293,7 +293,7 @@
else if(M.flash_act())
to_chat(M, "Such a pretty light...")
- M.confused += min(M.confused + 4, 20)
+ M.add_confusion(min(M.get_confusion() + 4, 20))
M.dizziness += min(M.dizziness + 4, 20)
M.drowsyness += min(M.drowsyness + 4, 20)
M.apply_status_effect(STATUS_EFFECT_PACIFY, 40)
diff --git a/code/modules/hydroponics/hydroitemdefines.dm b/code/modules/hydroponics/hydroitemdefines.dm
index 137a49b8ded..771ac0c505b 100644
--- a/code/modules/hydroponics/hydroitemdefines.dm
+++ b/code/modules/hydroponics/hydroitemdefines.dm
@@ -104,7 +104,7 @@
return
var/mob/living/carbon/human/H = AM
if(has_gravity(loc) && HAS_TRAIT(H, TRAIT_CLUMSY) && !H.resting)
- H.confused = max(H.confused, 10)
+ H.set_confusion(max(H.get_confusion(), 10))
H.Stun(20)
playsound(src, 'sound/weapons/punch4.ogg', 50, TRUE)
H.visible_message("[H] steps on [src] causing the handle to hit [H.p_them()] right in the face!", \
diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm
index 9b49de49120..f95fddf2a9b 100644
--- a/code/modules/mining/ores_coins.dm
+++ b/code/modules/mining/ores_coins.dm
@@ -120,7 +120,7 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
return
C.adjust_blurriness(6)
C.adjustStaminaLoss(15)//the pain from your eyes burning does stamina damage
- C.confused += 5
+ C.add_confusion(5)
to_chat(C, "\The [src] gets into your eyes! The pain, it burns!")
qdel(src)
diff --git a/code/modules/mob/living/carbon/alien/organs.dm b/code/modules/mob/living/carbon/alien/organs.dm
index 290df6982a9..d89945195b8 100644
--- a/code/modules/mob/living/carbon/alien/organs.dm
+++ b/code/modules/mob/living/carbon/alien/organs.dm
@@ -132,7 +132,7 @@
owner.Paralyze(100)
owner.jitteriness += 30
- owner.confused += 30
+ owner.add_confusion(30)
owner.stuttering += 30
recent_queen_death = 1
diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm
index 66f3c4536a3..586f157f889 100644
--- a/code/modules/mob/living/carbon/human/species.dm
+++ b/code/modules/mob/living/carbon/human/species.dm
@@ -1592,7 +1592,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
if(H.stat == CONSCIOUS)
H.visible_message("[H] is knocked senseless!", \
"You're knocked senseless!")
- H.confused = max(H.confused, 20)
+ H.set_confusion(max(H.get_confusion(), 20))
H.adjust_blurriness(10)
if(prob(10))
H.gain_trauma(/datum/brain_trauma/mild/concussion)
diff --git a/code/modules/mob/living/carbon/human/species_types/golems.dm b/code/modules/mob/living/carbon/human/species_types/golems.dm
index bdc60ed9bf0..d744647704e 100644
--- a/code/modules/mob/living/carbon/human/species_types/golems.dm
+++ b/code/modules/mob/living/carbon/human/species_types/golems.dm
@@ -817,7 +817,7 @@
M.show_message("GONG!", MSG_AUDIBLE)
M.playsound_local(H, 'sound/effects/gong.ogg', 100, TRUE)
M.soundbang_act(1, 0, 30, 3)
- M.confused += 10
+ M.add_confusion(10)
M.jitteriness += 4
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "gonged", /datum/mood_event/loud_gong)
if(2 to 3)
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index d0f2f169d4a..35d38343cd0 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -539,12 +539,12 @@ All effects don't start immediately, but rather get worse over time; the rate is
if(drunkenness >= 41)
if(prob(25))
- confused += 2
+ add_confusion(2)
Dizzy(10)
if(drunkenness >= 51)
if(prob(3))
- confused += 15
+ add_confusion(15)
vomit() // vomiting clears toxloss, consider this a blessing
Dizzy(25)
diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm
index 8de7082926d..052a94f2897 100644
--- a/code/modules/mob/living/life.dm
+++ b/code/modules/mob/living/life.dm
@@ -118,8 +118,6 @@
//this updates all special effects: knockdown, druggy, stuttering, etc..
/mob/living/proc/handle_status_effects()
- if(confused)
- confused = max(0, confused - 1)
/mob/living/proc/handle_traits()
//Eyes
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index c1c5b14182d..39ae9531cb5 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -618,7 +618,7 @@
heal_overall_damage(INFINITY, INFINITY, INFINITY, null, TRUE) //heal brute and burn dmg on both organic and robotic limbs, and update health right away.
ExtinguishMob()
fire_stacks = 0
- confused = 0
+ set_confusion(0)
dizziness = 0
drowsyness = 0
stuttering = 0
diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm
index 4e95ff98c62..409baa4a681 100644
--- a/code/modules/mob/living/living_defines.dm
+++ b/code/modules/mob/living/living_defines.dm
@@ -33,8 +33,6 @@
VAR_PROTECTED/lying_angle = 0 ///number of degrees. DO NOT USE THIS IN CHECKS. CHECK FOR MOBILITY FLAGS INSTEAD!!
var/lying_prev = 0 ///last value of lying on update_mobility
- var/confused = 0 ///Makes the mob move in random directions.
-
var/hallucination = 0 ///Directly affects how long a mob will hallucinate for
var/last_special = 0 ///Used by the resist verb, likely used to prevent players from bypassing next_move by logging in/out.
diff --git a/code/modules/mob/living/status_procs.dm b/code/modules/mob/living/status_procs.dm
index 27e0ed8fa79..4fa21d18980 100644
--- a/code/modules/mob/living/status_procs.dm
+++ b/code/modules/mob/living/status_procs.dm
@@ -494,3 +494,23 @@
LAZYREMOVEASSOC(movespeed_mod_immunities, slowdown_type, source)
if(update)
update_movespeed()
+
+/// Gets the amount of confusion on the mob.
+/mob/living/proc/get_confusion()
+ var/datum/status_effect/confusion/confusion = has_status_effect(STATUS_EFFECT_CONFUSION)
+ return confusion ? confusion.strength : 0
+
+/// Set the confusion of the mob. Confusion will make the mob walk randomly.
+/mob/living/proc/set_confusion(new_confusion)
+ new_confusion = max(new_confusion, 0)
+
+ if (new_confusion)
+ var/datum/status_effect/confusion/confusion_status = has_status_effect(STATUS_EFFECT_CONFUSION) || apply_status_effect(STATUS_EFFECT_CONFUSION)
+ confusion_status.set_strength(new_confusion)
+ else
+ remove_status_effect(STATUS_EFFECT_CONFUSION)
+
+/// Add confusion to the mob. Confusion will make the mob walk randomly.
+/// Shorthand for set_confusion(confusion + x).
+/mob/living/proc/add_confusion(confusion_to_add)
+ set_confusion(get_confusion() + confusion_to_add)
diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm
index fca063da80e..a4fa50515c1 100644
--- a/code/modules/mob/mob_movement.dm
+++ b/code/modules/mob/mob_movement.dm
@@ -123,13 +123,14 @@
else
move_delay = world.time
- if(L.confused)
+ var/confusion = L.get_confusion()
+ if(confusion)
var/newdir = 0
- if(L.confused > 40)
+ if(confusion > 40)
newdir = pick(GLOB.alldirs)
- else if(prob(L.confused * 1.5))
+ else if(prob(confusion * 1.5))
newdir = angle2dir(dir2angle(direct) + pick(90, -90))
- else if(prob(L.confused * 3))
+ else if(prob(confusion * 3))
newdir = angle2dir(dir2angle(direct) + pick(45, -45))
if(newdir)
direct = newdir
diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm
index 0eb2e99033b..020dbc42b2b 100644
--- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm
@@ -1318,7 +1318,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
/datum/reagent/consumable/ethanol/atomicbomb/on_mob_life(mob/living/carbon/M)
M.set_drugginess(50)
if(!HAS_TRAIT(M, TRAIT_ALCOHOL_TOLERANCE))
- M.confused = max(M.confused+2,0)
+ M.set_confusion(max(M.get_confusion()+2,0))
M.Dizzy(10)
if (!M.slurring)
M.slurring = 1
@@ -1353,7 +1353,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
M.slurring += 3
if(45 to 55)
if(prob(50))
- M.confused = max(M.confused+3,0)
+ M.set_confusion(max(M.get_confusion()+3,0))
if(55 to 200)
M.set_drugginess(55)
if(200 to INFINITY)
diff --git a/code/modules/reagents/chemistry/reagents/drug_reagents.dm b/code/modules/reagents/chemistry/reagents/drug_reagents.dm
index bb996ff3587..383714fdbea 100644
--- a/code/modules/reagents/chemistry/reagents/drug_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/drug_reagents.dm
@@ -393,7 +393,7 @@
/datum/reagent/drug/happiness/on_mob_life(mob/living/carbon/M)
M.jitteriness = 0
- M.confused = 0
+ M.set_confusion(0)
M.disgust = 0
M.adjustOrganLoss(ORGAN_SLOT_BRAIN, 0.2)
..()
diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm
index 02d224baffb..f3cd37a3a3c 100755
--- a/code/modules/reagents/chemistry/reagents/food_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm
@@ -314,7 +314,7 @@
victim.emote("scream")
victim.blur_eyes(5) // 10 seconds
victim.blind_eyes(3) // 6 seconds
- victim.confused = max(M.confused, 5) // 10 seconds
+ victim.set_confusion(max(M.get_confusion(), 5)) // 10 seconds
victim.Knockdown(3 SECONDS)
victim.add_movespeed_modifier(/datum/movespeed_modifier/reagent/pepperspray)
addtimer(CALLBACK(victim, /mob.proc/remove_movespeed_modifier, /datum/movespeed_modifier/reagent/pepperspray), 10 SECONDS)
diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
index f6d5385100a..ec6a4763ded 100644
--- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
@@ -76,7 +76,7 @@
M.drowsyness = 0
M.stuttering = 0
M.slurring = 0
- M.confused = 0
+ M.set_confusion(0)
M.SetSleeping(0, 0)
M.jitteriness = 0
if(M.blood_volume < BLOOD_VOLUME_NORMAL)
@@ -848,7 +848,7 @@
M.dizziness = 0
M.drowsyness = 0
M.slurring = 0
- M.confused = 0
+ M.set_confusion(0)
M.reagents.remove_all_type(/datum/reagent/consumable/ethanol, 3*REM, 0, 1)
M.adjustToxLoss(-0.2*REM, 0)
if(ishuman(M))
@@ -1215,7 +1215,7 @@
/datum/reagent/medicine/psicodine/on_mob_life(mob/living/carbon/M)
M.jitteriness = max(0, M.jitteriness-6)
M.dizziness = max(0, M.dizziness-6)
- M.confused = max(0, M.confused-6)
+ M.set_confusion(max(0, M.get_confusion()-6))
M.disgust = max(0, M.disgust-6)
var/datum/component/mood/mood = M.GetComponent(/datum/component/mood)
if(mood != null && mood.sanity <= SANITY_NEUTRAL) // only take effect if in negative sanity and then...
diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm
index 5393c9afaee..e49071e1eba 100644
--- a/code/modules/reagents/chemistry/reagents/other_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm
@@ -1111,9 +1111,7 @@
/datum/reagent/cryptobiolin/on_mob_life(mob/living/carbon/M)
M.Dizzy(1)
- if(!M.confused)
- M.confused = 1
- M.confused = max(M.confused, 20)
+ M.set_confusion(clamp(M.get_confusion(), 1, 20))
..()
/datum/reagent/impedrezene
@@ -1277,7 +1275,7 @@
H.blood_volume = max(H.blood_volume - 10, 0)
if(prob(20))
M.losebreath += 2
- M.confused = min(M.confused + 2, 5)
+ M.set_confusion(min(M.get_confusion() + 2, 5))
..()
/datum/reagent/stimulum
@@ -2068,8 +2066,8 @@
can_synth = TRUE
/datum/reagent/peaceborg/confuse/on_mob_life(mob/living/carbon/M)
- if(M.confused < 6)
- M.confused = clamp(M.confused + 3, 0, 5)
+ if(M.get_confusion() < 6)
+ M.set_confusion(clamp(M.get_confusion() + 3, 0, 5))
if(M.dizziness < 6)
M.dizziness = clamp(M.dizziness + 3, 0, 5)
if(prob(20))
diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm
index 8144dd2bfa6..02be6e33be3 100644
--- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm
@@ -221,7 +221,7 @@
return TRUE
switch(current_cycle)
if(1 to 5)
- M.confused += 1
+ M.add_confusion(1)
M.drowsyness += 1
M.slurring += 3
if(5 to 8)
@@ -378,7 +378,7 @@
/datum/reagent/toxin/chloralhydrate/on_mob_life(mob/living/carbon/M)
switch(current_cycle)
if(1 to 10)
- M.confused += 2
+ M.add_confusion(2)
M.drowsyness += 2
if(10 to 50)
M.Sleeping(40, 0)
@@ -979,7 +979,7 @@
/datum/reagent/toxin/bungotoxin/on_mob_life(mob/living/carbon/M)
M.adjustOrganLoss(ORGAN_SLOT_HEART, 3)
- M.confused = M.dizziness //add a tertiary effect here if this is isn't an effective poison.
+ M.set_confusion(M.dizziness) //add a tertiary effect here if this is isn't an effective poison.
if(current_cycle >= 12 && prob(8))
var/tox_message = pick("You feel your heart spasm in your chest.", "You feel faint.","You feel you need to catch your breath.","You feel a prickle of pain in your chest.")
to_chat(M, "[tox_message]")
@@ -1000,5 +1000,5 @@
M.adjustOrganLoss(ORGAN_SLOT_BRAIN,1)
if(prob(1))
to_chat(M, "Ah, what was that? You thought you heard something...")
- M.confused += 5
+ M.add_confusion(5)
return ..()
diff --git a/code/modules/research/nanites/nanite_programs/rogue.dm b/code/modules/research/nanites/nanite_programs/rogue.dm
index baf5634db84..011e5f28491 100644
--- a/code/modules/research/nanites/nanite_programs/rogue.dm
+++ b/code/modules/research/nanites/nanite_programs/rogue.dm
@@ -75,7 +75,7 @@
if(1)
host_mob.hallucination += 15
if(2)
- host_mob.confused += 10
+ host_mob.add_confusion(10)
if(3)
host_mob.drowsyness += 10
if(4)
@@ -110,7 +110,7 @@
/datum/nanite_program/nerve_decay/active_effect()
if(prob(5))
to_chat(host_mob, "You feel unbalanced!")
- host_mob.confused += 10
+ host_mob.add_confusion(10)
else if(prob(4))
to_chat(host_mob, "You can't feel your hands!")
host_mob.drop_all_held_items()
diff --git a/code/modules/surgery/organs/stomach.dm b/code/modules/surgery/organs/stomach.dm
index 3c1196de50a..db296c2abdf 100755
--- a/code/modules/surgery/organs/stomach.dm
+++ b/code/modules/surgery/organs/stomach.dm
@@ -51,13 +51,13 @@
if(H.disgust >= DISGUST_LEVEL_GROSS)
if(prob(10))
H.stuttering += 1
- H.confused += 2
+ H.add_confusion(2)
if(prob(10) && !H.stat)
to_chat(H, "You feel kind of iffy...")
H.jitteriness = max(H.jitteriness - 3, 0)
if(H.disgust >= DISGUST_LEVEL_VERYGROSS)
if(prob(pukeprob)) //iT hAndLeS mOrE ThaN PukInG
- H.confused += 2.5
+ H.add_confusion(2.5)
H.stuttering += 1
H.vomit(10, 0, 1, 0, 1, 0)
H.Dizzy(5)
diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm
index 45f634b11e4..dc7d7c840bb 100644
--- a/code/modules/unit_tests/_unit_tests.dm
+++ b/code/modules/unit_tests/_unit_tests.dm
@@ -15,6 +15,7 @@
#include "card_mismatch.dm"
#include "chain_pull_through_space.dm"
#include "component_tests.dm"
+#include "confusion.dm"
#include "keybinding_init.dm"
#include "medical_wounds.dm"
#include "metabolizing.dm"
diff --git a/code/modules/unit_tests/confusion.dm b/code/modules/unit_tests/confusion.dm
new file mode 100644
index 00000000000..8282493c962
--- /dev/null
+++ b/code/modules/unit_tests/confusion.dm
@@ -0,0 +1,16 @@
+// Checks that the confusion symptom correctly gives, and removes, confusion
+/datum/unit_test/confusion_symptom/Run()
+ var/mob/living/carbon/human/H = allocate(/mob/living/carbon/human)
+ var/datum/disease/advance/confusion/disease = allocate(/datum/disease/advance/confusion)
+ var/datum/symptom/confusion/confusion = disease.symptoms[1]
+ disease.processing = TRUE
+ disease.update_stage(5)
+ disease.infect(H, make_copy = FALSE)
+ confusion.Activate(disease)
+ TEST_ASSERT(H.get_confusion() > 0, "Human is not confused after getting symptom.")
+ disease.cure()
+ TEST_ASSERT_EQUAL(H.get_confusion(), 0, "Human is still confused after curing confusion.")
+
+/datum/disease/advance/confusion/New()
+ symptoms += new /datum/symptom/confusion
+ Refresh()