mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Flatpack fabricators stack flatpacks (#32173)
* Flatpack fabricators stack flatpacks * Restored error messages
This commit is contained in:
@@ -151,23 +151,32 @@
|
||||
/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 == ASSEMBLING || stacking.assembling == ASSEMBLING)
|
||||
to_chat(user, "You can't stack opened flatpacks.")
|
||||
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
|
||||
if(user.incapacitated() || user.lying) //make sure they can interact with it
|
||||
return
|
||||
if(!ishigherbeing(user) && !isrobot(user)) //check mob type
|
||||
return
|
||||
if(!user.Adjacent(src) || !user.Adjacent(dropping))
|
||||
return
|
||||
if(!try_add_stack(stacking, user))
|
||||
return
|
||||
user.visible_message("[user] adds [stacking.stacked.len + 1] flatpack\s to the stack.",
|
||||
"You add [stacking.stacked.len + 1] flatpack\s to the stack.")
|
||||
add_stack(stacking)
|
||||
return 1
|
||||
return
|
||||
|
||||
|
||||
/// Returns TRUE on success.
|
||||
/obj/structure/closet/crate/flatpack/proc/try_add_stack(obj/structure/closet/crate/flatpack/other, mob/user)
|
||||
if(other == src)
|
||||
return FALSE
|
||||
if(assembling == ASSEMBLING || other.assembling == ASSEMBLING)
|
||||
if(user)
|
||||
to_chat(user, "<span class='warning'>You can't stack opened flatpacks.</span>")
|
||||
return FALSE
|
||||
if((stacked.len + other.stacked.len + 2) >= MAX_FLATPACK_STACKS) //how many flatpacks we can in a stack (including the bases)
|
||||
if(user)
|
||||
to_chat(user, "<span class='warning'>You can't stack flatpacks that high.</span>")
|
||||
return FALSE
|
||||
add_stack(other)
|
||||
return TRUE
|
||||
|
||||
/obj/structure/closet/crate/flatpack/proc/add_stack(obj/structure/closet/crate/flatpack/flatpack)
|
||||
if(!flatpack)
|
||||
@@ -319,4 +328,4 @@
|
||||
/obj/structure/closet/crate/flatpack/ancient/chemmaster_electrolyzer/New()
|
||||
..()
|
||||
name = "ancient flatpack (electrolytic chemmaster)"
|
||||
machine = new /obj/machinery/chem_master/electrolytic(src)
|
||||
machine = new /obj/machinery/chem_master/electrolytic(src)
|
||||
|
||||
@@ -63,10 +63,12 @@
|
||||
src.use_power = 1
|
||||
src.overlays -= image(icon = icon, icon_state = "[base_state]_ani")
|
||||
if(being_built)
|
||||
var/obj/structure/closet/crate/flatpack/FP = new
|
||||
FP.insert_machine(being_built)
|
||||
var/turf/output = get_output()
|
||||
FP.forceMove(get_turf(output))
|
||||
var/obj/structure/closet/crate/flatpack/new_flatpack = new(output)
|
||||
new_flatpack.insert_machine(being_built)
|
||||
for(var/obj/structure/closet/crate/flatpack/existing in output)
|
||||
if(existing.try_add_stack(new_flatpack))
|
||||
break
|
||||
src.visible_message("[bicon(src)] \The [src] beeps: \"Successfully completed \the [being_built.name].\"")
|
||||
src.being_built = null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user