Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More supply updates #546

Merged
merged 49 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
23e7de7
More supply updates
EgorDinamit Feb 13, 2024
e63ebac
Tiny ui fix
EgorDinamit Feb 13, 2024
2531e4c
Fix logs
EgorDinamit Feb 13, 2024
5ef58eb
Fix cooldown display
EgorDinamit Feb 13, 2024
179a275
Changes favor requirement on some traders
EgorDinamit Feb 13, 2024
d5cc30e
More tweaks & fixes
EgorDinamit Feb 13, 2024
2a2a583
Platinum for sale
EgorDinamit Feb 13, 2024
f48dd6f
Reverse-list instead of reverse-range
EgorDinamit Feb 13, 2024
20b9bfc
Fix logs display again
EgorDinamit Feb 13, 2024
8882b21
Wizard item worths
EgorDinamit Feb 13, 2024
e7a005f
Display balance in the console
EgorDinamit Feb 14, 2024
a18a0e2
Payrolls test
EgorDinamit Feb 14, 2024
3f8a843
Hidden trading stations tiny tweak
EgorDinamit Feb 14, 2024
57c8c06
Faction link cooldown
EgorDinamit Feb 14, 2024
24560e5
Grown plants and gas values
EgorDinamit Feb 14, 2024
bf88f40
Market crash effect!
EgorDinamit Feb 14, 2024
10e41be
Fix issue with SMG mags
EgorDinamit Feb 14, 2024
02b4062
Changes how market crash works
EgorDinamit Feb 14, 2024
56ccd13
Fix gas proc
EgorDinamit Feb 14, 2024
0e9a63d
Fix grown plants value
EgorDinamit Feb 14, 2024
1fbd555
Fix atmos worth again
EgorDinamit Feb 14, 2024
c7eb310
Atmos tweaks
EgorDinamit Feb 15, 2024
2f8ce52
Canisters don't late init their gases
EgorDinamit Feb 15, 2024
fa1884b
Fix attempt
EgorDinamit Feb 15, 2024
f2019d2
Fix please
EgorDinamit Feb 15, 2024
198d8b4
Pump fix
EgorDinamit Feb 15, 2024
391fc14
Supermatter is now sold in hidden inv of engi trader
EgorDinamit Feb 15, 2024
5722cdb
Payrolls update
EgorDinamit Feb 15, 2024
edb7bcb
Artifact values
EgorDinamit Feb 15, 2024
e62dee6
Fix
EgorDinamit Feb 15, 2024
0f37542
More trading stations
EgorDinamit Feb 16, 2024
e3eb5d4
Fix duplicate access name
EgorDinamit Feb 16, 2024
7252a9a
Fix
EgorDinamit Feb 16, 2024
b71f6cf
Some tweaks
EgorDinamit Feb 16, 2024
57c4537
Fix payrolls
EgorDinamit Feb 16, 2024
2e7d6b1
Engraver uses considerably more power now
EgorDinamit Feb 16, 2024
cdf58de
Dominion trader price change
EgorDinamit Feb 16, 2024
78c9039
Tweak
EgorDinamit Feb 16, 2024
e0ee2bc
Slime extract values
EgorDinamit Feb 16, 2024
f5d6622
Adds more exempt types
EgorDinamit Feb 16, 2024
e2a2873
External organs cost scales
EgorDinamit Feb 16, 2024
198116f
Seeds price fix
EgorDinamit Feb 16, 2024
4c4ad12
Auto-login at 0 security level
EgorDinamit Feb 16, 2024
bc68f1e
Dressup can be used on clientless mobs and ghosts
EgorDinamit Feb 16, 2024
3d90fad
Organ price tweaks
EgorDinamit Feb 16, 2024
1ed3659
Trading beacon circuits & designs
EgorDinamit Feb 17, 2024
869291f
Construct states for trade beacons
EgorDinamit Feb 17, 2024
7bfec9b
Fix spellbook value
EgorDinamit Feb 17, 2024
9a6af06
Rockets have higher weight
EgorDinamit Feb 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,7 @@
#include "code\game\objects\items\weapons\circuitboards\machinery\shieldgen.dm"
#include "code\game\objects\items\weapons\circuitboards\machinery\telecomms.dm"
#include "code\game\objects\items\weapons\circuitboards\machinery\teleporter.dm"
#include "code\game\objects\items\weapons\circuitboards\machinery\trade_beacon.dm"
#include "code\game\objects\items\weapons\circuitboards\machinery\unary_atmos.dm"
#include "code\game\objects\items\weapons\grenades\anti_photon_grenade.dm"
#include "code\game\objects\items\weapons\grenades\chem_grenade.dm"
Expand Down Expand Up @@ -3289,13 +3290,17 @@
#include "code\modules\tgs\includes.dm"
#include "code\modules\trading_stations\_faction.dm"
#include "code\modules\trading_stations\_trading_station.dm"
#include "code\modules\trading_stations\trading_station_types\0_always_spawn\atmos.dm"
#include "code\modules\trading_stations\trading_station_types\0_always_spawn\engineering.dm"
#include "code\modules\trading_stations\trading_station_types\0_always_spawn\eva.dm"
#include "code\modules\trading_stations\trading_station_types\0_always_spawn\materials.dm"
#include "code\modules\trading_stations\trading_station_types\0_always_spawn\medical.dm"
#include "code\modules\trading_stations\trading_station_types\0_always_spawn\mining.dm"
#include "code\modules\trading_stations\trading_station_types\0_always_spawn\science.dm"
#include "code\modules\trading_stations\trading_station_types\0_always_spawn\security.dm"
#include "code\modules\trading_stations\trading_station_types\0_always_spawn\terra.dm"
#include "code\modules\trading_stations\trading_station_types\2_rare\weapons.dm"
#include "code\modules\trading_stations\trading_station_types\3_very_rare\dominion.dm"
#include "code\modules\trading_stations\trading_station_types\3_very_rare\obs.dm"
#include "code\modules\trusted-players\procs.dm"
#include "code\modules\turbolift\_turbolift.dm"
Expand Down
3 changes: 3 additions & 0 deletions code/__defines/supply.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#define TRADE_CAT_MEDKIT "Medical Kits"
#define TRADE_CAT_CHEMICAL "Chemical"
#define TRADE_CAT_CHEMCARTS "Chemical Cartridges"
#define TRADE_CAT_CANISTERS "Gas Canisters"
#define TRADE_CAT_MACHINES "Machinery"
#define TRADE_CAT_ARTIFACT "Artifacts"

// As in - faction is a part of us
#define FACTION_STATE_PROTECTORATE 4
Expand Down
2 changes: 1 addition & 1 deletion code/_helpers/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@

/proc/print_atmos_analysis(user, var/list/result)
for(var/line in result)
to_chat(user, "<span class='notice'>[line]</span>")
to_chat(user, "<span class='notice'>[line]</span>")
82 changes: 65 additions & 17 deletions code/controllers/subsystems/supply.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ SUBSYSTEM_DEF(supply)
name = "Supply"
priority = SS_PRIORITY_SUPPLY
flags = SS_NO_FIRE
runlevels = RUNLEVEL_GAME|RUNLEVEL_POSTGAME
wait = 30 MINUTES

/// Budget for trading stations with spawn_always at FALSE
var/trade_stations_budget = 5
/// All available trading stations - visible, hidden, doesn't matter
var/list/all_trading_stations = list()
/// All visible and available stations
var/list/visible_trading_stations = list()
/// All hidden/unavailable stations
var/list/hidden_trading_stations = list()
/// All factions in the world; Assoc list Name = Datum.
/// Trading stations get the datums from here
var/list/factions = list()
Expand All @@ -35,6 +35,23 @@ SUBSYSTEM_DEF(supply)
var/order_queue_id = 0
var/list/order_queue = list()

// For exporting
/// Maximum price of an atom before it becomes affected by an export modifier
var/export_maximum = 25000
var/list/export_modifier = list()
var/list/export_counter = list()
/// Paths of atoms that are entirely unaffected by export price modifiers
var/list/export_modifier_exempt_types = list(
/obj/item/ore,
/obj/item/stack,
/obj/item/reagent_containers,
/obj/item/slime_extract,
/obj/item/ammo_casing,
/obj/machinery/artifact,
/obj/machinery/portable_atmospherics/canister,
/mob/living/carbon/slime,
)

/datum/controller/subsystem/supply/Initialize()
. = ..()
for(var/faction_type in typesof(/datum/trade_faction))
Expand Down Expand Up @@ -67,6 +84,14 @@ SUBSYSTEM_DEF(supply)
DeInitTradeStations()
. = ..()

/datum/controller/subsystem/supply/fire()
for(var/datum/money_account/A in all_money_accounts)
A.PayrollTick()
for(var/A in export_counter)
var/reduction = max(export_maximum, export_counter[A] * 0.5)
export_counter[A] = max(0, export_counter[A] -= reduction)
ExportCounterCheck()

/datum/controller/subsystem/supply/proc/GetFaction(fac)
if(!(fac in factions))
return null
Expand Down Expand Up @@ -96,7 +121,6 @@ SUBSYSTEM_DEF(supply)
for(var/datum/trading_station/TS in all_trading_stations)
TS.RegainTradeStationsBudget()
qdel(TS)
hidden_trading_stations -= TS
visible_trading_stations -= TS
all_trading_stations -= TS

Expand Down Expand Up @@ -275,7 +299,7 @@ SUBSYSTEM_DEF(supply)

return order_queue_slot

/datum/controller/subsystem/supply/proc/PurchaseOrder(obj/machinery/trade_beacon/receiving/beacon, order_id)
/datum/controller/subsystem/supply/proc/PurchaseOrder(obj/machinery/trade_beacon/receiving/beacon, order_id, used_faction = FACTION_INDEPENDENT)
if(QDELETED(beacon) || !beacon || !order_id)
return

Expand All @@ -289,12 +313,12 @@ SUBSYSTEM_DEF(supply)
var/total_cost = order["cost"] + order["fee"]
var/is_requestor_master = (requesting_account == master_account) ? TRUE : FALSE

Buy(beacon, master_account, shopping_list, !is_requestor_master, requesting_account.owner_name)
Buy(beacon, master_account, shopping_list, !is_requestor_master, requesting_account.owner_name, used_faction)
if(!is_requestor_master)
requesting_account.transfer(master_account, total_cost, "Order Request")
CreateLogEntry("Order", requesting_account.owner_name, viewable_contents, total_cost)
CreateLogEntry("Order", requesting_account.owner_name, used_faction, viewable_contents, total_cost)

/datum/controller/subsystem/supply/proc/Buy(obj/machinery/trade_beacon/receiving/senderBeacon, datum/money_account/account, list/shopList, is_order = FALSE, buyer_name = null)
/datum/controller/subsystem/supply/proc/Buy(obj/machinery/trade_beacon/receiving/senderBeacon, datum/money_account/account, list/shopList, is_order = FALSE, buyer_name = null, used_faction = FACTION_INDEPENDENT)
if(QDELETED(senderBeacon) || !istype(senderBeacon) || !account || !RecursiveLen(shopList))
return FALSE

Expand Down Expand Up @@ -348,14 +372,17 @@ SUBSYSTEM_DEF(supply)
if(count_of_all > 1)
invoice_location = C

CreateLogEntry("Shipping", account.owner_name, order_contents_info, price_for_all, FALSE, invoice_location)
CreateLogEntry("Shipping", account.owner_name, used_faction, order_contents_info, price_for_all, FALSE, invoice_location)
account.withdraw(price_for_all, "Purchase", "Trade Network")
return TRUE

/datum/controller/subsystem/supply/proc/Export(obj/machinery/trade_beacon/sending/senderBeacon, datum/money_account/moneyAccount)
/datum/controller/subsystem/supply/proc/Export(obj/machinery/trade_beacon/sending/senderBeacon, datum/money_account/moneyAccount, used_faction = FACTION_INDEPENDENT)
if(QDELETED(senderBeacon))
return

if(!senderBeacon.StartExport())
return

var/invoice_contents_info
var/export_count = 0
var/cost = 0
Expand All @@ -373,12 +400,20 @@ SUBSYSTEM_DEF(supply)

// We go backwards, so it'll be innermost objects sold first
for(var/atom/movable/item in reverseRange(contents_incl_self))
var/item_price = get_value(item)
if(istype(item, /obj/screen))
continue

var/item_price = GetExportValue(item)
var/export_value = item_price

if(export_value)
invoice_contents_info += "<li>[item.name]</li>"
cost += export_value
if(!(is_path_in_list(item.type, export_modifier_exempt_types)))
if(!(item.type in export_counter))
export_counter[item.type] = 0
if(export_counter[item.type] < export_maximum * 2)
export_counter[item.type] += round(min(export_value, export_maximum * 0.25))
//SEND_SIGNAL(src, COMSIG_TRADE_BEACON, item)
qdel(item)
++export_count
Expand All @@ -392,31 +427,44 @@ SUBSYSTEM_DEF(supply)
if(export_count > 100)
break

senderBeacon.StartExport()
ExportCounterCheck()

moneyAccount.deposit(cost, "Export", "Trade Network")

if(invoice_contents_info) // If no info, then nothing was exported
CreateLogEntry("Export", moneyAccount.owner_name, invoice_contents_info, cost, FALSE, get_turf(senderBeacon))
CreateLogEntry("Export", moneyAccount.owner_name, used_faction, invoice_contents_info, cost, FALSE, get_turf(senderBeacon))
return TRUE

/datum/controller/subsystem/supply/proc/GetExportValue(atom/A)
. = get_value(A)
if(A.type in export_modifier)
. *= export_modifier[A.type]

/datum/controller/subsystem/supply/proc/ExportCounterCheck()
for(var/A in export_counter)
if(export_counter[A] > export_maximum)
export_modifier[A] = clamp(round(export_maximum / export_counter[A], 0.01), 0.5, 2.0)
else if(A in export_modifier)
export_modifier -= A

// Logging

/datum/controller/subsystem/supply/proc/CreateLogEntry(type, ordering_account, contents, total_paid, create_invoice = FALSE, invoice_location = null)
/datum/controller/subsystem/supply/proc/CreateLogEntry(type, ordering_account, assoc_faction = FACTION_INDEPENDENT, contents, total_paid, create_invoice = FALSE, invoice_location = null)
var/log_id

switch(type)
if("Shipping")
log_id = "[++shipping_invoice_number]-S"
shipping_log.Add(list(list("id" = log_id, "ordering_acct" = ordering_account, "contents" = contents, "total_paid" = total_paid, "time" = time2text(world.time, "hh:mm"))))
shipping_log.Add(list(list("id" = log_id, "ordering_acct" = ordering_account, "assoc_faction" = assoc_faction, "contents" = contents, "total_paid" = total_paid, "time" = time2text(world.time, "hh:mm"))))
if("Export")
log_id = "[++export_invoice_number]-E"
export_log.Add(list(list("id" = log_id, "ordering_acct" = ordering_account, "contents" = contents, "total_paid" = total_paid, "time" = time2text(world.time, "hh:mm"))))
export_log.Add(list(list("id" = log_id, "ordering_acct" = ordering_account, "assoc_faction" = assoc_faction, "contents" = contents, "total_paid" = total_paid, "time" = time2text(world.time, "hh:mm"))))
if("Special Offer")
log_id = "[++offer_invoice_number]-SO"
offer_log.Add(list(list("id" = log_id, "ordering_acct" = ordering_account, "contents" = contents, "total_paid" = total_paid, "time" = time2text(world.time, "hh:mm"))))
offer_log.Add(list(list("id" = log_id, "ordering_acct" = ordering_account, "assoc_faction" = assoc_faction, "contents" = contents, "total_paid" = total_paid, "time" = time2text(world.time, "hh:mm"))))
if("Order")
log_id = "[++order_number]-O"
order_log.Add(list(list("id" = log_id, "ordering_acct" = ordering_account, "contents" = contents, "total_paid" = total_paid, "time" = time2text(world.time, "hh:mm"))))
order_log.Add(list(list("id" = log_id, "ordering_acct" = ordering_account, "assoc_faction" = assoc_faction, "contents" = contents, "total_paid" = total_paid, "time" = time2text(world.time, "hh:mm"))))
else
return

Expand Down
3 changes: 2 additions & 1 deletion code/datums/uplink/devices and tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@

/datum/uplink_item/item/tools/money
name = "Operations Funding"
item_cost = 8
item_cost = 10
path = /obj/item/storage/secure/briefcase/money

/datum/uplink_item/item/tools/money/New()
. = ..()
desc = "A briefcase with 10,000 untraceable [GLOB.using_map.local_currency_name]. Makes a great bribe if they're willing to take you up on your offer."
Expand Down
21 changes: 14 additions & 7 deletions code/game/jobs/access_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -483,47 +483,54 @@
/datum/access/supplylink_solgov
id = access_supplylink_solgov
desc = "Supply Console - SolGov Link"
region = ACCESS_REGION_SUPPLY
region = ACCESS_REGION_NONE
access_type = ACCESS_TYPE_NONE

/var/const/access_supplylink_terragov = "ACCESS_SUPPLY_LINK_TERRAGOV"
/datum/access/supplylink_terragov
id = access_supplylink_terragov
desc = "Supply Console - TerraGov Link"
region = ACCESS_REGION_SUPPLY
region = ACCESS_REGION_NONE
access_type = ACCESS_TYPE_NONE

/var/const/access_supplylink_isc = "ACCESS_SUPPLY_LINK_ISC"
/datum/access/supplylink_isc
id = access_supplylink_isc
desc = "Supply Console - ISC Link"
region = ACCESS_REGION_SUPPLY
region = ACCESS_REGION_NONE
access_type = ACCESS_TYPE_NONE

/var/const/access_supplylink_nanotrasen = "ACCESS_SUPPLY_LINK_NANOTRASEN"
/datum/access/supplylink_nanotrasen
id = access_supplylink_nanotrasen
desc = "Supply Console - Nanotrasen Link"
region = ACCESS_REGION_SUPPLY
region = ACCESS_REGION_NONE
access_type = ACCESS_TYPE_NONE

/var/const/access_supplylink_cybersun = "ACCESS_SUPPLY_LINK_CYBERSUN"
/datum/access/supplylink_cybersun
id = access_supplylink_cybersun
desc = "Supply Console - Cybersun Link"
region = ACCESS_REGION_SUPPLY
region = ACCESS_REGION_NONE
access_type = ACCESS_TYPE_NONE

/var/const/access_supplylink_obs = "ACCESS_SUPPLY_LINK_OBS"
/datum/access/supplylink_obs
id = access_supplylink_obs
desc = "Supply Console - OBS Link"
region = ACCESS_REGION_SUPPLY
region = ACCESS_REGION_NONE
access_type = ACCESS_TYPE_NONE

/var/const/access_supplylink_reborn_church = "ACCESS_SUPPLY_LINK_REBORN_CHURCH"
/datum/access/supplylink_reborn_church
id = access_supplylink_reborn_church
desc = "Supply Console - Reborn Christian Church Link"
region = ACCESS_REGION_SUPPLY
region = ACCESS_REGION_NONE
access_type = ACCESS_TYPE_NONE

/var/const/access_supplylink_dominion = "ACCESS_SUPPLY_LINK_TERRAN_DOMINION"
/datum/access/supplylink_dominion
id = access_supplylink_dominion
desc = "Supply Console - Terran Dominion"
region = ACCESS_REGION_NONE
access_type = ACCESS_TYPE_NONE
45 changes: 32 additions & 13 deletions code/game/machinery/atmoalter/canister.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,18 @@
var/update_flag = 0
/// Associative list of gases for this canister to begin with and the moles to have. A negative value will fill the tank to its starting pressure with the gas.
var/list/initial_gases = list()
/// A temperature in Kelvin for this canister's air contents to begin with. Use this for pre-chilled gases.
var/initial_temperature

/obj/machinery/portable_atmospherics/canister/LateInitialize(mapload)
. = ..(mapload)
if (prob(1))
/obj/machinery/portable_atmospherics/canister/Initialize(mapload)
. = ..()
if(prob(1))
desc += " Does not hold GAS." // huhuhu
if (!mapload) // Call gas creation after normal init if we're midround - otherwise, we'll runtime and have no gases
addtimer(CALLBACK(src, .proc/create_initial_gases), 0)
else
create_initial_gases()
create_initial_gases()

/// Fills this canister with gas based on its subtype's initial_gases list. Should only happen during initial creation.
/obj/machinery/portable_atmospherics/canister/proc/create_initial_gases()
if (initial_gases?.len)
for (var/gas_id in initial_gases)
if(LAZYLEN(initial_gases))
for(var/gas_id in initial_gases)
air_contents.adjust_gas(gas_id, initial_gases[gas_id] < 0 ? MolesForPressure() : initial_gases[gas_id])
if (initial_temperature)
air_contents.temperature = initial_temperature
update_icon()

/obj/machinery/portable_atmospherics/canister/drain_power()
Expand Down Expand Up @@ -174,6 +167,24 @@
GAS_CHLORINE = -1
)

/obj/machinery/portable_atmospherics/canister/tritium
name = "gas canister \[Tritium\]"
icon_state = "green"
canister_color = "green"
can_label = FALSE
initial_gases = list(
GAS_TRITIUM = -1
)

/obj/machinery/portable_atmospherics/canister/deuterium
name = "gas canister \[Deuterium\]"
icon_state = "green"
canister_color = "green"
can_label = FALSE
initial_gases = list(
GAS_DEUTERIUM = -1
)

/obj/machinery/portable_atmospherics/canister/air/airlock
start_pressure = 3 * ONE_ATMOSPHERE

Expand Down Expand Up @@ -219,6 +230,14 @@
icon_state = "purple"
canister_type = /obj/machinery/portable_atmospherics/canister/hydrogen

/obj/machinery/portable_atmospherics/canister/empty/tritium
icon_state = "green"
canister_type = /obj/machinery/portable_atmospherics/canister/tritium

/obj/machinery/portable_atmospherics/canister/empty/deuterium
icon_state = "green"
canister_type = /obj/machinery/portable_atmospherics/canister/deuterium



/obj/machinery/portable_atmospherics/canister/proc/check_change()
Expand Down
Loading
Loading