July 5th TG sync (#1883)

July 5th TG sync
This commit is contained in:
Poojawa
2017-07-05 22:14:19 -05:00
committed by GitHub
parent 454b9c3d68
commit b1b4826c0c
1264 changed files with 149689 additions and 570309 deletions
+200 -200
View File
@@ -1,203 +1,203 @@
/obj/machinery/computer/cargo
name = "supply console"
desc = "Used to order supplies, approve requests, and control the shuttle."
icon_screen = "supply"
circuit = /obj/item/weapon/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."
/obj/machinery/computer/cargo
name = "supply console"
desc = "Used to order supplies, approve requests, and control the shuttle."
icon_screen = "supply"
circuit = /obj/item/weapon/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."
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/weapon/circuitboard/computer/cargo/request
requestonly = TRUE
/obj/machinery/computer/cargo/New()
..()
var/obj/item/weapon/circuitboard/computer/cargo/board = circuit
contraband = board.contraband
emagged = board.emagged
/obj/machinery/computer/cargo/emag_act(mob/living/user)
if(!emagged)
user.visible_message("<span class='warning'>[user] swipes a suspicious card through [src]!",
"<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/weapon/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 = 0, \
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
data["message"] = SSshuttle.centcom_message || "Remember to stamp and send back the supply manifests."
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.supply.getDockedId() == "supply_home")
SSshuttle.supply.emagged = emagged
SSshuttle.supply.contraband = contraband
SSshuttle.moveShuttle("supply", "supply_away", TRUE)
say("The supply shuttle has departed.")
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/weapon/circuitboard/computer/cargo/request
requestonly = TRUE
/obj/machinery/computer/cargo/New()
..()
var/obj/item/weapon/circuitboard/computer/cargo/board = circuit
contraband = board.contraband
emagged = board.emagged
/obj/machinery/computer/cargo/emag_act(mob/living/user)
if(!emagged)
user.visible_message("<span class='warning'>[user] swipes a suspicious card through [src]!",
"<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/weapon/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 = 0, \
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
data["message"] = SSshuttle.centcom_message || "Remember to stamp and send back the supply manifests."
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.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
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
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 = input("Reason:", name, "") as text|null
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(1435)
if(!frequency)
return
var/datum/signal/status_signal = new
status_signal.source = src
status_signal.transmission_method = 1
status_signal.data["command"] = command
frequency.post_signal(src, status_signal)
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
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 = input("Reason:", name, "") as text|null
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(1435)
if(!frequency)
return
var/datum/signal/status_signal = new
status_signal.source = src
status_signal.transmission_method = 1
status_signal.data["command"] = command
frequency.post_signal(src, status_signal)
+35 -6
View File
@@ -60,6 +60,7 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
var/unit_name = "" // Unit name. Only used in "Received [total_amount] [name]s [message]." message
var/message = ""
var/cost = 100 // Cost of item, in cargo credits. Must not alow for infinite price dupes, see above.
var/k_elasticity = 1/30 //coefficient used in marginal price calculation that roughly corresponds to the inverse of price elasticity, or "quantity elasticity"
var/contraband = FALSE // Export must be unlocked with multitool.
var/emagged = FALSE // Export must be unlocked with emag.
var/list/export_types = list() // Type of the exported object. If none, the export datum is considered base type.
@@ -69,10 +70,33 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
// Used by print-out
var/total_cost = 0
var/total_amount = 0
var/init_cost
/datum/export/New()
..()
SSprocessing.processing += src
init_cost = cost
export_types = typecacheof(export_types)
exclude_types = typecacheof(exclude_types)
/datum/export/Destroy()
SSprocessing.processing -= src
return ..()
/datum/export/process()
..()
cost *= GLOB.E**(k_elasticity * (1/30))
if(cost > init_cost)
cost = init_cost
// Checks the cost. 0 cost items are skipped in export.
/datum/export/proc/get_cost(obj/O, contr = 0, emag = 0)
return cost * get_amount(O, contr, emag)
var/amount = get_amount(O, contr, emag)
if(k_elasticity!=0)
return round((cost/k_elasticity) * (1 - GLOB.E**(-1 * k_elasticity * amount))) //anti-derivative of the marginal cost function
else
return round(cost * amount) //alternative form derived from L'Hopital to avoid division by 0
// Checks the amount of exportable in object. Credits in the bill, sheets in the stack, etc.
// Usually acts as a multiplier for a cost, so item that has 0 amount will be skipped in export.
@@ -87,7 +111,7 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
return FALSE
if(!include_subtypes && !(O.type in export_types))
return FALSE
if(include_subtypes && (!is_type_in_list(O, export_types) || is_type_in_list(O, exclude_types)))
if(include_subtypes && (!is_type_in_typecache(O, export_types) || is_type_in_typecache(O, exclude_types)))
return FALSE
if(!get_cost(O, contr, emag))
return FALSE
@@ -99,12 +123,17 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
// Adds item's cost and amount to the current export cycle.
// get_cost, get_amount and applies_to do not neccesary mean a successful sale.
/datum/export/proc/sell_object(obj/O, contr = 0, emag = 0)
var/cost = get_cost(O)
var/the_cost = get_cost(O)
var/amount = get_amount(O)
total_cost += cost
total_amount += amount
total_cost += the_cost
if(istype(O,/datum/export/material))
total_amount += amount*MINERAL_MATERIAL_AMOUNT
else
total_amount += amount
cost *= GLOB.E**(-1*k_elasticity*amount) //marginal cost modifier
SSblackbox.add_details("export_sold_amount","[O.type]|[amount]")
SSblackbox.add_details("export_sold_cost","[O.type]|[cost]")
SSblackbox.add_details("export_sold_cost","[O.type]|[the_cost]")
// Total printout for the cargo console.
// Called before the end of current export cycle.
+2 -1
View File
@@ -3,6 +3,7 @@
// Selling Syndicate docs to NT
/datum/export/intel
cost = 25000
k_elasticity = 0
unit_name = "original article"
message = "of enemy intelligence"
var/global/originals_recieved = list()
@@ -71,4 +72,4 @@
unit_name = "recovered article"
message = "of Syndicate intelligence"
export_types = list(/obj/item/documents/syndicate)
// Syndicate only wants originals of their docs recovered.
// Syndicate only wants originals of their docs recovered.
@@ -3,6 +3,7 @@
// Crates, boxes, lockers.
/datum/export/large/crate
cost = 500
k_elasticity = 0
unit_name = "crate"
export_types = list(/obj/structure/closet/crate)
exclude_types = list(/obj/structure/closet/crate/large, /obj/structure/closet/crate/wooden)
+3 -1
View File
@@ -2,6 +2,7 @@
// +200 credits flat.
/datum/export/manifest_correct
cost = 200
k_elasticity = 0
unit_name = "approved manifest"
export_types = list(/obj/item/weapon/paper/manifest)
@@ -18,6 +19,7 @@
// Refunds the package cost minus the cost of crate.
/datum/export/manifest_error_denied
cost = -500
k_elasticity = 0
unit_name = "correctly denied manifest"
export_types = list(/obj/item/weapon/paper/manifest)
@@ -73,4 +75,4 @@
/datum/export/manifest_correct_denied/get_cost(obj/O)
var/obj/item/weapon/paper/manifest/M = O
return ..() - M.order_cost
return ..() - M.order_cost
+3 -5
View File
@@ -11,7 +11,7 @@
/datum/export/material/get_amount(obj/O)
if(!material_id)
return 0
if(!istype(O, /obj/item))
if(!isitem(O))
return 0
var/obj/item/I = O
if(!(material_id in I.materials))
@@ -25,10 +25,7 @@
else if(istype(I, /obj/item/weapon/ore))
amount *= 0.8 // Station's ore redemption equipment is really goddamn good.
return round(amount)
/datum/export/material/get_cost(obj/O)
return round(..() / MINERAL_MATERIAL_AMOUNT)
return round(amount/MINERAL_MATERIAL_AMOUNT)
// Materials. Nothing but plasma is really worth selling. Better leave it all to RnD and sell some plasma instead.
@@ -47,6 +44,7 @@
// Plasma. The oil of 26 century. The reason why you are here.
/datum/export/material/plasma
cost = 300
k_elasticity = 0
material_id = MAT_PLASMA
message = "cm3 of plasma"
+12 -1
View File
@@ -75,7 +75,18 @@
if(C.preserved)
return ..() * 2
return ..()
// Kitty Organs.
/datum/export/organ/cat/ears
cost = 1000
unit_name = "cat ears"
export_types = list(/obj/item/organ/ears/cat)
/datum/export/organ/cat/tail
cost = 1000
unit_name = "cat tail"
export_types = list(/obj/item/organ/tail/cat)
// Human organs.
+1 -12
View File
@@ -15,18 +15,7 @@
unit_name = "solar panel control board"
export_types = list(/obj/item/weapon/circuitboard/computer/solar_control)
/datum/export/swarmer
cost = 2000
unit_name = "deactivated alien deconstruction drone"
export_types = list(/obj/item/device/unactivated_swarmer)
/datum/export/swarmer/applies_to(obj/O, contr = 0, emag = 0)
if(!..())
return FALSE
var/obj/item/device/unactivated_swarmer/S = O
if(!S.crit_fail)
return FALSE
return TRUE
export_types = list(/obj/item/device/deactivated_swarmer)
+1
View File
@@ -1,5 +1,6 @@
/datum/export/seed
cost = 100 // Gets multiplied by potency
k_elasticity = 1 //price inelastic/quantity elastic, only need to export a few samples
unit_name = "new plant species sample"
export_types = list(/obj/item/seeds)
var/needs_discovery = FALSE // Only for undiscovered species
-4
View File
@@ -111,10 +111,6 @@
unit_name = "cable piece"
export_types = list(/obj/item/stack/cable_coil)
/datum/export/stack/cable/get_cost(O)
return round(..())
// Weird Stuff
// Alien Alloy. Like plasteel, but better.
+1 -1
View File
@@ -286,7 +286,7 @@
/obj/item/device/camera,
/obj/item/device/taperecorder,
/obj/item/toy/crayon/white,
/obj/item/clothing/head/det_hat)
/obj/item/clothing/head/fedora/det_hat)
crate_name = "forensics crate"
/datum/supply_pack/security/armory