Skip to content

Commit

Permalink
Added Godot project file version number check (Revolutionary-Games#5107)
Browse files Browse the repository at this point in the history
* Bump version to 0.6.6.1

* Switched delta parameters to doubles in the input system docs

* Updated version numbers and enabled check for them

to make sure the new project.godot doesn't get forgotten to update

* Fixed some enumerator warnings
  • Loading branch information
hhyyrylainen authored May 8, 2024
1 parent 5ae5878 commit 965f9ea
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 20 deletions.
9 changes: 6 additions & 3 deletions Scripts/CodeChecks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public CodeChecks(Program.CheckOptions opts,
inspectCode.DisableFullPathPrinting();
}

var thriveVersion = AssemblyInfoReader.ReadVersionFromCsproj("Thrive.csproj");

ValidChecks = new Dictionary<string, CodeCheck>
{
{
Expand All @@ -36,7 +38,8 @@ public CodeChecks(Program.CheckOptions opts,
IgnoredFiles = new List<string>(FilesNotAllowedToHaveBom),
},
new BomChecker(BomChecker.Mode.Disallowed, FilesNotAllowedToHaveBom),
new CfgCheck(AssemblyInfoReader.ReadVersionFromCsproj("Thrive.csproj")),
new CfgCheck(thriveVersion),
new ProjectGodotCheck(thriveVersion),
new DisallowedFileType(".gd", ".mo", ".gltf")
{
ExtraErrorMessages =
Expand Down Expand Up @@ -64,9 +67,9 @@ public CodeChecks(Program.CheckOptions opts,
// Generated json files that are intentionally minimized
FilePathsToAlwaysIgnore.Add(new Regex(@"older_patch_notes\.json$"));

// We ignore the .godot files as it has godot temporary data and a bunch of files that don't conform to any
// We ignore the .godot folder as it has godot temporary data and a bunch of files that don't conform to any
// styles
FilePathsToAlwaysIgnore.Add(new Regex(@"\.godot"));
FilePathsToAlwaysIgnore.Add(new Regex(@"\.godot\/"));
}

protected override Dictionary<string, CodeCheck> ValidChecks { get; }
Expand Down
3 changes: 2 additions & 1 deletion Thrive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<LangVersion>12.0</LangVersion>
<Nullable>enable</Nullable>
<Company>Revolutionary Games Studio</Company>
<Version>0.6.6.0</Version>
<Version>0.6.6.1</Version>
<!--<InformationalVersion>-alpha</InformationalVersion>-->
</PropertyGroup>
<!-- Ignore the subproject source files -->
Expand All @@ -34,6 +34,7 @@
<ItemGroup>
<PackageReference Include="AngleSharp" Version="1.1.2" />
<PackageReference Include="DefaultEcs" Version="0.17.2" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
Expand Down
14 changes: 7 additions & 7 deletions doc/input_system.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ The available input attributes

| Attribute | Description | Parameters | Method parameters | Multiple |
| --------- | ----------- | ---------- | ----------------- | -------- |
| RunOnKey | Fires repeatedly when the input is held down | input : string | delta : float | yes |
| RunOnKey | Fires repeatedly when the input is held down | input : string | delta : double | yes |
| RunOnKeyChange | Fires once when the input is pressed or released | input : string | state : bool | yes |
| RunOnKeyDown | Fires once when the input is pressed | input : string | none | yes |
| RunOnKeyUp | Fires once when the input is released | input : string | none | yes |
| RunOnKeyToggle | Fires once when the input is pressed and provides an alternating bool | input : string | state : bool | yes |
| RunOnAxis | Fires repeatedly when one of the axis members is held down. Every axis member has a value associated with it. The average of the pressed values is given to the method | inputs : string[]<br> values : float[] | delta : float<br> value : float | yes |
| RunOnAxis | Fires repeatedly when one of the axis members is held down. Every axis member has a value associated with it. The average of the pressed values is given to the method | inputs : string[]<br> values : float[] | delta : double<br> value : float | yes |
| RunOnAxisGroup | Combines multiple RunOnAxis. Used when you want to combine multiple axes and want to differentiate between them | none | delta : float<br>value1 : float<br>value2 : float... | no |

- **Attribute** is the name of the attribute
Expand Down Expand Up @@ -134,7 +134,7 @@ public class MicrobeCamera : Camera
}

[RunOnAxis(new[] { "g_zoom_in", "g_zoom_out" }, new[] { -1.0f, 1.0f })]
public void Zoom(float delta, float value) {}
public void Zoom(double delta, float value) {}
}
```

Expand All @@ -152,7 +152,7 @@ public class MicrobeCamera
{
[RunOnAxis(new[] { "g_zoom_in", "g_zoom_out" }, new[] { -1.0f, 1.0f })]
[RunOnAxis(new[] { "g_zoom_in_fast", "g_zoom_out_fast" }, new[] { -3.0f, 3.0f })]
public void Zoom(float delta, float value) {}
public void Zoom(double delta, float value) {}
}
```

Expand All @@ -169,7 +169,7 @@ public class MicrobeCamera

[RunOnAxis(new[] { "g_zoom_in", "g_zoom_out", "g_zoom_in_fast", "g_zoom_out_fast" },
new[] { -1.0f, 1.0f, -3.0f, 3.0f })]
public void Zoom(float delta, float value) {}
public void Zoom(double delta, float value) {}
}
```

Expand All @@ -189,7 +189,7 @@ public class PlayerMicrobeInput : NodeWithInput
{
[RunOnAxis(new[] { "g_move_forward", "g_move_backwards" }, new[] { -1.0f, 1.0f })]
[RunOnAxis(new[] { "g_move_left", "g_move_right" }, new[] { -1.0f, 1.0f })]
public void OnMovement(float delta, float value) {}
public void OnMovement(double delta, float value) {}
}
```

Expand All @@ -203,7 +203,7 @@ public class PlayerMicrobeInput : NodeWithInput
[RunOnAxis(new[] { "g_move_forward", "g_move_backwards" }, new[] { -1.0f, 1.0f })]
[RunOnAxis(new[] { "g_move_left", "g_move_right" }, new[] { -1.0f, 1.0f })]
[RunOnAxisGroup]
public void OnMovement(float delta, float forwardBackwardMovement, float leftRightMovement) {}
public void OnMovement(double delta, float forwardBackwardMovement, float leftRightMovement) {}
}
```

Expand Down
12 changes: 6 additions & 6 deletions export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ application/modify_resources=true
application/icon="res://assets/misc/icon.ico"
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version="0.6.6.0"
application/product_version="0.6.6.0"
application/file_version="0.6.6.1"
application/product_version="0.6.6.1"
application/company_name="Revolutionary Games Studio"
application/product_name="Thrive"
application/file_description="Thrive Game"
Expand Down Expand Up @@ -148,8 +148,8 @@ application/modify_resources=true
application/icon="res://assets/misc/icon.ico"
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version="0.6.6.0"
application/product_version="0.6.6.0"
application/file_version="0.6.6.1"
application/product_version="0.6.6.1"
application/company_name="Revolutionary Games Studio"
application/product_name="Thrive"
application/file_description="Thrive Game"
Expand Down Expand Up @@ -261,8 +261,8 @@ application/modify_resources=true
application/icon="res://assets/misc/icon.ico"
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version="0.6.6.0"
application/product_version="0.6.6.0"
application/file_version="0.6.6.1"
application/product_version="0.6.6.1"
application/company_name="Revolutionary Games Studio"
application/product_name="Thrive"
application/file_description="Thrive Game"
Expand Down
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ config/description="Thrive is an open source evolution simulation game.
Play as a microbe on an alien world trying to survive and adapt to your surroundings in order to thrive.
https://revolutionarygamesstudio.com/"
config/version="0.6.6"
config/version="0.6.6.1"
run/main_scene="res://src/general/MainMenu.tscn"
config/use_custom_user_dir=true
config/custom_user_dir_name="Thrive"
Expand Down
3 changes: 3 additions & 0 deletions src/auto-evo/RunResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.Linq;
using Godot;
using JetBrains.Annotations;

/// <summary>
/// Container for results before they are applied.
Expand Down Expand Up @@ -1002,6 +1003,7 @@ public void LogResultsToTimeline(GameWorld world, List<ExternalEffect>? effects
/// Call this only when auto-evo has finished. Calling at runtime will result in
/// incorrect result and random CollectionModifiedException.
/// </summary>
[MustDisposeResource]
public IEnumerator GetEnumerator()
{
return results.GetEnumerator();
Expand All @@ -1011,6 +1013,7 @@ public IEnumerator GetEnumerator()
/// Call this only when auto-evo has finished. Calling at runtime will result in
/// incorrect result and random CollectionModifiedException.
/// </summary>
[MustDisposeResource]
IEnumerator<KeyValuePair<Species, SpeciesResult>> IEnumerable<KeyValuePair<Species, SpeciesResult>>.
GetEnumerator()
{
Expand Down
3 changes: 3 additions & 0 deletions src/general/utils/MultiCollection.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Newtonsoft.Json;

/// <summary>
Expand Down Expand Up @@ -39,11 +40,13 @@ public MultiCollection(ICollection<T> primary, ICollection<T> secondary)
[JsonIgnore]
public bool IsReadOnly => primary.IsReadOnly;

[MustDisposeResource]
public IEnumerator<T> GetEnumerator()
{
return primary.Concat(secondary).Distinct().GetEnumerator();
}

[MustDisposeResource]
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
Expand Down
3 changes: 3 additions & 0 deletions src/microbe_stage/ColonyCompoundBag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Components;
using DefaultEcs;
using Godot;
using JetBrains.Annotations;

/// <summary>
/// Access to a microbe colony's compounds through a unified interface. Instances of this class should not be stored
Expand Down Expand Up @@ -111,6 +112,7 @@ public void DistributeCompoundSurplus()
}
}

[MustDisposeResource]
public IEnumerator<KeyValuePair<Compound, float>> GetEnumerator()
{
return GetCompoundBags()
Expand Down Expand Up @@ -148,6 +150,7 @@ public bool AnyIsUsefulInAnyCompoundBag(IEnumerable<Compound> compounds)
return false;
}

[MustDisposeResource]
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
Expand Down
1 change: 1 addition & 0 deletions src/saving/ISaveUpgradeStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ private static Dictionary<string, ISaveUpgradeStep> InitializeSaveUpgradeSteps()
{ "0.6.5.0-alpha", new UpgradeJustVersionNumber("0.6.5.0-rc1") },
{ "0.6.5.0-rc1", new UpgradeJustVersionNumber("0.6.5.0") },
{ "0.6.6.0-rc1", new UpgradeJustVersionNumber("0.6.6.0") },
{ "0.6.6.0", new UpgradeJustVersionNumber("0.6.6.1") },
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/ThreadedRunSimulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private void RunSimulationAttempts(int seed)
var (currentTime, currentDifference) = currentSimulationAttempt.AttemptOrdering(random.Next());
Interlocked.Increment(ref attempts);

// This is a bit cumbersome condition, but needed due to equal value being good enough if the thread
// This is a somewhat cumbersome condition, but needed due to equal value being good enough if the thread
// deviance is smaller
if (!(currentTime <= bestThreadTime))
continue;
Expand Down

0 comments on commit 965f9ea

Please sign in to comment.