Skip to content

Commit

Permalink
Merge pull request #13 from RimNauts/main
Browse files Browse the repository at this point in the history
Minor update
  • Loading branch information
sindre0830 committed Jan 22, 2023
2 parents 04245f6 + 955eedf commit eb78983
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 7 deletions.
Binary file modified Assemblies/RimNauts2.dll
Binary file not shown.
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Changelog
- Update version to print the correct version on startup (was 3.1.0 at update 3.1.2)
- Add stat printing in debug actions
- Move mineral-rich asteroid percentage to mod options
1 change: 0 additions & 1 deletion Defs/DefOfs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<defName>Satellite</defName>

<CrashingAsteroidObjectPercentage>0.05</CrashingAsteroidObjectPercentage>
<MineralRichAsteroidsPercentage>0.01</MineralRichAsteroidsPercentage>
<MineralRichAsteroidsRandomWaitTicks>(180000.0, 300000.0)</MineralRichAsteroidsRandomWaitTicks>
<MineralRichAsteroidsRandomInWorldTicks>(60000.0, 300000.0)</MineralRichAsteroidsRandomInWorldTicks>

Expand Down
1 change: 1 addition & 0 deletions Languages/English/Keyed/Other.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<LanguageData>
<RimNauts.default>Default</RimNauts.default>
<RimNauts.total_satellites_to_spawn_option>Total satellite objects to spawn in the world.</RimNauts.total_satellites_to_spawn_option>
<RimNauts.percantage_of_mineral_rich_asteroids>Percantage of mineral-rich asteroids that can spawn from the total amount of satellite objects: {0}%</RimNauts.percantage_of_mineral_rich_asteroids>
<RimNauts.crashing_asteroids>Crashing asteroids</RimNauts.crashing_asteroids>
<RimNauts.mineral_rich_asteroids>Mineral-rich asteroids</RimNauts.mineral_rich_asteroids>
<RimNauts.mineral_rich_asteroids_messages_option>Mineral-rich asteroids messages</RimNauts.mineral_rich_asteroids_messages_option>
Expand Down
2 changes: 1 addition & 1 deletion Source/RimNauts2/RimNauts2/Constants.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace RimNauts2 {
public static class Info {
public static readonly string name = "RimNauts 2";
public static readonly string version = "3.1.3";
public static readonly string version = "3.2.0";
}

public static class Style {
Expand Down
8 changes: 5 additions & 3 deletions Source/RimNauts2/RimNauts2/SatelliteDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class SatelliteDef : Def {
public List<string> ArtificalSatelliteObjects;
public List<string> SpaceStationObjects;

public float MineralRichAsteroidsPercentage;
public Vector2 MineralRichAsteroidsRandomWaitTicks;
public Vector2 MineralRichAsteroidsRandomInWorldTicks;

Expand Down Expand Up @@ -51,8 +50,11 @@ public int TotalCrashingAsteroidObjects {

public int TotalMineralAsteroidObjects {
get {
if (SatelliteDefOf.Satellite.MineralRichAsteroidsPercentage <= 0) return 0;
return (int) Math.Max(1.0f, Settings.TotalSatelliteObjects * SatelliteDefOf.Satellite.MineralRichAsteroidsPercentage);
if (Settings.MineralRichAsteroidsPercentage <= 0) return 0;
Verse.Log.Message(Settings.MineralRichAsteroidsPercentage.ToString());
Verse.Log.Message(Settings.TotalSatelliteObjects.ToString());
Verse.Log.Message((Settings.TotalSatelliteObjects * Settings.MineralRichAsteroidsPercentage).ToString());
return (int) Math.Max(1.0f, Settings.TotalSatelliteObjects * Settings.MineralRichAsteroidsPercentage);
}
}

Expand Down
14 changes: 13 additions & 1 deletion Source/RimNauts2/RimNauts2/Settings/DebugToolsSatellites.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
using Verse;
using System.Collections.Generic;
using Verse;

namespace RimNauts2 {
public static class DebugToolsSatellites {
[DebugAction("Spawning", "RimNauts2: Regenerate objects", false, false, false, 0, false, actionType = DebugActionType.Action, allowedGameStates = AllowedGameStates.PlayingOnWorld)]
public static void RegenerateSatellites() {
Generate_Satellites.regenerate_satellites();
}
[DebugAction("Spawning", "RimNauts2: Stats", false, false, false, 0, false, actionType = DebugActionType.Action, allowedGameStates = AllowedGameStates.PlayingOnWorld)]
public static void PrintStats() {
int asteroid_ore = 0;
int crashing_asteroid = 0;
foreach (KeyValuePair<int, Satellite> satellite in RimNauts_GameComponent.satellites) {
if (satellite.Value.mineral_rich) asteroid_ore++;
if (satellite.Value.can_out_of_bounds) crashing_asteroid++;
}
Verse.Log.Message("RimNauts.mineral_rich_asteroids".Translate() + ": " + asteroid_ore.ToString());
Verse.Log.Message("RimNauts.crashing_asteroids".Translate() + ": " + crashing_asteroid.ToString());
}
}
}
8 changes: 8 additions & 0 deletions Source/RimNauts2/RimNauts2/Settings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
namespace RimNauts2 {
public class Settings : ModSettings {
public static int TotalSatelliteObjects = 500;
public static float MineralRichAsteroidsPercentage = 0.01f;
public static bool CrashingAsteroidsToggle = true;
public static bool MineralAsteroidsToggle = true;
public static bool MineralAsteroidsVerboseToggle = false;

public override void ExposeData() {
base.ExposeData();
Scribe_Values.Look(ref TotalSatelliteObjects, "TotalSatelliteObjects", 500);
Scribe_Values.Look(ref MineralRichAsteroidsPercentage, "MineralRichAsteroidsPercentage", 0.01f);
Scribe_Values.Look(ref CrashingAsteroidsToggle, "CrashingAsteroidsToggle", true);
Scribe_Values.Look(ref MineralAsteroidsToggle, "MineralAsteroidsToggle", true);
Scribe_Values.Look(ref MineralAsteroidsVerboseToggle, "MineralAsteroidsVerboseToggle", false);
Expand All @@ -34,17 +36,23 @@ public override void DoSettingsWindowContents(Rect inRect) {

if (listingStandard1.ButtonText(Verse.TranslatorFormattedStringExtensions.Translate("RimNauts.default"))) {
Settings.TotalSatelliteObjects = 500;
Settings.MineralRichAsteroidsPercentage = 0.01f;
bufferTotalSatelliteObjects = Settings.TotalSatelliteObjects.ToString();
Settings.CrashingAsteroidsToggle = true;
Settings.MineralAsteroidsToggle = true;
Settings.MineralAsteroidsVerboseToggle = false;
}
listingStandard1.GapLine();
listingStandard1.Label(Verse.TranslatorFormattedStringExtensions.Translate("RimNauts.total_satellites_to_spawn_option"));
listingStandard1.IntEntry(ref Settings.TotalSatelliteObjects, ref bufferTotalSatelliteObjects);
if (Settings.TotalSatelliteObjects < 0) {
Settings.TotalSatelliteObjects = 0;
bufferTotalSatelliteObjects = Settings.TotalSatelliteObjects.ToString();
}
listingStandard1.GapLine();
listingStandard1.Label(Verse.TranslatorFormattedStringExtensions.Translate("RimNauts.percantage_of_mineral_rich_asteroids", new Verse.NamedArgument[] { (Settings.MineralRichAsteroidsPercentage * 100).ToString("0.00") }));
Settings.MineralRichAsteroidsPercentage = listingStandard1.Slider(Settings.MineralRichAsteroidsPercentage, 0.0f, 1.0f);
listingStandard1.GapLine();
listingStandard1.CheckboxLabeled(Verse.TranslatorFormattedStringExtensions.Translate("RimNauts.crashing_asteroids"), ref Settings.CrashingAsteroidsToggle);
listingStandard1.CheckboxLabeled(Verse.TranslatorFormattedStringExtensions.Translate("RimNauts.mineral_rich_asteroids"), ref Settings.MineralAsteroidsToggle);
listingStandard1.CheckboxLabeled(Verse.TranslatorFormattedStringExtensions.Translate("RimNauts.mineral_rich_asteroids_messages_option"), ref Settings.MineralAsteroidsVerboseToggle);
Expand Down

0 comments on commit eb78983

Please sign in to comment.