Skip to content

Commit

Permalink
rapid decompression
Browse files Browse the repository at this point in the history
  • Loading branch information
InsightfulParasite committed Dec 22, 2024
1 parent 759da4f commit 4d068f7
Show file tree
Hide file tree
Showing 12 changed files with 226 additions and 294 deletions.
68 changes: 1 addition & 67 deletions code/__DEFINES/text.dm
Original file line number Diff line number Diff line change
@@ -1,69 +1,3 @@
/// Does 4 spaces. Used as a makeshift tabulator.
#define FOURSPACES "    "

/// Standard maptext
/// Prepares a text to be used for maptext. Use this so it doesn't look hideous.
#define MAPTEXT(text) {"<span class='maptext'>[##text]</span>"}

/**
* Pixel-perfect scaled fonts for use in the MAP element as defined in skin.dmf
*
* Four sizes to choose from, use the sizes as mentioned below.
* Between the variations and a step there should be an option that fits your use case.
* BYOND uses pt sizing, different than px used in TGUI. Using px will make it look blurry due to poor antialiasing.
*
* Default sizes are prefilled in the macro for ease of use and a consistent visual look.
* To use a step other than the default in the macro, specify it in a span style.
* For example: MAPTEXT_PIXELLARI("<span style='font-size: 24pt'>Some large maptext here</span>")
*/
/// Large size (ie: context tooltips) - Size options: 12pt 24pt.
#define MAPTEXT_PIXELLARI(text) {"<span style='font-family: \"Pixellari\"; font-size: 12pt; -dm-text-outline: 1px black'>[##text]</span>"}

/// Standard size (ie: normal runechat) - Size options: 6pt 12pt 18pt.
#define MAPTEXT_GRAND9K(text) {"<span style='font-family: \"Grand9K Pixel\"; font-size: 6pt; -dm-text-outline: 1px black'>[##text]</span>"}

/// Small size. (ie: context subtooltips, spell delays) - Size options: 12pt 24pt.
#define MAPTEXT_TINY_UNICODE(text) {"<span style='font-family: \"TinyUnicode\"; font-size: 12pt; line-height: 0.75; -dm-text-outline: 1px black'>[##text]</span>"}

/// Smallest size. (ie: whisper runechat) - Size options: 6pt 12pt 18pt.
#define MAPTEXT_SPESSFONT(text) {"<span style='font-family: \"Spess Font\"; font-size: 6pt; line-height: 1.4; -dm-text-outline: 1px black'>[##text]</span>"}

/**
* Prepares a text to be used for maptext, using a variable size font.
*
* More flexible but doesn't scale pixel perfect to BYOND icon resolutions.
* (May be blurry.) Can use any size in pt or px.
*
* You MUST Specify the size when using the macro
* For example: MAPTEXT_VCR_OSD_MONO("<span style='font-size: 24pt'>Some large maptext here</span>")
*/
/// Prepares a text to be used for maptext, using a variable size font.
/// Variable size font. More flexible but doesn't scale pixel perfect to BYOND icon resolutions. (May be blurry.) Can use any size in pt or px.
#define MAPTEXT_VCR_OSD_MONO(text) {"<span style='font-family: \"VCR OSD Mono\"'>[##text]</span>"}

/// Macro from Lummox used to get height from a MeasureText proc.
/// resolves the MeasureText() return value once, then resolves the height, then sets return_var to that.
#define WXH_TO_HEIGHT(measurement, return_var) \
do { \
var/_measurement = measurement; \
return_var = text2num(copytext(_measurement, findtextEx(_measurement, "x") + 1)); \
} while(FALSE);

/// Removes characters incompatible with file names.
#define SANITIZE_FILENAME(text) (GLOB.filename_forbidden_chars.Replace(text, ""))

/// Simply removes the < and > characters, and limits the length of the message.
#define STRIP_HTML_SIMPLE(text, limit) (GLOB.angular_brackets.Replace(copytext(text, 1, limit), ""))

/// Removes everything enclose in < and > inclusive of the bracket, and limits the length of the message.
#define STRIP_HTML_FULL(text, limit) (GLOB.html_tags.Replace(copytext(text, 1, limit), ""))

/**
* stuff like `copytext(input, length(input))` will trim the last character of the input,
* because DM does it so it copies until the char BEFORE the `end` arg, so we need to bump `end` by 1 in these cases.
*/
#define PREVENT_CHARACTER_TRIM_LOSS(integer) (integer + 1)

/// BYOND's string procs don't support being used on datum references (as in it doesn't look for a name for stringification)
/// We just use this macro to ensure that we will only pass strings to this BYOND-level function without developers needing to really worry about it.
#define LOWER_TEXT(thing) lowertext(UNLINT("[thing]"))
Expand All @@ -73,4 +7,4 @@

#define ALPHABET list("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z")
#define VOWELS list("a", "e", "i", "o", "u")
#define CONSONANTS (ALPHABET - VOWELS)
#define CONSONANTS list("b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z")
4 changes: 0 additions & 4 deletions code/__DEFINES/~lobotomy_defines/lore_and_theme.dm

This file was deleted.

123 changes: 123 additions & 0 deletions code/controllers/subsystem/economy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,21 @@ SUBSYSTEM_DEF(economy)
///The modifier multiplied to the value of cargo pack prices.
var/pack_price_modifier = 1
var/market_crashing = FALSE
//STOCK MARKET VARS
var/list/stocks = list()
var/list/balances = list()
var/list/last_read = list()
var/list/stock_brokers = list()
var/list/logs
var/list/frozen_accounts = list()


/datum/controller/subsystem/economy/Initialize(timeofday)
var/budget_to_hand_out = round(budget_pool / department_accounts.len)
for(var/A in department_accounts)
new /datum/bank_account/department(A, budget_to_hand_out)
generateBrokers()
generateStocks()
return ..()

/datum/controller/subsystem/economy/Recover()
Expand All @@ -66,6 +76,9 @@ SUBSYSTEM_DEF(economy)
station_target = max(round(temporary_total / max(bank_accounts_by_id.len * 2, 1)) + station_target_buffer, 1)
// if(!market_crashing)
// price_update() Fucks up Workshop, I'll figure out how to make it override soon:tm: - Kirie
for(var/stock in stocks)
var/datum/stock/S = stock
S.process()

/**
* Handy proc for obtaining a department's bank account, given the department ID, AKA the define assigned for what department they're under.
Expand Down Expand Up @@ -113,3 +126,113 @@ SUBSYSTEM_DEF(economy)
return 1
inflation_value = max(round(((station_total / bank_accounts_by_id.len) / station_target), 0.1), 1.0)
return inflation_value

//STOCK MARKET PROCS
/datum/controller/subsystem/economy/proc/list_frozen()
for(var/A in frozen_accounts)
to_chat(usr, "[A]: [length(frozen_accounts[A])] borrows")

/datum/controller/subsystem/economy/proc/balanceLog(whose, net)
if (!(whose in balances))
balances[whose] = net
else
balances[whose] += net

/datum/controller/subsystem/economy/proc/generateBrokers()
stock_brokers = list()
var/list/fnames = list("Goldman", "Edward", "James", "Luis", "Alexander", "Walter", "Eugene", "Mary", "Morgan", "Jane", "Elizabeth", "Xavier", "Hayden", "Samuel", "Lee")
var/list/names = list("Johnson", "Rothschild", "Sachs", "Stanley", "Hepburn", "Brown", "McColl", "Fischer", "Edwards", "Becker", "Witter", "Walker", "Lambert", "Smith", "Montgomery", "Lynch", "Roosevelt", "Lehman")
var/list/first = list("The", "First", "Premier", "Finest", "Prime")
var/list/company = list("Investments", "Securities", "Corporation", "Bank", "Brokerage", "& Co.", "Brothers", "& Sons", "Investement Firm", "Union", "Partners", "Capital", "Trade", "Holdings")
for(var/i in 1 to 5)
var/pname = ""
switch (rand(1,5))
if (1)
pname = "[prob(10) ? pick(first) + " " : null][pick(names)] [pick(company)]"
if (2)
pname = "[pick(names)] & [pick(names)][prob(25) ? " " + pick(company) : null]"
if (3)
pname = "[prob(45) ? pick(first) + " " : null] District [rand(4,24)] [pick(company)]"
if (4)
pname = "[prob(10) ? "The " : null][pick(names)] District [rand(4,24)] [pick(company)]"
if (5)
pname = "[prob(10) ? "The " : null][pick(fnames)] [pick(names)][prob(10) ? " " + pick(company) : null]"
if (pname in stock_brokers)
i--
continue
stock_brokers += pname

/datum/controller/subsystem/economy/proc/generateDesignation(name)
if (length(name) <= 4)
return uppertext(name)
var/list/w = splittext(name, " ")
if (w.len >= 2)
var/d = ""
for(var/i in 1 to min(5, w.len))
d += uppertext(ascii2text(text2ascii(w[i], 1)))
return d
else
var/d = uppertext(ascii2text(text2ascii(name, 1)))
for(var/i in 2 to length(name))
if (prob(100 / i))
d += uppertext(ascii2text(text2ascii(name, i)))
return d

/datum/controller/subsystem/economy/proc/generateStocks(amt = 15)
var/list/fruits = list("Banana", "Mimana", "Watermelon", "Ambrosia", "Pomegranate", "Reishi", "Papaya", "Mango", "Tomato", "Conkerberry", "Wood", "Lychee", "Mandarin", "Harebell", "Pumpkin", "Rhubarb", "Tamarillo", "Yantok", "Ziziphus", "Oranges", "Gatfruit", "Daisy", "Kudzu")
var/list/tech_prefix = list("Nano", "Cyber", "Funk", "Astro", "Fusion", "Tera", "Exo", "Star", "Virtual", "Plasma", "Robust", "Bit", "Future", "Hugbox", "Carbon", "Nerf", "Buff", "Nova", "Space", "Meta", "Cyber")
var/list/tech_short = list("soft", "tech", "prog", "tec", "tek", "ware", "", "gadgets", "nics", "tric", "trasen", "tronic", "coin")
var/list/random_nouns = list("Johnson", "Cluwne", "General", "Specific", "Master", "King", "Queen", "Table", "Rupture", "Dynamic", "Massive", "Mega", "Giga", "Certain", "Singulo", "State", "National", "International", "Interplanetary", "Sector", "Planet", "Burn", "Robust", "Exotic", "Solar", "Lunar", "Chelp", "Corgi", "Lag", "Lizard")
var/list/company = list("Company", "Factory", "Incorporated", "Industries", "Group", "Consolidated", "GmbH", "LLC", "Ltd", "Inc.", "Association", "Limited", "Software", "Technology", "Programming", "IT Group", "Electronics", "Nanotechnology", "Farms", "Stores", "Mobile", "Motors", "Electric", "Designs", "Energy", "Pharmaceuticals", "Communications", "Wholesale", "Holding", "Health", "Machines", "Astrotech", "Gadgets", "Kinetics")
for (var/i = 1, i <= amt, i++)
var/datum/stock/S = new
var/sname = ""
switch (rand(1,6))
if(1)
if(sname == "" || sname == "FAG") // honestly it's a 0.6% chance per round this happens - or once in 166 rounds - so i'm accounting for it before someone yells at me
sname = "[CONSONANTS][VOWELS][CONSONANTS]"
if (2)
sname = "[pick(tech_prefix)][pick(tech_short)][prob(20) ? " " + pick(company) : null]"
if (3 to 4)
var/fruit = pick(fruits)
fruits -= fruit
sname = "[prob(10) ? "The " : null][fruit][prob(40) ? " " + pick(company): null]"
if (5 to 6)
var/pname = pick(random_nouns)
random_nouns -= pname
switch (rand(1,3))
if (1)
sname = "[pname] & [pname]"
if (2)
sname = "[pname] [pick(company)]"
if (3)
sname = "[pname]"
S.name = sname
S.short_name = generateDesignation(S.name)
S.current_value = rand(10, 125)
var/dv = rand(10, 40) / 10
S.fluctuational_coefficient = prob(50) ? (1 / dv) : dv
S.average_optimism = rand(-10, 10) / 100
S.optimism = S.average_optimism + (rand(-40, 40) / 100)
S.current_trend = rand(-200, 200) / 10
S.last_trend = S.current_trend
S.disp_value_change = rand(-1, 1)
S.speculation = rand(-20, 20)
S.average_shares = round(rand(500, 10000) / 10)
S.outside_shareholders = rand(1000, 30000)
S.available_shares = rand(200000, 800000)
S.fluctuation_rate = rand(6, 20)
S.generateIndustry()
S.generateEvents()
stocks += S
last_read[S] = list()

/datum/controller/subsystem/economy/proc/add_log(log_type, user, company_name, stocks, shareprice, money)
var/datum/stock_log/L = new log_type
L.user_name = user
L.company_name = company_name
L.stocks = stocks
L.shareprice = shareprice
L.money = money
L.time = time2text(world.timeofday, "hh:mm")
logs += L
2 changes: 1 addition & 1 deletion code/controllers/subsystem/shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ SUBSYSTEM_DEF(shuttle)
//supply shuttle stuff
var/obj/docking_port/mobile/supply/supply
var/ordernum = 1 //order number given to next order
var/points = 5000 //number of trade-points we have
var/points = 500 //number of trade-points we have
var/centcom_message = "" //Remarks from CentCom on how well you checked the last order.
var/list/discoveredPlants = list() //Typepaths for unusual plants we've already sent CentCom, associated with their potencies

Expand Down
20 changes: 8 additions & 12 deletions code/modules/stock_market/articles.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* This is the code that generates the articles
* that tell you that your stock has plummeted.
*/
/proc/ucfirst(S)
return "[uppertext(ascii2text(text2ascii(S, 1)))][copytext(S, 2)]"

Expand All @@ -8,12 +12,6 @@
M += ucfirst(P)
return jointext(M, " ")

GLOBAL_LIST_EMPTY(FrozenAccounts)

/proc/list_frozen()
for(var/A in GLOB.FrozenAccounts)
to_chat(usr, "[A]: [length(GLOB.FrozenAccounts[A])] borrows")

/datum/article
var/headline = "Something big is happening"
var/subtitle = "Investors panic as stock market collapses"
Expand All @@ -29,7 +27,6 @@ GLOBAL_LIST_EMPTY(FrozenAccounts)
"buy" = list("buy!", "buy, buy, buy!", "get in now!", "ride the share value to the stars!"), \
"company" = list("company", "conglomerate", "enterprise", "venture"), \
"complete" = list("complete", "total", "absolute", "incredible"), \
"country" = LC_DISTRICT_LIST, \
"development" = list("development", "unfolding of events", "turn of events", "new shit"), \
"dip" = list("dip", "fall", "plunge", "decrease"), \
"excited" = list("excited", "euphoric", "exhilarated", "thrilled", "stimulated"), \
Expand All @@ -56,7 +53,7 @@ GLOBAL_LIST_EMPTY(FrozenAccounts)

/datum/article/New()
..()
if ((outlets.len && !prob(100 / (outlets.len + 1))) || !outlets.len)
if((outlets.len && !prob(100 / (outlets.len + 1))) || !outlets.len)
var/ON = generateOutletName()
if (!(ON in outlets))
outlets[ON] = list()
Expand All @@ -65,7 +62,7 @@ GLOBAL_LIST_EMPTY(FrozenAccounts)
outlet = pick(outlets)

var/list/authors = outlets[outlet]
if ((authors.len && !prob(100 / (authors.len + 1))) || !authors.len)
if((authors.len && !prob(100 / (authors.len + 1))) || !authors.len)
var/AN = generateAuthorName()
outlets[outlet] += AN
author = AN
Expand All @@ -75,13 +72,12 @@ GLOBAL_LIST_EMPTY(FrozenAccounts)
ticks = world.time

/datum/article/proc/generateOutletName()
var/list/locations = LC_DISTRICT_LIST
var/list/nouns = list("Post", "Herald", "Sun", "Tribune", "Mail", "Times", "Journal", "Report")
var/list/timely = list("Daily", "Hourly", "Weekly", "Biweekly", "Monthly", "Yearly")

switch(rand(1,2))
if (1)
return "The [pick(locations)] [pick(nouns)]"
return "The District [rand(4,24)] [pick(nouns)]"
if (2)
return "The [pick(timely)] [pick(nouns)]"

Expand All @@ -98,7 +94,7 @@ GLOBAL_LIST_EMPTY(FrozenAccounts)
var/ticksc = round(ticks/100)
ticksc = ticksc % 100000
var/ticksp = "[ticksc]"
for(var/cycle = 1 to 5)
for(var/cycle = 0 to 4)
ticksp = "0[ticksp]"
spacetime = "[ticksp][time2text(world.realtime, "MM")][time2text(world.realtime, "DD")][text2num(time2text(world.realtime, "YYYY"))+540]"

Expand Down
Loading

0 comments on commit 4d068f7

Please sign in to comment.