mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-25 06:07:22 +01:00
Merge pull request #4858 from mwerezak/webbing
Storage and Clothing/Accessory Changes and Cleanup
This commit is contained in:
@@ -15,9 +15,22 @@
|
||||
max_combined_w_class = 21
|
||||
|
||||
/obj/item/weapon/storage/backpack/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
playsound(src.loc, "rustle", 50, 1, -5)
|
||||
if (src.use_sound)
|
||||
playsound(src.loc, src.use_sound, 50, 1, -5)
|
||||
..()
|
||||
|
||||
/obj/item/weapon/storage/backpack/equipped(var/mob/user, var/slot)
|
||||
if (slot == slot_back && src.use_sound)
|
||||
playsound(src.loc, src.use_sound, 50, 1, -5)
|
||||
..(user, slot)
|
||||
|
||||
/*
|
||||
/obj/item/weapon/storage/backpack/dropped(mob/user as mob)
|
||||
if (loc == user && src.use_sound)
|
||||
playsound(src.loc, src.use_sound, 50, 1, -5)
|
||||
..(user)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Backpack Types
|
||||
*/
|
||||
|
||||
@@ -8,29 +8,6 @@
|
||||
slot_flags = SLOT_BELT
|
||||
attack_verb = list("whipped", "lashed", "disciplined")
|
||||
|
||||
|
||||
/obj/item/weapon/storage/belt/proc/can_use()
|
||||
return is_equipped()
|
||||
|
||||
|
||||
/obj/item/weapon/storage/belt/MouseDrop(obj/over_object as obj, src_location, over_location)
|
||||
var/mob/M = usr
|
||||
if(!istype(over_object, /obj/screen))
|
||||
return ..()
|
||||
playsound(src.loc, "rustle", 50, 1, -5)
|
||||
if (!M.restrained() && !M.stat && can_use())
|
||||
switch(over_object.name)
|
||||
if("r_hand")
|
||||
M.u_equip(src)
|
||||
M.put_in_r_hand(src)
|
||||
if("l_hand")
|
||||
M.u_equip(src)
|
||||
M.put_in_l_hand(src)
|
||||
src.add_fingerprint(usr)
|
||||
return
|
||||
|
||||
|
||||
|
||||
/obj/item/weapon/storage/belt/utility
|
||||
name = "tool-belt" //Carn: utility belt is nicer, but it bamboozles the text parsing.
|
||||
desc = "Can hold various tools."
|
||||
|
||||
@@ -102,5 +102,6 @@
|
||||
A.reagents.add_reagent("holywater",water2holy)
|
||||
|
||||
/obj/item/weapon/storage/bible/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
playsound(src.loc, "rustle", 50, 1, -5)
|
||||
if (src.use_sound)
|
||||
playsound(src.loc, src.use_sound, 50, 1, -5)
|
||||
..()
|
||||
|
||||
@@ -124,29 +124,7 @@
|
||||
allow_quick_gather = 1
|
||||
use_to_pickup = 1
|
||||
storage_slots = 14
|
||||
|
||||
/obj/item/weapon/storage/pill_bottle/MouseDrop(obj/over_object as obj) //Quick pillbottle fix. -Agouri
|
||||
|
||||
if (ishuman(usr) || ismonkey(usr)) //Can monkeys even place items in the pocket slots? Leaving this in just in case~
|
||||
var/mob/M = usr
|
||||
if (!( istype(over_object, /obj/screen) ))
|
||||
return ..()
|
||||
if ((!( M.restrained() ) && !( M.stat ) /*&& M.pocket == src*/))
|
||||
switch(over_object.name)
|
||||
if("r_hand")
|
||||
M.u_equip(src)
|
||||
M.put_in_r_hand(src)
|
||||
if("l_hand")
|
||||
M.u_equip(src)
|
||||
M.put_in_l_hand(src)
|
||||
src.add_fingerprint(usr)
|
||||
return
|
||||
if(over_object == usr && in_range(src, usr) || usr.contents.Find(src))
|
||||
if (usr.s_active)
|
||||
usr.s_active.close(usr)
|
||||
src.show_to(usr)
|
||||
return
|
||||
return
|
||||
use_sound = null
|
||||
|
||||
/obj/item/weapon/storage/pill_bottle/kelotane
|
||||
name = "bottle of kelotane pills"
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
//A storage item intended to be used by other items to provide storage functionality.
|
||||
//Types that use this should consider overriding emp_act() and hear_talk(), unless they shield their contents somehow.
|
||||
/obj/item/weapon/storage/internal
|
||||
var/obj/item/master_item
|
||||
|
||||
/obj/item/weapon/storage/internal/New(obj/item/MI)
|
||||
master_item = MI
|
||||
loc = master_item
|
||||
name = master_item.name
|
||||
verbs -= /obj/item/verb/verb_pickup //make sure this is never picked up.
|
||||
..()
|
||||
|
||||
/obj/item/weapon/storage/internal/attack_hand()
|
||||
return //make sure this is never picked up
|
||||
|
||||
/obj/item/weapon/storage/internal/mob_can_equip()
|
||||
return 0 //make sure this is never picked up
|
||||
|
||||
//Helper procs to cleanly implement internal storages - storage items that provide inventory slots for other items.
|
||||
//These procs are completely optional, it is up to the master item to decide when it's storage get's opened by calling open()
|
||||
//However they are helpful for allowing the master item to pretend it is a storage item itself.
|
||||
//If you are using these you will probably want to override attackby() as well.
|
||||
//See /obj/item/clothing/suit/storage for an example.
|
||||
|
||||
//items that use internal storage have the option of calling this to emulate default storage MouseDrop behaviour.
|
||||
//returns 1 if the master item's parent's MouseDrop() should be called, 0 otherwise. It's strange, but no other way of
|
||||
//doing it without the ability to call another proc's parent, really.
|
||||
/obj/item/weapon/storage/internal/proc/handle_mousedrop(mob/user as mob, obj/over_object as obj)
|
||||
if (ishuman(user) || ismonkey(user)) //so monkeys can take off their backpacks -- Urist
|
||||
|
||||
if (istype(user.loc,/obj/mecha)) // stops inventory actions in a mech
|
||||
return 0
|
||||
|
||||
if(over_object == user && Adjacent(user)) // this must come before the screen objects only block
|
||||
src.open(user)
|
||||
return 0
|
||||
|
||||
if (!( istype(over_object, /obj/screen) ))
|
||||
return 1
|
||||
|
||||
//makes sure master_item is equipped before putting it in hand, so that we can't drag it into our hand from miles away.
|
||||
//there's got to be a better way of doing this...
|
||||
if (!(master_item.loc == user) || (master_item.loc && master_item.loc.loc == user))
|
||||
return 0
|
||||
|
||||
if (!( user.restrained() ) && !( user.stat ))
|
||||
switch(over_object.name)
|
||||
if("r_hand")
|
||||
user.u_equip(master_item)
|
||||
user.put_in_r_hand(master_item)
|
||||
if("l_hand")
|
||||
user.u_equip(master_item)
|
||||
user.put_in_l_hand(master_item)
|
||||
master_item.add_fingerprint(user)
|
||||
return 0
|
||||
return 0
|
||||
|
||||
//items that use internal storage have the option of calling this to emulate default storage attack_hand behaviour.
|
||||
//returns 1 if the master item's parent's attack_hand() should be called, 0 otherwise.
|
||||
//It's strange, but no other way of doing it without the ability to call another proc's parent, really.
|
||||
/obj/item/weapon/storage/internal/proc/handle_attack_hand(mob/user as mob)
|
||||
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.l_store == master_item && !H.get_active_hand()) //Prevents opening if it's in a pocket.
|
||||
H.put_in_hands(master_item)
|
||||
H.l_store = null
|
||||
return 0
|
||||
if(H.r_store == master_item && !H.get_active_hand())
|
||||
H.put_in_hands(master_item)
|
||||
H.r_store = null
|
||||
return 0
|
||||
|
||||
src.add_fingerprint(user)
|
||||
if (master_item.loc == user)
|
||||
src.open(user)
|
||||
return 0
|
||||
|
||||
for(var/mob/M in range(1, master_item.loc))
|
||||
if (M.s_active == src)
|
||||
src.close(M)
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -167,16 +167,12 @@
|
||||
if ((src.loc == user) && (src.locked == 1))
|
||||
usr << "\red [src] is locked and cannot be opened!"
|
||||
else if ((src.loc == user) && (!src.locked))
|
||||
playsound(src.loc, "rustle", 50, 1, -5)
|
||||
if (user.s_active)
|
||||
user.s_active.close(user) //Close and re-open
|
||||
src.show_to(user)
|
||||
src.open(usr)
|
||||
else
|
||||
..()
|
||||
for(var/mob/M in range(1))
|
||||
if (M.s_active == src)
|
||||
src.close(M)
|
||||
src.orient2hud(user)
|
||||
src.add_fingerprint(user)
|
||||
return
|
||||
|
||||
@@ -245,4 +241,4 @@
|
||||
|
||||
/obj/item/weapon/storage/secure/safe/HoS/New()
|
||||
..()
|
||||
//new /obj/item/weapon/storage/lockbox/clusterbang(src) This item is currently broken... and probably shouldnt exist to begin with (even though it's cool)
|
||||
//new /obj/item/weapon/storage/lockbox/clusterbang(src) This item is currently broken... and probably shouldnt exist to begin with (even though it's cool)
|
||||
|
||||
@@ -22,41 +22,36 @@
|
||||
var/allow_quick_gather //Set this variable to allow the object to have the 'toggle mode' verb, which quickly collects all items from a tile.
|
||||
var/collection_mode = 1; //0 = pick one at a time, 1 = pick all on tile
|
||||
var/foldable = null // BubbleWrap - if set, can be folded (when empty) into a sheet of cardboard
|
||||
var/use_sound = "rustle" //sound played when used. null for no sound.
|
||||
|
||||
/obj/item/weapon/storage/MouseDrop(obj/over_object as obj)
|
||||
if (ishuman(usr) || ismonkey(usr)) //so monkeys can take off their backpacks -- Urist
|
||||
var/mob/M = usr
|
||||
|
||||
if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech
|
||||
return
|
||||
|
||||
if(over_object == M && Adjacent(M)) // this must come before the screen objects only block
|
||||
orient2hud(M) // dunno why it wasn't before
|
||||
if(M.s_active)
|
||||
M.s_active.close(M)
|
||||
show_to(M)
|
||||
if(over_object == usr && Adjacent(usr)) // this must come before the screen objects only block
|
||||
src.open(usr)
|
||||
return
|
||||
|
||||
if (!( istype(over_object, /obj/screen) ))
|
||||
return ..()
|
||||
|
||||
//makes sure that the storage is equipped, so that we can't drag it into our hand from miles away.
|
||||
//there's got to be a better way of doing this.
|
||||
if (!(src.loc == usr) || (src.loc && src.loc.loc == usr))
|
||||
return
|
||||
playsound(src.loc, "rustle", 50, 1, -5)
|
||||
if (!( M.restrained() ) && !( M.stat ))
|
||||
|
||||
if (!( usr.restrained() ) && !( usr.stat ))
|
||||
switch(over_object.name)
|
||||
if("r_hand")
|
||||
M.u_equip(src)
|
||||
M.put_in_r_hand(src)
|
||||
usr.u_equip(src)
|
||||
usr.put_in_r_hand(src)
|
||||
if("l_hand")
|
||||
M.u_equip(src)
|
||||
M.put_in_l_hand(src)
|
||||
usr.u_equip(src)
|
||||
usr.put_in_l_hand(src)
|
||||
src.add_fingerprint(usr)
|
||||
return
|
||||
if(over_object == usr && in_range(src, usr) || usr.contents.Find(src))
|
||||
if (usr.s_active)
|
||||
usr.s_active.close(usr)
|
||||
src.show_to(usr)
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
@@ -101,6 +96,15 @@
|
||||
user.s_active = null
|
||||
return
|
||||
|
||||
/obj/item/weapon/storage/proc/open(mob/user as mob)
|
||||
if (src.use_sound)
|
||||
playsound(src.loc, src.use_sound, 50, 1, -5)
|
||||
|
||||
orient2hud(user)
|
||||
if (user.s_active)
|
||||
user.s_active.close(user)
|
||||
show_to(user)
|
||||
|
||||
/obj/item/weapon/storage/proc/close(mob/user as mob)
|
||||
|
||||
src.hide_from(user)
|
||||
@@ -313,17 +317,17 @@
|
||||
|
||||
if(isrobot(user))
|
||||
user << "\blue You're a robot. No."
|
||||
return 1 //Robots can't interact with storage items.
|
||||
return //Robots can't interact with storage items.
|
||||
|
||||
if(!can_be_inserted(W))
|
||||
return 0
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/tray))
|
||||
var/obj/item/weapon/tray/T = W
|
||||
if(T.calc_carry() > 0)
|
||||
if(prob(85))
|
||||
user << "\red The tray won't fit in [src]."
|
||||
return 1
|
||||
return
|
||||
else
|
||||
W.loc = user.loc
|
||||
if ((user.client && user.s_active != src))
|
||||
@@ -331,15 +335,14 @@
|
||||
W.dropped(user)
|
||||
user << "\red God damnit!"
|
||||
|
||||
W.add_fingerprint(user)
|
||||
handle_item_insertion(W)
|
||||
return 1
|
||||
return
|
||||
|
||||
/obj/item/weapon/storage/dropped(mob/user as mob)
|
||||
return
|
||||
|
||||
/obj/item/weapon/storage/attack_hand(mob/user as mob)
|
||||
playsound(src.loc, "rustle", 50, 1, -5)
|
||||
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.l_store == src && !H.get_active_hand()) //Prevents opening if it's in a pocket.
|
||||
@@ -350,12 +353,9 @@
|
||||
H.put_in_hands(src)
|
||||
H.r_store = null
|
||||
return
|
||||
|
||||
src.orient2hud(user)
|
||||
|
||||
if (src.loc == user)
|
||||
if (user.s_active)
|
||||
user.s_active.close(user)
|
||||
src.show_to(user)
|
||||
src.open(user)
|
||||
else
|
||||
..()
|
||||
for(var/mob/M in range(1))
|
||||
@@ -455,4 +455,20 @@
|
||||
var/obj/O = A
|
||||
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).
|
||||
//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 && !(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
|
||||
|
||||
Reference in New Issue
Block a user