Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fira committed Nov 16, 2023
1 parent b642244 commit cd273c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion code/game/gamemodes/cm_initialize.dm
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ Additional game mode variables.

///Updates the [/datum/game_mode/var/gear_scale] multiplier based on joining marines in [/datum/game_mode/var/latejoin_tally]
/datum/game_mode/proc/update_gear_scale()
var/new_gear_scale = round(gear_scale_init + latejoin_tally / MARINE_GEAR_SCALING_NORMAL)
var/new_gear_scale = gear_scale_init + latejoin_tally / MARINE_GEAR_SCALING_NORMAL
if(new_gear_scale > gear_scale)
for(var/obj/structure/machinery/cm_vending/sorted/vendor as anything in GLOB.cm_vending_vendors)
vendor.update_dynamic_stock(new_gear_scale)
Expand Down
9 changes: 6 additions & 3 deletions code/game/machinery/vending/cm_vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -854,14 +854,17 @@ GLOBAL_LIST_EMPTY(vending_products)
for(var/list/vendspec in dynamic_stock_multipliers)
var/list/metadata = dynamic_stock_multipliers[vendspec]
var/multiplier = metadata[1] // How much do we multiply scales by
var/previous_max_amount = metadata[2] // How many we would have total at old scale
var/previous_max_amount = metadata[2] // How many we already handed out at old scale
var/projected_max_amount = round(new_scale * multiplier) // How much we would have had total now in total
if(projected_max_amount > previous_max_amount)
vendspec[2] += (projected_max_amount - previous_max_amount) // Add missing ones!
var/amount_to_add = round(projected_max_amount - previous_max_amount) // Rounding just in case
if(amount_to_add > 0)
metadata[2] += amount_to_add
vendspec[2] += amount_to_add
update_derived_ammo_and_boxes_on_add(vendspec)

///this proc, well, populates product list based on roundstart amount of players
///do not rely on scale here if you use VEND_STOCK_DYNAMIC because it's already taken into account
///this is here for historical reasons and should ONLY be called by populate_product_list_and_boxes if you want dynamic stocks and ammoboxes to work
/obj/structure/machinery/cm_vending/sorted/proc/populate_product_list(scale)
return

Expand Down

0 comments on commit cd273c2

Please sign in to comment.