mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 19:52:40 +00:00
TGUI Destination Tagger
This commit is contained in:
@@ -3,3 +3,6 @@ GLOBAL_LIST_EMPTY(meteor_list)
|
||||
|
||||
/// List of wire colors for each object type of that round. One for airlocks, one for vendors, etc.
|
||||
GLOBAL_LIST_EMPTY(wire_color_directory) // This is an associative list with the `holder_type` as the key, and a list of colors as the value.
|
||||
|
||||
// Reference list for disposal sort junctions. Filled up by sorting junction's New()
|
||||
GLOBAL_LIST_EMPTY(tagger_locations)
|
||||
@@ -130,9 +130,6 @@ var/custom_event_msg = null
|
||||
var/DBConnection/dbcon = new() // Feedback database (New database)
|
||||
var/DBConnection/dbcon_old = new() // /tg/station database (Old database) -- see the files in the SQL folder for information on what goes where.
|
||||
|
||||
// Reference list for disposal sort junctions. Filled up by sorting junction's New()
|
||||
/var/list/tagger_locations = list()
|
||||
|
||||
// Added for Xenoarchaeology, might be useful for other stuff.
|
||||
var/global/list/alphabet_uppercase = list("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z")
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
set desc = "Tag yourself for delivery through the disposals system."
|
||||
set category = "Robot Commands"
|
||||
|
||||
var/new_tag = input("Select the desired destination.", "Set Mail Tag", null) as null|anything in tagger_locations
|
||||
var/new_tag = input("Select the desired destination.", "Set Mail Tag", null) as null|anything in GLOB.tagger_locations
|
||||
|
||||
if(!new_tag)
|
||||
mail_destination = ""
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
data["fabricator"] = dronefab
|
||||
data["fabPower"] = dronefab?.produce_drones
|
||||
|
||||
data["areas"] = tagger_locations
|
||||
data["areas"] = GLOB.tagger_locations
|
||||
data["selected_area"] = "[drone_call_area]"
|
||||
|
||||
return data
|
||||
@@ -65,7 +65,7 @@
|
||||
switch(action)
|
||||
if("set_dcall_area")
|
||||
var/t_area = params["area"]
|
||||
if(!t_area || !(t_area in tagger_locations))
|
||||
if(!t_area || !(t_area in GLOB.tagger_locations))
|
||||
return
|
||||
|
||||
drone_call_area = t_area
|
||||
|
||||
@@ -1210,7 +1210,7 @@
|
||||
New()
|
||||
. = ..()
|
||||
dpdir = dir | turn(dir, 180)
|
||||
if(sort_tag) tagger_locations |= sort_tag
|
||||
if(sort_tag) GLOB.tagger_locations |= sort_tag
|
||||
updatename()
|
||||
updatedesc()
|
||||
update()
|
||||
@@ -1276,7 +1276,7 @@
|
||||
|
||||
New()
|
||||
. = ..()
|
||||
if(sortType) tagger_locations |= sortType
|
||||
if(sortType) GLOB.tagger_locations |= sortType
|
||||
|
||||
updatedir()
|
||||
updatename()
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
var/label_x
|
||||
var/tag_x
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
/obj/structure/bigDelivery/attack_hand(mob/user as mob)
|
||||
unwrap()
|
||||
|
||||
proc/unwrap()
|
||||
/obj/structure/bigDelivery/proc/unwrap()
|
||||
playsound(src, 'sound/items/package_unwrap.ogg', 50, 1)
|
||||
// Destroy will drop our wrapped object on the turf, so let it.
|
||||
qdel(src)
|
||||
|
||||
attackby(obj/item/W as obj, mob/user as mob)
|
||||
/obj/structure/bigDelivery/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/device/destTagger))
|
||||
var/obj/item/device/destTagger/O = W
|
||||
if(O.currTag)
|
||||
@@ -72,7 +72,7 @@
|
||||
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
|
||||
return
|
||||
|
||||
update_icon()
|
||||
/obj/structure/bigDelivery/update_icon()
|
||||
overlays = new()
|
||||
if(nameset || examtext)
|
||||
var/image/I = new/image('icons/obj/storage.dmi',"delivery_label")
|
||||
@@ -101,7 +101,7 @@
|
||||
I.pixel_y = -3
|
||||
overlays += I
|
||||
|
||||
examine(mob/user)
|
||||
/obj/structure/bigDelivery/examine(mob/user)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 4)
|
||||
if(sortTag)
|
||||
@@ -121,7 +121,7 @@
|
||||
var/nameset = 0
|
||||
var/tag_x
|
||||
|
||||
attack_self(mob/user as mob)
|
||||
/obj/item/smallDelivery/attack_self(mob/user as mob)
|
||||
if (src.wrapped) //sometimes items can disappear. For example, bombs. --rastaf0
|
||||
wrapped.loc = user.loc
|
||||
if(ishuman(user))
|
||||
@@ -132,7 +132,7 @@
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
attackby(obj/item/W as obj, mob/user as mob)
|
||||
/obj/item/smallDelivery/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/device/destTagger))
|
||||
var/obj/item/device/destTagger/O = W
|
||||
if(O.currTag)
|
||||
@@ -183,7 +183,7 @@
|
||||
playsound(src, pick('sound/bureaucracy/pen1.ogg','sound/bureaucracy/pen2.ogg'), 20)
|
||||
return
|
||||
|
||||
update_icon()
|
||||
/obj/item/smallDelivery/update_icon()
|
||||
overlays = new()
|
||||
if((nameset || examtext) && icon_state != "deliverycrate1")
|
||||
var/image/I = new/image('icons/obj/storage.dmi',"delivery_label")
|
||||
@@ -208,7 +208,7 @@
|
||||
I.pixel_y = -3
|
||||
overlays += I
|
||||
|
||||
examine(mob/user)
|
||||
/obj/item/smallDelivery/examine(mob/user)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 4)
|
||||
if(sortTag)
|
||||
@@ -226,7 +226,7 @@
|
||||
drop_sound = 'sound/items/drop/wrapper.ogg'
|
||||
|
||||
|
||||
afterattack(var/obj/target as obj, mob/user as mob, proximity)
|
||||
/obj/item/weapon/packageWrap/afterattack(var/obj/target as obj, mob/user as mob, proximity)
|
||||
if(!proximity) return
|
||||
if(!istype(target)) //this really shouldn't be necessary (but it is). -Pete
|
||||
return
|
||||
@@ -311,7 +311,7 @@
|
||||
return
|
||||
return
|
||||
|
||||
examine(mob/user)
|
||||
/obj/item/weapon/packageWrap/examine(mob/user)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 0)
|
||||
. += "<font color='blue'>There are [amount] units of package wrap left!</font>"
|
||||
@@ -338,30 +338,34 @@
|
||||
item_state = "electronic"
|
||||
slot_flags = SLOT_BELT
|
||||
|
||||
proc/openwindow(mob/user as mob)
|
||||
var/dat = "<tt><center><h1><b>TagMaster 2.3</b></h1></center>"
|
||||
/obj/item/device/destTagger/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "DestinationTagger", name)
|
||||
ui.open()
|
||||
|
||||
dat += "<table style='width:100%; padding:4px;'><tr>"
|
||||
for(var/i = 1, i <= tagger_locations.len, i++)
|
||||
dat += "<td><a href='?src=\ref[src];nextTag=[tagger_locations[i]]'>[tagger_locations[i]]</a></td>"
|
||||
/obj/item/device/destTagger/tgui_data(mob/user, datum/tgui/ui)
|
||||
var/list/data = ..()
|
||||
|
||||
if (i%4==0)
|
||||
dat += "</tr><tr>"
|
||||
data["currTag"] = currTag
|
||||
data["taggerLocs"] = GLOB.tagger_locations
|
||||
|
||||
dat += "</tr></table><br>Current Selection: [currTag ? currTag : "None"]</tt>"
|
||||
return data
|
||||
|
||||
user << browse(dat, "window=destTagScreen;size=450x350")
|
||||
onclose(user, "destTagScreen")
|
||||
/obj/item/device/destTagger/attack_self(mob/user as mob)
|
||||
tgui_interact(user)
|
||||
|
||||
attack_self(mob/user as mob)
|
||||
openwindow(user)
|
||||
return
|
||||
|
||||
Topic(href, href_list)
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["nextTag"] && href_list["nextTag"] in tagger_locations)
|
||||
src.currTag = href_list["nextTag"]
|
||||
openwindow(usr)
|
||||
/obj/item/device/destTagger/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
add_fingerprint(usr)
|
||||
switch(action)
|
||||
if("set_tag")
|
||||
var/new_tag = params["tag"]
|
||||
if(!(new_tag in GLOB.tagger_locations))
|
||||
return FALSE
|
||||
currTag = new_tag
|
||||
. = TRUE
|
||||
|
||||
/obj/machinery/disposal/deliveryChute
|
||||
name = "Delivery chute"
|
||||
@@ -371,20 +375,20 @@
|
||||
|
||||
var/c_mode = 0
|
||||
|
||||
New()
|
||||
/obj/machinery/disposal/deliveryChute/New()
|
||||
..()
|
||||
spawn(5)
|
||||
trunk = locate() in src.loc
|
||||
if(trunk)
|
||||
trunk.linked = src // link the pipe trunk to self
|
||||
|
||||
interact()
|
||||
/obj/machinery/disposal/deliveryChute/interact()
|
||||
return
|
||||
|
||||
update()
|
||||
/obj/machinery/disposal/deliveryChute/update()
|
||||
return
|
||||
|
||||
Bumped(var/atom/movable/AM) //Go straight into the chute
|
||||
/obj/machinery/disposal/deliveryChute/Bumped(var/atom/movable/AM) //Go straight into the chute
|
||||
if(istype(AM, /obj/item/projectile) || istype(AM, /obj/effect) || istype(AM, /obj/mecha)) return
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
@@ -404,7 +408,7 @@
|
||||
M.loc = src
|
||||
src.flush()
|
||||
|
||||
flush()
|
||||
/obj/machinery/disposal/deliveryChute/flush()
|
||||
flushing = 1
|
||||
flick("intake-closing", src)
|
||||
var/obj/structure/disposalholder/H = new() // virtual holder object which actually
|
||||
@@ -426,7 +430,7 @@
|
||||
update()
|
||||
return
|
||||
|
||||
attackby(var/obj/item/I, var/mob/user)
|
||||
/obj/machinery/disposal/deliveryChute/attackby(var/obj/item/I, var/mob/user)
|
||||
if(!I || !user)
|
||||
return
|
||||
|
||||
|
||||
34
tgui/packages/tgui/interfaces/DestinationTagger.js
Normal file
34
tgui/packages/tgui/interfaces/DestinationTagger.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import { round } from 'common/math';
|
||||
import { Fragment } from 'inferno';
|
||||
import { useBackend } from "../backend";
|
||||
import { Box, Button, Flex, Icon, LabeledList, ProgressBar, Section, Table } from "../components";
|
||||
import { Window } from "../layouts";
|
||||
|
||||
export const DestinationTagger = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
|
||||
const {
|
||||
currTag,
|
||||
taggerLocs,
|
||||
} = data;
|
||||
|
||||
return (
|
||||
<Window width={450} height={310} resizable>
|
||||
<Window.Content>
|
||||
<Section title="Tagger Locations">
|
||||
<Flex wrap="wrap" spacing={1} justify="center">
|
||||
{taggerLocs.sort().map(tag => (
|
||||
<Flex.Item key={tag}>
|
||||
<Button
|
||||
icon={(currTag === tag) ? "check-square-o" : "square-o"}
|
||||
selected={currTag === tag}
|
||||
content={tag}
|
||||
onClick={() => act("set_tag", { tag: tag })} />
|
||||
</Flex.Item>
|
||||
))}
|
||||
</Flex>
|
||||
</Section>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user