Initial commit

This commit is contained in:
Ricardo Lopes 2020-02-10 23:03:28 +01:00
commit 1c302a931f
12 changed files with 321 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
packages
.vs
QSB/bin
QSB/obj

25
QSB.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QSB", "QSB\QSB.csproj", "{1F00090A-C697-4C55-B401-192F3CFB9DC2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1F00090A-C697-4C55-B401-192F3CFB9DC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F00090A-C697-4C55-B401-192F3CFB9DC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F00090A-C697-4C55-B401-192F3CFB9DC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F00090A-C697-4C55-B401-192F3CFB9DC2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {59091249-7726-4F95-86E2-3C3278C9CB9B}
EndGlobalSection
EndGlobal

BIN
QSB/Assets/network Normal file

Binary file not shown.

View File

@ -0,0 +1,29 @@
ManifestFileVersion: 0
CRC: 3137456723
Hashes:
AssetFileHash:
serializedVersion: 2
Hash: a8622f2115b36ee2bd8a26fbd37882e9
TypeTreeHash:
serializedVersion: 2
Hash: 47ee499ae8022a6b96ca6a5fd541f154
HashAppended: 0
ClassTypes:
- Class: 1
Script: {instanceID: 0}
- Class: 4
Script: {instanceID: 0}
- Class: 114
Script: {fileID: 372142912, guid: dc443db3e92b4983b9738c1131f555cb, type: 3}
- Class: 114
Script: {fileID: -822479833, guid: dc443db3e92b4983b9738c1131f555cb, type: 3}
- Class: 114
Script: {fileID: 227461547, guid: dc443db3e92b4983b9738c1131f555cb, type: 3}
- Class: 114
Script: {fileID: -1768714887, guid: dc443db3e92b4983b9738c1131f555cb, type: 3}
- Class: 115
Script: {instanceID: 0}
Assets:
- Assets/NetworkPlayer.prefab
- Assets/NetworkManager.prefab
Dependencies: []

37
QSB/NetworkPlayer.cs Normal file
View File

@ -0,0 +1,37 @@
using UnityEngine;
using UnityEngine.Networking;
namespace QSB {
public class NetworkPlayer: NetworkBehaviour {
Transform _body;
Transform _sun;
void Start () {
QSB.Log("Started network player");
_sun = Locator.GetAstroObject(AstroObject.Name.TimberHearth).transform;
var player = Locator.GetPlayerBody().transform.Find("Traveller_HEA_Player_v2");
if (isLocalPlayer) {
_body = player;
} else {
_body = Instantiate(player);
_body.parent = transform;
_body.localPosition = Vector3.zero;
_body.localRotation = Quaternion.identity;
}
}
void Update () {
if (!_body) {
return;
}
if (isLocalPlayer) {
transform.position = _body.position - _sun.position;
transform.rotation = _body.rotation * Quaternion.Inverse(_sun.rotation);
} else {
_body.position = _sun.position + transform.position;
_body.rotation = transform.rotation * _sun.rotation;
}
}
}
}

View File

@ -0,0 +1,36 @@
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("FriendsInSpace")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FriendsInSpace")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[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("1f00090a-c697-4c55-b401-192f3cfb9dc2")]
// 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.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

56
QSB/QSB.cs Normal file
View File

@ -0,0 +1,56 @@
using OWML.Common;
using OWML.ModHelper;
using UnityEngine;
using UnityEngine.Networking;
namespace QSB {
public class QSB: ModBehaviour {
static QSB _instance;
void Awake () {
Application.runInBackground = true;
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
void Update () {
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
void Start () {
_instance = this;
ModHelper.Events.Subscribe<PlayerBody>(Events.AfterStart);
ModHelper.Events.OnEvent += OnEvent;
var assetBundle = ModHelper.Assets.LoadBundle("assets/network");
var networkManager = Instantiate(assetBundle.LoadAsset<GameObject>("assets/networkmanager.prefab"));
var networkPlayerPrefab = assetBundle.LoadAsset<GameObject>("assets/networkplayer.prefab");
networkPlayerPrefab.AddComponent<NetworkPlayer>();
networkManager.GetComponent<NetworkManager>().playerPrefab = networkPlayerPrefab;
}
void OnEvent (MonoBehaviour behaviour, Events ev) {
var player = GameObject.Find("Traveller_HEA_Player_v2");
var spawn1 = Locator.GetPlayerBody().gameObject;
spawn1.AddComponent<NetworkStartPosition>();
var spawn2 = Locator.GetShipBody().gameObject;
spawn2.AddComponent<NetworkStartPosition>();
var networkIdentity = player.AddComponent<NetworkIdentity>();
networkIdentity.localPlayerAuthority = true;
var networkTransform = player.AddComponent<NetworkTransform>();
var networkManager = gameObject.AddComponent<NetworkManager>();
networkManager.playerPrefab = player;
var networkHUD = gameObject.AddComponent<NetworkManagerHUD>();
}
public static void Log (params string[] strings) {
_instance.ModHelper.Console.WriteLine(string.Join(" ", strings));
}
}
}

105
QSB/QSB.csproj Normal file
View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" 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>{1F00090A-C697-4C55-B401-192F3CFB9DC2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FriendsInSpace</RootNamespace>
<AssemblyName>FriendsInSpace</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony, Version=1.2.0.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Lib.Harmony.1.2.0.1\lib\net35\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\..\Program Files\Epic Games\OuterWilds\OuterWilds_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="NAudio-Unity, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.3.35\lib\net35\NAudio-Unity.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Json.Net.Unity3D.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="OWML, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.3.35\lib\net35\OWML.dll</HintPath>
</Reference>
<Reference Include="OWML.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.3.35\lib\net35\OWML.Common.dll</HintPath>
</Reference>
<Reference Include="OWML.ModHelper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.3.35\lib\net35\OWML.ModHelper.dll</HintPath>
</Reference>
<Reference Include="OWML.ModHelper.Assets, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.3.35\lib\net35\OWML.ModHelper.Assets.dll</HintPath>
</Reference>
<Reference Include="OWML.ModHelper.Events, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.3.35\lib\net35\OWML.ModHelper.Events.dll</HintPath>
</Reference>
<Reference Include="OWML.ModHelper.Menus, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.3.35\lib\net35\OWML.ModHelper.Menus.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\..\..\Program Files\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\..\..\..\Program Files\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Networking">
<HintPath>..\..\..\..\..\..\Program Files\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.Networking.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="QSB.cs" />
<Compile Include="NetworkPlayer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="default-config.json" />
<None Include="manifest.json" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>md "$(StartWorkingDirectory)\Mods\FriendsInSpace"
md "$(StartWorkingDirectory)\Mods\FriendsInSpace\assets"
copy /y "$(TargetPath)" "$(StartWorkingDirectory)\Mods\FriendsInSpace\FriendsInSpace.dll"
copy /y "$(ProjectDir)\default-config.json" "$(StartWorkingDirectory)\Mods\FriendsInSpace\default-config.json"
copy /y "$(ProjectDir)\default-config.json" "$(StartWorkingDirectory)\Mods\FriendsInSpace\config.json"
copy /y "$(ProjectDir)\manifest.json" "$(StartWorkingDirectory)\Mods\FriendsInSpace\manifest.json"
copy /y "$(ProjectDir)\Assets\*" "$(StartWorkingDirectory)\Mods\FriendsInSpace\Assets"</PostBuildEvent>
</PropertyGroup>
</Project>

9
QSB/QSB.csproj.user Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartWorkingDirectory>C:\Program Files\Epic Games\OuterWilds\OWML</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>

5
QSB/default-config.json Normal file
View File

@ -0,0 +1,5 @@
{
"requireVR": false,
"enabled": true,
"settings": {}
}

8
QSB/manifest.json Normal file
View File

@ -0,0 +1,8 @@
{
"filename": "FriendsInSpace.dll",
"author": "Raicuparta",
"name": "FriendsInSpace",
"uniqueName": "Raicuparta.FriendsInSpace",
"version": "0.1",
"owmlVersion": "0.3.30"
}

6
QSB/packages.config Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Json.Net.Unity3D" version="9.0.1" targetFramework="net35" />
<package id="Lib.Harmony" version="1.2.0.1" targetFramework="net35" />
<package id="OWML" version="0.3.35" targetFramework="net35" />
</packages>