Skip to content

Commit

Permalink
Merge pull request #59 from RimNauts/main
Browse files Browse the repository at this point in the history
Fix expanded icons hiding too early
  • Loading branch information
sindre0830 authored Mar 28, 2023
2 parents a21805b + 0b7050a commit 2581e60
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
Binary file modified Assemblies/RimNauts2.dll
Binary file not shown.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# RimNauts2
- Fix expanded icons hiding too early
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 = "4.14.3";
public static readonly string version = "4.14.4";
}

public static class Style {
Expand Down
1 change: 1 addition & 0 deletions Source/RimNauts2/RimNauts2/Defs/Of.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class General : Def {
public float drag_velocity_multiplier = 0.50f;
public float zoom_sensitivity_multiplier = 0.75f;
public float altitude_hide_labels_multiplier = 0.50f;
public float zoom_enum_multiplier = 0.20f;
public List<string> allowed_incidents;
public string space_station_wall;
public string space_station_floor;
Expand Down
17 changes: 17 additions & 0 deletions Source/RimNauts2/RimNauts2/World/Patch/CameraDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,21 @@ public static bool Prefix(ref float __result) {
return false;
}
}

[HarmonyPatch(typeof(RimWorld.Planet.WorldCameraDriver), "CurrentZoom", MethodType.Getter)]
class WorldCameraDriver_CurrentZoom {
public static bool Prefix(ref RimWorld.Planet.WorldCameraDriver __instance, ref RimWorld.Planet.WorldCameraZoomRange __result) {
float altitudePercent = __instance.AltitudePercent;
if ((double) altitudePercent < 0.025 * Defs.Of.general.zoom_enum_multiplier) {
__result = RimWorld.Planet.WorldCameraZoomRange.VeryClose;
return false;
}
if ((double) altitudePercent < 0.042 * Defs.Of.general.zoom_enum_multiplier) {
__result = RimWorld.Planet.WorldCameraZoomRange.Close;
return false;
}
__result = (double) altitudePercent < (0.125 * Defs.Of.general.zoom_enum_multiplier) ? RimWorld.Planet.WorldCameraZoomRange.Far : RimWorld.Planet.WorldCameraZoomRange.VeryFar;
return false;
}
}
}

0 comments on commit 2581e60

Please sign in to comment.