mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 02:57:48 +01:00
Slicing grown snacks
This commit is contained in:
@@ -60,6 +60,31 @@
|
||||
|
||||
/obj/item/reagent_containers/food/snacks/grown/attackby(obj/item/O, mob/user, params)
|
||||
..()
|
||||
if(slices_num && slices_num >0 && slice_path)
|
||||
var/inaccurate = TRUE
|
||||
if(O.sharp)
|
||||
if(istype(O, /obj/item/kitchen/knife) || istype(O, /obj/item/scalpel))
|
||||
inaccurate = FALSE
|
||||
|
||||
if(!isturf(loc) || !(locate(/obj/structure/table) in loc) && !(locate(/obj/machinery/optable) in loc) && !(locate(/obj/item/storage/bag/tray) in loc))
|
||||
to_chat(user, "<span class='warning'>You cannot slice [src] here! You need a table or at least a tray to do it.</span>")
|
||||
return TRUE
|
||||
|
||||
var/slices_lost = 0
|
||||
if(!inaccurate)
|
||||
user.visible_message("<span class='notice'>[user] slices [src]!</span>",
|
||||
"<span class='notice'>You slice [src]!</span>")
|
||||
else
|
||||
user.visible_message("<span class='notice'>[user] crudely slices [src] with [O]!</span>", "<span class='notice'>You crudely slice [src] with your [O]</span>!")
|
||||
slices_lost = rand(1,min(1,round(slices_num/2)))
|
||||
|
||||
var/reagents_per_slice = reagents.total_volume/slices_num
|
||||
for(var/i=1 to (slices_num-slices_lost))
|
||||
var/obj/slice = new slice_path (loc)
|
||||
reagents.trans_to(slice,reagents_per_slice)
|
||||
qdel(src)
|
||||
return ..()
|
||||
|
||||
if (istype(O, /obj/item/plant_analyzer))
|
||||
var/msg = "<span class='info'>*---------*\n This is \a <span class='name'>[src]</span>.\n"
|
||||
if(seed)
|
||||
|
||||
Reference in New Issue
Block a user