mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-18 18:47:53 +01:00
+3








fa2ab65f07
Handful of missed mirrors (#3739) * fix duplicate traits * Adds a Contraband trait, and implements contraband as a mechanic to security bounties. (#84003) This PR does a few things but centrally it's all centered around mechanically enforcing what items are and are-not considered contraband in-game. Contraband items are visually indistinguishable from non-contraband. If an item is Contraband, it can only be detected in two ways: * After being scanned by an N-Spect scanner, which is a standard item security item, assuming it still has a charge to do so. * Via a scanner gate, which can now be upgraded with an N-spect scanner to allow for it to scan a person and all their contents for contraband. Contraband items are intended to be determined both logically and through other relevant examine text. However, here's the short list of items that are considered contraband, reserving the right to expand the list. <details> <summary>In hindsight it's kind of a long list.</summary> * Items that have "contraband" or "illegal" in the name or description. * Items that allow for the player to obtain other illegal items, that are NOT particularly stealthy. * This means that a syndicate uplink is NOT considered contraband, as they're typically hidden on your person as something else. * Stealth items under the syndicate uplink, the revolutionary flash, and some mapped in dangerous items that can come from both syndicate and company-aligned resources are not considered dangerous. * Items that are purchased from cargo after emagging or switching to extended cargo range. * Items purchased FROM syndicate uplinks, the wizard knowledge scroll, or other antagonist shops. * Cursed artifacts/tools magically produced by cultists or heretics. * Items purchased from the blackmarket. * Items purchased from the contraband section of vending machines. * Some drugs and overtly dangerous or criminal byproducts. </details> Well, primarily, this is an aid for in-game enforcement of space law. Based on the length of the above list, we have a LONG, LONG list of items in-game that are technically considered, in one way or another, illegal to have on the station, and yet without either metaknowledge of what those items are, or how they're used, security officers lack some of the certainty of how to deal with these kinds of encounters. Additionally to the knowledge aspect of this trait, security officers may now receive a new civilian bounty to collect items that are considered contraband, also giving them an incentive to look for and confiscate contraband that's been found across the station while upholding space law. Security has a bounty for 3 different rechargers, and considering access limitations, most security players aren't going to make this exchange, so I've lowered the required amount down to 1. Adjusted the N-spect scanner's description to match it's new functionality. The Civilian bounty TGUI now has an additional 1 point of padding to make it feel less cramped. https://github.com/tgstation/tgstation/assets/41715314/c3cd4752-b03a-4e0b-959e-1252fcc2369d **Updated as of 6/19/2024:** Additionally, some storage items will block the presence of contraband when going through a contraband aligned scanning gate. These items include the infiltrator modsuit core, storage implant, void cloak, the aptly named smuggler's satchel, and the chameleon kit's backpack. **Updated as of 6/23/2024:** N-spect scanner now has contextual screentips. **Updated as of 6/29/2024:** Scanner gates are now available in all lathes that have a feature specific to how scanner gates function. So, includes cargo (contraband), security (weapons), and medbay (diseases). Originally, this started out as a way to be able to provide more in-character and in-flavor bounties for security officers, because they suck! Most security bounties as they exist right now do the worst possible things from all respective bounties: * They detract away from a job's actual responsibilities as opposed to working with them. * They're best completed while sitting next to your lathe and running items back to the bounty pad. * They exist with such esoteric rarity of high quantity of items that it's miserable to fulfil. As a result, I started work on this as a framework to allow security officers to be further incentivized to collect contraband across the station, either as a result of the gamemode or just through routine patrols across the station. Implementing it as a learning tool for security as well just happened to work out as an additional bonus, and having a function in-game allowing newer or less experienced players to know if an item is considered dangerous or conspicuous also works as a particularly good way to provide information where a player may not know what they're up against. If nothing else, this might be interesting to try, and if not, I'll just snip out the QOL changes from it and we'll see how it goes. Going forward, I am a bit hesitant about the contraband scanner gate mode, and as such, will try working with the admin team to determine if that's a good feature to keep around for game health, while hoping to give it a chance in the fullness of time. 🆑 add: Items spawned via traitor uplinks or are known illegal contraband on the station can now be scanned and identified as such by the N-spect scanners in security. These only applies to overt traitor or antagonist items, and "stealth" items will not be seen as such. add: Scanner gates can now be upgraded by using an N-spect scanner on it to unlock "contraband scanning" mode. add: Security officers can now be offered a bounty to turn in pieces of contraband. add: Some stealthy storage items like storage implants, smuggler's satchels, void cloaks, the infiltrator modsuit, and the chameleon backpack will block the presence of contraband on your person when placed inside. qol: N-spect scanner contextual screentips. balance: Recharger security bounties ask for a quantity of 1, down from 3. qol: security, cargo, and medbay have access to scanner gate boards. /🆑 --------- * Adds six new strange object powers! (#84775) DESIGN CONCEPT: Strange Devices are at their best when they're odd tools which can help a department out, with some strange drawbacks that make them interesting and unique. Foam for the Janitor, Flashbang for Security, Teleporter for tiders, Corgimaker for the chef. They're also ambiguous enough that they can really be used by anyone for silly hijinks. Drink Dispenser: Creates a glass, then fills it up with a random drink. Bioscrambler: After a noticeable warning, bioscrambles people nearby. 33% chance to be used up on use. Recharger: Shocks you, but recharges one random item to max battery. Hugger: Hugs everyone in range as if you had the friendly trait. DImensional: Converts the surroundings to a random material-theme. Each use increases cooldown by two seconds. Disguiser: Drops your clothing to the ground and replaces it with a delete-on-drop costume and a randomly assigned cardboard ID. Removed an unused and unusable shock flag. Removed an unused dumb ghost item. Added a proc that returns a hex color with the # attached. > DESIGN CONCEPT: Strange Devices are at their best when they're odd tools which can help a department out, with some strange drawbacks that make them interesting and unique. Foam for the Janitor, Flashbang for Security, Teleporter for tiders, Corgimaker for the chef. They're also ambiguous enough that they can really be used by anyone for silly hijinks. Request by ArcaneMusic! He wanted new abilities to go along with the new sprites, and approved these. > Removed an unused dumb ghost item. please stop using costume subtypes for OP items. whats the damn point of the subtype if youre just going to screw with it > Added a proc that returns a hex color with the # attached. idk why it didnt have this tbh 🆑 add: Adds six new strange object powers! Drink dispenser, bioscrambler, recharger, hugger, dimensional, disguiser. code: Removed some unused code and items, and added a proc that returns a random #colorstring. /🆑 * [NO GBP] the random spawner loot weight config is not an integer (#84814) Sets `integer` to false. Also a tidbit about the `skew_loot_weight` proc, though loot lists with uneven weights all tend to add a value to all entries so it isn't an issue. The config isn't an integer. N/A * The techweb no longer erroneously refers to MODsuits as exosuits (#84800) At some point, some of the techweb node descriptions were changed, so that it referred to certain modsuits as exosuits. This just changes it back. The term "exosuit" is generally used for mechs, not modsuits. The techweb descriptions should refer to modsuits as modsuits. 🆑 spellcheck: The techweb no longer erroneously refers to MODsuits as exosuits. /🆑 * Adds new hairstyle - Short Bangs 2 (#84804) Adds a new hairstyle called Short Bangs 2. The hairstyle is basically an edit of the existing double buns, except the hair buns themselves are removed. https://github.com/tgstation/tgstation/assets/66234359/38fe3b09-c42b-43e6-9e30-949428aab506 More customization, variety and character flavor is great. Double buns itself is a good hairstyle but some may not like the hair buns out of personal preference or that it can look weird on non-human species like felinids. 🆑 Hardly3D add: Added new hairstyle: Short Bangs 2 /🆑 * Offset render relays for non-offsetting planes to match highest matching render plane (#84184) **Alternate title: "Fix blind people getting so blind they become deaf when going down a flight of stairs"** So 'bout half a week to a week ago I overheard a friend complaining about blind people not seeing runechat on lower multi-z levels. Asked a bit, apparently they'd reported this about half a year ago, and it's still an issue. So in my never-ending hubris I decided to just go and fix it! Now, admittedly? I really _really_ do not get the rendering system we use. The simple options were right out: we can't allow the fullscreens plane to be offset, as this causes issues with looking up/down, or disallow runechat from being offset, which causes issues with runechat from other levels. After poking our very cool and smart rendering guy several times over the course of the last week, this is what we got to: We simply make the rendering relays for non-offsetting plane masters point to the highest rendering plane that matches the target. We do this by offsetting the rendering relays in place, by adjusting their plane and layer values to match the new offset, with a new `offset_relays_in_place(new_offset)` proc called in `/datum/plane_master_group/proc/transform_lower_turfs(...)`. Importantly, we compare the current layer values to what they should've been, so we don't accidentally override relays with custom-set layers. This fixes our issue (as tested on wawastation): <details> <summary>Images</summary>    </details> Fixes #80376. 🆑 fix: You can see runechat above fullscreen overlays on lower multi-z levels again. Rejoice, blind players. Please report any weird rendering layering issues. /🆑 * illegal tech flag got changed * Automatic changelog for PR #84003 [ci skip] * Automatic changelog for PR #84775 [ci skip] * Automatic changelog for PR #84800 [ci skip] * Automatic changelog for PR #84804 [ci skip] * Automatic changelog for PR #84184 [ci skip] * Makes the smoking pipe sprite not give you a phantom stache. (#84898) The smoking pipe currently gives you a phantom stache. Observe, note the black background and know this character has no facial hair.  I basically adjusted the pixels so it'd look better from different directions. This is the new look - approximately.  Smoking pipe is cool for RP but the sprite's fucked. 🆑 image: the smoking pipe's directional looks have been altered to make it less ugly /🆑 (cherry picked from commitc499c51bb3) * Automatic changelog for PR #84898 [ci skip] (cherry picked from commit1e80a72dee) * Revert "Automatic changelog for PR #84898 [ci skip]" This reverts commit 1ddc7d43de30bb7ef029d1ddd39f86ded94e110c. * Revert "Makes the smoking pipe sprite not give you a phantom stache. (#84898)" This reverts commit b66b9d634e5f28e40e800586d4642468049767e6. --------- Co-authored-by: FlufflesTheDog <piecopresident@gmail.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: carlarctg <53100513+carlarctg@users.noreply.github.com> Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com> Co-authored-by: GPeckman <21979502+GPeckman@users.noreply.github.com> Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com> Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com> Co-authored-by: orange man <61334995+comfyorange@users.noreply.github.com> Co-authored-by: NewyearnewmeUwu <70115628+NewyearnewmeUwu@users.noreply.github.com> Co-authored-by: SomeRandomOwl <2568378+SomeRandomOwl@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
454 lines
16 KiB
Plaintext
454 lines
16 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
|
|
light_color = COLOR_BRIGHT_ORANGE
|
|
|
|
///Can the supply console send the shuttle back and forth? Used in the UI backend.
|
|
var/can_send = TRUE
|
|
///Can this console only send requests?
|
|
var/requestonly = FALSE
|
|
///Can you approve requests placed for cargo? Works differently between the app and the computer.
|
|
var/can_approve_requests = TRUE
|
|
var/contraband = FALSE
|
|
var/self_paid = FALSE
|
|
var/safety_warning = "For safety and ethical reasons, the automated supply shuttle cannot transport live organisms, \
|
|
human remains, classified nuclear weaponry, mail, undelivered departmental order crates, syndicate bombs, \
|
|
homing beacons, unstable eigenstates, fax machines, 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
|
|
var/list/loaded_coupons
|
|
/// var that makes express console use rockets
|
|
var/is_express = FALSE
|
|
///The name of the shuttle template being used as the cargo shuttle. 'cargo' is default and contains critical code. Don't change this unless you know what you're doing.
|
|
var/cargo_shuttle = "cargo"
|
|
///The docking port called when returning to the station.
|
|
var/docking_home = "cargo_home"
|
|
///The docking port called when leaving the station.
|
|
var/docking_away = "cargo_away"
|
|
///If this console can loan the cargo shuttle. Set to false to disable.
|
|
var/stationcargo = TRUE
|
|
///The account this console processes and displays. Independent from the account the shuttle processes.
|
|
var/cargo_account = ACCOUNT_CAR
|
|
///Interface name for the ui_interact call for different subtypes.
|
|
var/interface_type = "Cargo"
|
|
|
|
/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
|
|
can_send = FALSE
|
|
can_approve_requests = FALSE
|
|
requestonly = TRUE
|
|
|
|
/obj/machinery/computer/cargo/Initialize(mapload)
|
|
. = ..()
|
|
radio = new /obj/item/radio/headset/headset_cargo(src)
|
|
|
|
/obj/machinery/computer/cargo/Destroy()
|
|
QDEL_NULL(radio)
|
|
return ..()
|
|
|
|
/obj/machinery/computer/cargo/attacked_by(obj/item/I, mob/living/user)
|
|
if(istype(I,/obj/item/trade_chip))
|
|
var/obj/item/trade_chip/contract = I
|
|
contract.try_to_unlock_contract(user)
|
|
return TRUE
|
|
else
|
|
return ..()
|
|
|
|
/obj/machinery/computer/cargo/emag_act(mob/user, obj/item/card/emag/emag_card)
|
|
if(obj_flags & EMAGGED)
|
|
return FALSE
|
|
if(user)
|
|
if (emag_card)
|
|
user.visible_message(span_warning("[user] swipes [emag_card] through [src]!"))
|
|
to_chat(user, span_notice("You adjust [src]'s routing and receiver spectrum, unlocking special supplies and contraband."))
|
|
|
|
obj_flags |= EMAGGED
|
|
contraband = TRUE
|
|
|
|
// This also permanently sets this on the circuit board
|
|
var/obj/item/circuitboard/computer/cargo/board = circuit
|
|
board.contraband = TRUE
|
|
board.obj_flags |= EMAGGED
|
|
update_static_data(user)
|
|
return TRUE
|
|
|
|
/obj/machinery/computer/cargo/on_construction(mob/user)
|
|
. = ..()
|
|
circuit.configure_machine(src)
|
|
|
|
/obj/machinery/computer/cargo/ui_interact(mob/user, datum/tgui/ui)
|
|
. = ..()
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, interface_type, name)
|
|
ui.open()
|
|
|
|
/obj/machinery/computer/cargo/ui_data()
|
|
var/list/data = list()
|
|
data["department"] = "Cargo" // Hardcoded here, for customization in budgetordering.dm AKA NT IRN
|
|
data["location"] = SSshuttle.supply.getStatusText()
|
|
var/datum/bank_account/D = SSeconomy.get_dep_account(cargo_account)
|
|
if(D)
|
|
data["points"] = D.account_balance
|
|
data["grocery"] = SSshuttle.chef_groceries.len
|
|
data["away"] = SSshuttle.supply.getDockedId() == docking_away
|
|
data["self_paid"] = self_paid
|
|
data["docked"] = SSshuttle.supply.mode == SHUTTLE_IDLE
|
|
data["loan"] = !!SSshuttle.shuttle_loan
|
|
data["loan_dispatched"] = SSshuttle.shuttle_loan && SSshuttle.shuttle_loan.dispatched
|
|
data["can_send"] = can_send
|
|
data["can_approve_requests"] = can_approve_requests
|
|
var/message = "Remember to stamp and send back the supply manifests."
|
|
if(SSshuttle.centcom_message)
|
|
message = SSshuttle.centcom_message
|
|
if(SSshuttle.supply_blocked)
|
|
message = blockade_warning
|
|
data["message"] = message
|
|
|
|
var/list/amount_by_name = list()
|
|
var/cart_list = list()
|
|
for(var/datum/supply_order/order in SSshuttle.shopping_list)
|
|
if(cart_list[order.pack.name])
|
|
amount_by_name[order.pack.name] += 1
|
|
cart_list[order.pack.name][1]["amount"]++
|
|
cart_list[order.pack.name][1]["cost"] += order.get_final_cost()
|
|
if(order.department_destination)
|
|
cart_list[order.pack.name][1]["dep_order"]++
|
|
if(!isnull(order.paying_account))
|
|
cart_list[order.pack.name][1]["paid"]++
|
|
continue
|
|
|
|
amount_by_name[order.pack.name] += 1
|
|
cart_list[order.pack.name] = list(list(
|
|
"cost_type" = order.cost_type,
|
|
"object" = order.pack.name,
|
|
"cost" = order.get_final_cost(),
|
|
"id" = order.id,
|
|
"amount" = 1,
|
|
"orderer" = order.orderer,
|
|
"paid" = !isnull(order.paying_account) ? 1 : 0, //number of orders purchased privatly
|
|
"dep_order" = order.department_destination ? 1 : 0, //number of orders purchased by a department
|
|
"can_be_cancelled" = order.can_be_cancelled,
|
|
))
|
|
data["cart"] = list()
|
|
for(var/item_id in cart_list)
|
|
data["cart"] += cart_list[item_id]
|
|
|
|
|
|
data["requests"] = list()
|
|
for(var/datum/supply_order/order in SSshuttle.request_list)
|
|
var/datum/supply_pack/pack = order.pack
|
|
amount_by_name[pack.name] += 1
|
|
data["requests"] += list(list(
|
|
"object" = pack.name,
|
|
"cost" = pack.get_cost(),
|
|
"orderer" = order.orderer,
|
|
"reason" = order.reason,
|
|
"id" = order.id,
|
|
))
|
|
data["amount_by_name"] = amount_by_name
|
|
|
|
return data
|
|
|
|
/obj/machinery/computer/cargo/ui_static_data(mob/user)
|
|
var/list/data = list()
|
|
data["max_order"] = CARGO_MAX_ORDER
|
|
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 && !(obj_flags & EMAGGED)) || (P.contraband && !contraband) || (P.special && !P.special_enabled) || P.drop_pod_only)
|
|
continue
|
|
data["supplies"][P.group]["packs"] += list(list(
|
|
"name" = P.name,
|
|
"cost" = P.get_cost(),
|
|
"id" = pack,
|
|
"desc" = P.desc || P.name, // If there is a description, use it. Otherwise use the pack's name.
|
|
"goody" = P.goody,
|
|
"access" = P.access,
|
|
"contraband" = P.contraband,
|
|
))
|
|
return data
|
|
|
|
/**
|
|
* adds an supply pack to the checkout cart
|
|
* * user - the mobe doing this order
|
|
* * id - the type of pack to order
|
|
* * amount - the amount to order. You may not order more then 10 things at once
|
|
*/
|
|
/obj/machinery/computer/cargo/proc/add_item(mob/user, id, amount = 1)
|
|
if(is_express)
|
|
return
|
|
id = text2path(id) || id
|
|
var/datum/supply_pack/pack = SSshuttle.supply_packs[id]
|
|
if(!istype(pack))
|
|
CRASH("Unknown supply pack id given by order console ui. ID: [id]")
|
|
if(amount > CARGO_MAX_ORDER || amount < 1) // Holy shit fuck off
|
|
CRASH("Invalid amount passed into add_item")
|
|
if((pack.hidden && !(obj_flags & EMAGGED)) || (pack.contraband && !contraband) || pack.drop_pod_only || (pack.special && !pack.special_enabled))
|
|
return
|
|
|
|
var/name = "*None Provided*"
|
|
var/rank = "*None Provided*"
|
|
var/ckey = user.ckey
|
|
if(ishuman(user))
|
|
var/mob/living/carbon/human/human = user
|
|
name = human.get_authentification_name()
|
|
rank = human.get_assignment(hand_first = TRUE)
|
|
else if(HAS_SILICON_ACCESS(user))
|
|
name = user.real_name
|
|
rank = "Silicon"
|
|
|
|
var/datum/bank_account/account
|
|
if(self_paid && isliving(user))
|
|
var/mob/living/living_user = user
|
|
var/obj/item/card/id/id_card = living_user.get_idcard(TRUE)
|
|
if(!istype(id_card))
|
|
say("No ID card detected.")
|
|
return
|
|
if(IS_DEPARTMENTAL_CARD(id_card))
|
|
say("The [src] rejects [id_card].")
|
|
return
|
|
account = id_card.registered_account
|
|
if(!istype(account))
|
|
say("Invalid bank account.")
|
|
return
|
|
var/list/access = id_card.GetAccess()
|
|
if(pack.access_view && !(pack.access_view in access))
|
|
say("[id_card] lacks the requisite access for this purchase.")
|
|
return
|
|
|
|
// The list we are operating on right now
|
|
var/list/working_list = SSshuttle.shopping_list
|
|
var/reason = ""
|
|
if(requestonly && !self_paid)
|
|
working_list = SSshuttle.request_list
|
|
reason = tgui_input_text(user, "Reason", name)
|
|
if(isnull(reason))
|
|
return
|
|
|
|
if(pack.goody && !self_paid)
|
|
playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE)
|
|
say("ERROR: Small crates may only be purchased by private accounts.")
|
|
return
|
|
|
|
var/similar_count = SSshuttle.supply.get_order_count(pack)
|
|
if(similar_count == OVER_ORDER_LIMIT)
|
|
playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE)
|
|
say("ERROR: No more then [CARGO_MAX_ORDER] of any pack may be ordered at once")
|
|
return
|
|
|
|
amount = clamp(amount, 1, CARGO_MAX_ORDER - similar_count)
|
|
for(var/count in 1 to amount)
|
|
var/obj/item/coupon/applied_coupon
|
|
for(var/obj/item/coupon/coupon_check in loaded_coupons)
|
|
if(pack.type == coupon_check.discounted_pack)
|
|
say("Coupon found! [round(coupon_check.discount_pct_off * 100)]% off applied!")
|
|
coupon_check.moveToNullspace()
|
|
applied_coupon = coupon_check
|
|
break
|
|
|
|
var/datum/supply_order/order = new(
|
|
pack = pack ,
|
|
orderer = name,
|
|
orderer_rank = rank,
|
|
orderer_ckey = ckey,
|
|
reason = reason,
|
|
paying_account = account,
|
|
coupon = applied_coupon,
|
|
charge_on_purchase = TRUE, // SKYRAT EDIT ADDITION
|
|
)
|
|
working_list += order
|
|
|
|
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)
|
|
var/message = amount == 1 ? "A new order has been requested." : "[amount] order has been requested."
|
|
radio.talk_into(src, message, RADIO_CHANNEL_SUPPLY)
|
|
message_cooldown = world.time + 30 SECONDS
|
|
. = TRUE
|
|
|
|
/**
|
|
* removes an item from the checkout cart
|
|
* * id - the id of the cart item to remove
|
|
*/
|
|
/obj/machinery/computer/cargo/proc/remove_item(id)
|
|
for(var/datum/supply_order/order in SSshuttle.shopping_list)
|
|
if(order.id != id)
|
|
continue
|
|
if(order.department_destination)
|
|
say("Only the department that ordered this item may cancel it.")
|
|
return FALSE
|
|
if(order.applied_coupon)
|
|
say("Coupon refunded.")
|
|
order.applied_coupon.forceMove(get_turf(src))
|
|
SSshuttle.shopping_list -= order
|
|
qdel(order)
|
|
return TRUE
|
|
return FALSE
|
|
/**
|
|
* maps the ordename displayed on the ui to its supply pack id
|
|
* * order_name - the name of the order
|
|
*/
|
|
/obj/machinery/computer/cargo/proc/name_to_id(order_name)
|
|
for(var/pack in SSshuttle.supply_packs)
|
|
var/datum/supply_pack/supply = SSshuttle.supply_packs[pack]
|
|
if(order_name == supply.name)
|
|
return pack
|
|
return null
|
|
|
|
/obj/machinery/computer/cargo/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
switch(action)
|
|
if("send")
|
|
if(!SSshuttle.supply.canMove())
|
|
say(safety_warning)
|
|
return
|
|
if(SSshuttle.supply_blocked)
|
|
say(blockade_warning)
|
|
return
|
|
|
|
if(SSshuttle.supply.getDockedId() == docking_home)
|
|
SSshuttle.moveShuttle(cargo_shuttle, docking_away, TRUE)
|
|
say("The supply shuttle is departing.")
|
|
ui.user.investigate_log("sent the supply shuttle away.", INVESTIGATE_CARGO)
|
|
else
|
|
//create the paper from the SSshuttle.shopping_list
|
|
if(length(SSshuttle.shopping_list))
|
|
var/obj/item/paper/requisition_paper = new(get_turf(src))
|
|
requisition_paper.name = "requisition form - [station_time_timestamp()]"
|
|
var/requisition_text = "<h2>[station_name()] Supply Requisition</h2>"
|
|
requisition_text += "<hr/>"
|
|
requisition_text += "Time of Order: [station_time_timestamp()]<br/><br/>"
|
|
for(var/datum/supply_order/order as anything in SSshuttle.shopping_list)
|
|
requisition_text += "<b>[order.pack.name]</b></br>"
|
|
requisition_text += "- Order ID: [order.id]</br>"
|
|
var/restrictions = SSid_access.get_access_desc(order.pack.access)
|
|
if(restrictions)
|
|
requisition_text += "- Access Restrictions: [restrictions]</br>"
|
|
requisition_text += "- Ordered by: [order.orderer] ([order.orderer_rank])</br>"
|
|
var/paying_account = order.paying_account
|
|
if(paying_account)
|
|
requisition_text += "- Paid Privately by: [order.paying_account.account_holder]<br/>"
|
|
var/reason = order.reason
|
|
if(reason)
|
|
requisition_text += "- Reason Given: [reason]</br>"
|
|
requisition_text += "</br></br>"
|
|
requisition_paper.add_raw_text(requisition_text)
|
|
requisition_paper.color = "#9ef5ff"
|
|
requisition_paper.update_appearance()
|
|
|
|
ui.user.investigate_log("called the supply shuttle.", INVESTIGATE_CARGO)
|
|
say("The supply shuttle has been called and will arrive in [SSshuttle.supply.timeLeft(600)] minutes.")
|
|
SSshuttle.moveShuttle(cargo_shuttle, docking_home, TRUE)
|
|
|
|
. = TRUE
|
|
if("loan")
|
|
if(!SSshuttle.shuttle_loan)
|
|
return
|
|
if(SSshuttle.supply_blocked)
|
|
say(blockade_warning)
|
|
return
|
|
else if(SSshuttle.supply.mode != SHUTTLE_IDLE)
|
|
return
|
|
else if(SSshuttle.supply.getDockedId() != docking_away)
|
|
return
|
|
else if(stationcargo != TRUE)
|
|
return
|
|
else
|
|
SSshuttle.shuttle_loan.loan_shuttle()
|
|
say("The supply shuttle has been loaned to CentCom.")
|
|
ui.user.investigate_log("accepted a shuttle loan event.", INVESTIGATE_CARGO)
|
|
ui.user.log_message("accepted a shuttle loan event.", LOG_GAME)
|
|
. = TRUE
|
|
if("add")
|
|
return add_item(ui.user, params["id"])
|
|
if("add_by_name")
|
|
var/supply_pack_id = name_to_id(params["order_name"])
|
|
if(!supply_pack_id)
|
|
return
|
|
return add_item(ui.user, supply_pack_id)
|
|
if("remove")
|
|
var/order_name = params["order_name"]
|
|
//try removing atleast one item with the specified name. An order may not be removed if it was from the department
|
|
for(var/datum/supply_order/order in SSshuttle.shopping_list)
|
|
if(order.pack.name != order_name)
|
|
continue
|
|
if(remove_item(order.id))
|
|
return TRUE
|
|
|
|
return TRUE
|
|
if("modify")
|
|
var/order_name = params["order_name"]
|
|
|
|
//clear out all orders with the above mentioned order_name name to make space for the new amount
|
|
for(var/datum/supply_order/order in SSshuttle.shopping_list) //find corresponding order id for the order name
|
|
if(order.pack.name == order_name)
|
|
remove_item(order.id)
|
|
|
|
//now add the new amount stuff
|
|
var/amount = text2num(params["amount"])
|
|
if(amount == 0)
|
|
return TRUE
|
|
if(amount > CARGO_MAX_ORDER)
|
|
return
|
|
var/supply_pack_id = name_to_id(order_name) //map order name to supply pack id for adding
|
|
if(!supply_pack_id)
|
|
return
|
|
return add_item(ui.user, supply_pack_id, amount)
|
|
if("clear")
|
|
//create copy of list else we will get runtimes when iterating & removing items on the same list SSshuttle.shopping_list
|
|
var/list/shopping_cart = SSshuttle.shopping_list.Copy()
|
|
for(var/datum/supply_order/cancelled_order in shopping_cart)
|
|
if(cancelled_order.department_destination || !cancelled_order.can_be_cancelled)
|
|
continue //don't cancel other department's orders or orders that can't be cancelled
|
|
remove_item(cancelled_order.id) //remove & properly refund any coupons attached with this order
|
|
if("approve")
|
|
var/id = text2num(params["id"])
|
|
for(var/datum/supply_order/SO in SSshuttle.request_list)
|
|
if(SO.id == id)
|
|
SSshuttle.request_list -= SO
|
|
SSshuttle.shopping_list += SO
|
|
. = TRUE
|
|
break
|
|
if("deny")
|
|
var/id = text2num(params["id"])
|
|
for(var/datum/supply_order/SO in SSshuttle.request_list)
|
|
if(SO.id == id)
|
|
SSshuttle.request_list -= SO
|
|
. = TRUE
|
|
break
|
|
if("denyall")
|
|
SSshuttle.request_list.Cut()
|
|
. = TRUE
|
|
if("toggleprivate")
|
|
self_paid = !self_paid
|
|
. = TRUE
|
|
if(.)
|
|
post_signal(cargo_shuttle)
|
|
|
|
/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)
|