Skip to content

Commit

Permalink
more POIs
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaPiggy committed Sep 2, 2024
1 parent 7133cb7 commit ff52e83
Show file tree
Hide file tree
Showing 31 changed files with 462 additions and 134 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"location": {
"x": 375,
"y": 0,
"z": -344
},
"conversationNodeName": "ExampleItems_Alex_Root",
"isOneTimeOnly": "false",
"autoMovePosition": {
"x": 0,
"y": 0,
"z": 0
},
"autoMoveRotation": {
"x": 0,
"y": 45,
"z": 0
},
"includeRotation": "true"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"location": {
"x": 370.0,
"y": 0.0,
"z": -334.0
},
"conversationNodeName": "Explosives_Root",
"isOneTimeOnly": "false",
"vCam": {
"x": -4.5,
"y": 7.5,
"z": 10
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"location": {
"x": 366.0,
"y": 0.0,
"z": -344.0
},
"conversationNodeName": "ExampleItems_Steve_Root",
"isOneTimeOnly": "false"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"location": {
"x": 362.0,
"y": 0.0,
"z": -344.0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
"harvestableParticlePrefab": "TrinketParticles",
"items": [ "exampleitems.diamond" ],
"nightItems": [ "exampleitems.musicdisc" ],
"startStock": 3,
"maxStock": 5,
"startStock": 1,
"maxStock": 2,
"doesRestock": true,
"usesTimeSpecificStock": true,
"overrideDefaultDaySpecialChance": true,
"overriddenDaytimeSpecialChance": 0.5,
"overrideDefaultNightSpecialChance": true,
"overriddenNighttimeSpecialChance": 0.5
"usesTimeSpecificStock": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@
"startStock": 5,
"maxStock": 10,
"doesRestock": true,
"usesTimeSpecificStock": false,
"overrideDefaultDaySpecialChance": true,
"overriddenDaytimeSpecialChance": 0.5,
"overrideDefaultNightSpecialChance": true,
"overriddenNighttimeSpecialChance": 0.5
"usesTimeSpecificStock": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,5 @@
"startStock": 3,
"maxStock": 5,
"doesRestock": true,
"usesTimeSpecificStock": true,
"overrideDefaultDaySpecialChance": true,
"overriddenDaytimeSpecialChance": 0.5,
"overrideDefaultNightSpecialChance": true,
"overriddenNighttimeSpecialChance": 0.5
"usesTimeSpecificStock": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,5 @@
"startStock": 5,
"maxStock": 10,
"doesRestock": true,
"usesTimeSpecificStock": true,
"overrideDefaultDaySpecialChance": true,
"overriddenDaytimeSpecialChance": 0.5,
"overrideDefaultNightSpecialChance": true,
"overriddenNighttimeSpecialChance": 0.5
"usesTimeSpecificStock": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,5 @@
"startStock": 5,
"maxStock": 10,
"doesRestock": true,
"usesTimeSpecificStock": true,
"overrideDefaultDaySpecialChance": true,
"overriddenDaytimeSpecialChance": 0.5,
"overrideDefaultNightSpecialChance": true,
"overriddenNighttimeSpecialChance": 0.5
"usesTimeSpecificStock": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@
"startStock": 1,
"maxStock": 3,
"doesRestock": true,
"usesTimeSpecificStock": false,
"overrideDefaultDaySpecialChance": true,
"overriddenDaytimeSpecialChance": 0.5,
"overrideDefaultNightSpecialChance": true,
"overriddenNighttimeSpecialChance": 0.5
"usesTimeSpecificStock": false
}
2 changes: 2 additions & 0 deletions Winch.Examples/ExampleItems/Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ private static GameObject CreateCube()

private static void OnGameStarted()
{
GameManager.Instance.SaveData.SetBoolVariable("exampleitems.explosive-detonated", val: false); // for testing

GameEvents.Instance.OnSpecialItemHandlerRequested += OnSpecialItemHandlerRequested;

try
Expand Down
32 changes: 32 additions & 0 deletions Winch/Components/ModdedAutoMovePOI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using Winch.Core;

namespace Winch.Components
{
public class ModdedAutoMovePOI : AutoMovePOI
{
[SerializeField]
public bool unlockPlayerMovementAfterConversationCompleted = true;

public override void OnConversationCompleted()
{
base.OnConversationCompleted();
if (unlockPlayerMovementAfterConversationCompleted)
{
UnlockPlayerMovement();
}
}

public void UnlockPlayerMovement()
{
WinchCore.Log.Debug("[ModdedAutoMovePOI] UnlockPlayerMovement()");
GameManager.Instance.Player.Controller.ClearAutoMoveTarget();
GameManager.Instance.Player.Controller.ClearAutoRotateTarget();
}
}
}
11 changes: 6 additions & 5 deletions Winch/Core/AssetLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using Winch.Serialization.POI.Item;
using Winch.Serialization.HarvestZone;
using Winch.Data.Item;
using Winch.Serialization.POI.Conversation;
using Winch.Serialization.POI.Dock;

namespace Winch.Core
{
Expand Down Expand Up @@ -97,11 +99,10 @@ private static void LoadAssetBundleFiles(string bundlesFolderpath)
{
{ typeof(CustomHarvestPOI), "Harvest"},
{ typeof(CustomItemPOI), "Item"},
//{ typeof(BaitHarvestPOI), "Bait"},
//{ typeof(PlacedHarvestPOI), "Placed"},
//{ typeof(AutoMovePOI), "Conversation/AutoMove"},
//{ typeof(ExplosivePOI), "Conversation/Explosive"},
//{ typeof(InspectPOI), "Conversation/Inspect"}
{ typeof(CustomDockPOI), "Dock"},
{ typeof(CustomAutoMovePOI), "Conversation/AutoMove"},
{ typeof(CustomExplosivePOI), "Conversation/Explosive"},
{ typeof(CustomInspectPOI), "Conversation/Inspect"}
};

private static void LoadPoiFiles(string poiFolderPath)
Expand Down
1 change: 1 addition & 0 deletions Winch/Patches/API/PlayerPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static void Postfix(Player __instance)
{
AbilityUtil.AddModdedAbilitiesToPlayer(__instance.transform.Find("Abilities"));
PoiUtil.PopulateHarvestablesAndHarvestParticlePrefabs();
PoiUtil.PopulateConversationPois();
PoiUtil.CreateModdedPois();
HarvestZoneUtil.CreateModdedHarvestZones();
ItemUtil.Encyclopedia();
Expand Down
26 changes: 0 additions & 26 deletions Winch/Serialization/POI/Conversation/ConversationPOIConverter.cs

This file was deleted.

35 changes: 35 additions & 0 deletions Winch/Serialization/POI/Conversation/CustomAutoMovePOI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace Winch.Serialization.POI.Conversation;

public class CustomAutoMovePOI : CustomConversationPOI
{
/// <summary>
/// Position to move the player's boat to, relative to this point of interest.
/// </summary>
[SerializeField]
public Vector3 autoMovePosition = Vector3.zero;

/// <summary>
/// Whether to use <see cref="autoMoveRotation"/>
/// </summary>
[SerializeField]
public bool includeRotation = false;

/// <summary>
/// Rotation to move the player's boat to, relative to this point of interest.
/// </summary>
[SerializeField]
public Vector3 autoMoveRotation = Vector3.zero;

/// <summary>
/// Whether to unlock player movement after the dialogue ends
/// </summary>
[SerializeField]
public bool unlockPlayerMovementAfterConversationCompleted = true;
}
20 changes: 20 additions & 0 deletions Winch/Serialization/POI/Conversation/CustomAutoMovePOIConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Collections.Generic;
using UnityEngine;

namespace Winch.Serialization.POI.Conversation;

public class CustomAutoMovePOIConverter : CustomConversationPOIConverter
{
private readonly Dictionary<string, FieldDefinition> _definitions = new()
{
{ "autoMovePosition", new(Vector3.zero, o=>DredgeTypeHelpers.ParseVector3(o)) },
{ "includeRotation", new(false, o=> bool.Parse(o.ToString())) },
{ "autoMoveRotation", new(Vector3.zero, o=>DredgeTypeHelpers.ParseVector3(o)) },
{ "unlockPlayerMovementAfterConversationCompleted", new(true, o=> bool.Parse(o.ToString())) },
};

public CustomAutoMovePOIConverter()
{
AddDefinitions(_definitions);
}
}
36 changes: 36 additions & 0 deletions Winch/Serialization/POI/Conversation/CustomConversationPOI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Cinemachine;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace Winch.Serialization.POI.Conversation;

public class CustomConversationPOI : CustomPOI
{
[SerializeField]
public bool isOneTimeOnly = true;

[SerializeField]
public bool releaseCameraOnComplete = true;

[SerializeField]
public string conversationNodeName = string.Empty;

[SerializeField]
public bool enabledByOtherNodeVisit;

[SerializeField]
public List<string> enableNodeNames = new List<string>();

[SerializeField]
public bool shouldDisableOnOtherNodeVisit;

[SerializeField]
public List<string> otherNodeNames = new List<string>();

[SerializeField]
public Vector3 vCam;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using UnityEngine;

namespace Winch.Serialization.POI.Conversation;

public class CustomConversationPOIConverter : CustomPOIConverter
{
private readonly Dictionary<string, FieldDefinition> _definitions = new()
{
{ "conversationNodeName", new( string.Empty, null) },
{ "enabledByOtherNodeVisit", new( false, o=>bool.Parse(o.ToString())) },
{ "enableNodeNames", new( new List<string>(), o=>DredgeTypeHelpers.ParseStringList((JArray)o)) },
{ "isOneTimeOnly", new( true, o=>bool.Parse(o.ToString())) },
{ "otherNodeNames", new( new List<string>(), o=>DredgeTypeHelpers.ParseStringList((JArray)o)) },
{ "releaseCameraOnComplete", new( true, o=>bool.Parse(o.ToString())) },
{ "shouldDisableOnOtherNodeVisit", new( false, o=>bool.Parse(o.ToString())) },
{ "vCam", new( Vector3.one, o=>DredgeTypeHelpers.ParseVector3(o)) },
};

public CustomConversationPOIConverter()
{
AddDefinitions(_definitions);
}
}
15 changes: 15 additions & 0 deletions Winch/Serialization/POI/Conversation/CustomExplosivePOI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Cinemachine;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace Winch.Serialization.POI.Conversation;

public class CustomExplosivePOI : CustomConversationPOI
{
[SerializeField]
public string explodeVibration;
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
using System.Collections.Generic;

// ReSharper disable HeapView.BoxingAllocation

namespace Winch.Serialization.POI.Conversation;

public class AutoMovePoiConverter : ConversationPoiConverter
// ReSharper disable HeapView.BoxingAllocation

public class CustomExplosivePOIConverter : CustomConversationPOIConverter
{
private readonly Dictionary<string, FieldDefinition> _definitions = new()
{
{ "autoMoveDestination", new( null, null) },
{ "includeRotation", new( false, null) },
{ "conversationNodeName", new("Explosives_Root", null) },
{ "isOneTimeOnly", new(false, null) },
{ "explodeVibration", new(string.Empty, null) },
};

public AutoMovePoiConverter()
public CustomExplosivePOIConverter()
{
AddDefinitions(_definitions);
}
Expand Down
Loading

0 comments on commit ff52e83

Please sign in to comment.