Skip to content

Commit

Permalink
fixed a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tommojphillips committed Sep 20, 2021
1 parent 48ad8ea commit c0e3b74
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 54 deletions.
1 change: 1 addition & 0 deletions ModAPI.sln
Expand Up @@ -31,6 +31,7 @@ Global
{59C5939B-FA7D-4A62-9778-9653502CBB35}.Debug|x86.ActiveCfg = Debug|x86
{59C5939B-FA7D-4A62-9778-9653502CBB35}.Debug|x86.Build.0 = Debug|x86
{59C5939B-FA7D-4A62-9778-9653502CBB35}.Release|x64.ActiveCfg = Release|x64
{59C5939B-FA7D-4A62-9778-9653502CBB35}.Release|x64.Build.0 = Release|x64
{59C5939B-FA7D-4A62-9778-9653502CBB35}.Release|x86.ActiveCfg = Release|x86
{59C5939B-FA7D-4A62-9778-9653502CBB35}.Release|x86.Build.0 = Release|x86
EndGlobalSection
Expand Down
2 changes: 1 addition & 1 deletion ModAPI/Attachable/CallBacks/TriggerCallBack.cs
@@ -1,7 +1,7 @@
using System;
using UnityEngine;

namespace TommoJProductions.ModApi.v0_1_3_0_alpha.Attachable.CallBacks
namespace TommoJProductions.ModApi.Attachable.CallBacks
{
/// <summary>
/// Represents call back for triggers.
Expand Down
37 changes: 8 additions & 29 deletions ModAPI/Attachable/Part.cs
@@ -1,11 +1,10 @@
using MSCLoader;
using System;
using System;
using System.Collections;
using System.Linq;
using TommoJProductions.ModApi.v0_1_3_0_alpha.Attachable.CallBacks;
using TommoJProductions.ModApi.Attachable.CallBacks;
using UnityEngine;

namespace TommoJProductions.ModApi.v0_1_3_0_alpha.Attachable
namespace TommoJProductions.ModApi.Attachable
{
/// <summary>
/// Represents a pickable and installable part for the satsuma (or anything).
Expand Down Expand Up @@ -107,16 +106,17 @@ public PartSaveInfo(Part inPart)
public bool installed
{
get => loadedSaveInfo.installed;
set => loadedSaveInfo.installed = value;
private set => loadedSaveInfo.installed = value;
}
/// <summary>
/// Represents the current install point index that this part is installed to.
/// </summary>
public int installPointIndex
{
get => loadedSaveInfo.installedPointIndex;
set => loadedSaveInfo.installedPointIndex = value;
private set => loadedSaveInfo.installedPointIndex = value;
}

#endregion

#region Private Fields
Expand Down Expand Up @@ -273,8 +273,6 @@ public void initPart(PartSaveInfo saveInfo, params Trigger[] triggerRefs)
triggers = triggerRefs;

loadedSaveInfo = saveInfo ?? defaultSaveInfo ?? new PartSaveInfo();
installed = loadedSaveInfo.installed;
installPointIndex = loadedSaveInfo.installedPointIndex;
installPointColliders = new Collider[triggerRefs.Length];
if (triggerRefs.Length > 0)
{
Expand All @@ -291,8 +289,6 @@ public void initPart(PartSaveInfo saveInfo, params Trigger[] triggerRefs)
if (installed)
assemble(installPointColliders[installPointIndex], false);
}
else
ModConsole.LogWarning($"no install point defined ({name})");
if (!installed)
{
transform.position = loadedSaveInfo.position;
Expand All @@ -308,10 +304,8 @@ public void assemble(Collider installPoint, bool playSound = true)
{
installed = true;
inTrigger = false;

installPoint.enabled = false;
installPointIndex = Array.IndexOf(installPointColliders, installPoint);
triggers[installPointIndex].triggerRenderer.enabled = false;
makePartPickable(false);
transform.parent = installPoint.transform;
transform.localPosition = Vector3.zero;
Expand All @@ -333,8 +327,6 @@ public void assemble(Collider installPoint, bool playSound = true)
if (installedRoutine != null)
StopCoroutine(installedRoutine);
installedRoutine = StartCoroutine(partInstalled());

ModConsole.Log($"PartMagnet: {gameObject.name} attached on attachment point: {installPoint.name}.");
}
/// <summary>
/// Disassemble this part from the installed point
Expand All @@ -343,20 +335,11 @@ public void assemble(Collider installPoint, bool playSound = true)
public void disassemble(bool playSound = true)
{
installed = false;

if (installedRoutine != null)
StopCoroutine(installedRoutine);
if (mouseOver)
mouseOverReset();

makePartPickable(true);

transform.parent = null;

triggers[installPointIndex].triggerRenderer.enabled = true;

installPointColliders[installPointIndex].enabled = true;

transform.parent = null;
setActiveAttachedToTrigger(true);
cachedRigidBody = gameObject.AddComponent<Rigidbody>();
cachedRigidBody.mass = cachedMass;

Expand All @@ -366,8 +349,6 @@ public void disassemble(bool playSound = true)
}

onDisassemble?.Invoke();

ModConsole.Log($"Part: {gameObject.name} disassembled from install point: {installPointColliders[installPointIndex].name}.");
}
/// <summary>
/// Sets all part triggers (install points) to <paramref name="active"/>.
Expand Down Expand Up @@ -416,8 +397,6 @@ public void makePartPickable(bool inPickable, LayerMasksEnum inLayer = LayerMask
gameObject.tag = "DontPickThis";
gameObject.layer = inLayer.layer();
}


/// <summary>
/// ends (resets) a gui interaction.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion ModAPI/Attachable/Trigger.cs
@@ -1,6 +1,6 @@
using UnityEngine;

namespace TommoJProductions.ModApi.v0_1_3_0_alpha.Attachable
namespace TommoJProductions.ModApi.Attachable
{
/// <summary>
/// Represents a trigger for a part.
Expand Down
2 changes: 1 addition & 1 deletion ModAPI/GuiInteractSymbolEnum.cs
@@ -1,4 +1,4 @@
namespace TommoJProductions.ModApi.v0_1_3_0_alpha
namespace TommoJProductions.ModApi
{
/// <summary>
/// Represents gui interact symbols.
Expand Down
2 changes: 1 addition & 1 deletion ModAPI/LayerMasksEnum.cs
@@ -1,4 +1,4 @@
namespace TommoJProductions.ModApi.v0_1_3_0_alpha
namespace TommoJProductions.ModApi
{
/// <summary>
/// Represents all layers of my summer car.
Expand Down
12 changes: 6 additions & 6 deletions ModAPI/ModAPI.csproj
Expand Up @@ -7,8 +7,8 @@
<ProjectGuid>{2CEAE666-CBA5-4FA6-AEE3-D6C5CFB2DE20}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TommoJProductions.ModApi.v0_1_3_0_alpha</RootNamespace>
<AssemblyName>modapi_v0130-alpha</AssemblyName>
<RootNamespace>TommoJProductions.ModApi</RootNamespace>
<AssemblyName>modapi_v0131-alpha</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Unity Full v3.5</TargetFrameworkProfile>
Expand All @@ -23,26 +23,26 @@
<PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Release\</OutputPath>
<Optimize>false</Optimize>
<DocumentationFile>bin\x86\Release\modapi_v0130-alpha.xml</DocumentationFile>
<DocumentationFile>bin\x86\Release\modapi_v0131-alpha.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<DocumentationFile>bin\x86\Debug\modapi_v0130-alpha.xml</DocumentationFile>
<DocumentationFile>bin\x86\Debug\modapi_v0131-alpha.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>x64</DefineConstants>
<Optimize>false</Optimize>
<DocumentationFile>bin\x64\Release\modapi_v0130-alpha.xml</DocumentationFile>
<DocumentationFile>bin\x64\Release\modapi_v0131-alpha.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;x64</DefineConstants>
<DocumentationFile>bin\x64\Debug\modapi_v0130-alpha.xml</DocumentationFile>
<DocumentationFile>bin\x64\Debug\modapi_v0131-alpha.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down
6 changes: 3 additions & 3 deletions ModAPI/ModClient.cs
@@ -1,11 +1,11 @@
using System.Collections.Generic;
using UnityEngine;
using HutongGames.PlayMaker;
using TommoJProductions.ModApi.v0_1_3_0_alpha.Attachable;
using TommoJProductions.ModApi.Attachable;
using System.Collections;
using System;

namespace TommoJProductions.ModApi.v0_1_3_0_alpha
namespace TommoJProductions.ModApi
{
/// <summary>
/// Represents useful properties for interacting with My Summer Car and PlayMaker.
Expand Down Expand Up @@ -42,7 +42,7 @@ public static class ModClient
/// <summary>
/// Represents the complied runtime version of the api.
/// </summary>
public const string version = "0.1.3.0";
public const string version = "0.1.3.1";

#endregion

Expand Down
2 changes: 1 addition & 1 deletion ModAPI/PlayerModeEnum.cs
@@ -1,4 +1,4 @@
namespace TommoJProductions.ModApi.v0_1_3_0_alpha
namespace TommoJProductions.ModApi
{
/// <summary>
/// Represents a player mode.
Expand Down
4 changes: 2 additions & 2 deletions ModAPI/Properties/AssemblyInfo.cs
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.3.0")]
[assembly: AssemblyFileVersion("0.1.3.0")]
[assembly: AssemblyVersion("0.1.3.1")]
[assembly: AssemblyFileVersion("0.1.3.1")]
4 changes: 1 addition & 3 deletions ModApiInterface/ConsoleCommands.cs
@@ -1,8 +1,6 @@
using MSCLoader;
using System.Collections;
using System.Linq;
using TommoJProductions.ModApi.v0_1_3_0_alpha;
using TommoJProductions.ModApi.v0_1_3_0_alpha.Attachable;
using TommoJProductions.ModApi.Attachable;
using UnityEngine;

namespace TommoJProductions.ModApi.Interface
Expand Down
10 changes: 4 additions & 6 deletions ModApiInterface/ModApiInterface.csproj
Expand Up @@ -40,6 +40,10 @@
<DocumentationFile>bin\x86\Release\ModApiInterface.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="modapi_v0131-alpha, Version=0.1.3.1, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\Games\SteamApps\steamapps\common\My Summer Car\Mods\References\modapi_v0131-alpha.dll</HintPath>
</Reference>
<Reference Include="MSCLoader">
<HintPath>D:\Games\SteamApps\steamapps\common\My Summer Car\mysummercar_Data\Managed\MSCLoader.dll</HintPath>
</Reference>
Expand All @@ -53,12 +57,6 @@
<Compile Include="ModApiInterface.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ModAPI\ModAPI.csproj">
<Project>{65DDDAC8-54EA-4116-A53D-05B126FD5A49}</Project>
<Name>ModAPI</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if "$(ConfigurationName)" == "Debug" (
Expand Down

0 comments on commit c0e3b74

Please sign in to comment.