mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Made mousetraps an assembly.
The path has changed from /obj/item/weapon/mousetrap to /obj/item/device/assembly/mousetrap Deleted mousetraps.dm, and removed the original define from weapon.dm Added a new /obj/item proc, on_found(). It's called when pockets are emptied, and whenever someone looks in a storage item. Currently used only by mousetraps and facehuggers~ Updated the map with path changes. Updated the changelog. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4969 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -62,11 +62,11 @@
|
||||
update_icon()
|
||||
overlays = null
|
||||
if(a_left)
|
||||
overlays += "[initial(a_left.icon_state)]_left" //the initial() is probably unnecessary, but you just know
|
||||
for(var/O in a_left.attached_overlays) //someone is gonna fuck around with the icon_state in the future
|
||||
overlays += "[a_left.icon_state]_left"
|
||||
for(var/O in a_left.attached_overlays)
|
||||
overlays += "[O]_l"
|
||||
if(a_right)
|
||||
src.overlays += "[initial(a_right.icon_state)]_right"
|
||||
src.overlays += "[a_right.icon_state]_right"
|
||||
for(var/O in a_right.attached_overlays)
|
||||
overlays += "[O]_r"
|
||||
if(master)
|
||||
@@ -98,7 +98,26 @@
|
||||
a_right.HasProximity(AM)
|
||||
if(special_assembly)
|
||||
special_assembly.HasProximity(AM)
|
||||
return
|
||||
|
||||
|
||||
HasEntered(atom/movable/AM as mob|obj)
|
||||
if(a_left)
|
||||
a_left.HasEntered(AM)
|
||||
if(a_right)
|
||||
a_right.HasEntered(AM)
|
||||
if(special_assembly)
|
||||
special_assembly.HasEntered(AM)
|
||||
|
||||
|
||||
on_found(mob/finder as mob)
|
||||
if(a_left)
|
||||
a_left.on_found(finder)
|
||||
if(a_right)
|
||||
a_right.on_found(finder)
|
||||
if(special_assembly)
|
||||
if(istype(special_assembly, /obj/item))
|
||||
var/obj/item/S = special_assembly
|
||||
S.on_found(finder)
|
||||
|
||||
|
||||
Move()
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
w_amt = 10
|
||||
origin_tech = "magnets=1"
|
||||
|
||||
secured = 1
|
||||
|
||||
|
||||
activate()
|
||||
if(!..()) return 0//Cooldown check
|
||||
var/turf/location = get_turf(loc)
|
||||
|
||||
115
code/modules/assembly/mousetrap.dm
Normal file
115
code/modules/assembly/mousetrap.dm
Normal file
@@ -0,0 +1,115 @@
|
||||
/obj/item/device/assembly/mousetrap
|
||||
name = "mousetrap"
|
||||
desc = "A handy little spring-loaded trap for catching pesty rodents."
|
||||
icon_state = "mousetrap"
|
||||
m_amt = 100
|
||||
w_amt = 10
|
||||
origin_tech = "combat=1"
|
||||
var/armed = 0
|
||||
|
||||
|
||||
examine()
|
||||
..()
|
||||
if(armed)
|
||||
usr << "It looks like it's armed."
|
||||
|
||||
update_icon()
|
||||
if(armed)
|
||||
icon_state = "mousetraparmed"
|
||||
else
|
||||
icon_state = "mousetrap"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
proc/triggered(mob/target as mob, var/type = "feet")
|
||||
if(!armed)
|
||||
return
|
||||
var/datum/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)
|
||||
armed = 0
|
||||
update_icon()
|
||||
pulse(0)
|
||||
|
||||
|
||||
attack_self(mob/living/user as mob)
|
||||
if(!armed)
|
||||
user << "<span class='notice'>You arm [src].</span>"
|
||||
else
|
||||
if(((user.getBrainLoss() >= 60 || (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
|
||||
user << "<span class='notice'>You disarm [src].</span>"
|
||||
armed = !armed
|
||||
update_icon()
|
||||
playsound(user.loc, 'sound/weapons/handcuffs.ogg', 30, 1, -3)
|
||||
|
||||
|
||||
attack_hand(mob/living/user as mob)
|
||||
if(armed)
|
||||
if(((user.getBrainLoss() >= 60 || 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
|
||||
..()
|
||||
|
||||
|
||||
HasEntered(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)
|
||||
..()
|
||||
|
||||
|
||||
on_found(mob/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
|
||||
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user