mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-13 08:03:43 +01:00
Added pizzaboxes. Stackable, Tagable, and awesome. Sprites by supercrayon (I slightly modified them, sorry)
Updated (and fixed) changelog. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3927 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -1880,3 +1880,175 @@
|
||||
icon_state = "vegetablepizzaslice"
|
||||
bitesize = 2
|
||||
|
||||
/obj/item/pizzabox
|
||||
name = "Pizza Box"
|
||||
desc = "A box suited for pizzas"
|
||||
icon = 'food.dmi'
|
||||
icon_state = "pizzabox1"
|
||||
|
||||
var/open = 0 // Is the box open?
|
||||
var/ismessy = 0 // Fancy mess on the lid
|
||||
var/obj/item/weapon/reagent_containers/food/snacks/sliceable/pizza/pizza // Content pizza
|
||||
var/list/boxes = list() // If the boxes are stacked, they come here
|
||||
var/boxtag = ""
|
||||
|
||||
/obj/item/pizzabox/update_icon()
|
||||
|
||||
overlays = list()
|
||||
|
||||
// Set appropriate description
|
||||
if( open && pizza )
|
||||
desc = "A box suited for pizzas. It appears to have a [pizza.name] inside."
|
||||
else if( boxes.len > 0 )
|
||||
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/toptag = topbox.boxtag
|
||||
if( toptag != "" )
|
||||
desc = "[desc] The box on top has a tag, it reads: '[toptag]'."
|
||||
else
|
||||
desc = "A box suited for pizzas."
|
||||
|
||||
if( boxtag != "" )
|
||||
desc = "[desc] The box has a tag, it reads: '[boxtag]'."
|
||||
|
||||
// Icon states and overlays
|
||||
if( open )
|
||||
if( ismessy )
|
||||
icon_state = "pizzabox_messy"
|
||||
else
|
||||
icon_state = "pizzabox_open"
|
||||
|
||||
if( pizza )
|
||||
var/image/pizzaimg = image("food.dmi", icon_state = pizza.icon_state)
|
||||
pizzaimg.pixel_y = -3
|
||||
overlays += pizzaimg
|
||||
|
||||
return
|
||||
else
|
||||
// Stupid code because byondcode sucks
|
||||
var/doimgtag = 0
|
||||
if( boxes.len > 0 )
|
||||
var/obj/item/pizzabox/topbox = boxes[boxes.len]
|
||||
if( topbox.boxtag != "" )
|
||||
doimgtag = 1
|
||||
else
|
||||
if( boxtag != "" )
|
||||
doimgtag = 1
|
||||
|
||||
if( doimgtag )
|
||||
var/image/tagimg = image("food.dmi", icon_state = "pizzabox_tag")
|
||||
tagimg.pixel_y = boxes.len * 3
|
||||
overlays += tagimg
|
||||
|
||||
icon_state = "pizzabox[boxes.len+1]"
|
||||
|
||||
/obj/item/pizzabox/attack_hand( mob/user as mob )
|
||||
|
||||
if( open && pizza )
|
||||
user.put_in_hand( pizza )
|
||||
|
||||
user << "\red You take the [src.pizza] out of the [src]."
|
||||
src.pizza = null
|
||||
update_icon()
|
||||
return
|
||||
|
||||
if( boxes.len > 0 )
|
||||
if( user.get_inactive_hand() != src )
|
||||
..()
|
||||
return
|
||||
|
||||
var/obj/item/pizzabox/box = boxes[boxes.len]
|
||||
boxes -= box
|
||||
|
||||
user.put_in_hand( box )
|
||||
user << "\red You remove the topmost [src] from your hand."
|
||||
box.update_icon()
|
||||
update_icon()
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/pizzabox/attack_self( mob/user as mob )
|
||||
|
||||
if( boxes.len > 0 )
|
||||
return
|
||||
|
||||
open = !open
|
||||
|
||||
if( open && pizza )
|
||||
ismessy = 1
|
||||
|
||||
update_icon()
|
||||
|
||||
/obj/item/pizzabox/attackby( obj/item/I as obj, mob/user as mob )
|
||||
if( istype(I, /obj/item/pizzabox/) )
|
||||
var/obj/item/pizzabox/box = I
|
||||
|
||||
if( !box.open && !src.open )
|
||||
// Make a list of all boxes to be added
|
||||
var/list/boxestoadd = list()
|
||||
boxestoadd += box
|
||||
for(var/obj/item/pizzabox/i in box.boxes)
|
||||
boxestoadd += i
|
||||
|
||||
if( (boxes.len+1) + boxestoadd.len <= 5 )
|
||||
user.drop_item()
|
||||
|
||||
box.loc = src
|
||||
box.boxes = list() // Clear the box boxes so we don't have boxes inside boxes. - Xzibit
|
||||
src.boxes.Add( boxestoadd )
|
||||
|
||||
box.update_icon()
|
||||
update_icon()
|
||||
|
||||
user << "\red You put the [box] ontop of the [src]!"
|
||||
else
|
||||
user << "\red The stack is too high!"
|
||||
else
|
||||
user << "\red Close the [box] first!"
|
||||
|
||||
return
|
||||
|
||||
if( istype(I, /obj/item/weapon/reagent_containers/food/snacks/sliceable/pizza/) ) // Long ass fucking object name
|
||||
|
||||
if( src.open )
|
||||
user.drop_item()
|
||||
I.loc = src
|
||||
src.pizza = I
|
||||
|
||||
update_icon()
|
||||
|
||||
user << "\red You put the [I] in the [src]!"
|
||||
else
|
||||
user << "\red You try to push the [I] through the lid but it doesn't work!"
|
||||
return
|
||||
|
||||
if( istype(I, /obj/item/weapon/pen/) )
|
||||
|
||||
if( src.open )
|
||||
return
|
||||
|
||||
var/t = input("Enter what you want to add to the tag:", "Write", null, null) as text
|
||||
|
||||
var/obj/item/pizzabox/boxtotagto = src
|
||||
if( boxes.len > 0 )
|
||||
boxtotagto = boxes[boxes.len]
|
||||
|
||||
boxtotagto.boxtag = copytext("[boxtotagto.boxtag][t]", 1, 30)
|
||||
|
||||
update_icon()
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user