Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 2025.1.14
* Allows for multiple values to be passed in when an Enum has a `[Flags]` attribute

## 2025.1.13
* Update support for XML Only mods to allow launching directly through Rider
* Update support for XML Only mods to work with both 1.6 and 1.7
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
DotnetPluginId=ReSharperPlugin.RimworldDev
DotnetSolution=ReSharperPlugin.RimworldDev.sln
RiderPluginId=com.jetbrains.rider.plugins.rimworlddev
PluginVersion=2025.1.13
PluginVersion=2025.1.14

BuildConfiguration=Release

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,23 @@
<deepLumpSizeRange>1~two</deepLumpSizeRange>
<startingHpRange>0.5~high</startingHpRange>
<uiIconOffset>left,2</uiIconOffset>
<defaultPlacingRot>North, South</defaultPlacingRot>
<graphicData>
<drawOffset>(1,2,down)</drawOffset>
</graphicData>
</ThingDef>

<PawnRenderTreeDef>
<root Class="PawnRenderNodeProperties_Parent">
<children>
<li>
<children>
<li Class="PawnRenderNodeProperties_Tattoo" MayRequire="Ludeon.RimWorld.Ideology">
<rotDrawMode>Fresh, Invalid</rotDrawMode>
</li>
</children>
</li>
</children>
</root>
</PawnRenderTreeDef>
</Defs>
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,25 @@
<deepLumpSizeRange>|1~two|(13)</deepLumpSizeRange>
<startingHpRange>|0.5~high|(14)</startingHpRange>
<uiIconOffset>|left,2|(15)</uiIconOffset>
<defaultPlacingRot>|North, South|(16)</defaultPlacingRot>
<graphicData>
<drawOffset>|(1,2,down)|(16)</drawOffset>
<drawOffset>|(1,2,down)|(17)</drawOffset>
</graphicData>
</ThingDef>

<PawnRenderTreeDef>
<root Class="PawnRenderNodeProperties_Parent">
<children>
<li>
<children>
<li Class="PawnRenderNodeProperties_Tattoo" MayRequire="Ludeon.RimWorld.Ideology">
<rotDrawMode>Fresh, |Invalid|(18)</rotDrawMode>
</li>
</children>
</li>
</children>
</root>
</PawnRenderTreeDef>
</Defs>

---------------------------------------------------------
Expand All @@ -81,4 +96,6 @@
(13): ReSharper Underlined Error Highlighting: "two" is not a valid integer
(14): ReSharper Underlined Error Highlighting: "high" is not a valid float
(15): ReSharper Underlined Error Highlighting: "left" is not a valid number
(16): ReSharper Underlined Error Highlighting: "down" is not a valid number
(16): ReSharper Underlined Error Highlighting: "North, South" is not a valid value for Rot4
(17): ReSharper Underlined Error Highlighting: "down" is not a valid number
(18): ReSharper Underlined Error Highlighting: "Invalid" is not a valid value for RotDrawMode
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,18 @@
<drawOffset>(0,0,0)</drawOffset>
</graphicData>
</ThingDef>

<PawnRenderTreeDef>
<root Class="PawnRenderNodeProperties_Parent">
<children>
<li>
<children>
<li Class="PawnRenderNodeProperties_Tattoo" MayRequire="Ludeon.RimWorld.Ideology">
<rotDrawMode>Fresh, Rotting</rotDrawMode>
</li>
</children>
</li>
</children>
</root>
</PawnRenderTreeDef>
</Defs>
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@
<drawOffset>(0,0,0)</drawOffset>
</graphicData>
</ThingDef>

<PawnRenderTreeDef>
<root Class="PawnRenderNodeProperties_Parent">
<children>
<li>
<children>
<li Class="PawnRenderNodeProperties_Tattoo" MayRequire="Ludeon.RimWorld.Ideology">
<rotDrawMode>Fresh, Rotting</rotDrawMode>
</li>
</children>
</li>
</children>
</root>
</PawnRenderTreeDef>
</Defs>

---------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using JetBrains.Annotations;
Expand Down Expand Up @@ -130,7 +131,7 @@
break;
}

var a = 1 + 1;

Check warning on line 134 in src/dotnet/ReSharperPlugin.RimworldDev/ProblemAnalyzers/CustomXmlAnalysisStageProcess.cs

View workflow job for this annotation

GitHub Actions / Test

The variable 'a' is assigned but its value is never used

Check warning on line 134 in src/dotnet/ReSharperPlugin.RimworldDev/ProblemAnalyzers/CustomXmlAnalysisStageProcess.cs

View workflow job for this annotation

GitHub Actions / Build

The variable 'a' is assigned but its value is never used

Check warning on line 134 in src/dotnet/ReSharperPlugin.RimworldDev/ProblemAnalyzers/CustomXmlAnalysisStageProcess.cs

View workflow job for this annotation

GitHub Actions / Test

The variable 'a' is assigned but its value is never used
break;
}
}
Expand Down Expand Up @@ -270,11 +271,25 @@
private void ProcessEnum(string textValue, DocumentRange range, ITypeElement context)
{
if (context.GetType().Name != "Enum") return;

var isFlagAttribute = context.GetAttributeInstances(AttributesSource.Self)
.Any(attr => attr.GetClrName().FullName == "System.FlagsAttribute");

var textValues = isFlagAttribute ? textValue.Split(",").Select(item => item.Trim()) : [textValue];

var enumValues = context.GetMembers().Select(x => x.ShortName).ToList();
if (!enumValues.Contains(textValue))
foreach (var value in textValues)
{
AddError($"\"{textValue}\" is not a valid value for {context.ShortName}", range);
if (enumValues.Contains(value)) continue;

var valueIndex = textValue.IndexOf(value, StringComparison.Ordinal);

var targetedRange = new DocumentRange(
range.Document,
new TextRange(range.TextRange.StartOffset + valueIndex, range.TextRange.StartOffset + valueIndex + value.Length)
);

AddError($"\"{value}\" is not a valid value for {context.ShortName}", targetedRange);
}
}

Expand Down
Loading