mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-30 19:41:56 +00:00
* Change transmission_method to use defines rather than magic numbers * Use MIN and MAX_FREE_FREQ defines when bounds-checking radios * Remove violently broken "Debug Signals" verb The relevant Destroy() is never called, making the static pointers list take lots of memory and be large enough, even at roundstart, to crash the chat when invoked (25k+ entries). * Remove unnecessary checks for SSradio not existing * Move department frequencies from GLOB to defines * Replace all hardcoded radio frequencies with named defines * Change the radio filters to be defines * Use a define for the default signaler code
215 lines
6.7 KiB
Plaintext
215 lines
6.7 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
|
|
var/requestonly = FALSE
|
|
var/contraband = FALSE
|
|
var/safety_warning = "For safety reasons the automated supply shuttle \
|
|
cannot transport live organisms, classified nuclear weaponry or \
|
|
homing beacons."
|
|
var/blockade_warning = "Bluespace instability detected. Shuttle movement impossible."
|
|
|
|
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()
|
|
. = ..()
|
|
var/obj/item/circuitboard/computer/cargo/board = circuit
|
|
contraband = board.contraband
|
|
emagged = board.emagged
|
|
|
|
/obj/machinery/computer/cargo/emag_act(mob/user)
|
|
if(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>")
|
|
|
|
emagged = TRUE
|
|
contraband = TRUE
|
|
|
|
// This also permamently sets this on the circuit board
|
|
var/obj/item/circuitboard/computer/cargo/board = circuit
|
|
board.contraband = TRUE
|
|
board.emagged = TRUE
|
|
|
|
/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, 1000, 800, master_ui, state)
|
|
ui.open()
|
|
|
|
/obj/machinery/computer/cargo/ui_data()
|
|
var/list/data = list()
|
|
data["requestonly"] = requestonly
|
|
data["location"] = SSshuttle.supply.getStatusText()
|
|
data["points"] = SSshuttle.points
|
|
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()
|
|
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 && !emagged) || (P.contraband && !contraband) || (P.special && !P.special_enabled))
|
|
continue
|
|
data["supplies"][P.group]["packs"] += list(list(
|
|
"name" = P.name,
|
|
"cost" = P.cost,
|
|
"id" = pack
|
|
))
|
|
|
|
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
|
|
))
|
|
|
|
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
|
|
if(action != "add" && requestonly)
|
|
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.emagged = emagged
|
|
SSshuttle.supply.contraband = contraband
|
|
SSshuttle.moveShuttle("supply", "supply_away", TRUE)
|
|
say("The supply shuttle has departed.")
|
|
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 && !emagged) || (pack.contraband && !contraband))
|
|
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()
|
|
else if(issilicon(usr))
|
|
name = usr.real_name
|
|
rank = "Silicon"
|
|
|
|
var/reason = ""
|
|
if(requestonly)
|
|
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)
|
|
SO.generateRequisition(T)
|
|
if(requestonly)
|
|
SSshuttle.requestlist += SO
|
|
else
|
|
SSshuttle.shoppinglist += SO
|
|
. = 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(.)
|
|
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
|
|
status_signal.source = src
|
|
status_signal.transmission_method = TRANSMISSION_RADIO
|
|
status_signal.data["command"] = command
|
|
|
|
frequency.post_signal(src, status_signal)
|