diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm index 0c963ec70b..71c0bf2f1c 100644 --- a/code/modules/food_and_drinks/pizzabox.dm +++ b/code/modules/food_and_drinks/pizzabox.dm @@ -10,7 +10,7 @@ name = "pizza box" desc = "A box suited for pizzas." icon = 'icons/obj/food/containers.dmi' - icon_state = "pizzabox1" + icon_state = "pizzabox" item_state = "pizzabox" var/open = FALSE @@ -68,13 +68,30 @@ bomb_overlay.pixel_y = 5 add_overlay(bomb_overlay) else - icon_state = "pizzabox[boxes.len + 1]" + icon_state = "pizzabox" + var/current_offset = 3 + for(var/V in boxes) + var/obj/item/pizzabox/P = V + var/mutable_appearance/box_overlay = mutable_appearance(P.icon, P.icon_state) + box_overlay.pixel_y = current_offset + add_overlay(box_overlay) + current_offset += 3 var/obj/item/pizzabox/box = boxes.len ? boxes[boxes.len] : src if(box.boxtag != "") var/mutable_appearance/tag_overlay = mutable_appearance(icon, "pizzabox_tag") tag_overlay.pixel_y = boxes.len * 3 add_overlay(tag_overlay) +/obj/item/pizzabox/worn_overlays(isinhands, icon_file) + . = list() + var/current_offset = 2 + if(isinhands) + for(var/V in boxes) //add EXTRA BOX per box + var/mutable_appearance/M = mutable_appearance(icon_file, item_state) + M.pixel_y = current_offset + current_offset += 2 + . += M + /obj/item/pizzabox/attack_self(mob/user) if(boxes.len > 0) return @@ -124,6 +141,7 @@ to_chat(user, "You remove the topmost [name] from the stack.") topbox.update_icon() update_icon() + user.regenerate_icons() return ..() @@ -134,23 +152,28 @@ var/list/add = list() add += newbox add += newbox.boxes - - if((boxes.len + 1) + add.len <= 5) - if(!user.drop_item()) - return - boxes += add - newbox.boxes.Cut() - newbox.loc = src - to_chat(user, "You put [newbox] on top of [src]!") - newbox.update_icon() - update_icon() + if(!user.transferItemToLoc(add, src)) return - else - to_chat(user, "The stack is dangerously high!") + boxes += add + newbox.boxes.Cut() + to_chat(user, "You put [newbox] on top of [src]!") + newbox.update_icon() + update_icon() + user.regenerate_icons() + if(boxes.len >= 5) + if(prob(10 * boxes.len)) + to_chat(user, "You can't keep holding the stack!") + disperse_pizzas() + else + to_chat(user, "The stack is getting a little high...") + return else to_chat(user, "Close [open ? src : newbox] first!") else if(istype(I, /obj/item/weapon/reagent_containers/food/snacks/pizza) || istype(I, /obj/item/weapon/reagent_containers/food/snacks/customizable/pizza)) if(open) + if(pizza) + to_chat(user, "[src] already has \a [pizza.name]!") + return if(!user.drop_item()) return pizza = I @@ -181,7 +204,7 @@ if(wires && bomb) wires.interact(user) else if(istype(I, /obj/item/weapon/reagent_containers/food)) - to_chat(user, "That's not a pizza!") + to_chat(user, "That's not a pizza!") ..() /obj/item/pizzabox/process() @@ -200,6 +223,34 @@ unprocess() return +/obj/item/pizzabox/attack(mob/living/target, mob/living/user, def_zone) + . = ..() + if(boxes.len >= 3 && prob(25 * boxes.len)) + disperse_pizzas() + +/obj/item/pizzabox/throw_impact(atom/movable/AM) + if(boxes.len >= 2 && prob(20 * boxes.len)) + disperse_pizzas() + +/obj/item/pizzabox/proc/disperse_pizzas() + visible_message("The pizzas fall everywhere!") + for(var/V in boxes) + var/obj/item/pizzabox/P = V + var/fall_dir = pick(GLOB.alldirs) + step(P, fall_dir) + if(P.pizza && prob(50)) //rip pizza + P.open = TRUE + P.pizza.forceMove(get_turf(P)) + fall_dir = pick(GLOB.alldirs) + step(P.pizza, fall_dir) + P.pizza = null + P.update_icon() + boxes -= P + update_icon() + if(isliving(loc)) + var/mob/living/L = loc + L.regenerate_icons() + /obj/item/pizzabox/proc/unprocess() STOP_PROCESSING(SSobj, src) qdel(wires) diff --git a/icons/obj/food/containers.dmi b/icons/obj/food/containers.dmi index 68c192bec3..f95ce283d2 100644 Binary files a/icons/obj/food/containers.dmi and b/icons/obj/food/containers.dmi differ