Skip to content

Commit

Permalink
Reworks Bowls to hold both solids and liquids (#8203)
Browse files Browse the repository at this point in the history
* readability update and refactor

* reagent containers no longer drain when empty or from full target

* added trailing newline toggle option to to_chat

* add hybrid storage and reagent containers

* adds volume to description of drywet

* replaced bowl system

* Update code/modules/food/drywet.dm

I missed this though.

Co-authored-by: hyperioo <[email protected]>

---------

Co-authored-by: hyperioo <[email protected]>
  • Loading branch information
vode-code and hyperioo authored Jun 16, 2023
1 parent aac0b98 commit d27271c
Show file tree
Hide file tree
Showing 8 changed files with 241 additions and 54 deletions.
1 change: 1 addition & 0 deletions cev_eris.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,7 @@
#include "code\modules\ext_scripts\python.dm"
#include "code\modules\flufftext\Dreaming.dm"
#include "code\modules\flufftext\TextFilters.dm"
#include "code\modules\food\drywet.dm"
#include "code\modules\food\recipes_microwave.dm"
#include "code\modules\games\boardgame.dm"
#include "code\modules\games\cardemon.dm"
Expand Down
2 changes: 1 addition & 1 deletion code/datums/autolathe/containers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

/datum/design/autolathe/container/mixingbowl
name = "mixing bowl"
build_path = /obj/item/reagent_containers/glass/beaker/bowl
build_path = /obj/item/reagent_containers/drywet

/datum/design/autolathe/container/vial
name = "glass vial"
Expand Down
61 changes: 24 additions & 37 deletions code/game/objects/items/weapons/storage/storage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
totalHeight = (currentSlot/maxColumnCount) * (itemBackground.getHeight() + spacingBetweenSlots)

main.setPosition(data.StorageData["Xspace"],data.StorageData["Yspace"])
return main
. = main

/obj/item/storage/Destroy()
close_all()
Expand All @@ -221,7 +221,7 @@
/obj/item/storage/MouseDrop(obj/over_object)
if(ishuman(usr) && usr == over_object && !usr.incapacitated() && Adjacent(usr))
return src.open(usr)
return ..()
. = ..()

/obj/item/storage/proc/return_inv()
var/list/L = list()
Expand All @@ -234,7 +234,7 @@
L += G.gift
if (istype(G.gift, /obj/item/storage))
L += G.gift:return_inv()
return L
. = L

/obj/item/storage/proc/show_to(mob/user)
if(!user.client)
Expand Down Expand Up @@ -301,38 +301,38 @@
if(!istype(W)) return //Not an item

if(usr && usr.isEquipped(W) && !usr.canUnEquip(W))
return 0
return FALSE

if(src.loc == W)
return 0 //Means the item is already in the storage item
return FALSE //Means the item is already in the storage item
if(storage_slots != null && contents.len >= storage_slots)
if(!stop_messages)
to_chat(usr, SPAN_NOTICE("[src] is full, make some space."))
return 0 //Storage item is full
return FALSE //Storage item is full

if(W.anchored)
return 0
return FALSE

if(can_hold.len)
if(!is_type_in_list(W, can_hold))
if(!stop_messages && ! istype(W, /obj/item/hand_labeler))
to_chat(usr, SPAN_NOTICE("[src] cannot hold \the [W]."))
return 0
return FALSE
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/hand_labeler))
to_chat(usr, SPAN_NOTICE("[src] has no more space specifically for \the [W]."))
return 0
return FALSE

if(cant_hold.len && is_type_in_list(W, cant_hold))
if(!stop_messages)
to_chat(usr, SPAN_NOTICE("[src] cannot hold [W]."))
return 0
return FALSE

if (max_w_class != null && W.w_class > max_w_class)
if(!stop_messages)
to_chat(usr, SPAN_NOTICE("[W] is too long for this [src]."))
return 0
return FALSE

//Slot based storage overrides space-based storage
if(storage_slots == null)
Expand All @@ -343,14 +343,14 @@
if(total_storage_space > max_storage_space)
if(!stop_messages)
to_chat(usr, SPAN_NOTICE("[src] is too full, make some space."))
return 0
return FALSE

if(W.w_class >= src.w_class && (istype(W, /obj/item/storage)))
if(!stop_messages)
to_chat(usr, SPAN_NOTICE("[src] cannot hold [W] as it's a storage item of the same size."))
return 0 //To prevent the stacking of same sized storage items.
return FALSE //To prevent the stacking of same sized storage items.

return 1
. = TRUE

//This proc handles items being inserted. It does not perform any checks of whether an item can or can't be inserted. That's done by can_be_inserted()
//The stop_warning parameter will stop the insertion message from being displayed. It is intended for cases where you are inserting multiple items at once,
Expand Down Expand Up @@ -383,7 +383,7 @@
refresh_all()

update_icon()
return 1
. = TRUE

//Call this proc to handle the removal of an item from the storage item. The item will be moved to the atom sent as new_target
/obj/item/storage/proc/remove_from_storage(obj/item/W, atom/new_location)
Expand Down Expand Up @@ -417,7 +417,7 @@
var/amt_inserted = 0
var/turf/T = get_turf(user)
for(var/obj/item/light/L in src.contents)
if(L.status == 0)
if(L.status == 0) // LIGHT_OK, don't try using it though as it is undefined earlier in the dme
if(LP.uses < LP.max_uses)
LP.AddUses(1)
amt_inserted++
Expand All @@ -444,32 +444,19 @@
to_chat(user, SPAN_WARNING("God damnit!"))

W.add_fingerprint(user)
return handle_item_insertion(W)
. = handle_item_insertion(W)

/obj/item/storage/dropped(mob/user)
return

/obj/item/storage/attack_hand(mob/user)
// v Why does that exist? ~Luduk
/*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.
H.put_in_hands(src)
H.l_store = null
return
if(H.r_store == src && !H.get_active_hand())
H.put_in_hands(src)
H.r_store = null
return*/

if(loc == user)
open(user)
else
close_all()
..()

src.add_fingerprint(user)
return
add_fingerprint(user)

/obj/item/storage/verb/toggle_gathering_mode()
set name = "Switch Gathering Method"
Expand Down Expand Up @@ -512,7 +499,7 @@
if(isturf(A) && !A.density)
dump_it(A)
return TRUE
return ..()
. = ..()

/obj/item/storage/verb/quick_empty()
set name = "Empty Contents"
Expand Down Expand Up @@ -576,7 +563,7 @@
if(user.get_active_hand() == src && user.get_inactive_hand() == null)
if(user.swap_hand())
open(user)
return TRUE
. = TRUE

/obj/item/storage/proc/make_exact_fit()
storage_slots = contents.len
Expand Down Expand Up @@ -623,7 +610,7 @@
if (!cur_atom)
return -1 //inside something with a null loc.

return depth
. = depth

//Like storage depth, but returns the depth to the nearest turf
//Returns -1 if no top level turf (a loc was null somewhere, or a non-turf atom's loc was an area somehow).
Expand All @@ -641,10 +628,10 @@
if (!cur_atom)
return -1 //inside something with a null loc.

return depth
. = depth

/obj/item/proc/get_storage_cost()
return BASE_STORAGE_COST(w_class) //If you want to prevent stuff above a certain w_class from being stored, use max_w_class
. = BASE_STORAGE_COST(w_class) //If you want to prevent stuff above a certain w_class from being stored, use max_w_class


//Useful for spilling the contents of containers all over the floor
Expand All @@ -657,4 +644,4 @@
O.tumble(2)

/obj/item/storage/AllowDrop()
return TRUE
. = TRUE
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
new /obj/item/storage/box/mousetraps(src)
new /obj/item/storage/box/mousetraps(src)
new /obj/item/clothing/under/rank/chef(src)
new /obj/item/reagent_containers/glass/beaker/bowl(src)
new /obj/item/reagent_containers/glass/beaker/bowl(src)
new /obj/item/reagent_containers/drywet(src)
new /obj/item/reagent_containers/drywet(src)
new /obj/item/clothing/head/chefhat(src)

/*
Expand Down
Loading

0 comments on commit d27271c

Please sign in to comment.