mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +01:00
Donut box folding (#15027)
This commit is contained in:
@@ -25,42 +25,15 @@
|
||||
icon_state = "box"
|
||||
item_state = "syringe_kit"
|
||||
resistance_flags = FLAMMABLE
|
||||
var/foldable = /obj/item/stack/sheet/cardboard
|
||||
var/amt = 1
|
||||
|
||||
/obj/item/storage/box/attack_self(mob/user)
|
||||
..()
|
||||
|
||||
if(!foldable)
|
||||
return
|
||||
if(contents.len)
|
||||
to_chat(user, "<span class='warning'>You can't fold this box with items still inside!</span>")
|
||||
return
|
||||
if(!ispath(foldable))
|
||||
return
|
||||
|
||||
// Close any open UI windows first
|
||||
var/found = 0
|
||||
for(var/mob/M in range(1))
|
||||
if(M.s_active == src)
|
||||
close(M)
|
||||
if(M == user)
|
||||
found = 1
|
||||
if(!found) // User is too far away
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You fold [src] flat.</span>")
|
||||
var/obj/item/stack/I = new foldable(get_turf(src), amt)
|
||||
user.put_in_hands(I)
|
||||
qdel(src)
|
||||
foldable = /obj/item/stack/sheet/cardboard
|
||||
foldable_amt = 1
|
||||
|
||||
/obj/item/storage/box/large
|
||||
name = "large box"
|
||||
desc = "You could build a fort with this."
|
||||
icon_state = "largebox"
|
||||
w_class = 4 // Big, bulky.
|
||||
foldable = /obj/item/stack/sheet/cardboard
|
||||
amt = 4
|
||||
foldable_amt = 4
|
||||
storage_slots = 21
|
||||
max_combined_w_class = 42 // 21*2
|
||||
|
||||
@@ -897,7 +870,6 @@
|
||||
icon_state = "light"
|
||||
desc = "This box is shaped on the inside so that only light tubes and bulbs fit."
|
||||
item_state = "syringe_kit"
|
||||
foldable = /obj/item/stack/sheet/cardboard
|
||||
storage_slots=21
|
||||
can_hold = list(/obj/item/light/tube, /obj/item/light/bulb)
|
||||
max_combined_w_class = 21
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
storage_slots = 6
|
||||
can_hold = list(/obj/item/reagent_containers/food/snacks/donut)
|
||||
icon_type = "donut"
|
||||
foldable = /obj/item/stack/sheet/cardboard
|
||||
foldable_amt = 1
|
||||
|
||||
/obj/item/storage/fancy/donut_box/update_icon()
|
||||
overlays.Cut()
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
var/collection_mode = 1; //0 = pick one at a time, 1 = pick all on tile
|
||||
var/use_sound = "rustle" //sound played when used. null for no sound.
|
||||
|
||||
/// What kind of [/obj/item/stack] can this be folded into. (e.g. Boxes and cardboard)
|
||||
var/foldable = null
|
||||
/// How much of the stack item do you get.
|
||||
var/foldable_amt = 0
|
||||
|
||||
/obj/item/storage/MouseDrop(obj/over_object as obj)
|
||||
if(ishuman(usr)) //so monkeys can take off their backpacks -- Urist
|
||||
var/mob/M = usr
|
||||
@@ -502,11 +507,34 @@
|
||||
O.hear_message(M, msg)
|
||||
|
||||
/obj/item/storage/attack_self(mob/user)
|
||||
|
||||
//Clicking on itself will empty it, if allow_quick_empty is TRUE
|
||||
if(allow_quick_empty && user.is_in_active_hand(src))
|
||||
drop_inventory(user)
|
||||
|
||||
else if(foldable)
|
||||
fold(user)
|
||||
|
||||
/obj/item/storage/proc/fold(mob/user)
|
||||
if(length(contents))
|
||||
to_chat(user, "<span class='warning'>You can't fold this [name] with items still inside!</span>")
|
||||
return
|
||||
if(!ispath(foldable))
|
||||
return
|
||||
|
||||
var/found = FALSE
|
||||
for(var/mob/M in range(1))
|
||||
if(M.s_active == src) // Close any open UI windows first
|
||||
close(M)
|
||||
if(M == user)
|
||||
found = TRUE
|
||||
if(!found) // User is too far away
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You fold [src] flat.</span>")
|
||||
var/obj/item/stack/I = new foldable(get_turf(src), foldable_amt)
|
||||
user.put_in_hands(I)
|
||||
qdel(src)
|
||||
|
||||
//Returns the storage depth of an atom. This is the number of storage items the atom is contained in before reaching toplevel (the area).
|
||||
//Returns -1 if the atom was not found on container.
|
||||
/atom/proc/storage_depth(atom/container)
|
||||
|
||||
Reference in New Issue
Block a user