This commit is contained in:
Yoshax
2016-10-07 03:06:49 +01:00
parent 5819397a0a
commit 8c02e93b03

View File

@@ -2889,12 +2889,12 @@
/obj/item/pizzabox/proc/closepizzabox() /obj/item/pizzabox/proc/closepizzabox()
if( boxes.len > 0 ) if(boxes.len > 0)
return return
open = !open open = !open
if( open && pizza ) if(open && pizza)
ismessy = 1 ismessy = 1
update_icon() update_icon()
@@ -2904,29 +2904,29 @@
overlays = list() overlays = list()
// Set appropriate description // Set appropriate description
if( open && pizza ) if(open && pizza)
desc = "A box suited for pizzas. It appears to have a [pizza.name] inside." desc = "A box suited for pizzas. It appears to have a [pizza.name] inside."
else if( boxes.len > 0 ) else if(boxes.len > 0)
desc = "A pile of boxes suited for pizzas. There appears to be [boxes.len + 1] boxes in the pile." desc = "A pile of boxes suited for pizzas. There appears to be [boxes.len + 1] boxes in the pile."
var/obj/item/pizzabox/topbox = boxes[boxes.len] var/obj/item/pizzabox/topbox = boxes[boxes.len]
var/toptag = topbox.boxtag var/toptag = topbox.boxtag
if( toptag != "" ) if(toptag != "")
desc = "[desc] The box on top has a tag, it reads: '[toptag]'." desc = "[desc] The box on top has a tag, it reads: '[toptag]'."
else else
desc = "A box suited for pizzas." desc = "A box suited for pizzas."
if( boxtag != "" ) if(boxtag != "")
desc = "[desc] The box has a tag, it reads: '[boxtag]'." desc = "[desc] The box has a tag, it reads: '[boxtag]'."
// Icon states and overlays // Icon states and overlays
if( open ) if(open)
if( ismessy ) if(ismessy)
icon_state = "pizzabox_messy" icon_state = "pizzabox_messy"
else else
icon_state = "pizzabox_open" icon_state = "pizzabox_open"
if( pizza ) if(pizza)
var/image/pizzaimg = image("food.dmi", icon_state = pizza.icon_state) var/image/pizzaimg = image("food.dmi", icon_state = pizza.icon_state)
pizzaimg.pixel_y = -3 pizzaimg.pixel_y = -3
overlays += pizzaimg overlays += pizzaimg
@@ -2935,33 +2935,33 @@
else else
// Stupid code because byondcode sucks // Stupid code because byondcode sucks
var/doimgtag = 0 var/doimgtag = 0
if( boxes.len > 0 ) if(boxes.len > 0)
var/obj/item/pizzabox/topbox = boxes[boxes.len] var/obj/item/pizzabox/topbox = boxes[boxes.len]
if( topbox.boxtag != "" ) if(topbox.boxtag != "")
doimgtag = 1 doimgtag = 1
else else
if( boxtag != "" ) if(boxtag != "")
doimgtag = 1 doimgtag = 1
if( doimgtag ) if(doimgtag)
var/image/tagimg = image("food.dmi", icon_state = "pizzabox_tag") var/image/tagimg = image("food.dmi", icon_state = "pizzabox_tag")
tagimg.pixel_y = boxes.len * 3 tagimg.pixel_y = boxes.len * 3
overlays += tagimg overlays += tagimg
icon_state = "pizzabox[boxes.len+1]" icon_state = "pizzabox[boxes.len+1]"
/obj/item/pizzabox/attack_hand( mob/user as mob ) /obj/item/pizzabox/attack_hand(mob/user as mob)
if( open && pizza ) if( open && pizza )
user.put_in_hands( pizza ) user.put_in_hands(pizza)
user << "\red You take the [src.pizza] out of the [src]." user << "<span class='notice'>You take \the [src.pizza] out of the [src].</span>"
src.pizza = null src.pizza = null
update_icon() update_icon()
return return
if( boxes.len > 0 ) if(boxes.len > 0)
if( user.get_inactive_hand() != src ) if(user.get_inactive_hand() != src)
..() ..()
return return
@@ -2969,13 +2969,13 @@
boxes -= box boxes -= box
user.put_in_hands( box ) user.put_in_hands( box )
user << "\red You remove the topmost [src] from your hand." user << "<span class='notice'>You remove \the topmost [src] from your hand.</span>"
box.update_icon() box.update_icon()
update_icon() update_icon()
return return
..() ..()
/obj/item/pizzabox/attack_self( mob/user as mob ) /obj/item/pizzabox/attack_self(mob/user as mob)
closepizzabox() closepizzabox()
@@ -2985,57 +2985,58 @@
closepizzabox() closepizzabox()
/obj/item/pizzabox/attackby( obj/item/I as obj, mob/user as mob ) /obj/item/pizzabox/attackby( obj/item/I as obj, mob/user as mob )
if( istype(I, /obj/item/pizzabox/) ) if(istype(I, /obj/item/pizzabox/))
var/obj/item/pizzabox/box = I var/obj/item/pizzabox/box = I
if( !box.open && !src.open ) if(!box.open && !src.open)
// Make a list of all boxes to be added // Make a list of all boxes to be added
var/list/boxestoadd = list() var/list/boxestoadd = list()
boxestoadd += box boxestoadd += box
for(var/obj/item/pizzabox/i in box.boxes) for(var/obj/item/pizzabox/i in box.boxes)
boxestoadd += i boxestoadd += i
if( (boxes.len+1) + boxestoadd.len <= 5 ) if((boxes.len+1) + boxestoadd.len <= 5)
user.drop_item() user.drop_item()
box.loc = src box.loc = src
box.boxes = list() // Clear the box boxes so we don't have boxes inside boxes. - Xzibit box.boxes = list() // Clear the box boxes so we don't have boxes inside boxes. - Xzibit
src.boxes.Add( boxestoadd ) src.boxes.Add(boxestoadd)
box.update_icon() box.update_icon()
update_icon() update_icon()
user << "\red You put the [box] ontop of the [src]!" user << "<span class='notice'>You put \the [box] ontop of the [src]!</span>"
else else
user << "\red The stack is too high!" user << "<span class='warning'>\The stack is too high!</span>"
else else
user << "\red Close the [box] first!" user << "<span class='warning'>Close \the [box] first!</span>"
return return
if( istype(I, /obj/item/weapon/reagent_containers/food/snacks/sliceable/pizza/) ) // Long ass fucking object name if(istype(I, /obj/item/weapon/reagent_containers/food/snacks/sliceable/pizza/)) // Long ass fucking object name
if( src.open ) if(open)
if(!pizza)
user.drop_item() user.drop_item()
I.loc = src I.loc = src
src.pizza = I pizza = I
update_icon() update_icon()
user << "<span class='notice'>You put \the [I] in \the [src]!</span>"
user << "\red You put the [I] in the [src]!"
else else
user << "\red You try to push the [I] through the lid but it doesn't work!" user << "<span class='warning'>\The [src] is full! It already has a [pizza] inside.</span>"
else
user << "<span class='warning'>You try to push \the [I] through the lid but it doesn't work!</span>"
return return
if( istype(I, /obj/item/weapon/pen/) ) if(istype(I, /obj/item/weapon/pen/))
if(open)
if( src.open )
return return
var/t = sanitize(input("Enter what you want to add to the tag:", "Write", null, null) as text, 30) var/t = sanitize(input("Enter what you want to add to the tag:", "Write", null, null) as text, 30)
var/obj/item/pizzabox/boxtotagto = src var/obj/item/pizzabox/boxtotagto = src
if( boxes.len > 0 ) if(boxes.len > 0)
boxtotagto = boxes[boxes.len] boxtotagto = boxes[boxes.len]
boxtotagto.boxtag = copytext("[boxtotagto.boxtag][t]", 1, 30) boxtotagto.boxtag = copytext("[boxtotagto.boxtag][t]", 1, 30)