@@ -13,25 +13,12 @@ SUBSYSTEM_DEF(traitor)
1313 // / A list of all uplink items
1414 var /list /uplink_items = list ()
1515
16- // / File to load configurations from.
17- // MASSMETA ADDDITION START (re_traitorsecondary)
18- var /configuration_path = " config/traitor_objective.json"
19- var /progression_scaling_deviance = 20 MINUTES
20- // / Global configuration data that gets applied to each objective when it is created.
21- // / Basic objective format
22- // / '/datum/traitor_objective/path/to/objective': {
23- // / "global_progression_influence_intensity": 0
24- // / }
25- var /configuration_data = list ()
26-
27- // MASSMETA ADDDITION END (re_traitorsecondary)
28-
2916 // / The coefficient multiplied by the current_global_progression for new joining traitors to calculate their progression
3017 var /newjoin_progression_coeff = 1
31- // / The current progression that all traitors should be at in the round
18+ // / The current progression that all traitors should be at in the round, you can't have less than this
3219 var /current_global_progression = 0
33- // / The amount of deviance from the current global progression before you start getting 2x the current scaling or no scaling at all
34-
20+ // / The current uplink handlers being managed
21+ var / list /datum/uplink_handler/ uplink_handlers = list ()
3522 // / The current scaling per minute of progression.
3623 var /current_progression_scaling = 1 MINUTES
3724 // / List of code words for traitors
@@ -43,39 +30,10 @@ SUBSYSTEM_DEF(traitor)
4330 // / Regex of code responses for traitors
4431 var /regex /syndicate_code_response_regex
4532
46- // MASSMETA ADDDITION START (re_traitorsecondary)
47-
48- var /list /datum/uplink_handler/uplink_handlers = list ()
49- // / Used to handle the probability of getting an objective.
50- var /datum /traitor_category_handler/category_handler
51- // / The current debug handler for objectives. Used for debugging objectives
52- var /datum /traitor_objective_debug/traitor_debug_panel
53- // / Used by the debug menu, decides whether newly created objectives should generate progression and telecrystals. Do not modify for non-debug purposes.
54- var /generate_objectives = TRUE
55- // / Objectives that have been completed by type. Used for limiting objectives.
56- var /list /taken_objectives_by_type = list ()
57- // / A list of all existing objectives by type
58- var /list /all_objectives_by_type = list ()
59- // MASSMETA ADDDITION END (re_traitorsecondary)
6033/ datum / controller/ subsystem/ traitor/ Initialize()
61- /*
62- MASSMETA EDIT START (re_traitor_secondary)
63- ORIGINAL: current_progression_scaling = 1 MINUTES * CONFIG_GET(number/traitor_scaling_multiplier)
64- */
65- category_handler = new ()
66- traitor_debug_panel = new (category_handler)
67- // MASSMETA EDIT END (re_traitor_secondary)
34+ current_progression_scaling = 1 MINUTES * CONFIG_GET (number/ traitor_scaling_multiplier)
6835 for (var /theft_item in subtypesof (/ datum / objective_item/ steal))
6936 new theft_item
70- // MASSMETA ADDITION START (re_traitor_secondary)
71- if (fexists(configuration_path))
72- var /list /data = json_decode(file2text(file(configuration_path)))
73- for (var /typepath in data)
74- var /actual_typepath = text2path(typepath)
75- if (! actual_typepath)
76- log_world (" [ configuration_path] has an invalid type ( [ typepath] ) that doesn't exist in the codebase! Please correct or remove [ typepath] " )
77- configuration_data[actual_typepath] = data[typepath]
78- // MASSMETA ADDITION END (re_traitor_secondary)
7937
8038 syndicate_code_phrase = generate_code_phrase(return_list = TRUE )
8139 syndicate_code_phrase_regex = new (" ([ jointext(syndicate_code_phrase, " |" )] )" , " ig" )
@@ -84,38 +42,21 @@ SUBSYSTEM_DEF(traitor)
8442 return SS_INIT_SUCCESS
8543
8644/ datum / controller/ subsystem/ traitor/ fire(resumed)
45+ var /previous_progression = current_global_progression
8746 current_global_progression = (STATION_TIME_PASSED ()) * CONFIG_GET (number/ traitor_scaling_multiplier)
88- var /progression_scaling_delta = (wait / (1 MINUTES )) * current_progression_scaling
89- var /player_count = length(GLOB . alive_player_list)
90- // Has a maximum of 1 minute, however the value can be lower if there are lower players than the ideal
91- // player count for a traitor to be threatening. Rounds to the nearest 10% of a minute to prevent weird
92- // values from appearing in the UI. Traitor scaling multiplier bypasses the limit and only multiplies the end value.
93- // from all of our calculations.
94- current_progression_scaling = max(min(
95- (player_count / CONFIG_GET (number/ traitor_ideal_player_count)) * 1 MINUTES ,
96- 1 MINUTES
97- ), 0.1 MINUTES ) * CONFIG_GET (number/ traitor_scaling_multiplier)
47+ var /progression_increment = current_global_progression - previous_progression
9848
99- var /previous_global_progression = current_global_progression
100-
101- current_global_progression += progression_scaling_delta
10249 for (var /datum /uplink_handler/handler in uplink_handlers)
10350 if (! handler. has_progression || QDELETED (handler))
10451 uplink_handlers -= handler
105- var /deviance = (previous_global_progression - handler. progression_points) / progression_scaling_deviance
106- if (abs(deviance) < 0.01 )
107- // If deviance is less than 1%, just set them to the current global progression
52+ if (handler. progression_points < current_global_progression)
53+ // If we got unsynced somehow, just set them to the current global progression
10854 // Prevents problems with precision errors.
10955 handler. progression_points = current_global_progression
11056 else
111- // MASSMETA EDIT START (re_traitorsecondary) ORIGINAL: handler.progression_points += progression_increment // Should only really happen if an admin is messing with an individual's progression value
112-
113- var /amount_to_give = progression_scaling_delta + (progression_scaling_delta * deviance)
114- amount_to_give = clamp(amount_to_give, 0 , progression_scaling_delta * 2 )
115- handler. progression_points += amount_to_give
116- handler. on_update()
57+ handler. progression_points += progression_increment // Should only really happen if an admin is messing with an individual's progression value
58+ handler. on_update()
11759
118- // MASSMETA EDIT END (re_traitorsecondary)
11960/ datum / controller/ subsystem/ traitor/ proc / register_uplink_handler( datum / uplink_handler/ uplink_handler)
12061 if (! uplink_handler. has_progression)
12162 return
@@ -127,24 +68,3 @@ SUBSYSTEM_DEF(traitor)
12768/ datum / controller/ subsystem/ traitor/ proc / uplink_handler_deleted( datum / uplink_handler/ uplink_handler)
12869 SIGNAL_HANDLER
12970 uplink_handlers -= uplink_handler
130-
131- // MASSMETA ADDITION START (re_traitorsecondary)
132- / datum / controller/ subsystem/ traitor/ proc / on_objective_taken( datum / traitor_objective/ objective)
133- if (! istype(objective))
134- return
135-
136- add_objective_to_list (objective, taken_objectives_by_type)
137-
138- / datum / controller/ subsystem/ traitor/ proc / get_taken_count( datum / traitor_objective/ objective_type)
139- return length(taken_objectives_by_type[objective_type])
140-
141-
142- / datum / controller/ subsystem/ traitor/ proc / add_objective_to_list( datum / traitor_objective/ objective, list / objective_list)
143- var /datum /traitor_objective/current_type = objective. type
144- while (current_type != / datum / traitor_objective)
145- if (! objective_list[current_type])
146- objective_list[current_type] = list (objective)
147- else
148- objective_list[current_type] += objective
149- current_type = current_type:: parent_type
150- // MASSMETA ADDITION END (re_traitorsecondary)
0 commit comments