Ports over Mortars and Pestles (#11546)

* 2 ports for the commit of 1!

ports -[ready]ghetto grinder
#43600
ports - Mortar and Pestle Fixes #48086
Links -
https://github.com/tgstation/tgstation/pull/43600
https://github.com/tgstation/tgstation/pull/48086

* what if we didnt have that...

* Apply suggestions from code review

Co-Authored-By: Ghom <42542238+Ghommie@users.noreply.github.com>

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
Trilbyspaceclone
2020-03-24 09:03:31 -04:00
committed by GitHub
parent 613c66d88e
commit f8147e5a85
3 changed files with 66 additions and 0 deletions
@@ -120,6 +120,7 @@ GLOBAL_LIST_INIT(metal_recipes, list ( \
)), \
null, \
new/datum/stack_recipe("iron door", /obj/structure/mineral_door/iron, 20, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("pestle", /obj/item/pestle, 1, time = 50), \
new/datum/stack_recipe("floodlight frame", /obj/structure/floodlight_frame, 5, one_per_turf = TRUE, on_floor = TRUE), \
))
@@ -255,6 +256,7 @@ GLOBAL_LIST_INIT(wood_recipes, list ( \
new/datum/stack_recipe("apiary", /obj/structure/beebox, 40, time = 50),\
null, \
new/datum/stack_recipe("picture frame", /obj/item/wallframe/picture, 1, time = 10),\
new/datum/stack_recipe("mortar", /obj/item/reagent_containers/glass/mortar, 3), \
new/datum/stack_recipe("honey frame", /obj/item/honey_frame, 5, time = 10),\
))
@@ -388,3 +388,67 @@
/obj/item/reagent_containers/glass/get_belt_overlay()
return mutable_appearance('icons/obj/clothing/belt_overlays.dmi', "bottle")
//Mortar & Pestle
/obj/item/pestle
name = "pestle"
desc = "An ancient, simple tool used in conjunction with a mortar to grind or juice items."
icon = 'icons/obj/chemical.dmi'
icon_state = "pestle"
force = 4
/obj/item/reagent_containers/glass/mortar
name = "mortar"
desc = "A specially formed bowl of ancient design. It is possible to crush or juice items placed in it using a pestle; however the process, unlike modern methods, is slow and physically exhausting. Alt click to eject the item."
icon_state = "mortar"
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(5, 10, 15, 20, 25, 30, 50)
item_flags = NO_MAT_REDEMPTION
reagent_flags = OPENCONTAINER
spillable = TRUE
var/obj/item/grinded
/obj/item/reagent_containers/glass/mortar/AltClick(mob/user)
. = ..()
if(grinded)
grinded.forceMove(drop_location())
grinded = null
to_chat(user, "<span class='notice'>You eject the item inside.</span>")
return TRUE
/obj/item/reagent_containers/glass/mortar/attackby(obj/item/I, mob/living/carbon/human/user)
..()
if(istype(I,/obj/item/pestle))
if(grinded)
if(IS_STAMCRIT(user))
to_chat(user, "<span class='warning'>You are too tired to work!</span>")
return
to_chat(user, "<span class='notice'>You start grinding...</span>")
if((do_after(user, 25, target = src)) && grinded)
user.adjustStaminaLoss(20)
if(grinded.juice_results) //prioritize juicing
grinded.on_juice()
reagents.add_reagent_list(grinded.juice_results)
to_chat(user, "<span class='notice'>You juice [grinded] into a fine liquid.</span>")
QDEL_NULL(grinded)
return
grinded.on_grind()
reagents.add_reagent_list(grinded.grind_results)
if(grinded.reagents) //food and pills
grinded.reagents.trans_to(src, grinded.reagents.total_volume)
to_chat(user, "<span class='notice'>You break [grinded] into powder.</span>")
QDEL_NULL(grinded)
return
return
else
to_chat(user, "<span class='warning'>There is nothing to grind!</span>")
return
if(grinded)
to_chat(user, "<span class='warning'>There is something inside already!</span>")
return
if(I.juice_results || I.grind_results)
I.forceMove(src)
grinded = I
return
to_chat(user, "<span class='warning'>You can't grind this!</span>")