mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 13:05:44 +01:00
Cargo Price Inflation (#21258)
Refactors cargo pricing code to properly adjust prices based on sector and category (earlier it would multiply the price by each category's multiplier, leading to prices above intended price point) --------- Co-authored-by: Ben10083 <Ben10083@users.noreply.github.com>
This commit is contained in:
@@ -102,6 +102,7 @@ SUBSYSTEM_DEF(cargo)
|
||||
/datum/controller/subsystem/cargo/proc/load_cargo_suppliers()
|
||||
for(var/singleton/cargo_supplier/S as anything in (GET_SINGLETON_SUBTYPE_LIST(/singleton/cargo_supplier)))
|
||||
log_subsystem_cargo("Loading supplier '[S.name]', with short name '[S.short_name]'.")
|
||||
S.price_modifier = S.get_total_price_coefficient()
|
||||
SScargo.cargo_suppliers[S.short_name] = S
|
||||
|
||||
/datum/controller/subsystem/cargo/proc/load_cargo_items()
|
||||
|
||||
@@ -46,9 +46,17 @@
|
||||
/// Sets the item's adjusted_price according to different price modifiers. Returns nothing.
|
||||
/singleton/cargo_item/proc/get_adjusted_price()
|
||||
var/return_price = price
|
||||
var/item_category = SScargo.get_category_by_name(category)
|
||||
var/item_supplier = SScargo.get_supplier_by_name(supplier)
|
||||
|
||||
for(var/supplier_name in SScargo.cargo_suppliers)
|
||||
var/singleton/cargo_supplier/cs = SScargo.get_supplier_by_name(supplier_name)
|
||||
if(cs == item_supplier)
|
||||
return_price *= cs.price_modifier
|
||||
|
||||
for(var/category_name in SScargo.cargo_categories)
|
||||
var/singleton/cargo_category/cc = SScargo.get_category_by_name(category_name)
|
||||
if(cc)
|
||||
if(cc == item_category)
|
||||
return_price *= cc.price_modifier
|
||||
|
||||
adjusted_price = return_price
|
||||
|
||||
Reference in New Issue
Block a user