mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 17:52:36 +00:00
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may not be viewable. --> <!-- You can view Contributing.MD for a detailed description of the pull request process. --> ## About The Pull Request Renames SolFed/SolGov/Solar Goverment/Solar Federation to TerraGov/Terran Goverment <!-- Describe The Pull Request. Please be sure every change is documented or this can delay review and even discourage maintainers from merging your PR! --> <!-- Please make sure to actually test your PRs. If you have not tested your PR mention it. --> ## Why It's Good For The Game Requested by the loremins <!-- Argue for the merits of your changes and how they benefit the game, especially if they are controversial and/or far reaching. If you can't actually explain WHY what you are doing will improve the game, then it probably isn't good for the game in the first place. --> ## Proof Of Testing It compiles, nothing seems broken ingame (please TM this) <!-- Compile and run your code locally. Make sure it works. This is the place to show off your changes! We are not responsible for testing your features. --> </details> ## Changelog <!-- If your PR modifies aspects of the game that can be concretely observed by players or admins you should add a changelog. If your change does NOT meet this description, remove this section. Be sure to properly mark your PRs to prevent unnecessary GBP loss. You can read up on GBP and its effects on PRs in the tgstation guides for contributors. Please note that maintainers freely reserve the right to remove and add tags should they deem it appropriate. You can attempt to finagle the system all you want, but it's best to shoot for clear communication right off the bat. --> 🆑 add: Renames all mentions of the Solar Goverment/Federation to the Terran Goverment /🆑 <!-- Both 🆑's are required for the changelog to work! You can put your name to the right of the first 🆑 if you want to overwrite your GitHub username as author ingame. --> <!-- You can use multiple of the same prefix (they're only used for the icon ingame) and delete the unneeded ones. Despite some of the tags, changelogs should generally represent how a player might be affected by the changes rather than a summary of the PR's contents. --> <!-- By opening a pull request. You have read and understood the repository rules located on the main README.md on this project. --> --------- Co-authored-by: Waterpig <49160555+Majkl-J@users.noreply.github.com> Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
152 lines
5.6 KiB
Plaintext
152 lines
5.6 KiB
Plaintext
/datum/stock_market_event
|
|
/// The name of the event, used to describe it in the news.
|
|
var/name = "Stock Market Event!"
|
|
/// A list of company names to use for the event and the circumstance.
|
|
var/static/list/company_name = list(
|
|
"Nakamura Engineering",
|
|
"Robust Industries, LLC",
|
|
"MODular Solutions",
|
|
"TerraGov",
|
|
"Australicus Industrial Mining",
|
|
"Vey-Medical",
|
|
"Aussec Armory",
|
|
"Dreamland Robotics"
|
|
)
|
|
/// A list of strings selected from the event that's used to describe the event in the news.
|
|
var/list/circumstance = list()
|
|
/// What material is affected by the event?
|
|
var/datum/material/mat
|
|
/// Constant to multiply the original material value by to get the new minimum value, unless the material has a minimum override.
|
|
var/price_minimum = SHEET_MATERIAL_AMOUNT * 0.5
|
|
/// Constant to multiply the original material value by to get the new maximum value.
|
|
var/price_maximum = SHEET_MATERIAL_AMOUNT * 3
|
|
|
|
/// When this event is ongoing, what direction will the price trend in?
|
|
var/trend_value
|
|
/// When this event is triggered, for how long will its effects last?
|
|
var/trend_duration
|
|
|
|
/**
|
|
* When a new stock_market_event is created, this proc is called to set up the event if there's anything that needs to happen upon it starting.
|
|
* @param _mat The material that this event will affect.
|
|
*/
|
|
/datum/stock_market_event/proc/start_event(datum/material/mat)
|
|
if(istype(mat, /datum/material))
|
|
return FALSE
|
|
src.mat = mat
|
|
if(!isnull(trend_value))
|
|
SSstock_market.materials_trends[mat] = trend_value
|
|
if(!isnull(trend_duration))
|
|
SSstock_market.materials_trend_life[mat] = trend_duration
|
|
return TRUE
|
|
|
|
/**
|
|
* This proc is called every tick while the event is ongoing by SSstock_market.
|
|
*/
|
|
/datum/stock_market_event/proc/handle()
|
|
trend_duration--
|
|
if(trend_duration <= 0)
|
|
end_event()
|
|
return
|
|
|
|
/**
|
|
* When a stock_market_event is ended, this proc is called to apply any final effects and clean up anything that needs to be cleaned up.
|
|
*/
|
|
/datum/stock_market_event/proc/end_event()
|
|
SSstock_market.active_events -= src
|
|
qdel(src)
|
|
|
|
/**
|
|
* This proc is called to create a news string for the event, which is passed along to SSstock_market to be appended to the automatic newscaster messages.
|
|
*/
|
|
/datum/stock_market_event/proc/create_news()
|
|
var/temp_company = pick(company_name)
|
|
var/temp_circumstance = pick(circumstance)
|
|
SSstock_market.news_string += "<b>[name] [temp_company]</b> [temp_circumstance]<b>[mat.name].</b><br>"
|
|
|
|
|
|
/datum/stock_market_event/market_reset
|
|
name = "Market Reset!"
|
|
trend_value = MARKET_TREND_STABLE
|
|
trend_duration = 1
|
|
circumstance = list(
|
|
"was purchased by a private investment firm, resetting the price of ",
|
|
"restructured, resetting the price of ",
|
|
"has been rolled into a larger company, resetting the price of ",
|
|
)
|
|
|
|
/datum/stock_market_event/market_reset/start_event()
|
|
. = ..()
|
|
SSstock_market.materials_prices[mat] = (initial(mat.value_per_unit)) * SHEET_MATERIAL_AMOUNT
|
|
create_news()
|
|
|
|
/datum/stock_market_event/large_boost
|
|
name = "Large Boost!"
|
|
trend_value = MARKET_TREND_UPWARD
|
|
trend_duration = 4
|
|
circumstance = list(
|
|
"has just released a new product that raised the price of ",
|
|
"discovered a new valuable use for ",
|
|
"has produced a report that raised the price of ",
|
|
)
|
|
|
|
/datum/stock_market_event/large_boost/start_event()
|
|
. = ..()
|
|
var/price_units = SSstock_market.materials_prices[mat]
|
|
SSstock_market.materials_prices[mat] += round(gaussian(price_units, price_units * 0.15))
|
|
SSstock_market.materials_prices[mat] = clamp(SSstock_market.materials_prices[mat], price_minimum * mat.value_per_unit, price_maximum * mat.value_per_unit)
|
|
create_news()
|
|
|
|
/datum/stock_market_event/large_drop
|
|
name = "Large Drop!"
|
|
trend_value = MARKET_TREND_DOWNWARD
|
|
trend_duration = 4
|
|
circumstance = list(
|
|
"'s latest product has seen major controversy, and resulted in a price drop for ",
|
|
"has been hit with a major lawsuit, resulting in a price drop for ",
|
|
"has produced a report that lowered the price of ",
|
|
)
|
|
|
|
/datum/stock_market_event/large_drop/start_event()
|
|
. = ..()
|
|
var/price_units = SSstock_market.materials_prices[mat]
|
|
SSstock_market.materials_prices[mat] -= round(gaussian(price_units * 1.5, price_units * 0.15))
|
|
SSstock_market.materials_prices[mat] = clamp(SSstock_market.materials_prices[mat], price_minimum * mat.value_per_unit, price_maximum * mat.value_per_unit)
|
|
create_news()
|
|
|
|
/datum/stock_market_event/hotcakes
|
|
name = "Selling like Hotcakes!"
|
|
trend_value = MARKET_TREND_UPWARD
|
|
trend_duration = 1
|
|
circumstance = list(
|
|
"has just released a new product that is dominating the market for ",
|
|
"is hitting it big! Dramatically stocking and raising the price of ",
|
|
", in a surprise move, monopolized supply and has raised the price of ",
|
|
)
|
|
|
|
/datum/stock_market_event/hotcakes/start_event()
|
|
. = ..()
|
|
SSstock_market.materials_prices[mat] = round(price_maximum * mat.value_per_unit)
|
|
create_news()
|
|
|
|
/datum/stock_market_event/lockdown
|
|
name = "Lockdown!"
|
|
trend_value = MARKET_TREND_DOWNWARD
|
|
trend_duration = 2
|
|
circumstance = list(
|
|
"is being investigated by the Galactic Trade Commission, resulting in a halt of trade for ",
|
|
", in a stunning move, has been embargoed by TerraGov, resulting in a halt of trade of ",
|
|
)
|
|
|
|
/datum/stock_market_event/lockdown/handle()
|
|
. = ..()
|
|
SSstock_market.materials_quantity[mat] = 0 //Force the material to be unavailable.
|
|
|
|
/datum/stock_market_event/lockdown/end_event()
|
|
. = ..()
|
|
SSstock_market.materials_quantity[mat] = initial(mat.tradable_base_quantity) //Force the material to be available again.
|
|
SSstock_market.materials_prices[mat] = initial(mat.value_per_unit) * SHEET_MATERIAL_AMOUNT //Force the price to be reset once the lockdown is over.
|
|
create_news()
|
|
|
|
|