Skip to content

Commit

Permalink
Fixed difference highlight not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Metious committed Jun 25, 2024
1 parent 8765047 commit 67b344a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 18 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
src: url("days_one.ttf");
}

[data-bs-theme=dark] .lang-diff {
background: #0d1117;
}

.lang-diff-rem {
color: rgb(236, 89, 117);
}

.lang-diff-add {
color: rgb(62, 175, 124);;
color: rgb(62, 175, 124);
}

@media (min-width: 1600px) {
Expand Down
48 changes: 36 additions & 12 deletions Nautilus/Documentation/guides/sml2-to-nautilus.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ In this article, we will be talking about the necessary changes you must apply t

## Namespace
The root namespace for Nautilus is not the same as SMLHelper 2.0.
<pre class="lang-diff">
<pre class="hljs">

<span class="lang-diff-rem">- &lt;RootNamespace&gt;SMLHelper.V2&lt;/RootNamespace&gt;</span>
<span class="lang-diff-add">+ &lt;RootNamespace&gt;Nautilus&lt;/RootNamespace&gt;</span>

</pre>

## Referencing
Expand All @@ -23,7 +25,8 @@ mentioned in your code.

### Handler.cs
Following the handler interfaces change, the overly under-used `Handler` class will leave us in Nautilus
<pre class="lang-diff">
<pre class="hljs">

// Handler.cs
<span class="lang-diff-rem">
- namespace SMLHelper.V2
Expand All @@ -45,16 +48,19 @@ Following the handler interfaces change, the overly under-used `Handler` class w
- ...
- }
</span>

</pre>

### BioReactorHandler
The `BioReactorHandler` class is removed in Nautilus because it only had one very simple method to patch, and was forcing patch-time. That means if you tried to modify a bio charge _after_
SML's entry point, it didn't get applied.

The following example demonstrates how you can implement the same functionality the `BioReactorHandler` class offered.
<pre class="lang-diff">
<pre class="hljs">

<span class="lang-diff-rem">- BioReactorHandler.SetBioreactorCharge(TechType.Peeper, 69f);</span>
<span class="lang-diff-add">+ BaseBioReactor.charge[TechType.Peeper] = 69f;</span>

</pre>

### FishHandler
Expand All @@ -63,7 +69,8 @@ The `FishHandler` has been removed in Nautilus. At the time being, we have not a

### PDAEncyclopediaHandler And PDALogHandler
Beginning with Nautilus, both of these handler methods were moved to `PDAHandler` as they only had one method each.
<pre class="lang-diff">
<pre class="hljs">

PDAEncyclopedia.EntryData entry = new PDAEncyclopedia.EntryData()
{
key = "SomeEncy",
Expand All @@ -76,13 +83,16 @@ PDAEncyclopedia.EntryData entry = new PDAEncyclopedia.EntryData()

<span class="lang-diff-rem">- PDALogHandler.AddCustomEntry("SomeLog", "SomeLanguageKey");</span>
<span class="lang-diff-add">+ PDAHandler.AddLogEntry("SomeLog", "SomeLanguageKey");</span>

</pre>

### InGameMenuHandler
The methods `InGameMenuHandler` class had have been moved to the `Nautilus.Utility` namespace and the class has been renamed to `SaveUtils`.
<pre class="lang-diff">
<pre class="hljs">

<span class="lang-diff-rem">- InGameMenuHandler.RegisterOnSaveEvent(() => ErrorMessage.AddMessage("We do be saving!"));</span>
<span class="lang-diff-add">+ SaveUtils.RegisterOnSaveEvent(() => ErrorMessage.AddMessage("We do be saving!"));</span>

</pre>

## Enum Handlers
Expand Down Expand Up @@ -117,51 +127,63 @@ Below we will talk about the necessary changes you will need to make your custom


### Configuring Custom TechType Objects
<pre class="lang-diff">
<pre class="hljs">

<span class="lang-diff-rem">- TechType customTech = TechTypeHandler.AddTechType("CustomTech", "Custom Tech", "Custom Tech that makes me go yes.", SpriteManager.Get(TechType.Titanium), unlockedAtStart: false);</span>
<span class="lang-diff-add">+ TechType customTech = EnumHandler.AddEntry&lt;TechType&gt;("CustomTech")
+ .WithPdaInfo("Custom Tech", "Custom Tech that makes me go yes.", unlockedAtStart: false)
+ .WithIcon(SpriteManager.Get(TechType.Titanium));</span>

</pre>

### Configuring Custom CraftData.BackgroundType Objects
<pre class="lang-diff">
<pre class="hljs">

<span class="lang-diff-rem">- CraftData.BackgroundType customBG = BackgroundTypeHandler.AddBackgroundType("CustomBackground", SpriteManager.GetBackground(TechType.Battery));</span>
<span class="lang-diff-add">+ CraftData.BackgroundType customBG = EnumHandler.AddEntry&lt;CraftData.BackgroundType&gt;("CustomBackground")
+ .WithBackground(SpriteManager.GetBackground(TechType.Battery));</span>

</pre>

### Configuring Custom EquipmentType Objects
<pre class="lang-diff">
<pre class="hljs">

<span class="lang-diff-rem">- EquipmentType customEquipment = EquipmentHandler.AddEquipmentType("CustomEquipment");</span>
<span class="lang-diff-add">+ EquipmentType customEquipment = EnumHandler.AddEntry&lt;EquipmentType&gt;("CustomEquipment");</span>

</pre>

### Configuring Custom PingType Objects
<pre class="lang-diff">
<pre class="hljs">

<span class="lang-diff-rem">- PingType customPing = PingHandler.RegisterNewPingType("CustomPing", SpriteManager.Get(SpriteManager.Group.Pings, PingType.Signal.ToString()));</span>
<span class="lang-diff-add">+ PingType customPing = EnumHandler.AddEntry&lt;PingType&gt;("CustomPing")
+ .WithIcon(SpriteManager.Get(SpriteManager.Group.Pings, PingType.Signal.ToString()));</span>

</pre>

### Configuring Custom TechCategory and TechGroup Objects
<pre class="lang-diff">
<pre class="hljs">

<span class="lang-diff-rem">- TechGroup customGroup = TechGroupHandler.AddTechCategory("CustomGroup", "Custom Group");</span>
<span class="lang-diff-add">+ TechGroup customGroup = EnumHandler.AddEntry&lt;TechCategory&gt;("CustomGroup").WithPdaInfo("Custom Group");</span>

<span class="lang-diff-rem">- TechCategory customCategory = TechCategoryHandler.AddTechCategory("CustomCategory", "Custom Category");
- TechCategoryHandler.TryRegisterTechCategoryToTechGroup(customGroup, customCategory);</span>
<span class="lang-diff-add">+ TechCategory customCategory = EnumHandler.AddEntry&lt;TechCategory&gt;("CustomCategory").WithPdaInfo("Custom Group")
+ .RegisterToTechGroup(customGroup);</span>

</pre>

### Configuring Custom CraftTree.Type Objects
<pre class="lang-diff">
<pre class="hljs">

<span class="lang-diff-rem">- ModCraftTreeRoot root = CraftTreeHandler.CreateCustomCraftTreeAndType(CustomTree, out CraftTree.Type customTree);</span>
<span class="lang-diff-add">+ CraftTree.Type customTree = EnumHandler.AddEntry&lt;CraftTree.Type&gt;("CustomTree")
+ .CreateCraftTreeRoot(out ModCraftTreeRoot root);</span>

root.AddTabNode("SomeTab");

</pre>

___
Expand Down Expand Up @@ -512,7 +534,8 @@ Since we discovered the best practices and better ways to deal with custom sound
Beginning with Nautilus, all custom sounds will require a bus instead of a SoundChannel to determine the effects (E.G: reverb, muffling, low-pass, etc..) and the volume slider.
Additionally, the `PlaySound` signature was also modified and renamed to `TryPlaySound`.

<pre class="lang-diff">
<pre class="hljs">

<span class="lang-diff-rem">- Channel channel = AudioUtils.PlaySound(soundPath, SoundChannel.Music);</span>
<span class="lang-diff-add">+ if (AudioUtils.TryPlaySound(soundPath, AudioUtils.BusPaths.Music, out Channel channel))
+ {
Expand Down Expand Up @@ -540,6 +563,7 @@ Additionally, the `PlaySound` signature was also modified and renamed to `TryPla
+ // do something with channel
+ }
</span>

</pre>

> [!WARNING]
Expand Down
2 changes: 1 addition & 1 deletion Nautilus/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"template": [
"default",
"modern",
"DocFX/template"
"DocFX/custom"
]
}
}

0 comments on commit 67b344a

Please sign in to comment.