mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
slice a pizza into slices without it turning into a pile of slices (#89621)
## About The Pull Request https://github.com/user-attachments/assets/3a620eba-b9c7-464e-a4e4-6c98c1506b2f use a cutting tool on a pizza or a pizza in a pizza box to do this afterwards the pizza can only be picked up like a paper bin - click drag to self slice again to turn into pile of slices works on plates pizza boxes that start with pizza arrive pre-sliced also makes it use item_interaction ## Why It's Good For The Game it makes more sense ## Changelog 🆑 add: you may now take out individual slices of pizza /🆑
This commit is contained in:
@@ -16,11 +16,102 @@
|
||||
venue_value = FOOD_PRICE_CHEAP
|
||||
crafting_complexity = FOOD_COMPLEXITY_2
|
||||
/// type is spawned 6 at a time and replaces this pizza when processed by cutting tool
|
||||
var/obj/item/food/pizzaslice/slice_type
|
||||
slice_type = /obj/item/food/pizzaslice
|
||||
var/obj/item/food/pizzaslice/slice_type = /obj/item/food/pizzaslice
|
||||
///What label pizza boxes use if this pizza spawns in them.
|
||||
var/boxtag = ""
|
||||
/// how many slices left
|
||||
var/slices_left = 6
|
||||
/// have we been sliced? like sliced and you can take it apart by hand
|
||||
var/sliced = FALSE
|
||||
/// cutting tools
|
||||
var/list/cutting_tools = list(TOOL_KNIFE, TOOL_SAW, TOOL_SCALPEL)
|
||||
|
||||
/obj/item/food/pizza/Initialize(mapload)
|
||||
. = ..()
|
||||
AddElement(/datum/element/drag_pickup)
|
||||
register_context()
|
||||
|
||||
/obj/item/food/pizza/add_context(atom/source, list/context, obj/item/held_item, mob/user)
|
||||
. = ..()
|
||||
|
||||
if(istype(held_item) && (held_item.tool_behaviour in cutting_tools))
|
||||
context[SCREENTIP_CONTEXT_LMB] = "Slice"
|
||||
context[SCREENTIP_CONTEXT_RMB] = "Slice apart"
|
||||
return TRUE
|
||||
|
||||
if(sliced)
|
||||
context[SCREENTIP_CONTEXT_LMB] = "Take Slice"
|
||||
return TRUE
|
||||
|
||||
/obj/item/food/pizza/examine(mob/user)
|
||||
. = ..()
|
||||
if(isnull(slice_type) || !sliced)
|
||||
return
|
||||
. += span_notice("You can slice this to make it possible to take out slices with an empty hand!")
|
||||
|
||||
/obj/item/food/pizza/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
|
||||
. = NONE
|
||||
if(isnull(slice_type) || !(tool.tool_behaviour in cutting_tools))
|
||||
return
|
||||
if(!sliced)
|
||||
slice(user, tool)
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
user.visible_message(span_notice("[user] seperates [src] into individual slices with [tool]."))
|
||||
cut_apart()
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
/obj/item/food/pizza/item_interaction_secondary(mob/living/user, obj/item/tool, list/modifiers)
|
||||
. = NONE
|
||||
if(isnull(slice_type) || !(tool.tool_behaviour in cutting_tools))
|
||||
return
|
||||
visible_message(span_notice("[user] seperates [src] into individual slices with [tool]."))
|
||||
cut_apart()
|
||||
return ITEM_INTERACT_SUCCESS
|
||||
|
||||
/obj/item/food/pizza/attack_hand(mob/user, list/modifiers)
|
||||
. = ..()
|
||||
if(!sliced)
|
||||
return
|
||||
user.visible_message(span_notice("You take a slice of [src]."), span_notice("[user] takes a slice of [src]."))
|
||||
produce_slice(user)
|
||||
|
||||
/obj/item/food/pizza/proc/get_slices_filter() //to not repeat code
|
||||
return alpha_mask_filter(icon = icon('icons/obj/food/pizza.dmi', "[slices_left]slices"))
|
||||
|
||||
/// slices this pizza. all arguments optional.
|
||||
/obj/item/food/pizza/proc/slice(mob/user, obj/item/tool)
|
||||
if(sliced)
|
||||
return
|
||||
tool?.play_tool_sound(src)
|
||||
sliced = TRUE
|
||||
user?.visible_message(span_notice("[user] cuts [src] into 6 slices with [tool]."))
|
||||
interaction_flags_item &= ~INTERACT_ITEM_ATTACK_HAND_PICKUP
|
||||
|
||||
/obj/item/food/pizza/proc/cut_apart()
|
||||
for(var/_ in 1 to slices_left)
|
||||
produce_slice(no_update = TRUE)
|
||||
|
||||
/// make a slice and give it to user. no_update means no filter work is done. user is optional
|
||||
/obj/item/food/pizza/proc/produce_slice(mob/user, no_update = FALSE)
|
||||
var/turf/our_turf = get_turf(src)
|
||||
var/obj/item/food/pizzaslice/slice = new slice_type(our_turf)
|
||||
if(HAS_TRAIT(src, TRAIT_FOOD_SILVER))
|
||||
ADD_TRAIT(slice, TRAIT_FOOD_SILVER, INNATE_TRAIT)
|
||||
if(HAS_TRAIT(src, TRAIT_FOOD_CHEF_MADE))
|
||||
ADD_TRAIT(slice, TRAIT_FOOD_CHEF_MADE, GET_TRAIT_SOURCES(src, TRAIT_FOOD_CHEF_MADE)[1]) // wack thing to inherit first source
|
||||
slice.pixel_x += rand(-6, 6)
|
||||
slice.pixel_y += rand(-6, 6)
|
||||
user?.put_in_active_hand(slice)
|
||||
slices_left--
|
||||
if(slices_left <= 0)
|
||||
qdel(src)
|
||||
return
|
||||
if(no_update)
|
||||
return
|
||||
remove_filter("pizzaslices")
|
||||
add_filter("pizzaslices", 1, get_slices_filter())
|
||||
|
||||
// Raw Pizza
|
||||
/obj/item/food/pizza/raw
|
||||
foodtypes = GRAIN | RAW
|
||||
slice_type = null
|
||||
@@ -29,12 +120,6 @@
|
||||
/obj/item/food/pizza/raw/make_bakeable()
|
||||
AddComponent(/datum/component/bakeable, /obj/item/food/pizza, rand(70 SECONDS, 80 SECONDS), TRUE, TRUE)
|
||||
|
||||
/obj/item/food/pizza/make_processable()
|
||||
if (slice_type)
|
||||
AddElement(/datum/element/processable, TOOL_KNIFE, slice_type, 6, 3 SECONDS, table_required = TRUE, screentip_verb = "Slice")
|
||||
AddElement(/datum/element/processable, TOOL_SAW, slice_type, 6, 4.5 SECONDS, table_required = TRUE, screentip_verb = "Slice")
|
||||
AddElement(/datum/element/processable, TOOL_SCALPEL, slice_type, 6, 6 SECONDS, table_required = TRUE, screentip_verb = "Slice")
|
||||
|
||||
// Pizza Slice
|
||||
/obj/item/food/pizzaslice
|
||||
name = "pizza slice"
|
||||
|
||||
Reference in New Issue
Block a user