Files
Bubberstation/code/modules/cargo/console.dm
Aleksej Komarov 5521c8ebee [READY] tgui-next: Initial PR, speedy new Air Alarm interface. (#46764)
* Initial tgui-next commit

* Improve dev server, slight changes to layout.

* Add more components, fix dragging, finalize scrubber list

* Complete an air alarm interface.

* Multiple improvements based on feedback

- LabeledList now has a "buttons" prop, where you can put buttons.
- Improved Box and Flex components
- Whole UI is now dimmable if non-interactive
- Basic documentation of components (Box and Flex so far).
- Icon and Box now accept a "color" prop.
- Routing improved in "Layout" component, you can now specify whether an interface is scrollable.

* Less harsh dimming

* Redux, Toasts

- Fixed inconsistent backend updates with Redux.
- Added Toasts which are currently unused, but are functional.

* acclimator + ai airlock ui

* Add a progress bar component, implement resizing

* Fix a zero in title bar

* Add a linter to keep shit tidy, fix danger level mapping, add some more docs

* better ai door interact ui

* final ai airlock interface

* Fix issues with code, enforce hard 120 line length cap, automerge binaries

* Implement hot module reloading

* Fix progress bar, add color support

* Fix ProgressBar baseline alignment issues

* Remove unwanted padding on the bottom of the LabeledList.

* Component improvements

- Fix baseline issues with Button and ProgressBar components
- Box how inherits props from Box
- Atomic colors and Button colors are now auto-generated, all range of colors supported

* Chem Dispenser UI, animated numbers, more style fixes

* Add an IE8 polyfill

* Intermediate state of fixing IE8

* Lots of shimming and general misery

* Fully working old TGUI chainloader for IE8, more pipeline improvements

* Support title-less Sections

* Delete Yarn, use Lerna for workspace management

* Improve maths and animated numbers

* Fix loss of focus for scrollable content, activate buttons with keyboard

* Attempt to bust the cache, grab focus on keyboard presses too

* Fix hot module replacement by manually pulling replaced modules.

* backend logging

 un-nuke line endings

changes without insane line endings

* helper procs + href support

* slight optimization

* compiles

* Redux, Hotkeys, Kitchen Sink (for UI testing), Tabs component

* Push logs to backend, small kitchen sink changes, tab fixes

* Update component reference in README

* Small fixes

* Next bunch of IE8 fixes, PureComponent optimization for Inferno

* Delete old tgui html

* Log the event of loading the old tgui

* Enable tgui logging on server by default

* Final solution

* Extract routes into a separate file, fix ChemDispenser bug

- Chem dispenser was needlessly disabling transfer amount buttons

* Disable baseline alignment for vertical tabs

* Fix tabs and box units

- Tab content was not taking full page width
- Box can now accepts strings as units, which will be treated as raw style values.

* Fix tgui on Terry

* Fix sending all logs with an "error" flag

* Some macro UI component changes and improvements

- Refer to README.md diff to see what's new

* Tooltip component

* Add support for themes, nanotrasen logo is back

* Clockwork theme hotfix

* Slight adjustment to logo positioning

* Actually proper solution for logo positioning

* Fix color maps

* tgui-next thermomachine interface

* tgui-next canister interface

* Add icon_class_name proc to asset cache

* Lots of stuff backported from actioninja's repo

* Cleanup oopsies

* Cargo UI adjustments

* Nuke lodash

* Minor fixes and cleanup

- Remove local Inferno package in favor of upstream Inferno
- Fix "initial" prop on AnimatedNumber
- Force fancy=0 for IE8
- Click-through dimmer

* Add a bat file for dummies

* podlauncher interface fix

* Update README, assert code dominance

* Clarify usage of event handlers in Inferno

* Document LabeledList.Divider

* Fukken grammar

* fixes cellular emporium readapt button not working

* fixes incorrect action on button in atmos control interface

* remove unneeded data from airlock electronics ui

* Set +x mode on bin/tgui

* Fix filename cases

- They were untracked by git on windows

* Ignore package lock, make batch more robust

- package-lock.json is very random and unreliable as fuck. Yarn was better.

* Build tgui-next in travis

* bruh

- fixes tgui error reporting

* logging cleanup + always log
2019-10-15 17:20:37 +02:00

258 lines
8.3 KiB
Plaintext

/obj/machinery/computer/cargo
name = "supply console"
desc = "Used to order supplies, approve requests, and control the shuttle."
icon_screen = "supply"
circuit = /obj/item/circuitboard/computer/cargo
ui_x = 780
ui_y = 750
var/requestonly = FALSE
var/contraband = FALSE
var/self_paid = FALSE
var/safety_warning = "For safety reasons, the automated supply shuttle \
cannot transport live organisms, human remains, classified nuclear weaponry, \
homing beacons or machinery housing any form of artificial intelligence."
var/blockade_warning = "Bluespace instability detected. Shuttle movement impossible."
/// radio used by the console to send messages on supply channel
var/obj/item/radio/headset/radio
/// var that tracks message cooldown
var/message_cooldown
light_color = "#E2853D"//orange
/obj/machinery/computer/cargo/request
name = "supply request console"
desc = "Used to request supplies from cargo."
icon_screen = "request"
circuit = /obj/item/circuitboard/computer/cargo/request
requestonly = TRUE
/obj/machinery/computer/cargo/Initialize()
. = ..()
radio = new /obj/item/radio/headset/headset_cargo(src)
var/obj/item/circuitboard/computer/cargo/board = circuit
contraband = board.contraband
if (board.obj_flags & EMAGGED)
obj_flags |= EMAGGED
else
obj_flags &= ~EMAGGED
/obj/machinery/computer/cargo/Destroy()
QDEL_NULL(radio)
..()
/obj/machinery/computer/cargo/proc/get_export_categories()
. = EXPORT_CARGO
if(contraband)
. |= EXPORT_CONTRABAND
if(obj_flags & EMAGGED)
. |= EXPORT_EMAG
/obj/machinery/computer/cargo/emag_act(mob/user)
if(obj_flags & EMAGGED)
return
user.visible_message("<span class='warning'>[user] swipes a suspicious card through [src]!</span>",
"<span class='notice'>You adjust [src]'s routing and receiver spectrum, unlocking special supplies and contraband.</span>")
obj_flags |= EMAGGED
contraband = TRUE
// This also permamently sets this on the circuit board
var/obj/item/circuitboard/computer/cargo/board = circuit
board.contraband = TRUE
board.obj_flags |= EMAGGED
/obj/machinery/computer/cargo/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "cargo", name, ui_x, ui_y, master_ui, state)
ui.open()
/obj/machinery/computer/cargo/ui_data()
var/list/data = list()
data["requestonly"] = requestonly
data["location"] = SSshuttle.supply.getStatusText()
var/datum/bank_account/D = SSeconomy.get_dep_account(ACCOUNT_CAR)
if(D)
data["points"] = D.account_balance
data["away"] = SSshuttle.supply.getDockedId() == "supply_away"
data["docked"] = SSshuttle.supply.mode == SHUTTLE_IDLE
data["loan"] = !!SSshuttle.shuttle_loan
data["loan_dispatched"] = SSshuttle.shuttle_loan && SSshuttle.shuttle_loan.dispatched
var/message = "Remember to stamp and send back the supply manifests."
if(SSshuttle.centcom_message)
message = SSshuttle.centcom_message
if(SSshuttle.supplyBlocked)
message = blockade_warning
data["message"] = message
data["supplies"] = list()
data["self_paid"] = self_paid
for(var/pack in SSshuttle.supply_packs)
var/datum/supply_pack/P = SSshuttle.supply_packs[pack]
if(!data["supplies"][P.group])
data["supplies"][P.group] = list(
"name" = P.group,
"packs" = list()
)
if((P.hidden && !(obj_flags & EMAGGED)) || (P.contraband && !contraband) || (P.special && !P.special_enabled) || P.DropPodOnly)
continue
data["supplies"][P.group]["packs"] += list(list(
"name" = P.name,
"cost" = P.cost,
"id" = pack,
"desc" = P.desc || P.name, // If there is a description, use it. Otherwise use the pack's name.
"small_item" = P.small_item,
"access" = P.access
))
data["cart"] = list()
for(var/datum/supply_order/SO in SSshuttle.shoppinglist)
data["cart"] += list(list(
"object" = SO.pack.name,
"cost" = SO.pack.cost,
"id" = SO.id,
"orderer" = SO.orderer,
"paid" = !isnull(SO.paying_account) //paid by requester
))
data["requests"] = list()
for(var/datum/supply_order/SO in SSshuttle.requestlist)
data["requests"] += list(list(
"object" = SO.pack.name,
"cost" = SO.pack.cost,
"orderer" = SO.orderer,
"reason" = SO.reason,
"id" = SO.id
))
return data
/obj/machinery/computer/cargo/ui_act(action, params, datum/tgui/ui)
if(..())
return
switch(action)
if("send")
if(!SSshuttle.supply.canMove())
say(safety_warning)
return
if(SSshuttle.supplyBlocked)
say(blockade_warning)
return
if(SSshuttle.supply.getDockedId() == "supply_home")
SSshuttle.supply.export_categories = get_export_categories()
SSshuttle.moveShuttle("supply", "supply_away", TRUE)
say("The supply shuttle is departing.")
investigate_log("[key_name(usr)] sent the supply shuttle away.", INVESTIGATE_CARGO)
else
investigate_log("[key_name(usr)] called the supply shuttle.", INVESTIGATE_CARGO)
say("The supply shuttle has been called and will arrive in [SSshuttle.supply.timeLeft(600)] minutes.")
SSshuttle.moveShuttle("supply", "supply_home", TRUE)
. = TRUE
if("loan")
if(!SSshuttle.shuttle_loan)
return
if(SSshuttle.supplyBlocked)
say(blockade_warning)
return
else if(SSshuttle.supply.mode != SHUTTLE_IDLE)
return
else if(SSshuttle.supply.getDockedId() != "supply_away")
return
else
SSshuttle.shuttle_loan.loan_shuttle()
say("The supply shuttle has been loaned to CentCom.")
. = TRUE
if("add")
var/id = text2path(params["id"])
var/datum/supply_pack/pack = SSshuttle.supply_packs[id]
if(!istype(pack))
return
if((pack.hidden && !(obj_flags & EMAGGED)) || (pack.contraband && !contraband) || pack.DropPodOnly)
return
var/name = "*None Provided*"
var/rank = "*None Provided*"
var/ckey = usr.ckey
if(ishuman(usr))
var/mob/living/carbon/human/H = usr
name = H.get_authentification_name()
rank = H.get_assignment(hand_first = TRUE)
else if(issilicon(usr))
name = usr.real_name
rank = "Silicon"
var/datum/bank_account/account
if(self_paid && ishuman(usr))
var/mob/living/carbon/human/H = usr
var/obj/item/card/id/id_card = H.get_idcard(TRUE)
if(!istype(id_card))
say("No ID card detected.")
return
account = id_card.registered_account
if(!istype(account))
say("Invalid bank account.")
return
var/reason = ""
if(requestonly && !self_paid)
reason = stripped_input("Reason:", name, "")
if(isnull(reason) || ..())
return
var/turf/T = get_turf(src)
var/datum/supply_order/SO = new(pack, name, rank, ckey, reason, account)
SO.generateRequisition(T)
if(requestonly && !self_paid)
SSshuttle.requestlist += SO
else
SSshuttle.shoppinglist += SO
if(self_paid)
say("Order processed. The price will be charged to [account.account_holder]'s bank account on delivery.")
if(requestonly && message_cooldown < world.time)
radio.talk_into(src, "A new order has been requested.", RADIO_CHANNEL_SUPPLY)
message_cooldown = world.time + 30 SECONDS
. = TRUE
if("remove")
var/id = text2num(params["id"])
for(var/datum/supply_order/SO in SSshuttle.shoppinglist)
if(SO.id == id)
SSshuttle.shoppinglist -= SO
. = TRUE
break
if("clear")
SSshuttle.shoppinglist.Cut()
. = TRUE
if("approve")
var/id = text2num(params["id"])
for(var/datum/supply_order/SO in SSshuttle.requestlist)
if(SO.id == id)
SSshuttle.requestlist -= SO
SSshuttle.shoppinglist += SO
. = TRUE
break
if("deny")
var/id = text2num(params["id"])
for(var/datum/supply_order/SO in SSshuttle.requestlist)
if(SO.id == id)
SSshuttle.requestlist -= SO
. = TRUE
break
if("denyall")
SSshuttle.requestlist.Cut()
. = TRUE
if("toggleprivate")
self_paid = !self_paid
if(.)
post_signal("supply")
/obj/machinery/computer/cargo/proc/post_signal(command)
var/datum/radio_frequency/frequency = SSradio.return_frequency(FREQ_STATUS_DISPLAYS)
if(!frequency)
return
var/datum/signal/status_signal = new(list("command" = command))
frequency.post_signal(src, status_signal)