Skip to content

Commit 94737ac

Browse files
switch to using better keybinding widget
1 parent e33c6c0 commit 94737ac

13 files changed

+112
-127
lines changed

About/About.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ Proxyer: Japanese Translation
2121
Oleksii Bespalov: Fix bug in settings persistance
2222
Jorge Martínez: Spanish translations
2323
xProtosx: Russian translation
24-
Kroeze:
24+
Kroeze: ‘Release 3.5.76 [nolog]’, ‘Release v0.18.2.3 [nolog]’, ‘Release v0.18.2.2 [nolog]’, [A13] - initial release, version url, Initial release
2525

2626
<size=24>Version</size>
27-
This is version 4.4.81, for RimWorld 1.1.2579.
27+
This is version 4.4.82, for RimWorld 1.1.2610.
2828

2929
</description>
3030
<supportedVersions>

Assemblies/BetterKeybinding.dll

8.5 KB
Binary file not shown.

Assemblies/FollowMe!.dll

2 KB
Binary file not shown.

Defs/KeyBindingDefs/keybinding.xml

-17
This file was deleted.

LICENSE

+17-65
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,26 @@ Any original content (e.g. text, imagery or sounds) are licensed under
44
CC-BY-SA 4.0, the text of which is given below.
55
=======================================================================
66

7-
Copyright 2017 Fluffy
8-
9-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10-
11-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12-
13-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7+
Copyright 2020 Fluffy
148

9+
Permission is hereby granted, free of charge, to any person obtaining
10+
a copy of this software and associated documentation files (the
11+
"Software"), to deal in the Software without restriction, including
12+
without limitation the rights to use, copy, modify, merge, publish,
13+
distribute, sublicense, and/or sell copies of the Software, and to
14+
permit persons to whom the Software is furnished to do so, subject to
15+
the following conditions:
1516

17+
The above copyright notice and this permission notice shall be included
18+
in all copies or substantial portions of the Software.
1619

20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABI-
22+
LITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
23+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
24+
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26+
OTHER DEALINGS IN THE SOFTWARE.
1727

1828

1929

@@ -23,62 +33,6 @@ software and documentation are licensed under the MIT license, the text
2333
of which is given above.
2434
=======================================================================
2535

26-
Attribution-ShareAlike 4.0 International
27-
28-
=======================================================================
29-
30-
Creative Commons Corporation ("Creative Commons") is not a law firm and
31-
does not provide legal services or legal advice. Distribution of
32-
Creative Commons public licenses does not create a lawyer-client or
33-
other relationship. Creative Commons makes its licenses and related
34-
information available on an "as-is" basis. Creative Commons gives no
35-
warranties regarding its licenses, any material licensed under their
36-
terms and conditions, or any related information. Creative Commons
37-
disclaims all liability for damages resulting from their use to the
38-
fullest extent possible.
39-
40-
Using Creative Commons Public Licenses
41-
42-
Creative Commons public licenses provide a standard set of terms and
43-
conditions that creators and other rights holders may use to share
44-
original works of authorship and other material subject to copyright
45-
and certain other rights specified in the public license below. The
46-
following considerations are for informational purposes only, are not
47-
exhaustive, and do not form part of our licenses.
48-
49-
Considerations for licensors: Our public licenses are
50-
intended for use by those authorized to give the public
51-
permission to use material in ways otherwise restricted by
52-
copyright and certain other rights. Our licenses are
53-
irrevocable. Licensors should read and understand the terms
54-
and conditions of the license they choose before applying it.
55-
Licensors should also secure all rights necessary before
56-
applying our licenses so that the public can reuse the
57-
material as expected. Licensors should clearly mark any
58-
material not subject to the license. This includes other CC-
59-
licensed material, or material used under an exception or
60-
limitation to copyright. More considerations for licensors:
61-
wiki.creativecommons.org/Considerations_for_licensors
62-
63-
Considerations for the public: By using one of our public
64-
licenses, a licensor grants the public permission to use the
65-
licensed material under specified terms and conditions. If
66-
the licensor's permission is not necessary for any reason--for
67-
example, because of any applicable exception or limitation to
68-
copyright--then that use is not regulated by the license. Our
69-
licenses grant only permissions under copyright and certain
70-
other rights that a licensor has authority to grant. Use of
71-
the licensed material may still be restricted for other
72-
reasons, including because others have copyright or other
73-
rights in the material. A licensor may make special requests,
74-
such as asking that all changes be marked or described.
75-
Although not required by our licenses, you are encouraged to
76-
respect those requests where reasonable. More_considerations
77-
for the public:
78-
wiki.creativecommons.org/Considerations_for_licensees
79-
80-
=======================================================================
81-
8236
Creative Commons Attribution-ShareAlike 4.0 International Public
8337
License
8438

@@ -450,5 +404,3 @@ the avoidance of doubt, this paragraph does not form part of the
450404
public licenses.
451405

452406
Creative Commons may be contacted at creativecommons.org.
453-
454-
0Trackers

Readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Can safely be enabled/disabled in ongoing saves.
1717
- Oleksii Bespalov: Fix bug in settings persistance
1818
- Jorge Martínez: Spanish translations
1919
- xProtosx: Russian translation
20-
- Kroeze:
20+
- Kroeze: 'Release 3.5.76 [nolog]', 'Release v0.18.2.3 [nolog]', 'Release v0.18.2.2 [nolog]', [A13] - initial release, version url, Initial release
2121

2222
# Think you found a bug?
2323
Please read [this guide](http://steamcommunity.com/sharedfiles/filedetails/?id=725234314) before creating a bug report,
@@ -40,4 +40,4 @@ Show your appreciation by buying me a coffee (or contribute towards a nice singl
4040
[![I Have a Black Dog](https://i.ibb.co/ss59Rwy/New-Project-2.png)](https://www.youtube.com/watch?v=XiCrniLQGYc)
4141

4242
# Version
43-
This is version 4.4.81, for RimWorld 1.1.2579.
43+
This is version 4.4.82, for RimWorld 1.1.2610.

Source/Cinematics/CinematicCameraManager.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ namespace FollowMe
1111
public class CinematicCameraManager : GameComponent
1212
{
1313
public static CinematicCamera currentCamera;
14-
public static KeyBindingDef toggleCamera;
1514
private static bool _patched;
1615

1716
public static List<CinematicCamera> Cameras => DefDatabase<CinematicCamera>.AllDefsListForReading;
@@ -36,7 +35,6 @@ public override void LoadedGame()
3635

3736
public CinematicCameraManager( Game game )
3837
{
39-
toggleCamera = KeyBindingDef.Named( "CinematicCamera" );
4038
}
4139

4240
public static void Stop( string reason = null, bool stopFollow = true )
@@ -82,7 +80,7 @@ public override void GameComponentOnGUI()
8280
{
8381
base.GameComponentOnGUI();
8482

85-
if ( toggleCamera.KeyDownEvent )
83+
if ( Settings.CinematicCameraKey.JustPressed )
8684
CycleCameras();
8785
}
8886
}

Source/FollowMe.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ public class FollowMe : GameComponent
3737
KeyBindingDefOf.MapDolly_Left
3838
};
3939

40-
private readonly KeyBindingDef _followKey = KeyBindingDef.Named( "FollowSelected" );
41-
4240
public FollowMe()
4341
{
4442
// scribe
@@ -139,6 +137,11 @@ public override void GameComponentOnGUI()
139137
if ( Current.ProgramState != ProgramState.Playing )
140138
return; // gamecomp is already active in the 'setup' stage, but follow me shouldnt be.
141139

140+
141+
// start/stop following thing on key press
142+
if ( Settings.FollowMeKey.JustPressed )
143+
TryStartFollow( Find.Selector.SingleSelectedObject as Thing );
144+
142145
if ( Event.current.type == EventType.MouseUp &&
143146
Event.current.button == 2 )
144147
{
@@ -159,9 +162,6 @@ public override void GameComponentOnGUI()
159162

160163
public override void GameComponentUpdate()
161164
{
162-
// start/stop following thing on key press
163-
if ( _followKey.KeyDownEvent )
164-
TryStartFollow( Find.Selector.SingleSelectedObject as Thing );
165165

166166
if ( !_enabled )
167167
return;

Source/FollowMe.csproj

+9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<ErrorReport>prompt</ErrorReport>
2323
<WarningLevel>4</WarningLevel>
2424
<Prefer32Bit>false</Prefer32Bit>
25+
<LangVersion>8</LangVersion>
2526
</PropertyGroup>
2627
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2728
<DebugType>none</DebugType>
@@ -31,6 +32,7 @@
3132
<ErrorReport>prompt</ErrorReport>
3233
<WarningLevel>4</WarningLevel>
3334
<Prefer32Bit>false</Prefer32Bit>
35+
<LangVersion>8</LangVersion>
3436
</PropertyGroup>
3537
<ItemGroup>
3638
<Reference Include="0Harmony, Version=2.0.0.7, Culture=neutral, processorArchitecture=MSIL">
@@ -70,10 +72,17 @@
7072
<Compile Include="Mod.cs" />
7173
<Compile Include="Properties\AssemblyInfo.cs" />
7274
<Compile Include="Resources.cs" />
75+
<Compile Include="Settings.cs" />
7376
</ItemGroup>
7477
<ItemGroup>
7578
<None Include="packages.config" />
7679
</ItemGroup>
80+
<ItemGroup>
81+
<ProjectReference Include="..\..\..\TOOLS\BetterKeybinding\BetterKeybinding.csproj">
82+
<Project>{7A074D05-578C-48C4-9A0E-1C289CF862E1}</Project>
83+
<Name>BetterKeybinding</Name>
84+
</ProjectReference>
85+
</ItemGroup>
7786
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
7887
<PropertyGroup>
7988
<PostBuildEvent>mod update -x -n "Follow Me"</PostBuildEvent>

Source/FollowMe.sln

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.24720.0
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30002.166
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FollowMe!", "FollowMe.csproj", "{FAE5180C-6ADE-4E9F-BC22-BDC0407AFCC9}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FollowMe", "FollowMe.csproj", "{FAE5180C-6ADE-4E9F-BC22-BDC0407AFCC9}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BetterKeybinding", "..\..\..\TOOLS\BetterKeybinding\BetterKeybinding.csproj", "{7A074D05-578C-48C4-9A0E-1C289CF862E1}"
79
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,8 +17,15 @@ Global
1517
{FAE5180C-6ADE-4E9F-BC22-BDC0407AFCC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{FAE5180C-6ADE-4E9F-BC22-BDC0407AFCC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{FAE5180C-6ADE-4E9F-BC22-BDC0407AFCC9}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{7A074D05-578C-48C4-9A0E-1C289CF862E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{7A074D05-578C-48C4-9A0E-1C289CF862E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{7A074D05-578C-48C4-9A0E-1C289CF862E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{7A074D05-578C-48C4-9A0E-1C289CF862E1}.Release|Any CPU.Build.0 = Release|Any CPU
1824
EndGlobalSection
1925
GlobalSection(SolutionProperties) = preSolution
2026
HideSolutionNode = FALSE
2127
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {4FDDBE97-02B6-43A9-9A72-EBA2742550B9}
30+
EndGlobalSection
2231
EndGlobal

Source/Mod.cs

+2-29
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ namespace FollowMe
1111
{
1212
public class Mod : Verse.Mod
1313
{
14+
public static Settings Settings { get; private set; }
1415
public Mod( ModContentPack content ) : base( content )
1516
{
16-
GetSettings<Settings>();
17+
Settings = GetSettings<Settings>();
1718
}
1819

1920
public override string SettingsCategory()
@@ -42,32 +43,4 @@ public static void DoMessage( string message, MessageTypeDef type, GlobalTargetI
4243
type.sound.PlayOneShotOnCamera();
4344
}
4445
}
45-
46-
public class Settings : ModSettings
47-
{
48-
public static bool showNotifications = true;
49-
public static bool playSounds = true;
50-
public static bool edgeDetection = true;
51-
52-
public override void ExposeData()
53-
{
54-
base.ExposeData();
55-
Scribe_Values.Look( ref showNotifications, "showNotifications", true );
56-
Scribe_Values.Look( ref playSounds, "playSounds", true );
57-
Scribe_Values.Look( ref edgeDetection, "edgeDetection", true );
58-
}
59-
60-
public static void DoWindowContents( Rect rect )
61-
{
62-
var list = new Listing_Standard();
63-
list.Begin( rect );
64-
list.CheckboxLabeled( "FollowMe.Notifications".Translate(), ref showNotifications,
65-
"FollowMe.Notifications.Tooltip".Translate() );
66-
list.CheckboxLabeled( "FollowMe.Sounds".Translate(), ref playSounds,
67-
"FollowMe.Sounds.Tooltip".Translate() );
68-
list.CheckboxLabeled( "FollowMe.EdgeDetection".Translate(), ref edgeDetection,
69-
"FollowMe.EdgeDetection.Tooltip".Translate() );
70-
list.End();
71-
}
72-
}
7346
}

Source/Properties/AssemblyInfo.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
// Revision
3636
//
3737
[assembly: AssemblyVersion("4.0.0")]
38-
[assembly: AssemblyFileVersion("4.4.81")]
38+
[assembly: AssemblyFileVersion("4.4.82")]

Source/Settings.cs

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Settings.cs
2+
// Copyright Karel Kroeze, -2020
3+
4+
using BetterKeybinding;
5+
using UnityEngine;
6+
using Verse;
7+
8+
namespace FollowMe
9+
{
10+
public class Settings : ModSettings
11+
{
12+
public static bool showNotifications = true;
13+
public static bool playSounds = true;
14+
public static bool edgeDetection = true;
15+
private static KeyBind _followMeKey;
16+
17+
public static KeyBind FollowMeKey
18+
{
19+
get
20+
{
21+
_followMeKey??=new KeyBind( "Fluffy.FollowMe.KeyBind".Translate(), KeyCode.Home );
22+
return _followMeKey;
23+
}
24+
}
25+
26+
private static KeyBind _cinematicCameraKey;
27+
28+
public static KeyBind CinematicCameraKey
29+
{
30+
get
31+
{
32+
_cinematicCameraKey??= new KeyBind( "Fluffy.CinematicCamera.KeyBind".Translate(), KeyCode.End );
33+
return _cinematicCameraKey;
34+
}
35+
}
36+
37+
public override void ExposeData()
38+
{
39+
base.ExposeData();
40+
Scribe_Values.Look( ref showNotifications, "showNotifications", true );
41+
Scribe_Values.Look( ref playSounds, "playSounds", true );
42+
Scribe_Values.Look( ref edgeDetection, "edgeDetection", true );
43+
Scribe_Deep.Look( ref _followMeKey, "followMeKey" );
44+
Scribe_Deep.Look( ref _cinematicCameraKey, "cinematicCameraKey" );
45+
}
46+
47+
public static void DoWindowContents( Rect rect )
48+
{
49+
var list = new Listing_Standard();
50+
list.Begin( rect );
51+
list.CheckboxLabeled( "FollowMe.Notifications".Translate(), ref showNotifications,
52+
"FollowMe.Notifications.Tooltip".Translate() );
53+
list.CheckboxLabeled( "FollowMe.Sounds".Translate(), ref playSounds,
54+
"FollowMe.Sounds.Tooltip".Translate() );
55+
list.CheckboxLabeled( "FollowMe.EdgeDetection".Translate(), ref edgeDetection,
56+
"FollowMe.EdgeDetection.Tooltip".Translate() );
57+
FollowMeKey.Draw( list.GetRect( 30 ) );
58+
list.End();
59+
}
60+
}
61+
}

0 commit comments

Comments
 (0)