mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 02:34:00 +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)
|
||||
|
||||
12
code/modules/mining/ore_redemption_machine/construction.dm
Normal file
12
code/modules/mining/ore_redemption_machine/construction.dm
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef T_BOARD
|
||||
#error T_BOARD macro is not defined but we need it!
|
||||
#endif
|
||||
|
||||
/obj/item/weapon/circuitboard/mining_equipment_vendor
|
||||
name = T_BOARD("Mining Equipment Vendor")
|
||||
board_type = new /datum/frame/frame_types/machine
|
||||
build_path = /obj/machinery/mineral/equipment_vendor
|
||||
origin_tech = list(TECH_DATA = 1, TECH_ENGINEERING = 3)
|
||||
req_components = list(
|
||||
/obj/item/weapon/stock_parts/console_screen = 1,
|
||||
/obj/item/weapon/stock_parts/matter_bin = 3)
|
||||
185
code/modules/mining/ore_redemption_machine/equipment_vendor.dm
Normal file
185
code/modules/mining/ore_redemption_machine/equipment_vendor.dm
Normal file
@@ -0,0 +1,185 @@
|
||||
/**********************Mining Equipment Locker**************************/
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor
|
||||
name = "mining equipment vendor"
|
||||
desc = "An equipment vendor for miners, points collected at an ore redemption machine can be spent here."
|
||||
icon = 'icons/obj/machines/mining_machines.dmi'
|
||||
icon_state = "mining"
|
||||
density = TRUE
|
||||
anchored = TRUE
|
||||
circuit = /obj/item/weapon/circuitboard/mining_equipment_vendor
|
||||
var/icon_deny = "mining-deny"
|
||||
var/obj/item/weapon/card/id/inserted_id
|
||||
var/list/prize_list = list(
|
||||
new /datum/data/mining_equipment("1 Marker Beacon", /obj/item/stack/marker_beacon, 10),
|
||||
new /datum/data/mining_equipment("10 Marker Beacons", /obj/item/stack/marker_beacon/ten, 100),
|
||||
new /datum/data/mining_equipment("30 Marker Beacons", /obj/item/stack/marker_beacon/thirty, 300),
|
||||
new /datum/data/mining_equipment("Whiskey", /obj/item/weapon/reagent_containers/food/drinks/bottle/whiskey, 125),
|
||||
new /datum/data/mining_equipment("Absinthe", /obj/item/weapon/reagent_containers/food/drinks/bottle/absinthe, 125),
|
||||
new /datum/data/mining_equipment("Cigar", /obj/item/clothing/mask/smokable/cigarette/cigar/havana, 150),
|
||||
new /datum/data/mining_equipment("Soap", /obj/item/weapon/soap/nanotrasen, 200),
|
||||
new /datum/data/mining_equipment("Laser Pointer", /obj/item/device/laser_pointer, 900),
|
||||
new /datum/data/mining_equipment("Plush Toy", /obj/random/plushie, 300),
|
||||
// new /datum/data/mining_equipment("Fulton Beacon", /obj/item/fulton_core, 500),
|
||||
new /datum/data/mining_equipment("Point Transfer Card", /obj/item/weapon/card/mining_point_card, 500),
|
||||
// new /datum/data/mining_equipment("Fulton Pack", /obj/item/extraction_pack, 1200),
|
||||
new /datum/data/mining_equipment("Silver Pickaxe", /obj/item/weapon/pickaxe/silver, 1200),
|
||||
// new /datum/data/mining_equipment("Space Cash", /obj/item/weapon/spacecash/c1000, 2000),
|
||||
// new /datum/data/mining_equipment("Industrial Hardsuit - Control Module", /obj/item/weapon/rig/industrial, 2000),
|
||||
// new /datum/data/mining_equipment("Industrial Hardsuit - Plasma Cutter", /obj/item/rig_module/device/plasmacutter, 800),
|
||||
// new /datum/data/mining_equipment("Industrial Hardsuit - Drill", /obj/item/rig_module/device/drill, 2000),
|
||||
// new /datum/data/mining_equipment("Industrial Hardsuit - Ore Scanner", /obj/item/rig_module/device/orescanner, 1000),
|
||||
// new /datum/data/mining_equipment("Industrial Hardsuit - Material Scanner", /obj/item/rig_module/vision/material, 500),
|
||||
// new /datum/data/mining_equipment("Industrial Hardsuit - Maneuvering Jets", /obj/item/rig_module/maneuvering_jets, 1250),
|
||||
// new /datum/data/mining_equipment("Diamond Pickaxe", /obj/item/weapon/pickaxe/diamond, 2000),
|
||||
)
|
||||
|
||||
/datum/data/mining_equipment
|
||||
var/equipment_name = "generic"
|
||||
var/equipment_path = null
|
||||
var/cost = 0
|
||||
|
||||
/datum/data/mining_equipment/New(name, path, cost)
|
||||
src.equipment_name = name
|
||||
src.equipment_path = path
|
||||
src.cost = cost
|
||||
|
||||
/obj/machinery/power/quantumpad/initialize()
|
||||
. = ..()
|
||||
default_apply_parts()
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
if(inserted_id && !powered())
|
||||
visible_message("<span class='notice'>The ID slot indicator light flickers on \the [src] as it spits out a card before powering down.</span>")
|
||||
inserted_id.forceMove(get_turf(src))
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/update_icon()
|
||||
if(panel_open)
|
||||
icon_state = "[initial(icon_state)]-open"
|
||||
else if(powered())
|
||||
icon_state = initial(icon_state)
|
||||
else
|
||||
icon_state = "[initial(icon_state)]-off"
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/attack_hand(mob/user)
|
||||
if(..())
|
||||
return
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/attack_ghost(mob/user)
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/interact(mob/user)
|
||||
user.set_machine(src)
|
||||
|
||||
var/dat
|
||||
dat +="<div class='statusDisplay'>"
|
||||
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>"
|
||||
else
|
||||
dat += "No ID inserted. <A href='?src=\ref[src];choice=insert'>Insert ID.</A><br>"
|
||||
dat += "</div>"
|
||||
dat += "<br><b>Equipment point cost list:</b><BR><table border='0' width='100%'>"
|
||||
for(var/datum/data/mining_equipment/prize in prize_list)
|
||||
dat += "<tr><td>[prize.equipment_name]</td><td>[prize.cost]</td><td><A href='?src=\ref[src];purchase=\ref[prize]'>Purchase</A></td></tr>"
|
||||
dat += "</table>"
|
||||
var/datum/browser/popup = new(user, "miningvendor", "Mining Equipment Vendor", 400, 600)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
if(href_list["choice"])
|
||||
if(istype(inserted_id))
|
||||
if(href_list["choice"] == "eject")
|
||||
to_chat(usr, "<span class='notice'>You eject the ID from [src]'s card slot.</span>")
|
||||
usr.put_in_hands(inserted_id)
|
||||
inserted_id = null
|
||||
else if(href_list["choice"] == "insert")
|
||||
var/obj/item/weapon/card/id/I = usr.get_active_hand()
|
||||
if(istype(I) && !inserted_id && usr.unEquip(I))
|
||||
I.forceMove(src)
|
||||
inserted_id = I
|
||||
interact(usr)
|
||||
to_chat(usr, "<span class='notice'>You insert the ID into [src]'s card slot.</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>No valid ID.</span>")
|
||||
flick(icon_deny, src)
|
||||
|
||||
if(href_list["purchase"])
|
||||
if(istype(inserted_id))
|
||||
var/datum/data/mining_equipment/prize = locate(href_list["purchase"])
|
||||
if (!prize || !(prize in prize_list))
|
||||
to_chat(usr, "<span class='warning'>Error: Invalid choice!</span>")
|
||||
flick(icon_deny, src)
|
||||
return
|
||||
if(prize.cost > inserted_id.mining_points)
|
||||
to_chat(usr, "<span class='warning'>Error: Insufficent points for [prize.equipment_name]!</span>")
|
||||
flick(icon_deny, src)
|
||||
else
|
||||
inserted_id.mining_points -= prize.cost
|
||||
to_chat(usr, "<span class='notice'>[src] clanks to life briefly before vending [prize.equipment_name]!</span>")
|
||||
new prize.equipment_path(drop_location())
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>Error: Please insert a valid ID!</span>")
|
||||
flick(icon_deny, src)
|
||||
updateUsrDialog()
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/attackby(obj/item/I, mob/user, params)
|
||||
if(default_deconstruction_screwdriver(user, I))
|
||||
updateUsrDialog()
|
||||
return
|
||||
if(default_part_replacement(user, I))
|
||||
return
|
||||
if(default_deconstruction_crowbar(user, I))
|
||||
return
|
||||
if(istype(I, /obj/item/mining_voucher))
|
||||
if(!powered())
|
||||
return
|
||||
RedeemVoucher(I, user)
|
||||
return
|
||||
if(istype(I,/obj/item/weapon/card/id))
|
||||
if(!powered())
|
||||
return
|
||||
else if(!inserted_id && user.unEquip(I))
|
||||
I.forceMove(src)
|
||||
inserted_id = I
|
||||
interact(user)
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/dismantle()
|
||||
if(inserted_id)
|
||||
inserted_id.forceMove(loc) //Prevents deconstructing the ORM from deleting whatever ID was inside it.
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/proc/RedeemVoucher(obj/item/mining_voucher/voucher, mob/redeemer)
|
||||
var/selection = input(redeemer, "Pick your equipment", "Mining Voucher Redemption") as null|anything in list("Kinetic Accelerator", "Resonator", "Mining Drone", "Advanced Scanner", "Crusher")
|
||||
if(!selection || !Adjacent(redeemer) || voucher.loc != redeemer)
|
||||
return
|
||||
// var/drop_location = drop_location()
|
||||
// switch(selection)
|
||||
// if("Kinetic Accelerator")
|
||||
// new /obj/item/weapon/gun/energy/kinetic_accelerator(drop_location)
|
||||
// if("Resonator")
|
||||
// new /obj/item/resonator(drop_location)
|
||||
// if("Mining Drone")
|
||||
// new /obj/item/storage/box/drone_kit(drop_location)
|
||||
// if("Advanced Scanner")
|
||||
// new /obj/item/device/t_scanner/adv_mining_scanner(drop_location)
|
||||
// if("Crusher")
|
||||
// new /obj/item/twohanded/required/mining_hammer(drop_location)
|
||||
qdel(voucher)
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/ex_act(severity, target)
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(5, 1, src)
|
||||
s.start()
|
||||
if(prob(50 / severity) && severity < 3)
|
||||
qdel(src)
|
||||
@@ -0,0 +1,33 @@
|
||||
/**********************Mining Equipment Locker Items**************************/
|
||||
|
||||
/**********************Mining Equipment Voucher**********************/
|
||||
|
||||
/obj/item/mining_voucher
|
||||
name = "mining voucher"
|
||||
desc = "A token to redeem a piece of equipment. Use it on a mining equipment vendor."
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "mining_voucher"
|
||||
w_class = ITEMSIZE_TINY
|
||||
|
||||
/**********************Mining Point Card**********************/
|
||||
|
||||
/obj/item/weapon/card/mining_point_card
|
||||
name = "mining point card"
|
||||
desc = "A small card preloaded with mining points. Swipe your ID card over it to transfer the points, then discard."
|
||||
icon_state = "data"
|
||||
var/points = 500
|
||||
|
||||
/obj/item/weapon/card/mining_point_card/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/weapon/card/id))
|
||||
if(points)
|
||||
var/obj/item/weapon/card/id/C = I
|
||||
C.mining_points += points
|
||||
to_chat(user, "<span class='info'>You transfer [points] points to [C].</span>")
|
||||
points = 0
|
||||
else
|
||||
to_chat(user, "<span class='info'>There's no points left on [src].</span>")
|
||||
..()
|
||||
|
||||
/obj/item/weapon/card/mining_point_card/examine(mob/user)
|
||||
..(user)
|
||||
to_chat(user, "There's [points] points on the card.")
|
||||
107
code/modules/mining/resonator.dm
Normal file
107
code/modules/mining/resonator.dm
Normal file
@@ -0,0 +1,107 @@
|
||||
/**********************Resonator**********************/
|
||||
|
||||
/obj/item/resonator
|
||||
name = "resonator"
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "resonator"
|
||||
item_state = "resonator"
|
||||
origin_tech = list(TECH_MAGNET = 3, TECH_ENGINEERING = 3)
|
||||
desc = "A handheld device that creates small fields of energy that resonate until they detonate, crushing rock. It can also be activated without a target to create a field at the user's location, to act as a delayed time trap. It's more effective in low temperature."
|
||||
w_class = ITEMSIZE_NORMAL
|
||||
force = 8
|
||||
throwforce = 10
|
||||
var/cooldown = 0
|
||||
var/fieldsactive = 0
|
||||
var/burst_time = 50
|
||||
var/fieldlimit = 3
|
||||
|
||||
/obj/item/resonator/upgraded
|
||||
name = "upgraded resonator"
|
||||
desc = "An upgraded version of the resonator that can produce more fields at once."
|
||||
icon_state = "resonator_u"
|
||||
origin_tech = list(TECH_MATERIAL = 4, TECH_POWER = 3, TECH_MAGNET = 3, TECH_ENGINEERING = 3)
|
||||
fieldlimit = 5
|
||||
|
||||
/obj/item/resonator/proc/CreateResonance(var/target, var/creator)
|
||||
var/turf/T = get_turf(target)
|
||||
if(locate(/obj/effect/resonance) in T)
|
||||
return
|
||||
if(fieldsactive < fieldlimit)
|
||||
playsound(src,'sound/weapons/resonator_fire.ogg',50,1)
|
||||
new /obj/effect/resonance(T, creator, burst_time)
|
||||
fieldsactive++
|
||||
spawn(burst_time)
|
||||
fieldsactive--
|
||||
|
||||
/obj/item/resonator/attack_self(mob/user)
|
||||
if(burst_time == 50)
|
||||
burst_time = 30
|
||||
to_chat(user, "<span class='info'>You set the resonator's fields to detonate after 3 seconds.</span>")
|
||||
else
|
||||
burst_time = 50
|
||||
to_chat(user, "<span class='info'>You set the resonator's fields to detonate after 5 seconds.</span>")
|
||||
|
||||
/obj/item/resonator/afterattack(atom/target, mob/user, proximity_flag)
|
||||
if(proximity_flag)
|
||||
if(!check_allowed_items(target, 1))
|
||||
return
|
||||
CreateResonance(target, user)
|
||||
|
||||
/obj/effect/resonance
|
||||
name = "resonance field"
|
||||
desc = "A resonating field that significantly damages anything inside of it when the field eventually ruptures."
|
||||
icon = 'icons/effects/effects.dmi'
|
||||
icon_state = "shield1"
|
||||
plane = MOB_PLANE
|
||||
layer = ABOVE_MOB_LAYER
|
||||
mouse_opacity = 0
|
||||
var/resonance_damage = 20
|
||||
|
||||
/obj/effect/resonance/initialize(mapload, var/creator = null, var/timetoburst)
|
||||
. = ..()
|
||||
// Start small and grow to big size as we are about to burst
|
||||
transform = matrix()*0.75
|
||||
animate(src, transform = matrix()*1.5, time = timetoburst)
|
||||
// Queue the actual bursting
|
||||
spawn(timetoburst)
|
||||
if(!QDELETED(src))
|
||||
burst(creator)
|
||||
|
||||
/obj/effect/resonance/proc/burst(var/creator = null)
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T)
|
||||
return
|
||||
playsound(src, 'sound/weapons/resonator_blast.ogg', 50, 1)
|
||||
// Make the collapsing effect
|
||||
new /obj/effect/temp_visual/resonance_crush(T)
|
||||
|
||||
// Mineral turfs get drilled!
|
||||
if(istype(T, /turf/simulated/mineral))
|
||||
var/turf/simulated/mineral/M = T
|
||||
M.GetDrilled()
|
||||
qdel(src)
|
||||
return
|
||||
// Otherwise we damage mobs! Boost damage if low tempreature
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
if(environment.temperature < 250)
|
||||
name = "strong resonance field"
|
||||
resonance_damage = 50
|
||||
|
||||
for(var/mob/living/L in src.loc)
|
||||
if(creator)
|
||||
add_attack_logs(creator, L, "used a resonator field on")
|
||||
to_chat(L, "<span class='danger'>\The [src] ruptured with you in it!</span>")
|
||||
L.apply_damage(resonance_damage, BRUTE)
|
||||
qdel(src)
|
||||
|
||||
|
||||
/obj/effect/temp_visual/resonance_crush
|
||||
icon_state = "shield1"
|
||||
plane = MOB_PLANE
|
||||
layer = ABOVE_MOB_LAYER
|
||||
duration = 4
|
||||
|
||||
/obj/effect/temp_visual/resonance_crush/initialize()
|
||||
. = ..()
|
||||
transform = matrix()*1.5
|
||||
animate(src, transform = matrix()*0.1, alpha = 50, time = 4)
|
||||
Reference in New Issue
Block a user