-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Working trading! Details below...
feature: Production/Consumption system - a ticker that simulates processing of Assets based on 'recipes'. feature: Asset-Needs system - a ticker that updates Needs based on the amounts of affecting Assets (e.g. food for Hunger, money for Wealth). feature: API to set Need updates batched to avoid repeated proc-calls. feature: A DB of 'objective' Need weights to use as a reference point tweak: Sell offers now consider their own Utility AND the 'objective' Utility for pricing and take the maximum of the two prices. tweak: Sell offers now have 'friction' in the form of minimum money volume required to even bother (hardcoded at 100$ ATM). refactor: Removed the special-case fetcher for Wealth - no longer needed due to A-N system. refactor: Moved the Attachments variable to be common across all datums. fix: Fixed routing of goods from escrow on successful contracts. fix: Fixes to global ID lazy generation
- Loading branch information
jmalek
committed
Sep 22, 2024
1 parent
1bed49a
commit 2d50dd5
Showing
28 changed files
with
626 additions
and
147 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
/datum/faction_data/InitializeGlobalId(var/list/args = null) | ||
if(src.global_id) | ||
// Do not rewrite the ID if initialized | ||
return src.global_id | ||
|
||
// By default, generate an ID from the registry index stringified | ||
var/default_id = "[src.registry_index]" | ||
src.global_id = default_id | ||
return default_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
GOAI/_datastructures/registries/economy/market_utilities.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
// Stores the 'reference' Utilities for Needs. | ||
// | ||
// Various factions may value things higher or lower than these reference points. | ||
// If it's lower, then they need to be able to use this reference point to price sale goods correctly, | ||
// otherwise they will undercut themselves. This is particularly pertinent to produced goods. | ||
// | ||
// This is a bit of a hack, but you can handwave it as actors knowing the market more or less. | ||
// It helps design-wise to provide a somewhat sane stable standard. | ||
// | ||
// You may wonder why can't we simply standardize default utilities to '1' or something. | ||
// The answer is - not all goods have positive marginal Utility, so this is more flexible. | ||
*/ | ||
|
||
# ifdef GOAI_LIBRARY_FEATURES | ||
var/global/list/reference_market_utilities | ||
# endif | ||
# ifdef GOAI_SS13_SUPPORT | ||
GLOBAL_LIST_EMPTY(reference_market_utilities) | ||
# endif | ||
|
||
|
||
#define DEFAULT_MARKET_UTILITY_DB_FP GOAI_DATA_PATH("reference_utilities.json") | ||
|
||
|
||
/proc/InitReferenceUtilitiesDb(var/filepath_override = null, var/force = FALSE) | ||
if(!(isnull(GOAI_LIBBED_GLOB_ATTR(reference_market_utilities)) || force)) | ||
return TRUE | ||
|
||
var/db_filepath = isnull(filepath_override) ? DEFAULT_MARKET_UTILITY_DB_FP : filepath_override | ||
READ_JSON_FILE_CACHED(db_filepath, GOAI_LIBBED_GLOB_ATTR(reference_market_utilities)) | ||
to_world_log("New ReferenceUtilitiesDB is [GOAI_LIBBED_GLOB_ATTR(reference_market_utilities) ? json_encode(GOAI_LIBBED_GLOB_ATTR(reference_market_utilities)) : "uninitialized"] from [db_filepath]") | ||
|
||
if(!GOAI_LIBBED_GLOB_ATTR(reference_market_utilities)) | ||
GOAI_LIBBED_GLOB_ATTR(reference_market_utilities) = null | ||
|
||
return TRUE | ||
|
||
|
||
#define MARKET_UTILITIES_TABLE_LAZY_INIT(_Unused) if(isnull(GOAI_LIBBED_GLOB_ATTR(reference_market_utilities)) || !islist(GOAI_LIBBED_GLOB_ATTR(reference_market_utilities))) { InitReferenceUtilitiesDb() } |
Oops, something went wrong.