Skip to content

Commit

Permalink
wrapping up + adding about xml
Browse files Browse the repository at this point in the history
  • Loading branch information
rheirman committed Jan 24, 2021
1 parent 213de1b commit bd000e2
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
Binary file modified 1.2/Assemblies/AlmostThere.dll
Binary file not shown.
24 changes: 22 additions & 2 deletions 1.2/Source/AlmostThere/Harmony/Caravan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ namespace SearchAndDestroy.Harmony
class Caravan_get_NightResting
{
private static float nHours = 5f;
static bool Prefix(Caravan __instance)
static bool Prefix(Caravan __instance, ref bool __result)
{

if(Base.Instance.GetExtendedDataStorage() is ExtendedDataStorage store)
{
if (store.GetExtendedDataFor(__instance) is ExtendedCaravanData data)
{
if (data.forceRest)
{
__result = true;
return false;
}
if (data.fullyIgnoreRest)
{
return false;
Expand Down Expand Up @@ -73,6 +78,11 @@ private static Command_Toggle CreateIgnoreRestCommand(Caravan __instance, Extend
command_Toggle.toggleAction = delegate
{
caravanData.fullyIgnoreRest = !caravanData.fullyIgnoreRest;
if (caravanData.fullyIgnoreRest)
{
caravanData.forceRest = false;
caravanData.almostThere = false;
}
};
command_Toggle.defaultDesc = "AT_Command_DontRest_Description".Translate();
command_Toggle.icon = ContentFinder<Texture2D>.Get(("UI/" + "DontRest"), true);
Expand All @@ -86,6 +96,11 @@ private static Command_Toggle CreateAlmostThereCommand(Caravan __instance, Exten
command_Toggle.toggleAction = delegate
{
caravanData.almostThere = !caravanData.almostThere;
if (caravanData.almostThere)
{
caravanData.forceRest = false;
caravanData.fullyIgnoreRest = false;
}
};
command_Toggle.defaultDesc = "AT_Command_AlmostThere_Description".Translate(Base.almostThereHours.Value);
command_Toggle.icon = ContentFinder<Texture2D>.Get(("UI/" + "AlmostThere"), true);
Expand All @@ -96,10 +111,15 @@ private static Command_Toggle CreateAlmostThereCommand(Caravan __instance, Exten
private static Command_Toggle CreateForceRestCommand(Caravan __instance, ExtendedCaravanData caravanData)
{
Command_Toggle command_Toggle = new Command_Toggle();
command_Toggle.isActive = (() => caravanData.almostThere);
command_Toggle.isActive = (() => caravanData.forceRest);
command_Toggle.toggleAction = delegate
{
caravanData.forceRest = !caravanData.forceRest;
if (caravanData.forceRest)
{
caravanData.almostThere = false;
caravanData.fullyIgnoreRest = false;
}
};
command_Toggle.defaultDesc = "AT_Command_ForceRest_Description".Translate();
command_Toggle.icon = ContentFinder<Texture2D>.Get(("UI/" + "ForceRest"), true);
Expand Down
Binary file modified 1.2/Source/AlmostThere/obj/Debug/AlmostThere.dll
Binary file not shown.
11 changes: 9 additions & 2 deletions About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<name>Almost There!</name>
<author>Roolo</author>
<supportedVersions>
<li>1.0</li>
<li>1.1</li>
<li>1.2</li>
</supportedVersions>
<modDependencies>
Expand All @@ -16,6 +14,15 @@
</modDependencies>
<packageId>roolo.AlmostThere</packageId>
<description>
Cmon guys, we're almost there!
Nah, it's sleepy time.
But the colony is literally just one hour away, and Gonzalez really needs the medicines we brought, otherwise he'll die!
Meh, when it's nap time, it's nap time.

Sounds familiar? Then this mod is for you. It adds three things buttons to your caravans:
- An "Almost there" button - when your caravan is only x hours away from its goal, it won't stop for resting.
- A "Never rest" button. For those that like to have their pawns suffer.
- A "Force rest" button. Lets the caravan stop and rest immediately.

</description>
</ModMetaData>
Binary file modified About/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Languages/English/Keyed/AlmostThere_keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AT_Command_DontRest_Label>Never rest</AT_Command_DontRest_Label>
<AT_Command_DontRest_Description>Turning this on will prevent the caravan from ever resting. Use at your own risk!</AT_Command_DontRest_Description>
<AT_Command_AlmostThere_Label>Almost there!</AT_Command_AlmostThere_Label>
<AT_Command_AlmostThere_Description>Cmon guys, we're almost there! With this enabled, your caravan won't rest when {0} hours away from its target.</AT_Command_AlmostThere_Description>
<AT_Command_AlmostThere_Description>Cmon guys, we're almost there! With this enabled, your caravan won't rest when {0} hours away from its target. NOTE: the number of hours that are considered "almost there" can be configured in the mod settings!</AT_Command_AlmostThere_Description>
<AT_Command_ForceRest_Title>Force rest</AT_Command_ForceRest_Title>
<AT_Command_ForceRest_Description>Turning this on will force the caravan to rest. Turn it off to let them stop resting again.</AT_Command_ForceRest_Description>
</LanguageData>

0 comments on commit bd000e2

Please sign in to comment.