Skip to content
This repository was archived by the owner on Jun 24, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Binary file added GameData/KSPAPIExtensions.dll
Binary file not shown.
Binary file added GameData/KSPAPIExtras.dll
Binary file not shown.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ if incrementSmall is not set, then no button is visible in the control. If incre

The slider is set to run between the smallest available increment, so in the above if the current value was 1.3, then the slider would run from 1.25 to 1.5.


KSPAPIExtras
================
KSPAPIExtras is a set of additional tools built on the KSPAPIExtensions framework. It ships in a separate assembly and depends on KSPAPIExtensions.
# PartMessage

This is an improvement over the existing SendMessage system of Unity. It creates a publish/subscribe model for messages both within and between parts on a vessel. It will automatically wire message event senders and listeners in a PartModule or Part if they have the appropriate attributes.
Expand Down
22 changes: 0 additions & 22 deletions Source/CommonAPI/GameObjectExt.cs

This file was deleted.

169 changes: 0 additions & 169 deletions Source/CommonAPI/ResourceExtensions.cs

This file was deleted.

10 changes: 8 additions & 2 deletions Source/KSPAPIExtensions.sln
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
# Visual Studio 2012
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KSPAPIExtensions", "KSPAPIExtensions.csproj", "{4282B0DA-C314-4524-9C32-EDAB2C9666A9}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KSPAPIExtensions", "KSPAPIExtensions\KSPAPIExtensions.csproj", "{4282B0DA-C314-4524-9C32-EDAB2C9666A9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KSPAPIExtras", "KSPAPIExtras\KSPAPIExtras.csproj", "{7C69B948-FF19-11E4-B985-1E3E84ADF75F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -15,6 +17,10 @@ Global
{4282B0DA-C314-4524-9C32-EDAB2C9666A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4282B0DA-C314-4524-9C32-EDAB2C9666A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4282B0DA-C314-4524-9C32-EDAB2C9666A9}.Release|Any CPU.Build.0 = Release|Any CPU
{7C69B948-FF19-11E4-B985-1E3E84ADF75F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C69B948-FF19-11E4-B985-1E3E84ADF75F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C69B948-FF19-11E4-B985-1E3E84ADF75F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C69B948-FF19-11E4-B985-1E3E84ADF75F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
22 changes: 22 additions & 0 deletions Source/KSPAPIExtensions/CommonAPI/GameObjectExt.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

using KSP.IO;

namespace KSPAPIExtensions {
public static class GameObjectExtension
{
public static T AddTaggedComponent<T> (this GameObject go) where T : Component
{
Type taggedType = SystemUtils.VersionTaggedType(typeof(T));
return (T)go.AddComponent(taggedType);
}
public static T GetTaggedComponent<T> (this GameObject go) where T : Component
{
Type taggedType = SystemUtils.VersionTaggedType(typeof(T));
return (T)go.GetComponent(taggedType);
}
}
}
86 changes: 86 additions & 0 deletions Source/KSPAPIExtensions/KSPAPIExtensions.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4282B0DA-C314-4524-9C32-EDAB2C9666A9}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>KSPAPIExtensions</RootNamespace>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<UseMSBuildEngine>False</UseMSBuildEngine>
<AssemblyName>KSPAPIExtensions</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<BaseIntermediateOutputPath>..\..\Build\KSPAPIExtensions\obj\</BaseIntermediateOutputPath>
<OutputPath>..\..\GameData</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<NoWarn>1607</NoWarn>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<BaseIntermediateOutputPath>..\..\Build\KSPAPIExtensions\obj\</BaseIntermediateOutputPath>
<OutputPath>..\..\GameData</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Compile Include="tagged_classes.cs" />
<Compile Include="Tweakables\UIPartActionScaleEdit.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Tweakables\UIPartActionChooseOption.cs" />
<Compile Include="Tweakables\UIPartActionsExtended.cs" />
<Compile Include="Tweakables\UIPartActionFloatEdit.cs" />
<Compile Include="zzVersionChecker.cs" />
<Compile Include="Utils\SystemUtils.cs" />
<Compile Include="CommonAPI\GameObjectExt.cs" />
<Compile Include="Utils\MathUtils.cs" />
<Compile Include="Utils\GameScenesUtils.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>sh version-gen</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\KSP\_KSPAssemblies\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\..\..\..\KSP\_KSPAssemblies\Assembly-CSharp-firstpass.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\KSP\_KSPAssemblies\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System">
<HintPath>..\..\..\..\KSP\_KSPAssemblies\System.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
</Project>
35 changes: 35 additions & 0 deletions Source/KSPAPIExtensions/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("KSPAPIExtensions")]
[assembly: AssemblyDescription("A set of utilities for plugin developers for Kerbal Space Program")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("swamp_ig and taniwha")]
[assembly: AssemblyProduct("KSPAPIExtensions")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e46ed9d3-b992-4f9a-8e9a-64536116a2c4")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.7.4.15")]
[assembly: KSPAssembly("KSPAPIExtensions", 1, 7)]
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,13 @@ public override void UpdateItem()

private void UpdateValueDisplay(float newValue)
{
if (FieldInfo.incrementSlide != 0 &&
Mathf.Abs(this.value - newValue) >= 0.5f * FieldInfo.incrementSlide
)
{
GameEvents.onEditorShipModified.Fire(EditorLogic.fetch.ship);
}

this.value = newValue;
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (FieldInfo.incrementSlide != 0)
Expand Down
Loading