mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Surgical kits can now contain their equipment.
The surgical kit can now contain the equipment it came with. It can also not contain more items of a given type than it was spawned with. This means that even if the storage container otherwise has sufficient space it can, for example, still only ever contain 1 surgical saw. Fixes #11298. Fixes #11297.
This commit is contained in:
@@ -130,8 +130,7 @@
|
||||
|
||||
/obj/item/weapon/storage/firstaid/surgery
|
||||
name = "surgery kit"
|
||||
desc = "Contains tools for surgery."
|
||||
storage_slots = 10
|
||||
desc = "Contains tools for surgery. Has precise foam fitting for safe transport."
|
||||
|
||||
/obj/item/weapon/storage/firstaid/surgery/New()
|
||||
..()
|
||||
@@ -146,7 +145,8 @@
|
||||
new /obj/item/weapon/bonegel(src)
|
||||
new /obj/item/weapon/FixOVein(src)
|
||||
new /obj/item/stack/medical/advanced/bruise_pack(src)
|
||||
return
|
||||
|
||||
make_exact_fit()
|
||||
|
||||
/*
|
||||
* Pill Bottles
|
||||
|
||||
@@ -51,10 +51,10 @@
|
||||
//there's got to be a better way of doing this.
|
||||
if (!(src.loc == usr) || (src.loc && src.loc.loc == usr))
|
||||
return
|
||||
|
||||
|
||||
if (( usr.restrained() ) || ( usr.stat ))
|
||||
return
|
||||
|
||||
|
||||
if ((src.loc == usr) && !usr.unEquip(src))
|
||||
return
|
||||
|
||||
@@ -232,12 +232,16 @@
|
||||
usr << "<span class='notice'>[src] is full, make some space.</span>"
|
||||
return 0 //Storage item is full
|
||||
|
||||
if(can_hold.len && !is_type_in_list(W, can_hold))
|
||||
if(!stop_messages)
|
||||
if (istype(W, /obj/item/weapon/hand_labeler))
|
||||
return 0
|
||||
usr << "<span class='notice'>[src] cannot hold [W].</span>"
|
||||
return 0
|
||||
if(can_hold.len)
|
||||
if(!is_type_in_list(W, can_hold))
|
||||
if(!stop_messages && ! istype(W, /obj/item/weapon/hand_labeler))
|
||||
usr << "<span class='notice'>[src] cannot hold [W].</span>"
|
||||
return 0
|
||||
var/max_instances = can_hold[W.type]
|
||||
if(max_instances && instances_of_type_in_list(W, contents) >= max_instances)
|
||||
if(!stop_messages && !istype(W, /obj/item/weapon/hand_labeler))
|
||||
usr << "<span class='notice'>[src] has no more space for an additional [W].</span>"
|
||||
return 0
|
||||
|
||||
if(cant_hold.len && is_type_in_list(W, cant_hold))
|
||||
if(!stop_messages)
|
||||
@@ -449,6 +453,17 @@
|
||||
var/obj/O = A
|
||||
O.hear_talk(M, text, verb, speaking)
|
||||
|
||||
/obj/item/weapon/storage/proc/make_exact_fit()
|
||||
storage_slots = contents.len
|
||||
|
||||
can_hold.Cut()
|
||||
max_w_class = 0
|
||||
max_storage_space = 0
|
||||
for(var/obj/item/I in src)
|
||||
max_w_class = max(I.w_class, max_w_class)
|
||||
max_storage_space += I.get_storage_cost()
|
||||
can_hold[I.type] = ++can_hold[I.type]
|
||||
|
||||
//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 container.
|
||||
/atom/proc/storage_depth(atom/container)
|
||||
|
||||
Reference in New Issue
Block a user