Changes how clumsy checks are handled (#6299)

This pr adds the is_clumsy check, that checks if the mob has the mutation or if they are drunk enough. This fixes a bug where mobs would still have the clumsy mutation due to drinking.
This commit is contained in:
Alberyk
2019-04-14 13:45:45 -03:00
committed by Erki
parent 0cc7d1388e
commit aa70b6cffb
28 changed files with 57 additions and 33 deletions
+1 -1
View File
@@ -15,7 +15,7 @@
var/last_used = 0 //last world.time it was used.
/obj/item/device/flash/proc/clown_check(var/mob/user)
if(user && (CLUMSY in user.mutations) && prob(50))
if(user && (user.is_clumsy()) && prob(50))
to_chat(user, "<span class='warning'>\The [src] slips out of your hand.</span>")
user.drop_from_inventory(src)
return 0
@@ -48,7 +48,7 @@
add_fingerprint(user)
if(on && user.zone_sel.selecting == "eyes")
if(((CLUMSY in user.mutations) || (DUMB in user.mutations)) && prob(50)) //too dumb to use flashlight properly
if(((user.is_clumsy()) || (DUMB in user.mutations)) && prob(50)) //too dumb to use flashlight properly
return ..() //just hit them in the head
var/mob/living/carbon/human/H = M //mob has protective eyewear
@@ -284,7 +284,7 @@
/obj/item/device/flashlight/glowstick/attack_self(var/mob/living/user)
if(((CLUMSY in user.mutations)) && prob(50))
if(((user.is_clumsy())) && prob(50))
to_chat(user, "<span class='notice'>You break \the [src] apart, spilling its contents everywhere!</span>")
fuel = 0
new /obj/effect/decal/cleanable/greenglow(get_turf(user))
+2 -2
View File
@@ -33,7 +33,7 @@ BREATH ANALYZER
return
/proc/health_scan_mob(var/mob/living/M, var/mob/living/user, var/visible_msg, var/ignore_clumsiness, var/show_limb_damage = TRUE)
if ( ((CLUMSY in user.mutations) || (DUMB in user.mutations)) && prob(50))
if ( ((user.is_clumsy()) || (DUMB in user.mutations)) && prob(50))
to_chat(user, text("<span class='warning'>You try to analyze the floor's vitals!</span>"))
for(var/mob/O in viewers(M, null))
O.show_message("<span class='warning'>\The [user] has analyzed the floor's vitals!</span>", 1)
@@ -419,7 +419,7 @@ BREATH ANALYZER
to_chat(user,"<span class='warning'>You can't find a way to use \the [src] on [H]!</span>")
return
if ( ((CLUMSY in user.mutations) || (DUMB in user.mutations)) && prob(20))
if ( ((user.is_clumsy()) || (DUMB in user.mutations)) && prob(20))
to_chat(user,"<span class='danger'>Your hand slips from clumsiness!</span>")
eyestab(H,user)
to_chat(user,"<span class='danger'>Alert: No breathing detected.</span>")
@@ -14,7 +14,7 @@
var/fake = FALSE
/obj/item/weapon/grenade/proc/clown_check(var/mob/living/user)
if((CLUMSY in user.mutations) && prob(50))
if((user.is_clumsy()) && prob(50))
to_chat(user, "<span class='warning'>Huh? How does this thing work?</span>")
activate(user)
+1 -1
View File
@@ -24,7 +24,7 @@
if(!user.IsAdvancedToolUser())
return
if ((CLUMSY in user.mutations) && prob(50))
if ((user.is_clumsy()) && prob(50))
to_chat(user, "<span class='warning'>Uh ... how do those things work?!</span>")
place_handcuffs(user, user)
return
@@ -29,7 +29,7 @@
if(user.a_intent != I_HELP)
if(target_zone == "head" || target_zone == "eyes")
if((CLUMSY in user.mutations) && prob(50))
if((user.is_clumsy()) && prob(50))
M = user
return eyestab(M,user)
else
@@ -101,7 +101,7 @@
unbreakable = 1
/obj/item/weapon/material/kitchen/utensil/knife/attack(target as mob, mob/living/user as mob, var/target_zone)
if ((CLUMSY in user.mutations) && prob(50))
if ((user.is_clumsy()) && prob(50))
to_chat(user, "<span class='warning'>You accidentally cut yourself with \the [src].</span>")
user.take_organ_damage(20)
return
@@ -124,7 +124,7 @@
thrown_force_divisor = 1 // as above
/obj/item/weapon/material/kitchen/rollingpin/attack(mob/living/M as mob, mob/living/user as mob, var/target_zone)
if ((CLUMSY in user.mutations) && prob(50))
if ((user.is_clumsy()) && prob(50))
to_chat(user, "<span class='warning'>\The [src] slips out of your hand and hits your head.</span>")
user.drop_from_inventory(src)
user.take_organ_damage(10)
@@ -20,7 +20,7 @@
if(active == 1)
if(target_zone != "eyes" && target_zone != "head")
return ..()
if((CLUMSY in user.mutations) && prob(50))
if((user.is_clumsy()) && prob(50))
M = user
return eyestab(M,user)
@@ -39,7 +39,7 @@
/obj/item/weapon/melee/energy/attack_self(mob/living/user as mob)
if (active)
if ((CLUMSY in user.mutations) && prob(50))
if ((user.is_clumsy()) && prob(50))
user.visible_message("<span class='danger'>\The [user] accidentally cuts \himself with \the [src].</span>",\
"<span class='danger'>You accidentally cut yourself with \the [src].</span>")
user.take_organ_damage(5,5)
+1 -1
View File
@@ -194,7 +194,7 @@
return base_block_chance
/obj/item/weapon/shield/energy/attack_self(mob/living/user as mob)
if ((CLUMSY in user.mutations) && prob(50))
if ((user.is_clumsy()) && prob(50))
to_chat(user, "<span class='warning'>You beat yourself in the head with [src].</span>")
user.take_organ_damage(5)
active = !active
+1 -1
View File
@@ -102,7 +102,7 @@
/obj/item/weapon/melee/baton/attack(mob/living/L, mob/user, var/hit_zone)
if(!L) return
if(status && (CLUMSY in user.mutations) && prob(50))
if(status && (user.is_clumsy()) && prob(50))
to_chat(user, "<span class='danger'>You accidentally hit yourself with the [src]!</span>")
user.Weaken(30)
deductcharge(hitcost)
@@ -18,7 +18,7 @@
force = 10
/obj/item/weapon/melee/classic_baton/attack(mob/M as mob, mob/living/user as mob, var/target_zone)
if ((CLUMSY in user.mutations) && prob(50))
if ((user.is_clumsy()) && prob(50))
to_chat(user, "<span class='warning'>You club yourself over the head.</span>")
user.Weaken(3 * force)
if(ishuman(user))
@@ -85,7 +85,7 @@
/obj/item/weapon/melee/telebaton/attack(mob/target as mob, mob/living/user as mob, var/target_zone)
if(on)
if ((CLUMSY in user.mutations) && prob(50))
if ((user.is_clumsy()) && prob(50))
to_chat(user, "<span class='warning'>You club yourself over the head.</span>")
user.Weaken(3 * force)
if(ishuman(user))
+1 -1
View File
@@ -89,7 +89,7 @@
return ..()
if(target_zone != "eyes" && target_zone != "head")
return ..()
if((CLUMSY in user.mutations) && prob(50))
if((user.is_clumsy()) && prob(50))
M = user
return eyestab(M,user)
+1 -1
View File
@@ -41,7 +41,7 @@
spill(user, M.loc)
//Note: Added a robot check to all stun/weaken procs, beccause weakening a robot causes its active modules to bug out
if((CLUMSY in user.mutations) && prob(50)) //What if he's a clown?
if((user.is_clumsy()) && prob(50)) //What if he's a clown?
to_chat(M, "<span class='warning'>You accidentally slam yourself with the [src]!</span>")
if (!issilicon(M))
M.Weaken(1)
+1 -1
View File
@@ -72,7 +72,7 @@
to_chat(user, "<span class='danger'>You don't have the dexterity to do this!</span>")
return
if ((CLUMSY in user.mutations) && prob(50))
if ((user.is_clumsy()) && prob(50))
to_chat(user, "<span class='danger'>The rod slips out of your hand and hits your head.</span>")
user.take_organ_damage(10)
user.Paralyse(20)
+2 -2
View File
@@ -58,7 +58,7 @@
if(!armed)
to_chat(user, "<span class='notice'>You arm [src].</span>")
else
if(((CLUMSY in user.mutations) || (DUMB in user.mutations)) && prob(50))
if(((user.is_clumsy()) || (DUMB in user.mutations)) && prob(50))
var/which_hand = "l_hand"
if(!user.hand)
which_hand = "r_hand"
@@ -74,7 +74,7 @@
/obj/item/device/assembly/mousetrap/attack_hand(mob/living/user as mob)
if(armed)
if(((CLUMSY in user.mutations) || (DUMB in user.mutations)) && prob(50))
if(((user.is_clumsy()) || (DUMB in user.mutations)) && prob(50))
var/which_hand = "l_hand"
if(!user.hand)
which_hand = "r_hand"
+1
View File
@@ -460,3 +460,4 @@
return FALSE
return TRUE
+13 -1
View File
@@ -1599,4 +1599,16 @@
. = B.cure_all_traumas(cure_permanent, cure_type)
/mob/living/carbon/human/get_metabolism(metabolism)
return ..() * (species ? species.metabolism_mod : 1)
return ..() * (species ? species.metabolism_mod : 1)
/mob/living/carbon/human/is_clumsy()
if(CLUMSY in mutations)
return TRUE
var/bac = get_blood_alcohol()
var/SR = species.ethanol_resistance
if(bac > INTOX_REACTION*SR)
return TRUE
return FALSE
@@ -44,12 +44,10 @@ var/mob/living/carbon/human/alcohol_clumsy = 0
to_chat(src,"<span class='warning'>You feel uncoordinated and unsteady on your feet!</span>")
confused = max(confused, 10)
slurring = max(slurring, 50)
if (!alcohol_clumsy && !(CLUMSY in mutations))
mutations.Add(CLUMSY)
if (!alcohol_clumsy)
alcohol_clumsy = 1
else if (alcohol_clumsy)
to_chat(src,"<span class='notice'>You feel more sober and steady.</span>")
mutations.Remove(CLUMSY)
alcohol_clumsy = 0
if(bac > INTOX_VOMIT*SR)
+1 -1
View File
@@ -837,4 +837,4 @@ default behaviour is:
stomach_contents = null
QDEL_NULL(ingested)
return ..()
return ..()
@@ -17,7 +17,7 @@
var/mode = 1;
/obj/item/device/robotanalyzer/attack(mob/living/M as mob, mob/living/user as mob)
if( ((CLUMSY in user.mutations) || (DUMB in user.mutations)) && prob(50))
if( ((user.is_clumsy()) || (DUMB in user.mutations)) && prob(50))
to_chat(user, text("<span class='warning'>You try to analyze the floor's vitals!</span>"))
for(var/mob/O in viewers(M, null))
O.show_message(text("<span class='warning'>[user] has analyzed the floor's vitals!</span>"), 1)
+7
View File
@@ -1286,6 +1286,13 @@ mob/proc/yank_out_object()
return
/mob/proc/is_clumsy()
if(CLUMSY in mutations)
return TRUE
return FALSE
//Helper proc for figuring out if the active hand (or given hand) is usable.
/mob/proc/can_use_hand()
return 1
+1 -1
View File
@@ -111,7 +111,7 @@
set category = "Object"
set src in usr
if((CLUMSY in usr.mutations) && prob(50))
if((usr.is_clumsy()) && prob(50))
to_chat(usr, span("warning", "You cut yourself on the paper."))
return
var/n_name = sanitizeSafe(input(usr, "What would you like to label the paper?", "Paper Labelling", null) as text, MAX_NAME_LEN)
+1 -1
View File
@@ -142,7 +142,7 @@
to_chat(A, "<span class='warning'>[A.martial_art.no_guns_message]</span>")
return 0
if((CLUMSY in M.mutations) && prob(40)) //Clumsy handling
if((M.is_clumsy()) && prob(40)) //Clumsy handling
var/obj/P = consume_next_projectile()
if(P)
if(process_projectile(P, user, user, pick("l_foot", "r_foot")))
@@ -34,7 +34,7 @@
to_chat(user,"<span class='warning'>\The [src] is empty.</span>")
return
if ( ((CLUMSY in user.mutations) || (DUMB in user.mutations)) && prob(10))
if ( ((user.is_clumsy()) || (DUMB in user.mutations)) && prob(10))
to_chat(user,"<span class='danger'>Your hand slips from clumsiness!</span>")
eyestab(H,user)
if(H.reagents)
@@ -110,7 +110,7 @@
to_chat(user,"<span class='warning'>\The [src]'s cartridge is empty!</span>")
return
if (((CLUMSY in user.mutations) || (DUMB in user.mutations)) && prob(10))
if (((user.is_clumsy()) || (DUMB in user.mutations)) && prob(10))
to_chat(user,"<span class='danger'>Your hand slips from clumsiness!</span>")
eyestab(M,user)
user.visible_message("<span class='notice'>[user] accidentally sticks \the [src] in [M]'s eye!</span>","<span class='notice'>You accidentally stick the [src] in [M]'s eye!</span>")
@@ -63,7 +63,7 @@
return
if(user.a_intent == I_HURT && ishuman(user))
if((CLUMSY in user.mutations) && prob(50))
if((user.is_clumsy()) && prob(50))
target = user
syringestab(target, user)
return
+1 -1
View File
@@ -24,7 +24,7 @@
report("Scan Complete: No antibodies detected.", user)
return
if (CLUMSY in user.mutations && prob(50))
if (user.is_clumsy() && prob(50))
// I was tempted to be really evil and rot13 the output.
report("Antibodies detected: [reverse_text(antigens2string(C.antibodies))]", user)
else
+6
View File
@@ -0,0 +1,6 @@
author: Alberyk
delete-after: True
changes:
- bugfix: "Clumsy drunkness should no longer stay forever."