mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-22 08:01:06 +00:00
New ui for circuit printer (#10928)
This commit is contained in:
@@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
var/list/all_integrated_circuits = list()
|
var/list/all_integrated_circuits = list()
|
||||||
var/list/printer_recipe_list = list()
|
var/list/printer_recipe_list = list()
|
||||||
|
var/list/printer_recipe_list_basic = list()
|
||||||
|
var/list/printer_recipe_list_upgraded = list()
|
||||||
|
|
||||||
/datum/controller/subsystem/processing/electronics/New()
|
/datum/controller/subsystem/processing/electronics/New()
|
||||||
NEW_SS_GLOBAL(SSelectronics)
|
NEW_SS_GLOBAL(SSelectronics)
|
||||||
@@ -90,6 +92,22 @@
|
|||||||
new /obj/item/device/integrated_electronics/detailer
|
new /obj/item/device/integrated_electronics/detailer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
for(var/category in printer_recipe_list)
|
||||||
|
var/items = printer_recipe_list[category]
|
||||||
|
printer_recipe_list_basic[category] = list()
|
||||||
|
printer_recipe_list_upgraded[category] = list()
|
||||||
|
for(var/obj/O in items)
|
||||||
|
var/is_basic = TRUE
|
||||||
|
if(istype(O, /obj/item/integrated_circuit))
|
||||||
|
var/obj/item/integrated_circuit/IC = O
|
||||||
|
if((IC.spawn_flags & IC_SPAWN_RESEARCH) && (!(IC.spawn_flags & IC_SPAWN_DEFAULT)))
|
||||||
|
is_basic = FALSE
|
||||||
|
|
||||||
|
printer_recipe_list_basic[category] += list(list(path = "[O.type]", name = "[O.name]", desc = "[O.desc]", "b" = is_basic))
|
||||||
|
printer_recipe_list_upgraded[category] += list(list(path = "[O.type]", name = "[O.name]", desc = "[O.desc]", "b" = TRUE))
|
||||||
|
|
||||||
|
|
||||||
..()
|
..()
|
||||||
|
|
||||||
#undef IC_SPAWN_DEFAULT
|
#undef IC_SPAWN_DEFAULT
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
var/upgraded = FALSE // When hit with an upgrade disk, will turn true, allowing it to print the higher tier circuits.
|
var/upgraded = FALSE // When hit with an upgrade disk, will turn true, allowing it to print the higher tier circuits.
|
||||||
var/can_clone = FALSE // Same for above, but will allow the printer to duplicate a specific assembly.
|
var/can_clone = FALSE // Same for above, but will allow the printer to duplicate a specific assembly.
|
||||||
var/current_category
|
|
||||||
var/obj/item/device/electronic_assembly/assembly_to_clone
|
var/obj/item/device/electronic_assembly/assembly_to_clone
|
||||||
|
|
||||||
/obj/item/device/integrated_circuit_printer/upgraded
|
/obj/item/device/integrated_circuit_printer/upgraded
|
||||||
@@ -28,7 +27,7 @@
|
|||||||
if(stack.use(num))
|
if(stack.use(num))
|
||||||
to_chat(user, "<span class='notice'>You add [num] sheet\s to \the [src].</span>")
|
to_chat(user, "<span class='notice'>You add [num] sheet\s to \the [src].</span>")
|
||||||
metal += num * metal_per_sheet
|
metal += num * metal_per_sheet
|
||||||
interact(user)
|
SSvueui.check_uis_for_change(src)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
if(istype(O,/obj/item/integrated_circuit))
|
if(istype(O,/obj/item/integrated_circuit))
|
||||||
@@ -36,7 +35,7 @@
|
|||||||
user.unEquip(O)
|
user.unEquip(O)
|
||||||
metal = min(metal + O.w_class, max_metal)
|
metal = min(metal + O.w_class, max_metal)
|
||||||
qdel(O)
|
qdel(O)
|
||||||
interact(user)
|
SSvueui.check_uis_for_change(src)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
if(istype(O,/obj/item/disk/integrated_circuit/upgrade/advanced))
|
if(istype(O,/obj/item/disk/integrated_circuit/upgrade/advanced))
|
||||||
@@ -45,7 +44,7 @@
|
|||||||
return TRUE
|
return TRUE
|
||||||
to_chat(user, "<span class='notice'>You install \the [O] into \the [src]. </span>")
|
to_chat(user, "<span class='notice'>You install \the [O] into \the [src]. </span>")
|
||||||
upgraded = TRUE
|
upgraded = TRUE
|
||||||
interact(user)
|
SSvueui.check_uis_for_change(src)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
if(istype(O,/obj/item/disk/integrated_circuit/upgrade/clone))
|
if(istype(O,/obj/item/disk/integrated_circuit/upgrade/clone))
|
||||||
@@ -54,7 +53,7 @@
|
|||||||
return TRUE
|
return TRUE
|
||||||
to_chat(user, "<span class='notice'>You install \the [O] into \the [src]. </span>")
|
to_chat(user, "<span class='notice'>You install \the [O] into \the [src]. </span>")
|
||||||
can_clone = TRUE
|
can_clone = TRUE
|
||||||
interact(user)
|
SSvueui.check_uis_for_change(src)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
return ..()
|
return ..()
|
||||||
@@ -63,44 +62,27 @@
|
|||||||
interact(user)
|
interact(user)
|
||||||
|
|
||||||
/obj/item/device/integrated_circuit_printer/interact(mob/user)
|
/obj/item/device/integrated_circuit_printer/interact(mob/user)
|
||||||
var/window_height = 600
|
var/datum/vueui/ui = SSvueui.get_open_ui(user, src)
|
||||||
var/window_width = 500
|
if (!ui)
|
||||||
|
ui = new(user, src, "devices-circuit-printer", 600, 500, "Integrated Circuit Printer")
|
||||||
|
ui.open()
|
||||||
|
|
||||||
if(isnull(current_category))
|
/obj/item/device/integrated_circuit_printer/vueui_data_change(list/data, mob/user, datum/vueui/ui)
|
||||||
current_category = SSelectronics.printer_recipe_list[1]
|
. = ..()
|
||||||
|
data = . || data || list()
|
||||||
|
|
||||||
var/HTML = "<center><h2>Integrated Circuit Printer</h2></center><br>"
|
data["metal"] = metal / metal_per_sheet
|
||||||
HTML += "Metal: [metal/metal_per_sheet]/[max_metal/metal_per_sheet] sheets.<br>"
|
data["metal_max"] = max_metal / metal_per_sheet
|
||||||
HTML += "Circuits available: [upgraded ? "Regular":"Advanced"]."
|
data["upgraded"] = upgraded
|
||||||
HTML += "Assembly Cloning: [can_clone ? "Available": "Unavailable"]."
|
data["can_clone"] = can_clone
|
||||||
if(assembly_to_clone)
|
data["assembly_to_clone"] = assembly_to_clone ? assembly_to_clone.name : FALSE
|
||||||
HTML += "Assembly '[assembly_to_clone.name]' loaded."
|
|
||||||
HTML += "Crossed out circuits mean that the printer is not sufficentally upgraded to create that circuit.<br>"
|
|
||||||
HTML += "<hr>"
|
|
||||||
HTML += "Categories:"
|
|
||||||
for(var/category in SSelectronics.printer_recipe_list)
|
|
||||||
if(category != current_category)
|
|
||||||
HTML += " <a href='?src=\ref[src];category=[category]'>[category]</a> "
|
|
||||||
else // Bold the button if it's already selected.
|
|
||||||
HTML += " <b>[category]</b> "
|
|
||||||
HTML += "<hr>"
|
|
||||||
HTML += "<center><h4>[current_category]</h4></center>"
|
|
||||||
|
|
||||||
var/list/current_list = SSelectronics.printer_recipe_list[current_category]
|
if(upgraded)
|
||||||
for(var/obj/O in current_list)
|
data["circuits"] = SSelectronics.printer_recipe_list_upgraded
|
||||||
var/can_build = TRUE
|
else
|
||||||
if(istype(O, /obj/item/integrated_circuit))
|
data["circuits"] = SSelectronics.printer_recipe_list_basic
|
||||||
var/obj/item/integrated_circuit/IC = O
|
|
||||||
if((IC.spawn_flags & IC_SPAWN_RESEARCH) && (!(IC.spawn_flags & IC_SPAWN_DEFAULT)) && !upgraded)
|
|
||||||
can_build = FALSE
|
|
||||||
if(can_build)
|
|
||||||
HTML += "<A href='?src=\ref[src];build=[O.type]'>[O.name]</A>: [O.desc]<br>"
|
|
||||||
else
|
|
||||||
HTML += "<s>[O.name]: [O.desc]</s><br>"
|
|
||||||
|
|
||||||
var/datum/browser/B = new(user, "integrated_printer", null, window_width, window_height)
|
return data
|
||||||
B.set_content(HTML)
|
|
||||||
B.open(FALSE)
|
|
||||||
|
|
||||||
/obj/item/device/integrated_circuit_printer/Topic(href, href_list)
|
/obj/item/device/integrated_circuit_printer/Topic(href, href_list)
|
||||||
if(..())
|
if(..())
|
||||||
@@ -108,9 +90,6 @@
|
|||||||
|
|
||||||
add_fingerprint(usr)
|
add_fingerprint(usr)
|
||||||
|
|
||||||
if(href_list["category"])
|
|
||||||
current_category = href_list["category"]
|
|
||||||
|
|
||||||
if(href_list["build"])
|
if(href_list["build"])
|
||||||
var/build_type = text2path(href_list["build"])
|
var/build_type = text2path(href_list["build"])
|
||||||
if(!build_type || !ispath(build_type))
|
if(!build_type || !ispath(build_type))
|
||||||
@@ -139,14 +118,15 @@
|
|||||||
else
|
else
|
||||||
new build_type(get_turf(loc))
|
new build_type(get_turf(loc))
|
||||||
|
|
||||||
interact(usr)
|
SSvueui.check_uis_for_change(src)
|
||||||
|
|
||||||
/obj/item/device/integrated_circuit_printer/proc/can_print(build_type)
|
/obj/item/device/integrated_circuit_printer/proc/can_print(build_type)
|
||||||
var/list/current_list = SSelectronics.printer_recipe_list[current_category]
|
for(var/category in SSelectronics.printer_recipe_list)
|
||||||
|
var/list/current_list = SSelectronics.printer_recipe_list[category]
|
||||||
|
|
||||||
for (var/obj/O in current_list)
|
for (var/obj/O in current_list)
|
||||||
if (O.type == build_type)
|
if (O.type == build_type)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
return FALSE
|
return FALSE
|
||||||
|
|
||||||
|
|||||||
4
html/changelogs/ddaddadadddaaadsaa.yml
Normal file
4
html/changelogs/ddaddadadddaaadsaa.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
author: Karolis2011
|
||||||
|
delete-after: True
|
||||||
|
changes:
|
||||||
|
- rscadd: "Added a new flashy UI for integrated circuit printer."
|
||||||
36
vueui/src/components/view/devices/circuit/printer.vue
Normal file
36
vueui/src/components/view/devices/circuit/printer.vue
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
Metal: <vui-progress :value="s.metal" :max="s.metal_max">{{ s.metal }}/{{ s.metal_max }} sheets</vui-progress><br>
|
||||||
|
Circuits avaivable: {{ s.upgraded ? "Advanced" : "Regular" }}<br>
|
||||||
|
<vui-button v-for="cat in categories" :key="cat" @click="cc = cat" :class="{selected: cat == cc}">{{ cat }}</vui-button>
|
||||||
|
<hr>
|
||||||
|
<vui-input-search :input="currentItems" v-model="filtered" :keys="['name', 'desc']"/>
|
||||||
|
<div v-for="(item, i) in filtered" :key="i">
|
||||||
|
<vui-button :disabled="!item.b" :params="{ build: item.path }">{{ item.name }}</vui-button>
|
||||||
|
{{ item.desc }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
s: this.$root.$data.state,
|
||||||
|
cc: 'All',
|
||||||
|
filtered: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
categories() {
|
||||||
|
return ['All', ...Object.keys(this.s.circuits)]
|
||||||
|
},
|
||||||
|
currentItems() {
|
||||||
|
if(this.cc == 'All') {
|
||||||
|
return Object.values(this.s.circuits).flat()
|
||||||
|
}
|
||||||
|
return this.s.circuits[this.cc]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user