mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-28 02:52:01 +00: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()
|
||||
..()
|
||||
|
||||
Reference in New Issue
Block a user