Skip to content

Commit 5ce61e0

Browse files
committed
Merge branch 'development'
2 parents eb2fa47 + bed9f50 commit 5ce61e0

File tree

7 files changed

+70
-18
lines changed

7 files changed

+70
-18
lines changed

ActualMop/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("0.3.0.0")]
36-
[assembly: AssemblyFileVersion("0.3.0.0")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

ActualMop/Resources/changelog.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Changes:
2-
- Player has to hold the mop in hand, in order for it to work (press Use to grab the mop)
1+
Added:
2+
- Player can now open the doors while holding the mop, without dropping it
33

4-
Bug Fixes:
5-
- Mop should now always load back where you left it
4+
Changes:
5+
- The key binded to urinating will not be clicked anymore, if you Alt+Tab from the game

ActualMop/src/ActualMop.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ namespace ActualMop
2222
public class ActualMop : Mod
2323
{
2424
public override string ID => "ActualMop"; //Your mod ID (unique)
25-
public override string Name => "Actual Mop (Beta)"; //You mod name
25+
public override string Name => "Actual Mop"; //You mod name
2626
public override string Author => "Athlon"; //Your Username
27-
public override string Version => "0.3"; //Version
27+
public override string Version => "1.0"; //Version
2828

2929
// Set this to true if you will be load custom assets from Assets folder.
3030
// This will create subfolder in Assets folder for your mod.

ActualMop/src/MopBehaviour.cs

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program.If not, see<http://www.gnu.org/licenses/>.
1616

17+
using HutongGames.PlayMaker;
18+
using HutongGames.PlayMaker.Actions;
1719
using System.Collections;
20+
using System.Linq;
1821
using System.Runtime.InteropServices;
1922
using UnityEngine;
2023

@@ -55,6 +58,11 @@ class MopBehaviour : MonoBehaviour
5558
const int KEYEVENTF_KEYUP = 0x0002; //Key up flag
5659
byte virtualKey = 0x50;
5760

61+
FsmState itemPickedState;
62+
FsmEvent equipEvent, proceedDropEvent, proceedThrowEvent;
63+
64+
bool isPaused;
65+
5866
public MopBehaviour()
5967
{
6068
// Clone this game object to be used later for in hand object
@@ -63,7 +71,7 @@ public MopBehaviour()
6371
// Initialize the game object
6472
gameObject.name = "mop(Clone)";
6573
gameObject.layer = LayerMask.NameToLayer("Parts");
66-
gameObject.tag = "PART";
74+
gameObject.tag = "ITEM";
6775
gameObject.transform.parent = null;
6876

6977
// Get this object's renderer
@@ -96,6 +104,13 @@ public MopBehaviour()
96104
mopInHand.transform.localPosition = new Vector3(0.25f, -0.4f, 1);
97105
mopInHand.transform.localRotation = Quaternion.Euler(-80, -720, -720);
98106
mopInHand.SetActive(false);
107+
108+
// Setting up "anti-drop" script
109+
itemPickedState = player.transform.Find("Pivot/AnimPivot/Camera/FPSCamera/1Hand_Assemble/Hand")
110+
.GetComponents<PlayMakerFSM>()[0].FsmStates.FirstOrDefault(state => state.Name == "Item picked");
111+
equipEvent = (itemPickedState.Actions[5] as GetButtonDown).sendEvent;
112+
proceedDropEvent = (itemPickedState.Actions[1] as GetMouseButtonDown).sendEvent;
113+
proceedThrowEvent = (itemPickedState.Actions[2] as GetMouseButtonDown).sendEvent;
99114
}
100115

101116
public void Initialize(MopSaveData mopSaveData)
@@ -116,20 +131,23 @@ void Update()
116131

117132
// If is equipped, equip the mop
118133
if (isEquipped)
119-
{
134+
{
120135
ToggleCleaningMode(true);
121136

122137
// Simulate the P key press
123138
// Player HAS to have pissing button binded to P
124-
keybd_event(virtualKey, 0, KEYEVENTF_EXTENDEDKEY, 0);
125-
keybd_event(virtualKey, 0, KEYEVENTF_KEYUP, 0);
139+
if (!isPaused)
140+
{
141+
keybd_event(virtualKey, 0, KEYEVENTF_EXTENDEDKEY, 0);
142+
keybd_event(virtualKey, 0, KEYEVENTF_KEYUP, 0);
143+
}
126144

127145
// Hold the urine level
128146
PlayMakerGlobals.Instance.Variables.FindFsmFloat("PlayerUrine").Value = lastUrineValue <= 0 ? 1 : lastUrineValue;
129147
pissAreas.FsmVariables.FindFsmFloat("PissRate").Value = -400;
130148
}
131149
else
132-
{
150+
{
133151
ToggleCleaningMode(false);
134152
}
135153

@@ -167,6 +185,12 @@ void ToggleCleaningMode(bool enabled)
167185
// Enable in hand model and disable this object's renderer
168186
mopInHand.SetActive(true);
169187
renderer.SetActive(false);
188+
189+
// This piece of code prevents player from dropping the mop and lets him open doors, etc.
190+
(itemPickedState.Actions[1] as GetMouseButtonDown).sendEvent = equipEvent;
191+
(itemPickedState.Actions[2] as GetMouseButtonDown).sendEvent = equipEvent;
192+
(itemPickedState.Actions[3] as GetKeyDown).sendEvent = equipEvent;
193+
(itemPickedState.Actions[4] as GetKeyDown).sendEvent = equipEvent;
170194
}
171195
else
172196
{
@@ -175,6 +199,12 @@ void ToggleCleaningMode(bool enabled)
175199
// Disable in hand model and toggle back on this object's renderer
176200
mopInHand.SetActive(false);
177201
renderer.SetActive(true);
202+
203+
// Deactivate the previos script
204+
(itemPickedState.Actions[1] as GetMouseButtonDown).sendEvent = proceedDropEvent;
205+
(itemPickedState.Actions[2] as GetMouseButtonDown).sendEvent = proceedThrowEvent;
206+
(itemPickedState.Actions[3] as GetKeyDown).sendEvent = proceedDropEvent;
207+
(itemPickedState.Actions[4] as GetKeyDown).sendEvent = proceedDropEvent;
178208
}
179209
}
180210

@@ -205,5 +235,15 @@ public MopSaveData GetSaveInfo()
205235
{
206236
return new MopSaveData(transform.position, transform.rotation);
207237
}
238+
239+
void OnApplicationFocus(bool hasFocus)
240+
{
241+
isPaused = !hasFocus;
242+
}
243+
244+
void OnApplicationPause(bool pauseStatus)
245+
{
246+
isPaused = pauseStatus;
247+
}
208248
}
209-
}
249+
}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 1.0 (11.02.2020)
4+
5+
### Added
6+
7+
- Player can now open the doors while holding the mop, without dropping it
8+
9+
### Changes
10+
11+
- The key binded to urinating will not be clicked anymore, if you Alt+Tab from the game
12+
313
## Beta 0.3 (10.02.2020)
414

515
### Changes

PleaseReadMe.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,10 @@ You can find your mop in the washing machine room (between kitchen and bathroom)
2525
- BrennFuchS (https://www.racedepartment.com/downloads/authors/brennfuchs-yt.257537/) - 3D model of the mop
2626

2727

28+
# CREDITS #
29+
- BrennFuchS (https://www.racedepartment.com/downloads/authors/brennfuchs-yt.257537/) - 3D model of the mop
30+
- People at MSC Modding Discord for a help with an anti-drop script
31+
32+
2833
# CONTACT #
2934
Discord: Athlon#5974

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,14 @@ Grab the mod from [NexusMods](https://www.nexusmods.com/mysummercar/mods/163), [
2020

2121
You can find your mop in the washing machine room (between kitchen and bathroom).
2222

23-
## Known issues
24-
25-
* Player may need to drop and grab the mop again, in order to it work when moving between rooms
26-
2723
## License
2824

2925
This program is distributed under GNU General Public License v3. Feel free to use its source code as long as you mention the author and state the changes. You can also modify, share and distribute it, as long as you state changes. For more, see [LICENSE](LICENSE.md) file.
3026

3127
## Credits
3228

3329
- [BrennFuchS](https://www.racedepartment.com/downloads/authors/brennfuchs-yt.257537/) - 3D model of the mop
30+
- People at MSC Modding Discord for a help with an anti-drop script
3431

3532
## Support
3633

0 commit comments

Comments
 (0)