Merge pull request #10694 from VOREStation/upstream-merge-8140

[MIRROR] Refactors utensils to use weakrefs
This commit is contained in:
Novacat
2021-06-19 09:43:30 -04:00
committed by GitHub
3 changed files with 85 additions and 44 deletions
+17 -23
View File
@@ -175,32 +175,26 @@
// Eating with forks
if(istype(W,/obj/item/weapon/material/kitchen/utensil))
var/obj/item/weapon/material/kitchen/utensil/U = W
if(U.scoop_food)
if(!U.reagents)
U.create_reagents(5)
if(!U.reagents)
U.create_reagents(5)
if (U.reagents.total_volume > 0)
to_chat(user, "<font color='red'>You already have something on your [U].</font>")
return
user.visible_message( \
"[user] scoops up some [src] with \the [U]!", \
"<font color='blue'>You scoop up some [src] with \the [U]!</font>" \
)
src.bitecount++
U.cut_overlays()
U.loaded = "[src]"
var/image/I = new(U.icon, "loadedfood")
I.color = src.filling_color
U.add_overlay(I)
reagents.trans_to_obj(U, min(reagents.total_volume,5))
if (reagents.total_volume <= 0)
qdel(src)
if (U.reagents.total_volume > 0)
to_chat(user, "<font color='red'>You already have something on your [U].</font>")
return
user.visible_message( \
"[user] scoops up some [src] with \the [U]!", \
"<font color='blue'>You scoop up some [src] with \the [U]!</font>" \
)
bitecount++
reagents.trans_to_obj(U, min(reagents.total_volume,5))
if (reagents.total_volume <= 0)
qdel(src)
return
if (is_sliceable())
//these are used to allow hiding edge items in food that is not on a table/tray
var/can_slice_here = isturf(src.loc) && ((locate(/obj/structure/table) in src.loc) || (locate(/obj/machinery/optable) in src.loc) || (locate(/obj/item/weapon/tray) in src.loc))