mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 03:02:54 +00:00
Technically adds the Ore Redemption Machine
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
density = TRUE
|
||||
anchored = TRUE
|
||||
|
||||
var/obj/item/weapon/card/id/inserted_id // Inserted ID card, for points
|
||||
|
||||
var/obj/machinery/mineral/processing_unit/machine = null
|
||||
var/show_all_ores = FALSE
|
||||
|
||||
@@ -23,11 +25,27 @@
|
||||
log_debug("Ore processing machine console at [src.x], [src.y], [src.z] could not find its machine!")
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/Destroy()
|
||||
if(inserted_id)
|
||||
inserted_id.forceMove(loc) //Prevents deconstructing from deleting whatever ID was inside it.
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/attack_hand(mob/user)
|
||||
if(..())
|
||||
return
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/attackby(var/obj/item/I, var/mob/user)
|
||||
if(istype(I, /obj/item/weapon/card/id))
|
||||
if(!powered())
|
||||
return
|
||||
if(!inserted_id && user.unEquip(I))
|
||||
I.forceMove(src)
|
||||
inserted_id = I
|
||||
interact(user)
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/machinery/mineral/processing_unit_console/interact(mob/user)
|
||||
if(..())
|
||||
return
|
||||
@@ -40,6 +58,13 @@
|
||||
|
||||
var/dat = "<h1>Ore processor console</h1>"
|
||||
|
||||
dat += "Current unclaimed points: [machine.points]<br>"
|
||||
if(istype(inserted_id))
|
||||
dat += "You have [inserted_id.mining_points] mining points collected. <A href='?src=\ref[src];choice=eject'>Eject ID.</A><br>"
|
||||
dat += "<A href='?src=\ref[src];choice=claim'>Claim points.</A><br>"
|
||||
else
|
||||
dat += "No ID inserted. <A href='?src=\ref[src];choice=insert'>Insert ID.</A><br>"
|
||||
|
||||
dat += "<hr><table>"
|
||||
|
||||
for(var/ore in machine.ores_processing)
|
||||
@@ -96,6 +121,26 @@
|
||||
|
||||
show_all_ores = !show_all_ores
|
||||
|
||||
if(href_list["choice"])
|
||||
if(istype(inserted_id))
|
||||
if(href_list["choice"] == "eject")
|
||||
usr.put_in_hands(inserted_id)
|
||||
inserted_id = null
|
||||
if(href_list["choice"] == "claim")
|
||||
if(access_mining_station in inserted_id.access)
|
||||
inserted_id.mining_points += machine.points
|
||||
machine.points = 0
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>Required access not found.</span>")
|
||||
else if(href_list["choice"] == "insert")
|
||||
var/obj/item/weapon/card/id/I = usr.get_active_hand()
|
||||
if(istype(I))
|
||||
usr.drop_item()
|
||||
I.forceMove(src)
|
||||
inserted_id = I
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>No valid ID.</span>")
|
||||
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
@@ -118,6 +163,19 @@
|
||||
var/static/list/alloy_data
|
||||
var/active = FALSE
|
||||
|
||||
var/points = 0
|
||||
var/static/list/ore_values = list(
|
||||
"sand" = 1,
|
||||
"hematite" = 1,
|
||||
"carbon" = 1,
|
||||
"phoron" = 15,
|
||||
"silver" = 16,
|
||||
"gold" = 18,
|
||||
"uranium" = 30,
|
||||
"diamond" = 50,
|
||||
"platinum" = 40,
|
||||
"mhydrogen" = 40)
|
||||
|
||||
/obj/machinery/mineral/processing_unit/New()
|
||||
..()
|
||||
// initialize static alloy_data list
|
||||
@@ -148,7 +206,11 @@
|
||||
|
||||
/obj/machinery/mineral/processing_unit/process()
|
||||
|
||||
if (!src.output || !src.input) return
|
||||
if (!src.output || !src.input)
|
||||
return
|
||||
|
||||
if(panel_open || !powered())
|
||||
return
|
||||
|
||||
var/list/tick_alloys = list()
|
||||
|
||||
@@ -158,7 +220,7 @@
|
||||
if(!O) break
|
||||
if(!isnull(ores_stored[O.material]))
|
||||
ores_stored[O.material]++
|
||||
|
||||
points += ore_values[O.material] // Give Points!
|
||||
qdel(O)
|
||||
|
||||
if(!active)
|
||||
|
||||
Reference in New Issue
Block a user