Refactors utensils to use weakrefs (#8140)

* Refactors utensils

* fixes + removes extraneous var

* fixes another missed arg
This commit is contained in:
MarinaGryphon
2021-06-18 14:01:35 -09:00
committed by GitHub
parent 68eadcc100
commit 1672a51eff
3 changed files with 85 additions and 44 deletions
+17 -23
View File
@@ -160,32 +160,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.overlays.Cut()
U.loaded = "[src]"
var/image/I = new(U.icon, "loadedfood")
I.color = src.filling_color
U.overlays += 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))