diff --git a/code/datums/components/knockoff.dm b/code/datums/components/knockoff.dm
index 3f1c5422ce4..9567558a372 100644
--- a/code/datums/components/knockoff.dm
+++ b/code/datums/components/knockoff.dm
@@ -1,8 +1,11 @@
-//Items with these will have a chance to get knocked off when disarming
+///Items with these will have a chance to get knocked off when disarming or being knocked down
/datum/component/knockoff
- var/knockoff_chance = 100 //Chance to knockoff
- var/list/target_zones //Aiming for these zones will cause the knockoff, null means all zones allowed
- var/list/slots_knockoffable //Can be only knocked off from these slots, null means all slots allowed
+ ///Chance to knockoff
+ var/knockoff_chance = 100
+ ///Aiming for these zones will cause the knockoff, null means all zones allowed
+ var/list/target_zones
+ ///Can be only knocked off from these slots, null means all slots allowed
+ var/list/slots_knockoffable
/datum/component/knockoff/Initialize(knockoff_chance,zone_override,slots_knockoffable)
if(!isitem(parent))
@@ -11,40 +14,55 @@
RegisterSignal(parent, COMSIG_ITEM_DROPPED,.proc/OnDropped)
src.knockoff_chance = knockoff_chance
-
+
if(zone_override)
target_zones = zone_override
if(slots_knockoffable)
src.slots_knockoffable = slots_knockoffable
-/datum/component/knockoff/proc/Knockoff(mob/living/attacker,zone)
+///Tries to knockoff the item when disarmed
+/datum/component/knockoff/proc/Knockoff(mob/living/carbon/human/wearer,mob/living/attacker,zone)
SIGNAL_HANDLER
- var/obj/item/I = parent
- var/mob/living/carbon/human/wearer = I.loc
+ var/obj/item/item = parent
if(!istype(wearer))
return
if(target_zones && !(zone in target_zones))
return
if(!prob(knockoff_chance))
return
- if(!wearer.dropItemToGround(I))
+ if(!wearer.dropItemToGround(item))
return
+ wearer.visible_message("[attacker] knocks off [wearer]'s [item]!","[attacker] knocks off your [item]!")
+
+///Tries to knockoff the item when user is knocked down
+/datum/component/knockoff/proc/Knockoff_knockdown(mob/living/carbon/human/wearer,amount)
+ SIGNAL_HANDLER
+
+ var/obj/item/item = parent
+ if(!istype(wearer))
+ return
+ if(!prob(knockoff_chance))
+ return
+ if(!wearer.dropItemToGround(item))
+ return
+ wearer.visible_message("[wearer]'s [item] gets knocked off!","Your [item] was knocked off!")
- wearer.visible_message("[attacker] knocks off [wearer]'s [I.name]!","[attacker] knocks off your [I.name]!")
/datum/component/knockoff/proc/OnEquipped(datum/source, mob/living/carbon/human/H,slot)
SIGNAL_HANDLER
-
if(!istype(H))
return
if(slots_knockoffable && !(slot in slots_knockoffable))
UnregisterSignal(H, COMSIG_HUMAN_DISARM_HIT)
+ UnregisterSignal(H, COMSIG_LIVING_STATUS_KNOCKDOWN)
return
RegisterSignal(H, COMSIG_HUMAN_DISARM_HIT, .proc/Knockoff, TRUE)
+ RegisterSignal(H, COMSIG_LIVING_STATUS_KNOCKDOWN, .proc/Knockoff_knockdown, TRUE)
/datum/component/knockoff/proc/OnDropped(datum/source, mob/living/M)
SIGNAL_HANDLER
UnregisterSignal(M, COMSIG_HUMAN_DISARM_HIT)
+ UnregisterSignal(M, COMSIG_LIVING_STATUS_KNOCKDOWN)
diff --git a/code/datums/quirks/negative.dm b/code/datums/quirks/negative.dm
index 6bf76e313ce..bbd68a2b26a 100644
--- a/code/datums/quirks/negative.dm
+++ b/code/datums/quirks/negative.dm
@@ -237,7 +237,7 @@
/datum/quirk/nearsighted //t. errorage
name = "Nearsighted"
desc = "You are nearsighted without prescription glasses, but spawn with a pair."
- value = -1
+ value = -4
gain_text = "Things far away from you start looking blurry."
lose_text = "You start seeing faraway things normally again."
medical_record_text = "Patient requires prescription glasses in order to counteract nearsightedness."
diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm
index 4c2123ac3ee..8e81bcee4c2 100644
--- a/code/modules/clothing/glasses/_glasses.dm
+++ b/code/modules/clothing/glasses/_glasses.dm
@@ -202,6 +202,46 @@
inhand_icon_state = "glasses"
vision_correction = TRUE //corrects nearsightedness
+/obj/item/clothing/glasses/regular/Initialize()
+ . = ..()
+ AddComponent(/datum/component/knockoff,25,list(BODY_ZONE_PRECISE_EYES),list(ITEM_SLOT_EYES))
+ var/static/list/loc_connections = list(
+ COMSIG_ATOM_ENTERED = .proc/on_entered,
+ )
+ AddElement(/datum/element/connect_loc, src, loc_connections)
+
+
+/obj/item/clothing/glasses/regular/proc/on_entered(datum/source, atom/movable/movable)
+ SIGNAL_HANDLER
+ if(damaged_clothes == CLOTHING_SHREDDED)
+ return
+ if(isliving(movable))
+ var/mob/living/crusher = movable
+ if(crusher.m_intent != MOVE_INTENT_WALK && (!(crusher.movement_type & (FLYING|FLOATING)) || crusher.buckled))
+ playsound(src, 'sound/effects/glass_step.ogg', 30, TRUE)
+ visible_message("[crusher] steps on [src], damaging it!")
+ take_damage(100, sound_effect = FALSE)
+
+/obj/item/clothing/glasses/regular/obj_destruction(damage_flag)
+ . = ..()
+ vision_correction = FALSE
+
+/obj/item/clothing/glasses/regular/welder_act(mob/living/user, obj/item/I)
+ . = ..()
+ if(damaged_clothes == CLOTHING_PRISTINE)
+ return
+ if(!I.tool_start_check(user, amount=1))
+ return
+ if(I.use_tool(src, user, 10, volume=30, amount=1))
+ user.visible_message("[user] welds [src] back together.",\
+ "You weld [src] back together.")
+ repair()
+ return TRUE
+
+/obj/item/clothing/glasses/regular/repair()
+ . = ..()
+ vision_correction = TRUE
+
/obj/item/clothing/glasses/regular/jamjar
name = "jamjar glasses"
desc = "Also known as Virginity Protectors."