-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor how locomotive spawners work
The new documentation explains it better than I could here.
- Loading branch information
Showing
18 changed files
with
311 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,6 @@ trim_trailing_whitespace = false | |
|
||
[*.json] | ||
indent_size = 2 | ||
|
||
[*.csproj] | ||
ij_xml_space_inside_empty_tag = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,57 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="../UserProperties.props" Condition="Exists('../UserProperties.props')"/> | ||
<Import Project="../UserProperties.props" Condition="Exists('../UserProperties.props')" /> | ||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<LangVersion>7.3</LangVersion> | ||
<RootNamespace>Mapify</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="../MapifyEditor/MapifyEditor.csproj"/> | ||
<ProjectReference Include="../MapifyEditor/MapifyEditor.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<!-- Derail Valley --> | ||
<Reference Include="Assembly-CSharp"/> | ||
<Reference Include="CommandTerminal"/> | ||
<Reference Include="DV.Common"/> | ||
<Reference Include="DV.Interaction"/> | ||
<Reference Include="DV.Inventory"/> | ||
<Reference Include="DV.Localization"/> | ||
<Reference Include="DV.PointSet"/> | ||
<Reference Include="DV.TerrainSystem"/> | ||
<Reference Include="DV.TerrainTools"/> | ||
<Reference Include="DV.ThingTypes"/> | ||
<Reference Include="DV.UI"/> | ||
<Reference Include="DV.UIFramework"/> | ||
<Reference Include="DV.UserManagement"/> | ||
<Reference Include="DV.Utils"/> | ||
<Reference Include="DV.WeatherSystem"/> | ||
<Reference Include="Assembly-CSharp" /> | ||
<Reference Include="CommandTerminal" /> | ||
<Reference Include="DV.Common" /> | ||
<Reference Include="DV.Interaction" /> | ||
<Reference Include="DV.Inventory" /> | ||
<Reference Include="DV.Localization" /> | ||
<Reference Include="DV.PointSet" /> | ||
<Reference Include="DV.TerrainSystem" /> | ||
<Reference Include="DV.TerrainTools" /> | ||
<Reference Include="DV.ThingTypes" /> | ||
<Reference Include="DV.UI" /> | ||
<Reference Include="DV.UIFramework" /> | ||
<Reference Include="DV.UserManagement" /> | ||
<Reference Include="DV.Utils" /> | ||
<Reference Include="DV.WeatherSystem" /> | ||
<!-- Third-party --> | ||
<Reference Include="AwesomeTechnologies.VegetationStudioPro.Runtime"/> | ||
<Reference Include="BezierCurves"/> | ||
<Reference Include="I2.Localization"/> | ||
<Reference Include="net.smkd.vector3d"/> | ||
<Reference Include="Newtonsoft.Json"/> | ||
<Reference Include="sc.posteffects.runtime"/> | ||
<Reference Include="AwesomeTechnologies.VegetationStudioPro.Runtime" /> | ||
<Reference Include="BezierCurves" /> | ||
<Reference Include="I2.Localization" /> | ||
<Reference Include="net.smkd.vector3d" /> | ||
<Reference Include="Newtonsoft.Json" /> | ||
<Reference Include="sc.posteffects.runtime" /> | ||
<!-- Mod Loader --> | ||
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all"/> | ||
<PackageReference Include="BepInEx.Core" Version="5.*"/> | ||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*"/> | ||
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" /> | ||
<PackageReference Include="BepInEx.Core" Version="5.*" /> | ||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" /> | ||
<!-- Unity --> | ||
<Reference Include="Unity.Collections"/> | ||
<Reference Include="Unity.Postprocessing.Runtime"/> | ||
<Reference Include="Unity.TextMeshPro"/> | ||
<Reference Include="UnityEngine.UI"/> | ||
<PackageReference Include="UnityEngine.Modules" Version="2019.4.40" IncludeAssets="compile"/> | ||
<Reference Include="Unity.Collections" /> | ||
<Reference Include="Unity.Postprocessing.Runtime" /> | ||
<Reference Include="Unity.TextMeshPro" /> | ||
<Reference Include="UnityEngine.UI" /> | ||
<PackageReference Include="UnityEngine.Modules" Version="2019.4.40" IncludeAssets="compile" /> | ||
</ItemGroup> | ||
|
||
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> | ||
<!-- Copy to build folder --> | ||
<Copy SourceFiles="$(TargetPath)" DestinationFolder="../build/runtime"/> | ||
<Copy SourceFiles="$(TargetPath)" DestinationFolder="../build/runtime" /> | ||
|
||
<!-- Copy to game install folder --> | ||
<Exec Condition="Exists('$(DvInstallDir)') And '$(OS)' == 'Windows_NT'" Command="powershell -executionpolicy bypass -Command "(../package.ps1 -NoArchive -OutputDirectory '$(DvInstallDir)')""/> | ||
<Exec Condition="Exists('$(DvInstallDir)') And '$(OS)' != 'Windows_NT'" Command="pwsh -Command "(../package.ps1 -NoArchive -OutputDirectory '$(DvInstallDir)')""/> | ||
<Exec Condition="Exists('$(DvInstallDir)') And '$(OS)' == 'Windows_NT'" Command="powershell -executionpolicy bypass -Command "(../package.ps1 -NoArchive -OutputDirectory '$(DvInstallDir)')"" /> | ||
<Exec Condition="Exists('$(DvInstallDir)') And '$(OS)' != 'Windows_NT'" Command="pwsh -Command "(../package.ps1 -NoArchive -OutputDirectory '$(DvInstallDir)')"" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
Mapify/SceneInitializers/Railway/LocomotiveSpawnerSetup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Linq; | ||
using DV; | ||
using Mapify.Editor; | ||
using UnityEngine; | ||
|
||
namespace Mapify.SceneInitializers.Railway | ||
{ | ||
public class LocomotiveSpawnerSetup : SceneSetup | ||
{ | ||
public override void Run() | ||
{ | ||
foreach (LocomotiveSpawner spawner in Object.FindObjectsOfType<LocomotiveSpawner>()) SetupLocomotiveSpawner(spawner); | ||
} | ||
|
||
public static void SetupLocomotiveSpawner(LocomotiveSpawner spawner) | ||
{ | ||
bool wasActive = spawner.gameObject.activeSelf; | ||
spawner.gameObject.SetActive(false); | ||
StationLocoSpawner locoSpawner = spawner.gameObject.AddComponent<StationLocoSpawner>(); | ||
locoSpawner.spawnRotationFlipped = spawner.flipOrientation; | ||
locoSpawner.locoSpawnTrackName = spawner.Track.name; | ||
locoSpawner.locoTypeGroupsToSpawn = spawner.condensedLocomotiveTypes | ||
.Select(rollingStockTypes => | ||
new ListTrainCarTypeWrapper(rollingStockTypes.Split(',').Select(rollingStockType => | ||
Globals.G.Types.Liveries.Find(l => l.id == rollingStockType) | ||
).ToList() | ||
) | ||
).ToList(); | ||
spawner.gameObject.SetActive(wasActive); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Mapify.Editor | ||
{ | ||
[Serializable] | ||
// Unity doing Unity things and not supporting nested lists in the editor | ||
// Unity also doing Unity things by only supporting generics in 2020.1 and up | ||
public class CustomRollingStockList | ||
{ | ||
public List<string> rollingStock; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.