mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-30 00:21:11 +01:00
Constructable Mining Machines (#12212)
This commit is contained in:
@@ -23,12 +23,23 @@
|
||||
var/waste = 0
|
||||
var/idx = 0
|
||||
|
||||
component_types = list(
|
||||
/obj/item/circuitboard/redemption_console,
|
||||
/obj/item/stock_parts/scanning_module,
|
||||
/obj/item/stock_parts/console_screen
|
||||
)
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/Initialize(mapload, d, populate_components)
|
||||
. = ..()
|
||||
var/mutable_appearance/screen_overlay = mutable_appearance(icon, "production_console-screen", EFFECTS_ABOVE_LIGHTING_LAYER)
|
||||
add_overlay(screen_overlay)
|
||||
set_light(1.4, 1, COLOR_CYAN)
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/Destroy()
|
||||
if(machine)
|
||||
machine.console = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/proc/setup_machine(mob/user)
|
||||
if(!machine)
|
||||
var/area/A = get_area(src)
|
||||
@@ -44,6 +55,15 @@
|
||||
|
||||
return machine
|
||||
|
||||
/obj/machinery/mineral/processing_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/processing_unit_console/attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
if(!scanned_id)
|
||||
@@ -73,10 +93,6 @@
|
||||
if(!setup_machine(user))
|
||||
return
|
||||
|
||||
if(!allowed(user))
|
||||
to_chat(user, SPAN_WARNING("Access denied."))
|
||||
return
|
||||
|
||||
user.set_machine(src)
|
||||
|
||||
var/dat = "<h1>Ore processor console</h1>"
|
||||
@@ -292,8 +308,8 @@
|
||||
density = TRUE
|
||||
anchored = TRUE
|
||||
light_range = 3
|
||||
var/obj/machinery/mineral/input
|
||||
var/obj/machinery/mineral/output
|
||||
var/turf/input
|
||||
var/turf/output
|
||||
var/obj/machinery/mineral/processing_unit_console/console
|
||||
var/sheets_per_tick = 20
|
||||
var/list/ores_processing[0]
|
||||
@@ -327,14 +343,36 @@
|
||||
|
||||
//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/processing_unit/Destroy()
|
||||
if(console)
|
||||
console.machine = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/mineral/processing_unit/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/processing_unit/machinery_process()
|
||||
..()
|
||||
|
||||
@@ -345,7 +383,7 @@
|
||||
|
||||
//Grab some more ore to process this tick.
|
||||
for(var/i = 0, i < sheets_per_tick, i++)
|
||||
var/obj/item/ore/O = locate() in get_turf(input)
|
||||
var/obj/item/ore/O = locate() in input
|
||||
if(!O)
|
||||
break
|
||||
if(!isnull(ores_stored[O.material]))
|
||||
@@ -402,8 +440,9 @@
|
||||
sheets += total - 1
|
||||
|
||||
for(var/i = 0, i < total, i++)
|
||||
console.alloy_mats[A] = console.alloy_mats[A] + 1
|
||||
new A.product(get_turf(output))
|
||||
if(console)
|
||||
console.alloy_mats[A] = console.alloy_mats[A] + 1
|
||||
new A.product(output)
|
||||
|
||||
else if(ores_processing[metal] == 2 && O.compresses_to) //Compressing.
|
||||
var/can_make = Clamp(ores_stored[metal], 0, sheets_per_tick - sheets)
|
||||
@@ -422,7 +461,7 @@
|
||||
ores_stored[metal] -= 2
|
||||
sheets += 2
|
||||
console.output_mats[M] += 1
|
||||
new M.stack_type(get_turf(output))
|
||||
new M.stack_type(output)
|
||||
|
||||
else if(ores_processing[metal] == 1 && O.smelts_to) //Smelting.
|
||||
var/can_make = Clamp(ores_stored[metal], 0, sheets_per_tick - sheets)
|
||||
@@ -437,27 +476,24 @@
|
||||
use_power(100)
|
||||
ores_stored[metal] -= 1
|
||||
sheets++
|
||||
console.output_mats[M] += 1
|
||||
new M.stack_type(get_turf(output))
|
||||
if(console)
|
||||
console.output_mats[M] += 1
|
||||
new M.stack_type(output)
|
||||
else
|
||||
if(console)
|
||||
console.points -= O.worth * 3 //reee wasting our materials!
|
||||
use_power(500)
|
||||
ores_stored[metal] -= 1
|
||||
sheets++
|
||||
console.input_mats[O] += 1
|
||||
console.waste++
|
||||
new /obj/item/ore/slag(get_turf(output))
|
||||
if(console)
|
||||
console.input_mats[O] += 1
|
||||
console.waste++
|
||||
new /obj/item/ore/slag(output)
|
||||
else
|
||||
continue
|
||||
|
||||
console.updateUsrDialog()
|
||||
|
||||
/obj/machinery/mineral/processing_unit/attackby(obj/item/W, mob/user)
|
||||
if(default_deconstruction_screwdriver(user, W))
|
||||
return
|
||||
else if(default_part_replacement(user, W))
|
||||
return
|
||||
if(console)
|
||||
console.updateUsrDialog()
|
||||
|
||||
/obj/machinery/mineral/processing_unit/RefreshParts()
|
||||
..()
|
||||
|
||||
@@ -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
|
||||
@@ -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