Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
1.1.2
Browse files Browse the repository at this point in the history
- Additional updates for Tree Controller integration.
  • Loading branch information
algernon-A committed Dec 14, 2023
1 parent 0f8d960 commit b76f5a7
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 16 deletions.
2 changes: 1 addition & 1 deletion BepInEx/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace LineTool
/// <summary>
/// BepInEx plugin to substitute for IMod support.
/// </summary>
[BepInPlugin(GUID, "Line Tool Lite", "1.1.1")]
[BepInPlugin(GUID, "Line Tool Lite", "1.1.2")]
[HarmonyPatch]
public class Plugin : BaseUnityPlugin
{
Expand Down
2 changes: 1 addition & 1 deletion BepInEx/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Line_Tool_Lite",
"version_number": "1.1.1",
"version_number": "1.1.2",
"website_url": "https://github.com/algernon-A/LineToolLite",
"description": "Place objects in lines, curves, or circles. A variety of options and controls are availalbe to specify and fine-tune results.",
"dependencies": [
Expand Down
5 changes: 4 additions & 1 deletion Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
1.1.2
- Additional updates for Tree Controller integration.

1.1.1
- Update Tree Controller integration
- Update Tree Controller integration.

1.1.0
- Add dragging of line control points in fixed preview mode.
Expand Down
43 changes: 31 additions & 12 deletions Code/Systems/LineToolSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ namespace LineTool
using Colossal.Entities;
using Colossal.Logging;
using Colossal.Mathematics;
using Colossal.Serialization.Entities;
using Game;
using Game.Common;
using Game.Input;
using Game.Objects;
Expand Down Expand Up @@ -380,6 +382,16 @@ protected override void OnCreate()
hotKey.AddCompositeBinding("ButtonWithOneModifier").With("Modifier", "<Keyboard>/ctrl").With("Button", "<Keyboard>/l");
hotKey.performed += EnableTool;
hotKey.Enable();
}

/// <summary>
/// Called by the game when loading is complete.
/// </summary>
/// <param name="purpose">Loading purpose.</param>
/// <param name="mode">Current game mode.</param>
protected override void OnGameLoadingComplete(Purpose purpose, GameMode mode)
{
base.OnGameLoadingComplete(purpose, mode);

// Try to get tree controller tool.
if (World.GetOrCreateSystemManaged<ToolSystem>().tools.Find(x => x.toolID.Equals("Tree Controller Tool")) is ToolBaseSystem treeControllerTool)
Expand Down Expand Up @@ -546,23 +558,30 @@ protected override JobHandle OnUpdate(JobHandle inputDeps)
// Update cursor entity if we haven't got an initial position set.
if (!_mode.HasStart)
{
// Delete any existing cursor entity and create a new one.
if (_cursorEntity != Entity.Null)
// Don't update if the cursor hasn't moved.
if (position.x != _previousPos.x || position.z != _previousPos.z)
{
EntityManager.AddComponent<Deleted>(_cursorEntity);
}
// Delete any existing cursor entity and create a new one.
if (_cursorEntity != Entity.Null)
{
EntityManager.AddComponent<Deleted>(_cursorEntity);
}

_cursorEntity = CreateEntity();
_cursorEntity = CreateEntity();

// Highlight cursor entity.
EntityManager.AddComponent<Highlighted>(_cursorEntity);
// Highlight cursor entity.
EntityManager.AddComponent<Highlighted>(_cursorEntity);

// Update cursor entity position.
EntityManager.SetComponentData(_cursorEntity, new Transform { m_Position = position, m_Rotation = GetEffectiveRotation(position) });
EntityManager.AddComponent<BatchesUpdated>(_cursorEntity);
// Update cursor entity position.
EntityManager.SetComponentData(_cursorEntity, new Transform { m_Position = position, m_Rotation = GetEffectiveRotation(position) });
EntityManager.AddComponent<BatchesUpdated>(_cursorEntity);

// Ensure cursor entity tree state.
EnsureTreeState(_cursorEntity);
// Ensure cursor entity tree state.
EnsureTreeState(_cursorEntity);

// Update previous position.
_previousPos = position;
}

return inputDeps;
}
Expand Down
2 changes: 1 addition & 1 deletion LineToolLite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Authors>algernon</Authors>
<Copyright>Copyright © 2023 algernon (github.com/algernon-A). All rights reserved.</Copyright>
<Product>$(Title)</Product>
<Version>1.1.1</Version>
<Version>1.1.2</Version>
<LangVersion>9.0</LangVersion>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
Expand Down

0 comments on commit b76f5a7

Please sign in to comment.