mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
* A preface to my madness Travis failed one of my PR's because I copied old code that used /red /blue /green. Because of this, I am going to find and replace every instance of it that I find. Also this is a test commit to make sure I'm comitting to the correct branch. * /blue /green /red replacements Dear god. A slow and painful death from acid is more fun than this. I wouldn't wish this torture on my worst enemy. And this is only the beginning * Replace part 2. Time to fix the human error. * Fixes mismatches * Sets macro count to 220 One above the current number of macros in the code. * Fixes last of the mismatches. * Removes spaces, replaces \black Removes spaces Replaces \black in a few areas where seen Replaces \bold with <B> </B> where seen * Updating macro count again * More fixes! * Issues fixed! For real this time! I swear! * Fixing all the merge conflict files.
128 lines
3.7 KiB
Plaintext
128 lines
3.7 KiB
Plaintext
/obj/item/device/assembly/mousetrap
|
|
name = "mousetrap"
|
|
desc = "A handy little spring-loaded trap for catching pesty rodents."
|
|
icon_state = "mousetrap"
|
|
origin_tech = list(TECH_COMBAT = 1)
|
|
matter = list(DEFAULT_WALL_MATERIAL = 100, "waste" = 10)
|
|
var/armed = 0
|
|
|
|
|
|
/obj/item/device/assembly/mousetrap/examine(mob/user)
|
|
..(user)
|
|
if(armed)
|
|
to_chat(user, "It looks like it's armed.")
|
|
|
|
/obj/item/device/assembly/mousetrap/update_icon()
|
|
if(armed)
|
|
icon_state = "mousetraparmed"
|
|
else
|
|
icon_state = "mousetrap"
|
|
if(holder)
|
|
holder.update_icon()
|
|
|
|
/obj/item/device/assembly/mousetrap/proc/triggered(mob/target as mob, var/type = "feet")
|
|
if(!armed)
|
|
return
|
|
var/obj/item/organ/external/affecting = null
|
|
if(ishuman(target))
|
|
var/mob/living/carbon/human/H = target
|
|
switch(type)
|
|
if("feet")
|
|
if(!H.shoes)
|
|
affecting = H.get_organ(pick("l_leg", "r_leg"))
|
|
H.Weaken(3)
|
|
if("l_hand", "r_hand")
|
|
if(!H.gloves)
|
|
affecting = H.get_organ(type)
|
|
H.Stun(3)
|
|
if(affecting)
|
|
if(affecting.take_damage(1, 0))
|
|
H.UpdateDamageIcon()
|
|
H.updatehealth()
|
|
else if(ismouse(target))
|
|
var/mob/living/simple_animal/mouse/M = target
|
|
visible_message("\red <b>SPLAT!</b>")
|
|
M.splat()
|
|
playsound(target.loc, 'sound/effects/snap.ogg', 50, 1)
|
|
layer = MOB_LAYER - 0.2
|
|
armed = 0
|
|
update_icon()
|
|
pulse(0)
|
|
|
|
|
|
/obj/item/device/assembly/mousetrap/attack_self(mob/living/user as mob)
|
|
if(!armed)
|
|
user << "<span class='notice'>You arm [src].</span>"
|
|
else
|
|
if((CLUMSY in user.mutations) && prob(50))
|
|
var/which_hand = "l_hand"
|
|
if(!user.hand)
|
|
which_hand = "r_hand"
|
|
triggered(user, which_hand)
|
|
user.visible_message("<span class='warning'>[user] accidentally sets off [src], breaking their fingers.</span>", \
|
|
"<span class='warning'>You accidentally trigger [src]!</span>")
|
|
return
|
|
|
|
to_chat(user, "<span class='notice'>You disarm [src].</span>")
|
|
armed = !armed
|
|
update_icon()
|
|
playsound(user.loc, 'sound/weapons/handcuffs.ogg', 30, 1, -3)
|
|
|
|
|
|
/obj/item/device/assembly/mousetrap/attack_hand(mob/living/user as mob)
|
|
if(armed)
|
|
if((CLUMSY in user.mutations) && prob(50))
|
|
var/which_hand = "l_hand"
|
|
if(!user.hand)
|
|
which_hand = "r_hand"
|
|
triggered(user, which_hand)
|
|
user.visible_message("<span class='warning'>[user] accidentally sets off [src], breaking their fingers.</span>", \
|
|
"<span class='warning'>You accidentally trigger [src]!</span>")
|
|
return
|
|
..()
|
|
|
|
|
|
/obj/item/device/assembly/mousetrap/Crossed(AM as mob|obj)
|
|
if(armed)
|
|
if(ishuman(AM))
|
|
var/mob/living/carbon/H = AM
|
|
if(H.m_intent == "run")
|
|
triggered(H)
|
|
H.visible_message("<span class='warning'>[H] accidentally steps on [src].</span>", \
|
|
"<span class='warning'>You accidentally step on [src]</span>")
|
|
if(ismouse(AM))
|
|
triggered(AM)
|
|
..()
|
|
|
|
|
|
/obj/item/device/assembly/mousetrap/on_found(mob/living/finder as mob)
|
|
if(armed)
|
|
finder.visible_message("<span class='warning'>[finder] accidentally sets off [src], breaking their fingers.</span>", \
|
|
"<span class='warning'>You accidentally trigger [src]!</span>")
|
|
triggered(finder, finder.hand ? "l_hand" : "r_hand")
|
|
return 1 //end the search!
|
|
return 0
|
|
|
|
|
|
/obj/item/device/assembly/mousetrap/hitby(A as mob|obj)
|
|
if(!armed)
|
|
return ..()
|
|
visible_message("<span class='warning'>[src] is triggered by [A].</span>")
|
|
triggered(null)
|
|
|
|
|
|
/obj/item/device/assembly/mousetrap/armed
|
|
icon_state = "mousetraparmed"
|
|
armed = 1
|
|
|
|
|
|
/obj/item/device/assembly/mousetrap/verb/hide_under()
|
|
set src in oview(1)
|
|
set name = "Hide"
|
|
set category = "Object"
|
|
|
|
if(usr.stat)
|
|
return
|
|
|
|
layer = TURF_LAYER+0.2
|
|
to_chat(usr, "<span class='notice'>You hide [src].</span>") |