@@ -28,14 +28,14 @@ SUBSYSTEM_DEF(traitor)
2828
2929 // / The coefficient multiplied by the current_global_progression for new joining traitors to calculate their progression
3030 var /newjoin_progression_coeff = 1
31- // / The current progression that all traitors should be at in the round, you can't have less than this
31+ // / The current progression that all traitors should be at in the round
3232 var /current_global_progression = 0
33- // / The current uplink handlers being managed
33+ // / The amount of deviance from the current global progression before you start getting 2x the current scaling or no scaling at all
3434
3535 // MASSMETA ADDDITION START (re_traitorsecondary)
3636
3737 var /list /datum/uplink_handler/uplink_handlers = list ()
38- // / The current scaling per minute of progression.
38+ // / The current scaling per minute of progression. Has a maximum value of 1 MINUTES.
3939 var /current_progression_scaling = 1 MINUTES
4040 // / Used to handle the probability of getting an objective.
4141 var /datum /traitor_category_handler/category_handler
@@ -72,13 +72,26 @@ SUBSYSTEM_DEF(traitor)
7272/ datum / controller/ subsystem/ traitor/ fire(resumed)
7373 var /previous_progression = current_global_progression
7474 current_global_progression = (STATION_TIME_PASSED ()) * CONFIG_GET (number/ traitor_scaling_multiplier)
75- var /progression_increment = current_global_progression - previous_progression
7675 var /progression_scaling_delta = (wait / (1 MINUTES )) * current_progression_scaling
76+ var /player_count = length(GLOB . alive_player_list)
77+ // Has a maximum of 1 minute, however the value can be lower if there are lower players than the ideal
78+ // player count for a traitor to be threatening. Rounds to the nearest 10% of a minute to prevent weird
79+ // values from appearing in the UI. Traitor scaling multiplier bypasses the limit and only multiplies the end value.
80+ // from all of our calculations.
81+ current_progression_scaling = max(min(
82+ (player_count / CONFIG_GET (number/ traitor_ideal_player_count)) * 1 MINUTES ,
83+ 1 MINUTES
84+ ), 0.1 MINUTES ) * CONFIG_GET (number/ traitor_scaling_multiplier)
85+
86+ var /previous_global_progression = current_global_progression
87+
88+ current_global_progression += progression_scaling_delta
7789 for (var /datum /uplink_handler/handler in uplink_handlers)
7890 if (! handler. has_progression || QDELETED (handler))
7991 uplink_handlers -= handler
80- if (handler. progression_points < current_global_progression)
81- // If we got unsynced somehow, just set them to the current global progression
92+ var /deviance = (previous_global_progression - handler. progression_points) / progression_scaling_deviance
93+ if (abs(deviance) < 0.01 )
94+ // If deviance is less than 1%, just set them to the current global progression
8295 // Prevents problems with precision errors.
8396 handler. progression_points = current_global_progression
8497 else
@@ -87,9 +100,9 @@ SUBSYSTEM_DEF(traitor)
87100 var /amount_to_give = progression_scaling_delta + (progression_scaling_delta * deviance)
88101 amount_to_give = clamp(amount_to_give, 0 , progression_scaling_delta * 2 )
89102 handler. progression_points += amount_to_give
90- handler. update_objectives()
91103 handler. on_update()
92- // MASSMETA EDIT START (re_traitorsecondary)
104+
105+ // MASSMETA EDIT END (re_traitorsecondary)
93106/ datum / controller/ subsystem/ traitor/ proc / register_uplink_handler( datum / uplink_handler/ uplink_handler)
94107 if (! uplink_handler. has_progression)
95108 return
0 commit comments