mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 02:16:05 +00:00
Forgotten Flatpacks (#26414)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#define MAX_FLATPACK_STACKS 6 //how many flatpacks we can stack at once
|
||||
#define FLATPACK_HEIGHT 4 //the height of the icon
|
||||
#define UNASSEMBLED 2 //2 = not opened, 1 = opened, assembling, 0 = ready to use
|
||||
#define ASSEMBLING 1 //only ancient flatpacks use these, normal flatpacks start ready to use
|
||||
|
||||
/obj/structure/closet/crate/flatpack
|
||||
name = "\improper flatpack"
|
||||
@@ -11,10 +13,14 @@
|
||||
anchored = 0
|
||||
pass_flags = PASSTABLE
|
||||
var/obj/machinery/machine = null
|
||||
// var/datum/construction/flatpack_unpack/unpacking
|
||||
var/assembling = 0
|
||||
var/datum/construction/flatpack_unpack/unpacking
|
||||
var/assembling = FALSE
|
||||
var/list/image/stacked = list() //assoc ref list
|
||||
|
||||
/obj/structure/closet/crate/flatpack/ancient
|
||||
name = "ancient flatpack"
|
||||
assembling = UNASSEMBLED
|
||||
|
||||
/obj/structure/closet/crate/flatpack/examine(mob/user)
|
||||
..()
|
||||
if(stacked.len)
|
||||
@@ -23,7 +29,8 @@
|
||||
|
||||
/obj/structure/closet/crate/flatpack/New()
|
||||
..()
|
||||
// unpacking = new (src)
|
||||
if(assembling)
|
||||
unpacking = new (src)
|
||||
icon_state = "flatpack" //it gets changed in the crate code, so we reset it here
|
||||
|
||||
/obj/structure/closet/crate/flatpack/update_icon()
|
||||
@@ -47,8 +54,8 @@
|
||||
icon_state = "flatpackeng"
|
||||
break
|
||||
|
||||
/* if(assembling)
|
||||
overlays += image(icon = icon, icon_state = "assembly") */
|
||||
if(assembling == ASSEMBLING)
|
||||
overlays += image(icon = icon, icon_state = "assembly")
|
||||
else if(stacked.len)
|
||||
for(var/i = 1 to stacked.len)
|
||||
var/image/stack_image = stacked[stacked[i]] //because it's an assoc list
|
||||
@@ -57,36 +64,35 @@
|
||||
overlays += stack_image
|
||||
|
||||
/obj/structure/closet/crate/flatpack/attackby(var/atom/A, mob/user)
|
||||
/* if(assembling)
|
||||
if(assembling == ASSEMBLING)
|
||||
if(unpacking.action(A, user))
|
||||
return 1 */
|
||||
if(iscrowbar(A) && !assembling)
|
||||
return 1
|
||||
if(iscrowbar(A))
|
||||
if(stacked.len)
|
||||
to_chat(user, "<span class='rose'>You can't open this flatpack while others are stacked on top of it!</span>")
|
||||
return
|
||||
assembling = 1
|
||||
user.visible_message("<span class='notice'>[user] begins to open the flatpack...</span>", "<span class='notice'>You begin to open the flatpack...</span>")
|
||||
if(do_after(user, src, rand(10,40)))
|
||||
if(machine)
|
||||
to_chat(user, "<span class='notice'>[bicon(src)]You successfully unpack \the [machine]!</span>")
|
||||
// overlays += image(icon = icon, icon_state = "assembly")
|
||||
/* var/obj/item/weapon/paper/instructions = new (get_turf(src))
|
||||
var/list/inst_list = unpacking.GenerateInstructions()
|
||||
instructions.name = "instructions ([machine.name])"
|
||||
instructions.info = inst_list["instructions"]
|
||||
if(inst_list["misprint"])
|
||||
instructions.overlays += image(icon = icon, icon_state = "paper_stamp-deny")
|
||||
instructions.name = "misprinted " + instructions.name
|
||||
instructions.update_icon()
|
||||
*/
|
||||
machine.forceMove(src.loc)
|
||||
machine = null
|
||||
qdel(src)
|
||||
to_chat(user, "<span class='notice'>[bicon(src)] You successfully unpack \the [machine]!</span>")
|
||||
if(assembling == UNASSEMBLED)
|
||||
overlays += image(icon = icon, icon_state = "assembly")
|
||||
var/obj/item/weapon/paper/instructions = new (get_turf(src))
|
||||
var/list/inst_list = unpacking.GenerateInstructions()
|
||||
instructions.name = "instructions ([machine.name])"
|
||||
instructions.info = inst_list["instructions"]
|
||||
if(inst_list["misprint"])
|
||||
instructions.overlays += image(icon = icon, icon_state = "paper_stamp-deny")
|
||||
instructions.name = "misprinted " + instructions.name
|
||||
instructions.update_icon()
|
||||
assembling = ASSEMBLING
|
||||
else
|
||||
machine.forceMove(src.loc)
|
||||
machine = null
|
||||
qdel(src)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[bicon(src)]It seems this [src] was empty...</span>")
|
||||
to_chat(user, "<span class='notice'>[bicon(src)] It seems this [src] was empty...</span>")
|
||||
qdel(src)
|
||||
assembling = 0
|
||||
return
|
||||
|
||||
/obj/structure/closet/crate/flatpack/proc/Finalize()
|
||||
machine.forceMove(get_turf(src))
|
||||
@@ -141,9 +147,9 @@
|
||||
/obj/structure/closet/crate/flatpack/MouseDropTo(atom/dropping, mob/user)
|
||||
if(istype(dropping, /obj/structure/closet/crate/flatpack) && dropping != src)
|
||||
var/obj/structure/closet/crate/flatpack/stacking = dropping
|
||||
/* if(assembling || stacking.assembling)
|
||||
if(assembling == ASSEMBLING || stacking.assembling == ASSEMBLING)
|
||||
to_chat(user, "You can't stack opened flatpacks.")
|
||||
return */
|
||||
return
|
||||
if((stacked.len + stacking.stacked.len + 2) >= MAX_FLATPACK_STACKS) //how many flatpacks we can in a stack (including the bases)
|
||||
to_chat(user, "You can't stack flatpacks that high.")
|
||||
return
|
||||
@@ -198,7 +204,7 @@
|
||||
machine = thing
|
||||
update_icon()
|
||||
|
||||
/*
|
||||
|
||||
#define Fl_ACTION "action"
|
||||
|
||||
/datum/construction/flatpack_unpack
|
||||
@@ -270,7 +276,6 @@
|
||||
return 1
|
||||
|
||||
#undef Fl_ACTION
|
||||
*/
|
||||
|
||||
|
||||
/obj/structure/closet/crate/flatpack/suit_modifier/New()
|
||||
@@ -302,3 +307,10 @@
|
||||
..()
|
||||
machine = new /obj/machinery/shield_capacitor(src)
|
||||
|
||||
/obj/structure/closet/crate/flatpack/ancient/condiment_dispenser/New()
|
||||
..()
|
||||
machine = new /obj/machinery/chem_dispenser/condiment(src)
|
||||
|
||||
/obj/structure/closet/crate/flatpack/ancient/chemmaster_electrolyzer/New()
|
||||
..()
|
||||
machine = new /obj/machinery/chem_master/electrolytic(src)
|
||||
Reference in New Issue
Block a user