mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-21 23:52:12 +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/printer_recipe_list = list()
|
||||
var/list/printer_recipe_list_basic = list()
|
||||
var/list/printer_recipe_list_upgraded = list()
|
||||
|
||||
/datum/controller/subsystem/processing/electronics/New()
|
||||
NEW_SS_GLOBAL(SSelectronics)
|
||||
@@ -90,6 +92,22 @@
|
||||
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
|
||||
|
||||
@@ -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/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
|
||||
|
||||
/obj/item/device/integrated_circuit_printer/upgraded
|
||||
@@ -28,7 +27,7 @@
|
||||
if(stack.use(num))
|
||||
to_chat(user, "<span class='notice'>You add [num] sheet\s to \the [src].</span>")
|
||||
metal += num * metal_per_sheet
|
||||
interact(user)
|
||||
SSvueui.check_uis_for_change(src)
|
||||
return TRUE
|
||||
|
||||
if(istype(O,/obj/item/integrated_circuit))
|
||||
@@ -36,7 +35,7 @@
|
||||
user.unEquip(O)
|
||||
metal = min(metal + O.w_class, max_metal)
|
||||
qdel(O)
|
||||
interact(user)
|
||||
SSvueui.check_uis_for_change(src)
|
||||
return TRUE
|
||||
|
||||
if(istype(O,/obj/item/disk/integrated_circuit/upgrade/advanced))
|
||||
@@ -45,7 +44,7 @@
|
||||
return TRUE
|
||||
to_chat(user, "<span class='notice'>You install \the [O] into \the [src]. </span>")
|
||||
upgraded = TRUE
|
||||
interact(user)
|
||||
SSvueui.check_uis_for_change(src)
|
||||
return TRUE
|
||||
|
||||
if(istype(O,/obj/item/disk/integrated_circuit/upgrade/clone))
|
||||
@@ -54,7 +53,7 @@
|
||||
return TRUE
|
||||
to_chat(user, "<span class='notice'>You install \the [O] into \the [src]. </span>")
|
||||
can_clone = TRUE
|
||||
interact(user)
|
||||
SSvueui.check_uis_for_change(src)
|
||||
return TRUE
|
||||
|
||||
return ..()
|
||||
@@ -63,44 +62,27 @@
|
||||
interact(user)
|
||||
|
||||
/obj/item/device/integrated_circuit_printer/interact(mob/user)
|
||||
var/window_height = 600
|
||||
var/window_width = 500
|
||||
var/datum/vueui/ui = SSvueui.get_open_ui(user, src)
|
||||
if (!ui)
|
||||
ui = new(user, src, "devices-circuit-printer", 600, 500, "Integrated Circuit Printer")
|
||||
ui.open()
|
||||
|
||||
if(isnull(current_category))
|
||||
current_category = SSelectronics.printer_recipe_list[1]
|
||||
/obj/item/device/integrated_circuit_printer/vueui_data_change(list/data, mob/user, datum/vueui/ui)
|
||||
. = ..()
|
||||
data = . || data || list()
|
||||
|
||||
var/HTML = "<center><h2>Integrated Circuit Printer</h2></center><br>"
|
||||
HTML += "Metal: [metal/metal_per_sheet]/[max_metal/metal_per_sheet] sheets.<br>"
|
||||
HTML += "Circuits available: [upgraded ? "Regular":"Advanced"]."
|
||||
HTML += "Assembly Cloning: [can_clone ? "Available": "Unavailable"]."
|
||||
if(assembly_to_clone)
|
||||
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>"
|
||||
data["metal"] = metal / metal_per_sheet
|
||||
data["metal_max"] = max_metal / metal_per_sheet
|
||||
data["upgraded"] = upgraded
|
||||
data["can_clone"] = can_clone
|
||||
data["assembly_to_clone"] = assembly_to_clone ? assembly_to_clone.name : FALSE
|
||||
|
||||
var/list/current_list = SSelectronics.printer_recipe_list[current_category]
|
||||
for(var/obj/O in current_list)
|
||||
var/can_build = 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)) && !upgraded)
|
||||
can_build = FALSE
|
||||
if(can_build)
|
||||
HTML += "<A href='?src=\ref[src];build=[O.type]'>[O.name]</A>: [O.desc]<br>"
|
||||
if(upgraded)
|
||||
data["circuits"] = SSelectronics.printer_recipe_list_upgraded
|
||||
else
|
||||
HTML += "<s>[O.name]: [O.desc]</s><br>"
|
||||
data["circuits"] = SSelectronics.printer_recipe_list_basic
|
||||
|
||||
var/datum/browser/B = new(user, "integrated_printer", null, window_width, window_height)
|
||||
B.set_content(HTML)
|
||||
B.open(FALSE)
|
||||
return data
|
||||
|
||||
/obj/item/device/integrated_circuit_printer/Topic(href, href_list)
|
||||
if(..())
|
||||
@@ -108,9 +90,6 @@
|
||||
|
||||
add_fingerprint(usr)
|
||||
|
||||
if(href_list["category"])
|
||||
current_category = href_list["category"]
|
||||
|
||||
if(href_list["build"])
|
||||
var/build_type = text2path(href_list["build"])
|
||||
if(!build_type || !ispath(build_type))
|
||||
@@ -139,10 +118,11 @@
|
||||
else
|
||||
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)
|
||||
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)
|
||||
if (O.type == build_type)
|
||||
|
||||
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