mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-28 15:39:57 +01:00
Constructable Mining Machines (#12212)
This commit is contained in:
@@ -10,40 +10,63 @@
|
||||
use_power = 1
|
||||
idle_power_usage = 15
|
||||
active_power_usage = 50
|
||||
var/obj/machinery/mineral/input
|
||||
var/obj/machinery/mineral/output
|
||||
var/turf/input
|
||||
var/turf/output
|
||||
|
||||
component_types = list(
|
||||
/obj/item/circuitboard/unloading_machine,
|
||||
/obj/item/stock_parts/manipulator = 2
|
||||
)
|
||||
|
||||
|
||||
/obj/machinery/mineral/unloading_machine/Initialize()
|
||||
. = ..()
|
||||
|
||||
//Locate our output and input machinery.
|
||||
for(var/dir in cardinal)
|
||||
src.input = locate(/obj/machinery/mineral/input, get_step(src, dir))
|
||||
if(src.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)
|
||||
src.output = locate(/obj/machinery/mineral/output, get_step(src, dir))
|
||||
if(src.output)
|
||||
var/output_spot = locate(/obj/machinery/mineral/output, get_step(src, dir))
|
||||
if(output)
|
||||
output = get_turf(output_spot)
|
||||
break
|
||||
|
||||
if(!input)
|
||||
input = get_step(src, reverse_dir[dir])
|
||||
if(!output)
|
||||
output = get_step(src, dir)
|
||||
|
||||
/obj/machinery/mineral/unloading_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/unloading_machine/machinery_process()
|
||||
..()
|
||||
if(src.output && src.input)
|
||||
if(locate(/obj/structure/ore_box, get_turf(input)))
|
||||
var/obj/structure/ore_box/BOX = locate(/obj/structure/ore_box, get_turf(input))
|
||||
if(locate(/obj/structure/ore_box, input))
|
||||
var/obj/structure/ore_box/BOX = locate(/obj/structure/ore_box, input)
|
||||
var/i = 0
|
||||
for(var/obj/item/ore/O in BOX.contents)
|
||||
BOX.contents -= O
|
||||
O.forceMove(get_turf(output))
|
||||
O.forceMove(output)
|
||||
i++
|
||||
if(i >= 10)
|
||||
return
|
||||
if(locate(/obj/item, get_turf(input)))
|
||||
if(locate(/obj/item, input))
|
||||
var/obj/item/O
|
||||
var/i
|
||||
for(i = 0; i < 10; i++)
|
||||
O = locate(/obj/item, get_turf(input))
|
||||
O = locate(/obj/item, input)
|
||||
if(O)
|
||||
O.forceMove(get_turf(output))
|
||||
O.forceMove(output)
|
||||
else
|
||||
return
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user