Files
VOREStation/code/game/objects/items/weapons/traps.dm
Neerti 828dacf485 Centralizes weight class definitions
A lot of new defines are now in inventory_sizes.dm, which contains;
All the size identifiers (the thing that tells the game if something is bulky, or w/e).
Storage costs for all the sizes, which are exponents of two, as previously.
A few constants for inventory size.

Also changes all storage item's capacity definitions by basing it off of how many 'normal slots' exist for it.  This allows one to change the definition for all of the defines in the file, and everything will follow along without needing to change 500 files.  In testing, I made all ITEMSIZE_COST_* defines doubled, and nothing had broke.

The benefit of doing all of this is that it makes adding new weight classes in the future much simpler, and makes knowing how much space a container has easier, as seeing ITEMSIZE_COST_NORMAL * 7 means it can hold seven normal items.
2016-09-22 00:51:51 -04:00

118 lines
3.4 KiB
Plaintext

/obj/item/weapon/beartrap
name = "mechanical trap"
throw_speed = 2
throw_range = 1
gender = PLURAL
icon = 'icons/obj/items.dmi'
icon_state = "beartrap0"
desc = "A mechanically activated leg trap. Low-tech, but reliable. Looks like it could really hurt if you set it off."
throwforce = 0
w_class = ITEMSIZE_NORMAL
origin_tech = "materials=1"
matter = list(DEFAULT_WALL_MATERIAL = 18750)
var/deployed = 0
/obj/item/weapon/beartrap/suicide_act(mob/user)
viewers(user) << "<span class='danger'>[user] is putting the [src.name] on \his head! It looks like \he's trying to commit suicide.</span>"
return (BRUTELOSS)
/obj/item/weapon/beartrap/proc/can_use(mob/user)
return (user.IsAdvancedToolUser() && !issilicon(user) && !user.stat && !user.restrained())
/obj/item/weapon/beartrap/attack_self(mob/user as mob)
..()
if(!deployed && can_use(user))
user.visible_message(
"<span class='danger'>[user] starts to deploy \the [src].</span>",
"<span class='danger'>You begin deploying \the [src]!</span>",
"You hear the slow creaking of a spring."
)
if (do_after(user, 60))
user.visible_message(
"<span class='danger'>[user] has deployed \the [src].</span>",
"<span class='danger'>You have deployed \the [src]!</span>",
"You hear a latch click loudly."
)
deployed = 1
user.drop_from_inventory(src)
update_icon()
anchored = 1
/obj/item/weapon/beartrap/attack_hand(mob/user as mob)
if(buckled_mob && can_use(user))
user.visible_message(
"<span class='notice'>[user] begins freeing [buckled_mob] from \the [src].</span>",
"<span class='notice'>You carefully begin to free [buckled_mob] from \the [src].</span>",
)
if(do_after(user, 60))
user.visible_message("<span class='notice'>[buckled_mob] has been freed from \the [src] by [user].</span>")
unbuckle_mob()
anchored = 0
else if(deployed && can_use(user))
user.visible_message(
"<span class='danger'>[user] starts to disarm \the [src].</span>",
"<span class='notice'>You begin disarming \the [src]!</span>",
"You hear a latch click followed by the slow creaking of a spring."
)
if(do_after(user, 60))
user.visible_message(
"<span class='danger'>[user] has disarmed \the [src].</span>",
"<span class='notice'>You have disarmed \the [src]!</span>"
)
deployed = 0
anchored = 0
update_icon()
else
..()
/obj/item/weapon/beartrap/proc/attack_mob(mob/living/L)
var/target_zone
if(L.lying)
target_zone = ran_zone()
else
target_zone = pick("l_foot", "r_foot", "l_leg", "r_leg")
//armour
var/blocked = L.run_armor_check(target_zone, "melee")
if(blocked >= 100)
return
if(!L.apply_damage(30, BRUTE, target_zone, blocked, used_weapon=src))
return 0
//trap the victim in place
set_dir(L.dir)
can_buckle = 1
buckle_mob(L)
L << "<span class='danger'>The steel jaws of \the [src] bite into you, trapping you in place!</span>"
deployed = 0
can_buckle = initial(can_buckle)
/obj/item/weapon/beartrap/Crossed(AM as mob|obj)
if(deployed && isliving(AM))
var/mob/living/L = AM
if(L.m_intent == "run")
L.visible_message(
"<span class='danger'>[L] steps on \the [src].</span>",
"<span class='danger'>You step on \the [src]!</span>",
"<b>You hear a loud metallic snap!</b>"
)
attack_mob(L)
if(!buckled_mob)
anchored = 0
deployed = 0
update_icon()
..()
/obj/item/weapon/beartrap/update_icon()
..()
if(!deployed)
icon_state = "beartrap0"
else
icon_state = "beartrap1"