mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-26 14:31:59 +01:00
Constructable Mining Machines (#12212)
This commit is contained in:
@@ -12,6 +12,12 @@
|
||||
idle_power_usage = 15
|
||||
active_power_usage = 50
|
||||
|
||||
component_types = list(
|
||||
/obj/item/circuitboard/stacking_console,
|
||||
/obj/item/stock_parts/scanning_module,
|
||||
/obj/item/stock_parts/console_screen
|
||||
)
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console/Initialize(mapload, d, populate_components)
|
||||
..()
|
||||
var/mutable_appearance/screen_overlay = mutable_appearance(icon, "production_console-screen", EFFECTS_ABOVE_LIGHTING_LAYER)
|
||||
@@ -22,6 +28,11 @@
|
||||
/obj/machinery/mineral/stacking_unit_console/LateInitialize()
|
||||
setup_machine(null)
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console/Destroy()
|
||||
if(machine)
|
||||
machine.console = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console/proc/setup_machine(mob/user)
|
||||
if(!machine)
|
||||
var/area/A = get_area(src)
|
||||
@@ -37,6 +48,15 @@
|
||||
|
||||
return machine
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console/attackby(obj/item/I, mob/user)
|
||||
if(default_deconstruction_screwdriver(user, I))
|
||||
return
|
||||
if(default_deconstruction_crowbar(user, I))
|
||||
return
|
||||
if(default_part_replacement(user, I))
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/machinery/mineral/stacking_unit_console/attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
ui_interact(user)
|
||||
@@ -81,7 +101,7 @@
|
||||
return
|
||||
|
||||
if(machine.stack_storage[stacktype] > 0)
|
||||
var/obj/item/stack/material/S = new stacktype(get_turf(machine.output))
|
||||
var/obj/item/stack/material/S = new stacktype(machine.output)
|
||||
S.amount = machine.stack_storage[stacktype]
|
||||
machine.stack_storage[stacktype] = 0
|
||||
return TRUE
|
||||
@@ -108,6 +128,11 @@
|
||||
idle_power_usage = 15
|
||||
active_power_usage = 50
|
||||
|
||||
component_types = list(
|
||||
/obj/item/circuitboard/stacking_machine,
|
||||
/obj/item/stock_parts/manipulator = 2
|
||||
)
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/Initialize()
|
||||
. = ..()
|
||||
|
||||
@@ -116,15 +141,36 @@
|
||||
stack_storage[stacktype] = 0
|
||||
stack_paths[stacktype] = capitalize(initial(S.name))
|
||||
|
||||
//Locate our output and input machinery.
|
||||
for(var/dir in cardinal)
|
||||
input = locate(/obj/machinery/mineral/input, get_step(src, dir))
|
||||
if(input)
|
||||
var/input_spot = locate(/obj/machinery/mineral/input, get_step(src, dir))
|
||||
if(input_spot)
|
||||
input = get_turf(input_spot) // thought of qdeling the spots here, but it's useful when rebuilding a destroyed machine
|
||||
break
|
||||
for(var/dir in cardinal)
|
||||
var/output_spot = locate(/obj/machinery/mineral/output, get_step(src, dir))
|
||||
if(output)
|
||||
output = get_turf(output_spot)
|
||||
break
|
||||
|
||||
for(var/dir in cardinal)
|
||||
output = locate(/obj/machinery/mineral/output, get_step(src, dir))
|
||||
if(output)
|
||||
break
|
||||
if(!input)
|
||||
input = get_step(src, reverse_dir[dir])
|
||||
if(!output)
|
||||
output = get_step(src, dir)
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/Destroy()
|
||||
if(console)
|
||||
console.machine = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/attackby(obj/item/I, mob/user)
|
||||
if(default_deconstruction_screwdriver(user, I))
|
||||
return
|
||||
if(default_deconstruction_crowbar(user, I))
|
||||
return
|
||||
if(default_part_replacement(user, I))
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/machinery/mineral/stacking_machine/machinery_process()
|
||||
if(!console)
|
||||
@@ -135,8 +181,7 @@
|
||||
return
|
||||
|
||||
if(output && input)
|
||||
var/turf/T = get_turf(input)
|
||||
for(var/obj/item/O in T)
|
||||
for(var/obj/item/O in input)
|
||||
if(!O)
|
||||
return
|
||||
var/obj/item/stack/S = O
|
||||
@@ -144,10 +189,10 @@
|
||||
stack_storage[S.type] += S.amount
|
||||
qdel(S)
|
||||
else
|
||||
O.forceMove(get_turf(output))
|
||||
O.forceMove(output)
|
||||
|
||||
//Output amounts that are past stack_amt.
|
||||
for(var/sheet in stack_storage)
|
||||
if(stack_storage[sheet] >= stack_amt)
|
||||
new sheet(get_turf(output), stack_amt)
|
||||
new sheet(output, stack_amt)
|
||||
stack_storage[sheet] -= stack_amt
|
||||
Reference in New Issue
Block a user