Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Red-byte3D authored Dec 8, 2023
2 parents df7d42c + 078794c commit d889dac
Show file tree
Hide file tree
Showing 77 changed files with 2,442 additions and 2,244 deletions.
4 changes: 2 additions & 2 deletions code/__DEFINES/mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
//=================================================


//Number of marine players against which the Marine's gear scales
#define MARINE_GEAR_SCALING_NORMAL 30
/// Number of weighted marine players for 1 gear_scale. gear_scale is clamped to 1 minimum
#define MARINE_GEAR_SCALING_NORMAL 50

#define RESOURCE_NODE_SCALE 95 //How many players minimum per extra set of resource nodes
#define RESOURCE_NODE_QUANTITY_PER_POP 11 //How many resources total per pop
Expand Down
17 changes: 17 additions & 0 deletions code/__DEFINES/supply.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//We use the cost to determine the spawn chance this equals out the crates that spawn later in the round.
#define ASRS_HIGHEST_WEIGHT 0 //warning this weight wont change.
#define ASRS_VERY_HIGH_WEIGHT 5
#define ASRS_HIGH_WEIGHT 15
#define ASRS_MEDIUM_WEIGHT 25
#define ASRS_LOW_WEIGHT 35
#define ASRS_VERY_LOW_WEIGHT 50
#define ASRS_LOWEST_WEIGHT 100

// List of pools of supply packs, rolled individually by the ASRS system
/// Main pool of ASRS supplies, dispensing military supplies such as ammo
#define ASRS_POOL_MAIN "Main"
/// Secondary ASRS pool dispening food related items for MessTech
#define ASRS_POOL_FOOD "Food"

/// Divider to the amount of xeno forces on the planet to ASRS provided crates. It is used as such sqrt(xenos/ASRS_XENO_CRATES_DIVIDER))
#define ASRS_XENO_CRATES_DIVIDER 4
3 changes: 3 additions & 0 deletions code/__DEFINES/vendors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
//Whether or not to load ammo boxes depending on ammo loaded into the vendor
//Only relevant in big vendors, like Requisitions or Squad Prep
#define VEND_LOAD_AMMO_BOXES (1<<9)
/// Vendors with this flag will fill retroactively based on latejoining players,
/// and expect a scale multiplier instead of amount of items
#define VEND_STOCK_DYNAMIC (1<<10)

// Redemption Tokens
#define VEND_TOKEN_ENGINEER "Engineer"
Expand Down
2 changes: 2 additions & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,8 @@ DEFINE_BITFIELD(vend_flags, list(
"VEND_INSTANCED_CATEGORY" = VEND_INSTANCED_CATEGORY,
"VEND_FACTION_THEMES" = VEND_FACTION_THEMES,
"VEND_USE_VENDOR_FLAGS" = VEND_USE_VENDOR_FLAGS,
"VEND_LOAD_AMMO_BOXES" = VEND_LOAD_AMMO_BOXES,
"VEND_STOCK_DYNAMIC" = VEND_STOCK_DYNAMIC
))

DEFINE_BITFIELD(vehicle_flags, list(
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ SUBSYSTEM_DEF(ticker)
if(GLOB.round_statistics)
to_chat_spaced(world, html = FONT_SIZE_BIG(SPAN_ROLE_BODY("<B>Welcome to [GLOB.round_statistics.round_name]</B>")))

GLOB.supply_controller.process() //Start the supply shuttle regenerating points -- TLE
GLOB.supply_controller.start_processing()

for(var/i in GLOB.closet_list) //Set up special equipment for lockers and vendors, depending on gamemode
var/obj/structure/closet/C = i
Expand Down
146 changes: 62 additions & 84 deletions code/datums/ASRS.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,138 +2,116 @@
//These are non orderable packs that get in automaticly though the ARSR system.
//Note these should never show up to buy and some will only show up later in the round.
//BIG NOTE: Don't add living things to crates, that's bad, it will break the shuttle.
//We use the cost to determine the spawn chance this equals out the crates that spawn later in the round.
#define ASRS_HIGHEST_WEIGHT 0 //warning this weight wont change.
#define ASRS_VERY_HIGH_WEIGHT 5
#define ASRS_HIGH_WEIGHT 15
#define ASRS_MEDIUM_WEIGHT 25
#define ASRS_LOW_WEIGHT 35
#define ASRS_VERY_LOW_WEIGHT 50
#define ASRS_LOWEST_WEIGHT 100


/datum/supply_packs_asrs
/// How likely we are to select this pack over others
var/cost = ASRS_MEDIUM_WEIGHT
/// Which pool of ASRS automatically dispensed supplies this belongs to
var/pool = ASRS_POOL_MAIN
/// What supply pack would this dispense
var/datum/supply_packs/reference_package

//===================================
// Rounds
/datum/supply_packs/ammo_rounds_box_rifle/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_rounds_box_rifle
reference_package = /datum/supply_packs/ammo_rounds_box_rifle
cost = ASRS_MEDIUM_WEIGHT

/datum/supply_packs/ammo_rounds_box_rifle_ap/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_rounds_box_rifle_ap
reference_package = /datum/supply_packs/ammo_rounds_box_rifle_ap
cost = ASRS_LOW_WEIGHT

/datum/supply_packs/ammo_rounds_box_xm88/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_rounds_box_xm88
reference_package = /datum/supply_packs/ammo_rounds_box_xm88
cost = ASRS_LOW_WEIGHT

//===================================
// Magazines
/datum/supply_packs/gun/ammo_hpr/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/gun/ammo_hpr
reference_package = /datum/supply_packs/ammo_hpr
cost = ASRS_LOWEST_WEIGHT

/datum/supply_packs/ammo_m4a3_mag_box/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_m4a3_mag_box
reference_package = /datum/supply_packs/ammo_m4a3_mag_box
cost = ASRS_LOW_WEIGHT

/datum/supply_packs/ammo_m4a3_mag_box_ap/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_m4a3_mag_box_ap
reference_package = /datum/supply_packs/ammo_m4a3_mag_box_ap
cost = ASRS_VERY_LOW_WEIGHT

/datum/supply_packs/ammo_mag_box/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_mag_box
reference_package = /datum/supply_packs/ammo_mag_box
cost = ASRS_VERY_LOW_WEIGHT

/datum/supply_packs/ammo_mag_box_ap/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_mag_box_ap
reference_package = /datum/supply_packs/ammo_mag_box_ap

/datum/supply_packs/ammo_m4ra_mag_box/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_m4ra_mag_box
reference_package = /datum/supply_packs/ammo_m4ra_mag_box
cost = ASRS_VERY_LOW_WEIGHT

/datum/supply_packs/ammo_m4ra_mag_box_ap/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_m4ra_mag_box_ap
reference_package = /datum/supply_packs/ammo_m4ra_mag_box_ap

/datum/supply_packs/ammo_shell_box/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_shell_box
reference_package = /datum/supply_packs/ammo_shell_box
cost = ASRS_VERY_LOW_WEIGHT

/datum/supply_packs/ammo_shell_box_buck/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_shell_box_buck
reference_package = /datum/supply_packs/ammo_shell_box_buck
cost = ASRS_VERY_LOW_WEIGHT

/datum/supply_packs/ammo_shell_box_flechette/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_shell_box_flechette
reference_package = /datum/supply_packs/ammo_shell_box_flechette
cost = ASRS_VERY_LOW_WEIGHT

/datum/supply_packs/ammo_smartgun/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_smartgun
reference_package = /datum/supply_packs/ammo_smartgun

/datum/supply_packs/ammo_napalm/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_napalm
reference_package = /datum/supply_packs/ammo_napalm
cost = ASRS_VERY_LOW_WEIGHT

/datum/supply_packs/ammo_napalm_gel/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_napalm_gel
reference_package = /datum/supply_packs/ammo_napalm_gel
cost = ASRS_VERY_LOW_WEIGHT

/datum/supply_packs/ammo_flamer_mixed/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_flamer_mixed
reference_package = /datum/supply_packs/ammo_flamer_mixed
cost = ASRS_VERY_LOW_WEIGHT

//===================================
// Mortar ammo
/datum/supply_packs/ammo_mortar_he/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_mortar_he
reference_package = /datum/supply_packs/ammo_mortar_he

/datum/supply_packs/ammo_mortar_incend/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_mortar_incend
reference_package = /datum/supply_packs/ammo_mortar_incend

/datum/supply_packs/ammo_mortar_flare/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/ammo_mortar_flare
reference_package = /datum/supply_packs/ammo_mortar_flare

//===================================
// Misc supplies
/datum/supply_packs/flares/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/flares
reference_package = /datum/supply_packs/flares
cost = ASRS_LOW_WEIGHT

/datum/supply_packs/mre/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/mre
reference_package = /datum/supply_packs/mre
cost = ASRS_VERY_LOW_WEIGHT

/datum/supply_packs/flashlights/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/flashlights
reference_package = /datum/supply_packs/flashlights
cost = ASRS_VERY_LOW_WEIGHT

/datum/supply_packs/batteries/asrs
buyable = 0
group = "ASRS"
/datum/supply_packs_asrs/batteries
reference_package = /datum/supply_packs/batteries
cost = ASRS_VERY_LOW_WEIGHT

/datum/supply_packs/ingredient/asrs
buyable = 0
group = "ASRS"
cost = ASRS_LOW_WEIGHT
// ============================
// FOOD POOL - for Mess Tech gradual supplies throughout the round
/datum/supply_packs_asrs/ingredient
reference_package = /datum/supply_packs/ingredient
pool = ASRS_POOL_FOOD
2 changes: 2 additions & 0 deletions code/datums/helper_datums/getrev.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ GLOBAL_DATUM_INIT(revdata, /datum/getrev, new)
var/datum/tgs_revision_information/test_merge/tm = line
var/cm = tm.head_commit
var/details = ": '" + html_encode(tm.title) + "' by " + html_encode(tm.author) + " at commit " + html_encode(copytext_char(cm, 1, 11))
if(details && findtext(details, "\[s\]") && (!usr || !usr.client.admin_holder))
continue
. += "<a href=\"[CONFIG_GET(string/githuburl)]/pull/[tm.number]\">#[tm.number][details]</a><br>"

/client/verb/showrevinfo()
Expand Down
1 change: 0 additions & 1 deletion code/datums/supply_packs/_supply_packs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
var/group = null
var/buyable = 1 ///Can this pack be bought? These packs don't show up at all - they have to be spawned externally (fe: DEFCON ASRS)
var/randomised_num_contained = 0 //Randomly picks X of items out of the contains list instead of using all.
var/iteration_needed = 0
/// How many W-Y dollars are deducted from the supply controller. Only use for contraband.
var/dollar_cost = 0
/// How much "heat" this crate adds, too much heat will send an investigation. Only use for contraband.
Expand Down
6 changes: 0 additions & 6 deletions code/datums/supply_packs/operations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
containername = "OB Ammo Crate (Incendiary x2)"
buyable = 0
group = "Operations"
iteration_needed = null

/datum/supply_packs/ob_explosive
contains = list(
Expand All @@ -48,7 +47,6 @@
containername = "OB Ammo Crate (HE x2)"
buyable = 0
group = "Operations"
iteration_needed = null

/datum/supply_packs/ob_cluster
contains = list(
Expand All @@ -72,7 +70,6 @@
containername = "OB Ammo Crate (Cluster x2)"
buyable = 0
group = "Operations"
iteration_needed = null

/datum/supply_packs/telecommsparts
name = "Replacement Telecommunications Parts"
Expand All @@ -99,15 +96,13 @@
containertype = /obj/structure/machinery/nuclearbomb
buyable = 0
group = "Operations"
iteration_needed = null

/datum/supply_packs/technuclearbomb
name = "Encrypted Operational Nuke"
cost = 0
containertype = /obj/structure/machinery/nuclearbomb/tech
buyable = 0
group = "Operations"
iteration_needed = null

/datum/supply_packs/spec_kits
name = "Weapons Specialist Kits"
Expand All @@ -122,4 +117,3 @@
containername = "weapons specialist kits crate"
buyable = 0
group = "Operations"
iteration_needed = null
46 changes: 39 additions & 7 deletions code/game/gamemodes/cm_initialize.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ Additional game mode variables.
var/list/monkey_types = list() //What type of monkeys do we spawn
var/latejoin_tally = 0 //How many people latejoined Marines
var/latejoin_larva_drop = LATEJOIN_MARINES_PER_LATEJOIN_LARVA //A larva will spawn in once the tally reaches this level. If set to 0, no latejoin larva drop
/// Amount of latejoin_tally already awarded as larvas
var/latejoin_larva_used = 0
/// Multiplier to the amount of marine gear, current value as calculated with modifiers
var/gear_scale = 1
/// Multiplier to the amount of marine gear, maximum reached value for
var/gear_scale_max = 1

//Role Authority set up.
/// List of role titles to override to different roles when starting game
Expand Down Expand Up @@ -914,23 +920,49 @@ Additional game mode variables.
//We do NOT want to initilialize the gear before everyone is properly spawned in
/datum/game_mode/proc/initialize_post_marine_gear_list()
var/scale = get_scaling_value()
init_gear_scale()

//Set up attachment vendor contents related to Marine count
for(var/i in GLOB.cm_vending_vendors)
var/obj/structure/machinery/cm_vending/sorted/CVS = i
CVS.populate_product_list_and_boxes(scale)
CVS.populate_product_list_and_boxes(gear_scale)

//Scale the amount of cargo points through a direct multiplier
GLOB.supply_controller.points = round(GLOB.supply_controller.points * scale)
GLOB.supply_controller.points += round(GLOB.supply_controller.points_scale * gear_scale)

/datum/game_mode/proc/get_scaling_value()
///Returns a multiplier to the amount of gear that is to be distributed roundstart, stored in [/datum/game_mode/var/gear_scale]
/datum/game_mode/proc/init_gear_scale()
//We take the number of marine players, deduced from other lists, and then get a scale multiplier from it, to be used in arbitrary manners to distribute equipment
//This might count players who ready up but get kicked back to the lobby
var/marine_pop_size = length(GLOB.alive_human_list)
var/marine_pop_size = 0
var/uscm_personnel_count = 0
for(var/mob/living/carbon/human/human as anything in GLOB.alive_human_list)
if(human.faction == FACTION_USCM)
uscm_personnel_count++
var/datum/job/job = GET_MAPPED_ROLE(human.job)
marine_pop_size += GLOB.RoleAuthority.calculate_role_weight(job)

//This gives a decimal value representing a scaling multiplier. Cannot go below 1
return max(marine_pop_size / MARINE_GEAR_SCALING_NORMAL, 1)
gear_scale = max(marine_pop_size / MARINE_GEAR_SCALING_NORMAL, 1)
gear_scale_max = gear_scale
log_debug("SUPPLY: Game start detected [marine_pop_size] weighted marines (out of [uscm_personnel_count]/[length(GLOB.alive_human_list)] USCM humans), resulting in gear_scale = [gear_scale]")
return gear_scale

///Updates the [/datum/game_mode/var/gear_scale] multiplier based on joining and cryoing marines
/datum/game_mode/proc/update_gear_scale(delta)
// Magic inverse function that guarantees marines still get good supplies for latejoins within first ~30 minutes but stalls starting 2 hours or so
gear_scale += delta * (0.25 + 0.75 / (1 + ROUND_TIME / 20000)) / MARINE_GEAR_SCALING_NORMAL
var/gear_delta = gear_scale - gear_scale_max
if(gear_delta > 0)
gear_scale_max = gear_scale
for(var/obj/structure/machinery/cm_vending/sorted/vendor as anything in GLOB.cm_vending_vendors)
vendor.update_dynamic_stock(gear_scale_max)
GLOB.supply_controller.points += round(gear_delta * GLOB.supply_controller.points_scale)

/// Updates [var/latejoin_tally] and [var/gear_scale] based on role weights of latejoiners/cryoers. Delta is the amount of role positions added/removed
/datum/game_mode/proc/latejoin_update(role, delta = 1)
var/weight = GLOB.RoleAuthority.calculate_role_weight(role)
latejoin_tally += weight * delta
update_gear_scale(weight * delta)

// for the toolbox
/datum/game_mode/proc/end_round_message()
Expand Down
2 changes: 2 additions & 0 deletions code/game/jobs/role_authority.dm
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou
* survivors and the number of roundstart Squad Rifleman slots.
*/
/datum/authority/branch/role/proc/calculate_role_weight(datum/job/J)
if(!J)
return 0
if(GLOB.ROLES_MARINES.Find(J.title))
return 1
if(GLOB.ROLES_XENO.Find(J.title))
Expand Down
Loading

0 comments on commit d889dac

Please sign in to comment.