mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Holsters and Unathi knife harness
Also fixed mistyped path and OnClick bug.
This commit is contained in:
@@ -93,7 +93,8 @@
|
||||
return
|
||||
|
||||
// operate two STORAGE levels deep here (item in backpack in src; NOT item in box in backpack in src)
|
||||
if(A == loc || (A in loc) || A.storage_depth(src) <= 1)
|
||||
var/sdepth = A.storage_depth(src)
|
||||
if(A == loc || (A in loc) || (sdepth != -1 && sdepth <= 1))
|
||||
|
||||
// faster access to objects already on you
|
||||
if(A in contents)
|
||||
|
||||
@@ -456,14 +456,19 @@
|
||||
O.hear_talk(M, text)
|
||||
|
||||
//Returns the storage depth of an atom. This is the number of storage items the atom is contained in before reaching toplevel (the area).
|
||||
//If user is specified, this proc returns the storage depth to the user's contents.
|
||||
/atom/proc/storage_depth(mob/user=null)
|
||||
//Returns -1 if the atom was not found on user.
|
||||
/atom/proc/storage_depth(mob/user)
|
||||
var/depth = 0
|
||||
var/atom/cur_atom = src
|
||||
|
||||
while (cur_atom && !isarea(cur_atom) && (!(user) || !(cur_atom in user.contents)))
|
||||
while (cur_atom && !(cur_atom in user.contents))
|
||||
if (isarea(cur_atom))
|
||||
return -1
|
||||
if (istype(cur_atom.loc, /obj/item/weapon/storage))
|
||||
depth++
|
||||
cur_atom = cur_atom.loc
|
||||
|
||||
if (!cur_atom)
|
||||
return -1 //inside something with a null loc.
|
||||
|
||||
return depth
|
||||
|
||||
@@ -259,9 +259,6 @@ BLIND // can't see anything
|
||||
hastie = I
|
||||
hastie.attach_to(src, user)
|
||||
|
||||
if (istype(hastie,/obj/item/clothing/tie/holster))
|
||||
verbs += /obj/item/clothing/under/proc/holster
|
||||
|
||||
if(istype(loc, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = loc
|
||||
H.update_inv_w_uniform()
|
||||
@@ -275,11 +272,10 @@ BLIND // can't see anything
|
||||
if(hastie && src.loc == user)
|
||||
hastie.attack_hand(user)
|
||||
return
|
||||
|
||||
..()
|
||||
|
||||
//This is to allow people to take off suits when there is an attached accessory
|
||||
/obj/item/weapon/storage/MouseDrop(obj/over_object as obj)
|
||||
/obj/item/clothing/under/MouseDrop(obj/over_object as obj)
|
||||
if (ishuman(usr) || ismonkey(usr))
|
||||
//makes sure that the clothing is equipped so that we can't drag it into our hand from miles away.
|
||||
if (!(src.loc == usr))
|
||||
@@ -364,9 +360,6 @@ BLIND // can't see anything
|
||||
if(usr.stat) return
|
||||
|
||||
if(hastie)
|
||||
if (istype(hastie,/obj/item/clothing/tie/holster))
|
||||
verbs -= /obj/item/clothing/under/proc/holster
|
||||
|
||||
hastie.remove(usr)
|
||||
hastie = null
|
||||
|
||||
@@ -378,39 +371,4 @@ BLIND // can't see anything
|
||||
sensor_mode = pick(0,1,2,3)
|
||||
..()
|
||||
|
||||
/obj/item/clothing/under/proc/holster()
|
||||
set name = "Holster"
|
||||
set category = "Object"
|
||||
set src in usr
|
||||
if(!istype(usr, /mob/living)) return
|
||||
if(usr.stat) return
|
||||
|
||||
if (!hastie || !istype(hastie,/obj/item/clothing/tie/holster))
|
||||
usr << "\red You need a holster for that!"
|
||||
return
|
||||
var/obj/item/clothing/tie/holster/H = hastie
|
||||
|
||||
if(!H.holstered)
|
||||
if(!istype(usr.get_active_hand(), /obj/item/weapon/gun))
|
||||
usr << "\blue You need your gun equiped to holster it."
|
||||
return
|
||||
var/obj/item/weapon/gun/W = usr.get_active_hand()
|
||||
if (!W.isHandgun())
|
||||
usr << "\red This gun won't fit in \the [H]!"
|
||||
return
|
||||
H.holstered = usr.get_active_hand()
|
||||
usr.drop_item()
|
||||
H.holstered.loc = src
|
||||
usr.visible_message("\blue \The [usr] holsters \the [H.holstered].", "You holster \the [H.holstered].")
|
||||
else
|
||||
if(istype(usr.get_active_hand(),/obj) && istype(usr.get_inactive_hand(),/obj))
|
||||
usr << "\red You need an empty hand to draw the gun!"
|
||||
else
|
||||
if(usr.a_intent == "hurt")
|
||||
usr.visible_message("\red \The [usr] draws \the [H.holstered], ready to shoot!", \
|
||||
"\red You draw \the [H.holstered], ready to shoot!")
|
||||
else
|
||||
usr.visible_message("\blue \The [usr] draws \the [H.holstered], pointing it at the ground.", \
|
||||
"\blue You draw \the [H.holstered], pointing it at the ground.")
|
||||
usr.put_in_hands(H.holstered)
|
||||
H.holstered = null
|
||||
|
||||
@@ -173,6 +173,7 @@
|
||||
icon_state = "medgreen"
|
||||
item_color = "medgreen"
|
||||
|
||||
//holsters
|
||||
/obj/item/clothing/tie/holster
|
||||
name = "shoulder holster"
|
||||
desc = "A handgun holster."
|
||||
@@ -180,6 +181,93 @@
|
||||
item_color = "holster"
|
||||
var/obj/item/weapon/gun/holstered = null
|
||||
|
||||
//subtypes can override this to specify what can be holstered
|
||||
/obj/item/clothing/tie/holster/proc/can_holster(obj/item/weapon/gun/W)
|
||||
return W.isHandgun()
|
||||
|
||||
/obj/item/clothing/tie/holster/proc/holster(obj/item/I, mob/user as mob)
|
||||
if(holstered)
|
||||
user << "\red There is already a [holstered] holstered here!"
|
||||
|
||||
if (!istype(I, /obj/item/weapon/gun))
|
||||
user << "\red Only guns can be holstered!"
|
||||
|
||||
var/obj/item/weapon/gun/W = I
|
||||
if (!can_holster(W))
|
||||
user << "\red This [W] won't fit in the [src]!"
|
||||
return
|
||||
|
||||
holstered = W
|
||||
user.drop_from_inventory(holstered)
|
||||
holstered.loc = src
|
||||
holstered.add_fingerprint(user)
|
||||
user.visible_message("\blue [user] holsters the [holstered].", "You holster the [holstered].")
|
||||
|
||||
/obj/item/clothing/tie/holster/proc/unholster(mob/user as mob)
|
||||
if(!holstered)
|
||||
return
|
||||
|
||||
if(istype(user.get_active_hand(),/obj) && istype(user.get_inactive_hand(),/obj))
|
||||
user << "\red You need an empty hand to draw the [holstered]!"
|
||||
else
|
||||
if(user.a_intent == "hurt")
|
||||
usr.visible_message("\red [user] draws the [holstered], ready to shoot!", \
|
||||
"\red You draw the [holstered], ready to shoot!")
|
||||
else
|
||||
user.visible_message("\blue [user] draws the [holstered], pointing it at the ground.", \
|
||||
"\blue You draw the [holstered], pointing it at the ground.")
|
||||
user.put_in_hands(holstered)
|
||||
holstered.add_fingerprint(user)
|
||||
holstered = null
|
||||
|
||||
/obj/item/clothing/tie/holster/attack_hand(mob/user as mob)
|
||||
if (has_suit) //if we are part of a suit
|
||||
if (holstered)
|
||||
unholster(user)
|
||||
return
|
||||
|
||||
..(user)
|
||||
|
||||
/obj/item/clothing/tie/holster/attackby(obj/item/W as obj, mob/user as mob)
|
||||
holster(W, user)
|
||||
|
||||
/obj/item/clothing/tie/holster/emp_act(severity)
|
||||
if (holstered)
|
||||
holstered.emp_act(severity)
|
||||
..()
|
||||
|
||||
/obj/item/clothing/tie/holster/examine()
|
||||
set src in view()
|
||||
..()
|
||||
if (holstered)
|
||||
usr << "A [holstered] is holstered here."
|
||||
else
|
||||
usr << "It is empty."
|
||||
|
||||
/obj/item/clothing/tie/holster/attach_to(obj/item/clothing/under/S, mob/user as mob)
|
||||
..()
|
||||
has_suit.verbs += /obj/item/clothing/tie/holster/verb/holster_verb
|
||||
|
||||
/obj/item/clothing/tie/holster/remove(mob/user as mob)
|
||||
has_suit.verbs -= /obj/item/clothing/tie/holster/verb/holster_verb
|
||||
..()
|
||||
|
||||
/obj/item/clothing/tie/holster/verb/holster_verb()
|
||||
set name = "Holster"
|
||||
set category = "Object"
|
||||
set src in usr
|
||||
if(!istype(usr, /mob/living)) return
|
||||
if(usr.stat) return
|
||||
|
||||
if(!holstered)
|
||||
if(!istype(usr.get_active_hand(), /obj/item/weapon/gun))
|
||||
usr << "\blue You need your gun equiped to holster it."
|
||||
return
|
||||
var/obj/item/weapon/gun/W = usr.get_active_hand()
|
||||
holster(W, usr)
|
||||
else
|
||||
unholster(usr)
|
||||
|
||||
/obj/item/clothing/tie/holster/armpit
|
||||
name = "shoulder holster"
|
||||
desc = "A worn-out handgun holster. Perfect for concealed carry"
|
||||
@@ -221,7 +309,6 @@
|
||||
..(over_object)
|
||||
|
||||
/obj/item/clothing/tie/storage/attackby(obj/item/W as obj, mob/user as mob)
|
||||
..()
|
||||
hold.attackby(W, user)
|
||||
|
||||
/obj/item/clothing/tie/storage/emp_act(severity)
|
||||
@@ -343,27 +430,14 @@
|
||||
item_color = "unathiharness2"
|
||||
slots = 2
|
||||
|
||||
/obj/item/clothing/tie/storage/knifeharness/attackby(var/obj/item/O as obj, mob/user as mob)
|
||||
..()
|
||||
update()
|
||||
|
||||
/obj/item/clothing/tie/storage/knifeharness/proc/update()
|
||||
var/count = 0
|
||||
for(var/obj/item/I in hold)
|
||||
if(istype(I,/obj/item/weapon/hatchet/unathiknife))
|
||||
count++
|
||||
if(count>2) count = 2
|
||||
item_state = "unathiharness[count]"
|
||||
icon_state = item_state
|
||||
item_color = item_state
|
||||
|
||||
if(istype(loc, /obj/item/clothing))
|
||||
var/obj/item/clothing/U = loc
|
||||
if(istype(U.loc, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = U.loc
|
||||
H.update_inv_w_uniform()
|
||||
|
||||
/obj/item/clothing/tie/storage/knifeharness/New()
|
||||
..()
|
||||
hold.max_combined_w_class = 4
|
||||
hold.can_hold = list("/obj/item/weapon/hatchet/unathiknife",\
|
||||
"/obj/item/weapon/kitchen/utensil/knife",\
|
||||
"/obj/item/weapon/kitchen/utensil/pknife",\
|
||||
"/obj/item/weapon/kitchenknife",\
|
||||
"/obj/item/weapon/kitchenknife/ritual")
|
||||
|
||||
new /obj/item/weapon/hatchet/unathiknife(hold)
|
||||
new /obj/item/weapon/hatchet/unathiknife(hold)
|
||||
|
||||
Reference in New Issue
Block a user