-
-
Notifications
You must be signed in to change notification settings - Fork 682
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes Z-Copy breaking stat tabs & Adds in validation for MC stat pane…
…ls (#9972) * Adds in validation for the stat panel * Fixes the error being wrong if the MC stat tab is wrong * Corrects the z-copy stat entry
- Loading branch information
1 parent
89d7b6d
commit 0f1f301
Showing
3 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/datum/unit_test/stat_mc_validation/Run() | ||
var/list/failures = list() | ||
main_loop: | ||
for (var/datum/controller/subsystem/ss in Master.subsystems) | ||
var/list/result = ss.stat_entry() | ||
// Accepted | ||
if (isnull(result)) | ||
continue | ||
// Rejected for not returning a list | ||
if (!islist(result)) | ||
failures += "The subsystem [ss.name] has an invalid stat_entry proc, it did not return a list." | ||
continue | ||
// The list should be associative and contain stat types | ||
for (var/key in result) | ||
var/list/value = result[key] | ||
if (!islist(value)) | ||
failures += "The subsystem [ss.name] has an invalid stat_entry proc, it does not properly use the new system of stat panel component types." | ||
continue main_loop | ||
var/comp_type = value["type"] | ||
if (!comp_type) | ||
failures += "The subsystem [ss.name] has an invalid stat_entry proc, it does not properly use the new system of stat panel component types." | ||
continue main_loop | ||
switch (comp_type) | ||
if (STAT_TEXT) | ||
var/text = value["text"] | ||
if (isnull(text)) | ||
failures += "The subsystem [ss.name] has an invalid stat_entry proc, it contains a text component with no text parameter." | ||
continue main_loop | ||
continue | ||
if (STAT_BUTTON) | ||
var/text = value["text"] | ||
var/action = value["action"] | ||
if (isnull(text) || isnull(action)) | ||
failures += "The subsystem [ss.name] has an invalid stat_entry proc, it has a button which has either no text, or no action." | ||
continue main_loop | ||
continue | ||
if (STAT_ATOM) | ||
var/text = value["text"] | ||
if (isnull(text)) | ||
failures += "The subsystem [ss.name] has an invalid stat_entry proc, it contains an atom component with no text parameter." | ||
continue main_loop | ||
continue | ||
if (STAT_DIVIDER) | ||
continue | ||
if (STAT_VERB) | ||
var/action = value["action"] | ||
if (isnull(action)) | ||
failures += "The subsystem [ss.name] has an invalid stat_entry proc, it has a verb which has no action." | ||
continue main_loop | ||
continue | ||
if (STAT_BLANK) | ||
continue | ||
else | ||
failures += "The subsystem [ss.name] has an invalid stat_entry proc, it attempted to display a component with a type that was not recognised." | ||
continue main_loop | ||
if (!length(failures)) | ||
return | ||
Fail(jointext(failures, "\n")) |