Files
VOREStation/code/modules/assembly/mousetrap.dm
Cameron Lennox c42610c5ae Have you bingled that (#17407)
* Initial wiki system

* wiki organization and spoilers

* hide belly chems

* move ads to tgui

* add search

* .

* load screen

* error screen

* 8

* center

* .

* .

* make this more realistic

* tgui errro col

* move search to top

* .

* non NT theme

* logo to common

* base custom theme

* .

* wip refactor

* almost halfway

* reworked wiki data

* easy fix

* get data fix

* Material Page in tgui

* catch null supply points

* .

* forward crash

* reset pages

* .

* canvas prep

* fix icon stacking

* .

* colored outlined images

* fix sm datum

* fix material names

* subType prep

* only on crash

* fix null crash

* .

* fix solgov

* clean hiding

* .

* implement catalog page

* .

* particle smasher page

* I'm lazy

* unfuck some sins

* ore page

* botany page

* allergen list

* allergen returns null too

* slime injection var

* slime core data

* fixed warning

* wip

* proper data list for chems

* pass is_slime as null

* chems

* split that

* .

* .

* .

* .

* donation for bingle, some cleanup

* return types

* partially colord icons for chemistry

* .

* more sillies

* donation page

* thaler

* needs some variation

* .

* this will crash until implemented

* handle it

* fix that

* dismiss donation banner button

* .

* fix that

* donating procs

* donation stuff for comp

* -

* drink glass for drinks

* illegal iconstate pass

* fixes

* .

* nuke drink fix

* .

* .

* .

* Drink reagent fix

* more cleanup

* adjust

* .

* simple food

* .

* food list

* sending nulls, removed flavor from recipes

* .

* .

* get_donation_current added

* .

* missing key

* .

* duped recipes fixed

* .

* .

* wiki food reagent recipes

* double list add

* properly forbid remaining bad reagent

* hide this too

* stacky

* enable eslint const

* fix typing

* update that

* use proper donation proc

* printing fixes

* grinding

* .

* beaker fill volume

* plant ore and mat grinding results

* duped recipes fixed, unit test tweak

* yes this is terrible

* .

* .

* .

* chem analyzer tgui mode, some subsystem changes to support it

* redoce

* .

* ,

* .

* small fixes, missing reagent volume

* push

* sort

* catalog entries unlocked by explo

* new chem stuff

* .

* fix byond code

* fix scroll tracking

* comment

* alphabetical

* also this

* .

* fallback icon

* .

* ...

* rel path

* that too

* to defines

* organ to define

* .

* .

* .

---------

Co-authored-by: Willburd <7099514+Willburd@users.noreply.github.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
2025-03-28 19:00:50 +01:00

124 lines
3.3 KiB
Plaintext

/obj/item/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(MAT_STEEL = 100)
var/armed = 0
/obj/item/assembly/mousetrap/examine(var/mob/user)
. = ..(user)
if(armed)
. += "It looks like it's armed."
/obj/item/assembly/mousetrap/update_icon()
if(armed)
icon_state = "mousetraparmed"
else
icon_state = "mousetrap"
if(holder)
holder.update_icon()
/obj/item/assembly/mousetrap/proc/triggered(var/mob/target, 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(BP_L_LEG, BP_R_LEG))
H.Weaken(3)
if(BP_L_HAND, BP_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_mob/animal/passive/mouse/M = target
visible_message(span_bolddanger("SPLAT!"))
M.splat()
playsound(target, 'sound/effects/snap.ogg', 50, 1)
layer = MOB_LAYER - 0.2
armed = 0
update_icon()
pulse(0)
/obj/item/assembly/mousetrap/attack_self(var/mob/living/user)
if(!armed)
to_chat(user, span_notice("You arm [src]."))
else
if((CLUMSY in user.mutations) && prob(50))
var/which_hand = BP_L_HAND
if(!user.hand)
which_hand = BP_R_HAND
triggered(user, which_hand)
user.visible_message(span_warning("[user] accidentally sets off [src], breaking their fingers."), \
span_warning("You accidentally trigger [src]!"))
return
to_chat(user, span_notice("You disarm [src]."))
armed = !armed
update_icon()
playsound(user, 'sound/weapons/handcuffs.ogg', 30, 1, -3)
/obj/item/assembly/mousetrap/attack_hand(var/mob/living/user)
if(armed)
if((CLUMSY in user.mutations) && prob(50))
var/which_hand = BP_L_HAND
if(!user.hand)
which_hand = BP_R_HAND
triggered(user, which_hand)
user.visible_message(span_warning("[user] accidentally sets off [src], breaking their fingers."), \
span_warning("You accidentally trigger [src]!"))
return
..()
/obj/item/assembly/mousetrap/Crossed(var/atom/movable/AM)
if(AM.is_incorporeal())
return
if(armed)
if(ishuman(AM))
var/mob/living/carbon/H = AM
if(H.m_intent == I_RUN)
triggered(H)
H.visible_message(span_warning("[H] accidentally steps on [src]."), \
span_warning("You accidentally step on [src]"))
if(ismouse(AM))
triggered(AM)
..()
/obj/item/assembly/mousetrap/on_found(var/mob/living/finder)
if(armed)
finder.visible_message(span_warning("[finder] accidentally sets off [src], breaking their fingers."), \
span_warning("You accidentally trigger [src]!"))
triggered(finder, finder.hand ? BP_L_HAND : BP_R_HAND)
return 1 //end the search!
return 0
/obj/item/assembly/mousetrap/hitby(var/atom/movable/A)
if(!armed)
return ..()
visible_message(span_warning("[src] is triggered by [A]."))
triggered(null)
/obj/item/assembly/mousetrap/armed
icon_state = "mousetraparmed"
armed = 1
/obj/item/assembly/mousetrap/verb/hide_under()
set src in oview(1)
set name = "Hide"
set category = "Object"
if(usr.stat)
return
layer = HIDING_LAYER
to_chat(usr, span_notice("You hide [src]."))