Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
Updated the readme file fir TrackMusic and changed the MusicTrack Err…
Browse files Browse the repository at this point in the history
…or display behavior
  • Loading branch information
REHERC committed Aug 12, 2020
1 parent 3ce1e02 commit 7a9a69f
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)Mod\mod.json" />
</ItemGroup>
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)Readme\instructions.html" />
</ItemGroup>
</Project>
69 changes: 69 additions & 0 deletions Distance.CustomDeathMessages.Content/Readme/instructions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<h1>EDITING THE MESSAGES</h1>
<section>
<h2>MODIFYING THE FILE</h2>
<p>
To edit the messages, go in the mod settings directory <span>Distance_Data/Centrifuge/Mods/{BuildPath}/Settings</span> and open <span>Config.json</span> with a text editor of your choice.
If the file/folder is missing, please be sure you ran the game at least once after installing the mod so the default configuration is created.
<a target="_blank" href="steam://rungameid/233610/-console">Click here to launch Distance (Steam only)</a>.
</p>
<p>
After you opened the file, the default configuration should look something like this:
<span class="block">&lbrace;<br />
"KillGrid": [<br />
"The laser grid was not cool with &lbrace;0&rbrace;",<br />
"&lbrace;0&rbrace; have touched the forbiden grid"<br />
],<br />
"SelfTermination": [<br />
"&lbrace;0&rbrace; pressed the reset button",<br />
"&lbrace;0&rbrace; commited sudoku"<br />
],<br />
"LaserOverheated": [<br />
"&lbrace;0&rbrace; don't know how to drive without wheels",<br />
"&lbrace;0&rbrace; was too hot"<br />
],<br />
"Impact": [<br />
"&lbrace;0&rbrace; kissed a wall",<br />
"The ground facepalmed &lbrace;0&rbrace;"<br />
],<br />
"Overheated": [<br />
"&lbrace;0&rbrace; needs to stop boosting sometimes"<br />
],<br />
"AntiTunnelSquish": [<br />
"&lbrace;0&rbrace; got unitied"<br />
],<br />
"StuntCollect": [<br />
"&lbrace;0&rbrace; looted a x&lbrace;1&rbrace; multiplier!"<br />
],<br />
"KickNoLevel": [<br />
"&lbrace;0&rbrace; is too poor to have this level",<br />
"[FF0000]&lbrace;0&rbrace; is sad because he can't load the level[-]"<br />
],<br />
"Finished": [<br />
"[FFFFFF]&lbrace;0&rbrace;[-] [00FF00]f[-][00FFFF]i[-][0000FF]n[-][FF00FF]i[-][FF0000]s[-][FFFF00]h[-][00FF00]e[-][00FFFF]d[-]"<br />
],<br />
"NotReady": [<br />
"&lbrace;0&rbrace; is a little busy, try agains later"<br />
],<br />
"Spectate": [<br />
"[-]This map is too hard, &lbrace;0&rbrace; gave up"<br />
],<br />
"TagPointsLead": [<br />
"[FFFFFF]&lbrace;0&rbrace;[-] is [00FF00]f[-][00FFFF]a[-][0000FF]b[-][FF00FF]u[-][FF0000]l[-][FFFF00]o[-][00FF00]u[-][00FFFF]s[-]!"<br />
]<br />
&rbrace;</span>
</p>
<p>
If you don't know how to edit JSON files without breaking them, i recommend using an online editor like <a target="_blank" href="https://jsoneditoronline.org/">jsoneditoronline.org</a> or <a target="_blank" href="https://jsonformatter.org/json-editor">jsonformatter.org/json-editor</a> (just paste the json in the left text zone and click the right arrow button; once you're done press the left arrow button and copy back the text from the left side into your Config.json file).
</p>
<p>
<b>If Distance is running, restart it for the changes to take effect.</b>
</p>
<h2>TEXT REPLACEMENT CODES</h2>
<p>
When editing your messages, you can use (inline) replacement codes to display specific values when the message is sent.
<ul>
<li><b>&lbrace;0&rbrace;</b> displays the current player username.</li>
<li><b>&lbrace;1&rbrace;</b> displays the current stunt multiplier (displays 0 if the parent group isn't <u>StuntCollect</u>).</li>
</ul>
</p>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
</PropertyGroup>
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)Mod\mod.json" />
<Content Include="$(MSBuildThisFileDirectory)Readme\instructions.html" />
</ItemGroup>
</Project>
51 changes: 51 additions & 0 deletions Distance.TrackMusic.Content/Readme/instructions.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,15 @@ internal static bool Prefix(ZEventListener __instance, IVisitor visitor)

if (Error == null)
{
Error = "None";
Error = "None".Colorize(Colors.white);
}
else
{
Error = Error.Colorize(Colors.red);
}
//visitor.Visit("Error", ref Error, null);

visitor.Visit("Error", ref Error, null);
visitor.VisualLabel($"Error: {Error}".Colorize(Colors.white));

return false;
}
Expand Down
3 changes: 1 addition & 2 deletions Distance.TrackMusic/Models/MusicTrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ public override bool ReadDataString(string data)
return false;
}
var numSub = data.Substring(0, separatorLoc);
int num = -1;
var success = int.TryParse(numSub, out num);
var success = int.TryParse(numSub, out int num);
if (!success || data.Length < separatorLoc + 1 + num)
{
return false;
Expand Down
7 changes: 5 additions & 2 deletions Solution.Task.PostBuild/AdvancedModManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,17 @@ public string CreatorInfo

[JsonIgnore]
public string DependencyList => Dependencies != null && Dependencies.Any() ? string.Join(", ", Dependencies) : "<i>No dependencies</i>";

[JsonIgnore]
public string GameSupportList => RequiredGSLs != null && RequiredGSLs.Any() ? string.Join(", ", RequiredGSLs) : "<i>No GSL required</i>";

[JsonIgnore]
public string CentrifugeVersion { get; set; } = "Not found";

[JsonIgnore]
public DirectoryInfo ModDirectory { get; set; }

[JsonIgnore]
public DirectoryInfo ContentDirectory => new DirectoryInfo($"{ModDirectory.FullName}.Content");
}
}
35 changes: 31 additions & 4 deletions Solution.Task.PostBuild/Data/readme_template.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ header > h2 {
opacity: 0.9;
}

div > h1 {
main > div > div h1 {
font-size: 1.4em;
position: relative;
overflow-x: visible;
}

div > h1::before {
main > div > div h1::before {
position: absolute;
content: ' ';
background: rgba(var(--accent-color), 0.8);
Expand All @@ -96,12 +96,22 @@ div > h1::before {
transform: translateX(-12px);
}

div > section {
main > div > div h2 {
text-decoration: underline;
font-weight: bold;
font-size: 1.2em;
position: relative;
overflow-x: visible;
}

div section {
font-size: 1em;
line-height: 1.5em;
padding-left: 0.8em;
display: block;
}

div > section > p {
div section p {
max-width: 80ch;
text-justify: auto;
}
Expand All @@ -114,4 +124,21 @@ span {
padding: 0 0.2em;
background: rgba(var(--darker), 0.2);
color: rgba(var(--darker), 0.85);
}

span.block {
display: block;
line-height: normal;
white-space: pre;
tab-size: 8;
-moz-tab-size: 8;
-o-tab-size: 8;
overflow-wrap: break-word;
word-wrap: break-word;

overflow-x: scroll;
}

img {
width: 100%;
}
9 changes: 2 additions & 7 deletions Solution.Task.PostBuild/Data/readme_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h1>PREREQUISITES</h1>
This mod uses the Centrifuge mod loader made by Ciastex, you will need to install it to use this mod. You can find more details on the <a target="_blank" href="https://github.com/Ciastex/Centrifuge/wiki//How-to-Install">Centrifuge wiki</a>.
</p>
<p>
Any other prerequisites specific to one mod will be added here in that specific mod readme.
{Prerequisites}
</p>
</section>

Expand All @@ -43,12 +43,7 @@ <h1>INSTALLATION</h1>
</p>
</section>

<!--<h1>OTHER INFORMATIONS</h1>
<section>
<p>
Other sections will be added if a file called "readme_additional.html" can be found in "Distance.{Mod}.Content/Readme". Those sections may include a feature list, settings list or links to external resources (custom car google drive, the developer's discord server, ...)
</p>
</section>-->
{Instructions}

<h1>ADDITIONAL INFORMATIONS</h1>
<section>
Expand Down
10 changes: 9 additions & 1 deletion Solution.Task.PostBuild/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ public static int Main(string[] args)

try
{
string readme = template.FormatWith(manifest).FormatWith( new { DocumentStyle = css });
ReadFile(manifest.ContentDirectory, "Readme/prerequisites.html", out string prerequisites);
ReadFile(manifest.ContentDirectory, "Readme/instructions.html", out string instructions);

string readme = template.FormatWith(manifest).FormatWith(new {
DocumentStyle = css,
Prerequisites = prerequisites.FormatWith(manifest),
Instructions = instructions.FormatWith(manifest)
});

FileInfo readme_file = new FileInfo($@"{directory.FullName}\Build\{manifest.BuildPath}\Readme {manifest.FriendlyName}.html");

if (readme_file.Exists)
Expand Down

0 comments on commit 7a9a69f

Please sign in to comment.