2022-01-28 20:49:07 -08:00
|
|
|
|
using Cysharp.Threading.Tasks;
|
|
|
|
|
using OWML.Common;
|
2022-04-01 19:08:03 +01:00
|
|
|
|
using QSB.ItemSync.WorldObjects;
|
2021-11-01 15:49:00 +00:00
|
|
|
|
using QSB.ItemSync.WorldObjects.Items;
|
|
|
|
|
using QSB.ItemSync.WorldObjects.Sockets;
|
2021-02-23 14:42:18 +00:00
|
|
|
|
using QSB.Utility;
|
2024-02-14 21:40:11 +00:00
|
|
|
|
using QSB.Utility.Deterministic;
|
2021-02-23 14:42:18 +00:00
|
|
|
|
using QSB.WorldSync;
|
2022-04-01 19:08:03 +01:00
|
|
|
|
using System.Linq;
|
2022-01-28 20:49:07 -08:00
|
|
|
|
using System.Threading;
|
2022-04-01 19:08:03 +01:00
|
|
|
|
using UnityEngine;
|
2021-02-23 14:42:18 +00:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
namespace QSB.ItemSync;
|
|
|
|
|
|
2023-07-28 19:30:57 +01:00
|
|
|
|
public class ItemManager : WorldObjectManager
|
2021-02-23 14:42:18 +00:00
|
|
|
|
{
|
2022-03-02 19:46:33 -08:00
|
|
|
|
public override WorldObjectScene WorldObjectScene => WorldObjectScene.Both;
|
2022-02-27 04:40:44 -08:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
public override async UniTask BuildWorldObjects(OWScene scene, CancellationToken ct)
|
|
|
|
|
{
|
|
|
|
|
DebugLog.DebugWrite("Building OWItems...", MessageType.Info);
|
2021-11-01 15:49:00 +00:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
// Items
|
|
|
|
|
QSBWorldSync.Init<QSBNomaiConversationStone, NomaiConversationStone>();
|
|
|
|
|
QSBWorldSync.Init<QSBScrollItem, ScrollItem>();
|
|
|
|
|
QSBWorldSync.Init<QSBSharedStone, SharedStone>();
|
|
|
|
|
QSBWorldSync.Init<QSBSimpleLanternItem, SimpleLanternItem>();
|
|
|
|
|
QSBWorldSync.Init<QSBSlideReelItem, SlideReelItem>();
|
|
|
|
|
QSBWorldSync.Init<QSBWarpCoreItem, WarpCoreItem>();
|
2022-10-10 22:23:44 -07:00
|
|
|
|
// dream lantern and vision torch are set up in their own managers
|
2021-11-01 15:49:00 +00:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
// Sockets
|
|
|
|
|
QSBWorldSync.Init<QSBItemSocket, OWItemSocket>();
|
2022-04-01 19:08:03 +01:00
|
|
|
|
|
2022-04-01 14:08:08 -07:00
|
|
|
|
// other drop targets that don't already have world objects
|
2022-04-01 13:42:20 -07:00
|
|
|
|
var listToInitFrom = QSBWorldSync.GetUnityObjects<MonoBehaviour>()
|
2022-04-25 21:36:17 +01:00
|
|
|
|
.Where(x => x is IItemDropTarget and not (RaftDock or RaftController or PrisonCellElevator))
|
2022-04-01 13:42:20 -07:00
|
|
|
|
.SortDeterministic();
|
2022-04-01 14:08:08 -07:00
|
|
|
|
QSBWorldSync.Init<QSBOtherDropTarget, MonoBehaviour>(listToInitFrom);
|
2021-02-23 14:42:18 +00:00
|
|
|
|
}
|
2022-04-01 13:42:20 -07:00
|
|
|
|
}
|