mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-04-15 11:42:23 +00:00
set AttachedObject and ObjectId in QSBWorldSync.cs, meaning many Init()s can be removed
This commit is contained in:
parent
fde9efa599
commit
2414efd65f
@ -14,11 +14,8 @@ namespace QSB.Anglerfish.WorldObjects
|
||||
|
||||
private Vector3 _lastTargetPosition;
|
||||
|
||||
public override void Init(AnglerfishController attachedObject, int id)
|
||||
public override void Init()
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
QNetworkServer.Spawn(Object.Instantiate(QSBNetworkManager.Instance.AnglerPrefab));
|
||||
|
@ -7,12 +7,6 @@ namespace QSB.Animation.NPC.WorldObjects
|
||||
internal abstract class NpcAnimController<T> : WorldObject<T>, INpcAnimController
|
||||
where T : MonoBehaviour
|
||||
{
|
||||
public override void Init(T controller, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = controller;
|
||||
}
|
||||
|
||||
public abstract CharacterDialogueTree GetDialogueTree();
|
||||
|
||||
public virtual void StartConversation()
|
||||
|
@ -8,12 +8,6 @@ namespace QSB.Animation.NPC.WorldObjects
|
||||
{
|
||||
private readonly List<PlayerInfo> _playersInHeadZone = new();
|
||||
|
||||
public override void Init(SolanumAnimController controller, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = controller;
|
||||
}
|
||||
|
||||
public List<PlayerInfo> GetPlayersInHeadZone()
|
||||
=> _playersInHeadZone;
|
||||
|
||||
|
@ -5,12 +5,6 @@ namespace QSB.CampfireSync.WorldObjects
|
||||
{
|
||||
public class QSBCampfire : WorldObject<Campfire>
|
||||
{
|
||||
public override void Init(Campfire campfire, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = campfire;
|
||||
}
|
||||
|
||||
public void StartRoasting()
|
||||
=> AttachedObject
|
||||
.GetType()
|
||||
|
@ -4,10 +4,5 @@ namespace QSB.EchoesOfTheEye.AirlockSync.WorldObjects
|
||||
{
|
||||
internal class QSBGhostAirlock : WorldObject<GhostAirlock>
|
||||
{
|
||||
public override void Init(GhostAirlock airlock, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = airlock;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,5 @@ namespace QSB.EchoesOfTheEye.LightSensorSync.WorldObjects
|
||||
{
|
||||
internal class QSBSingleLightSensor : WorldObject<SingleLightSensor>
|
||||
{
|
||||
public override void Init(SingleLightSensor sensor, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = sensor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,8 @@ namespace QSB.ElevatorSync.WorldObjects
|
||||
private OWAudioSource _owAudioSourceLP;
|
||||
private OWTriggerVolume _elevatorTrigger;
|
||||
|
||||
public override void Init(Elevator elevator, int id)
|
||||
public override void Init()
|
||||
{
|
||||
AttachedObject = elevator;
|
||||
ObjectId = id;
|
||||
QSBCore.UnityEvents.RunWhen(() => AttachedObject._interactVolume != null, InitValues);
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,8 @@ namespace QSB.GeyserSync.WorldObjects
|
||||
{
|
||||
public class QSBGeyser : WorldObject<GeyserController>
|
||||
{
|
||||
public override void Init(GeyserController geyserController, int id)
|
||||
public override void Init()
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = geyserController;
|
||||
AttachedObject.OnGeyserActivateEvent += () => HandleEvent(true);
|
||||
AttachedObject.OnGeyserDeactivateEvent += () => HandleEvent(false);
|
||||
}
|
||||
|
@ -2,11 +2,5 @@
|
||||
{
|
||||
internal class QSBNomaiConversationStone : QSBOWItem<NomaiConversationStone>
|
||||
{
|
||||
public override void Init(NomaiConversationStone attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ namespace QSB.ItemSync.WorldObjects.Items
|
||||
public QSBSector InitialSector { get; private set; }
|
||||
public uint HoldingPlayer { get; private set; }
|
||||
|
||||
public override void Init(T attachedObject, int id)
|
||||
public override void Init()
|
||||
{
|
||||
if (attachedObject == null)
|
||||
if (AttachedObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - AttachedObject is null! Type:{GetType().Name}", OWML.Common.MessageType.Error);
|
||||
return;
|
||||
@ -30,10 +30,10 @@ namespace QSB.ItemSync.WorldObjects.Items
|
||||
{
|
||||
FinishDelayedReady();
|
||||
|
||||
InitialParent = attachedObject.transform.parent;
|
||||
InitialPosition = attachedObject.transform.localPosition;
|
||||
InitialRotation = attachedObject.transform.localRotation;
|
||||
var initialSector = attachedObject.GetSector();
|
||||
InitialParent = AttachedObject.transform.parent;
|
||||
InitialPosition = AttachedObject.transform.localPosition;
|
||||
InitialRotation = AttachedObject.transform.localRotation;
|
||||
var initialSector = AttachedObject.GetSector();
|
||||
if (initialSector != null)
|
||||
{
|
||||
InitialSector = QSBWorldSync.GetWorldFromUnity<QSBSector>(initialSector);
|
||||
@ -41,7 +41,7 @@ namespace QSB.ItemSync.WorldObjects.Items
|
||||
|
||||
if (InitialParent == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - InitialParent of {attachedObject.name} is null!", OWML.Common.MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - InitialParent of {AttachedObject.name} is null!", OWML.Common.MessageType.Warning);
|
||||
}
|
||||
|
||||
if (InitialParent?.GetComponent<OWItemSocket>() != null)
|
||||
|
@ -2,13 +2,6 @@
|
||||
{
|
||||
internal class QSBScrollItem : QSBOWItem<ScrollItem>
|
||||
{
|
||||
public override void Init(ScrollItem attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
|
||||
public override void PlaySocketAnimation()
|
||||
=> AttachedObject.PlaySocketAnimation();
|
||||
|
||||
|
@ -2,13 +2,6 @@
|
||||
{
|
||||
internal class QSBSharedStone : QSBOWItem<SharedStone>
|
||||
{
|
||||
public override void Init(SharedStone attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
|
||||
public override void PlaySocketAnimation()
|
||||
=> AttachedObject.PlaySocketAnimation();
|
||||
|
||||
|
@ -2,13 +2,6 @@
|
||||
{
|
||||
internal class QSBSimpleLanternItem : QSBOWItem<SimpleLanternItem>
|
||||
{
|
||||
public override void Init(SimpleLanternItem attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
|
||||
public override void PlaySocketAnimation()
|
||||
=> AttachedObject.PlaySocketAnimation();
|
||||
|
||||
|
@ -2,13 +2,6 @@
|
||||
{
|
||||
internal class QSBSlideReelItem : QSBOWItem<SlideReelItem>
|
||||
{
|
||||
public override void Init(SlideReelItem attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
|
||||
public override void PlaySocketAnimation()
|
||||
=> AttachedObject.PlaySocketAnimation();
|
||||
|
||||
|
@ -2,13 +2,6 @@
|
||||
{
|
||||
internal class QSBWarpCoreItem : QSBOWItem<WarpCoreItem>
|
||||
{
|
||||
public override void Init(WarpCoreItem attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
|
||||
public bool IsVesselCoreType()
|
||||
=> AttachedObject.IsVesselCoreType();
|
||||
}
|
||||
|
@ -2,11 +2,5 @@
|
||||
{
|
||||
internal class QSBNomaiConversationStoneSocket : QSBOWItemSocket<NomaiConversationStoneSocket>
|
||||
{
|
||||
public override void Init(NomaiConversationStoneSocket attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,6 @@ namespace QSB.ItemSync.WorldObjects.Sockets
|
||||
internal class QSBOWItemDoubleSocket<T> : WorldObject<T>, IQSBOWItemSocket
|
||||
where T : OWItemSocket
|
||||
{
|
||||
public override void Init(T attachedObject, int id) { }
|
||||
|
||||
public virtual bool AcceptsItem(IQSBOWItem item)
|
||||
{
|
||||
var itemType = item.GetItemType();
|
||||
|
@ -6,8 +6,6 @@ namespace QSB.ItemSync.WorldObjects.Sockets
|
||||
internal class QSBOWItemSocket<T> : WorldObject<T>, IQSBOWItemSocket
|
||||
where T : OWItemSocket
|
||||
{
|
||||
public override void Init(T attachedObject, int id) { }
|
||||
|
||||
public virtual bool AcceptsItem(IQSBOWItem item)
|
||||
{
|
||||
var itemType = item.GetItemType();
|
||||
|
@ -2,11 +2,5 @@
|
||||
{
|
||||
internal class QSBScrollSocket : QSBOWItemSocket<ScrollSocket>
|
||||
{
|
||||
public override void Init(ScrollSocket attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,5 @@
|
||||
{
|
||||
internal class QSBSharedStoneSocket : QSBOWItemSocket<SharedStoneSocket>
|
||||
{
|
||||
public override void Init(SharedStoneSocket attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,5 @@
|
||||
{
|
||||
internal class QSBSlideProjectorSocket : QSBOWItemDoubleSocket<SlideProjectorSocket>
|
||||
{
|
||||
public override void Init(SlideProjectorSocket attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,5 @@
|
||||
{
|
||||
internal class QSBSlideReelSocket : QSBOWItemSocket<SlideReelSocket>
|
||||
{
|
||||
public override void Init(SlideReelSocket attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,5 @@
|
||||
{
|
||||
internal class QSBWarpCoreSocket : QSBOWItemSocket<WarpCoreSocket>
|
||||
{
|
||||
public override void Init(WarpCoreSocket attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,10 +11,8 @@ namespace QSB.JellyfishSync.WorldObjects
|
||||
public JellyfishTransformSync TransformSync;
|
||||
private AlignWithTargetBody _alignWithTargetBody;
|
||||
|
||||
public override void Init(JellyfishController attachedObject, int id)
|
||||
public override void Init()
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
_alignWithTargetBody = AttachedObject.GetRequiredComponent<AlignWithTargetBody>();
|
||||
|
||||
if (QSBCore.IsHost)
|
||||
|
@ -5,10 +5,8 @@ namespace QSB.MeteorSync.WorldObjects
|
||||
{
|
||||
public class QSBFragment : WorldObject<FragmentIntegrity>
|
||||
{
|
||||
public override void Init(FragmentIntegrity attachedObject, int id)
|
||||
public override void Init()
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
DetachableFragment = AttachedObject.GetComponent<DetachableFragment>();
|
||||
|
||||
if (QSBCore.IsHost)
|
||||
|
@ -5,12 +5,6 @@ namespace QSB.MeteorSync.WorldObjects
|
||||
{
|
||||
public class QSBMeteor : WorldObject<MeteorController>
|
||||
{
|
||||
public override void Init(MeteorController attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
}
|
||||
|
||||
public static bool IsSpecialImpact(GameObject go) =>
|
||||
go == Locator.GetPlayerCollider().gameObject || go == Locator.GetProbe()._anchor._collider.gameObject;
|
||||
|
||||
|
@ -4,12 +4,6 @@ namespace QSB.MeteorSync.WorldObjects
|
||||
{
|
||||
public class QSBMeteorLauncher : WorldObject<MeteorLauncher>
|
||||
{
|
||||
public override void Init(MeteorLauncher attachedObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
}
|
||||
|
||||
public int MeteorId;
|
||||
public float LaunchSpeed;
|
||||
|
||||
|
@ -11,10 +11,8 @@ namespace QSB.OrbSync.WorldObjects
|
||||
|
||||
private bool _initialized;
|
||||
|
||||
public override void Init(NomaiInterfaceSlot slot, int id)
|
||||
public override void Init()
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = slot;
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
|
@ -4,12 +4,10 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
{
|
||||
internal class QSBEyeProxyQuantumMoon : QSBQuantumObject<EyeProxyQuantumMoon>
|
||||
{
|
||||
public override void Init(EyeProxyQuantumMoon moonObject, int id)
|
||||
public override void Init()
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = moonObject;
|
||||
ControllingPlayer = QSBPlayerManager.LocalPlayerId;
|
||||
base.Init(moonObject, id);
|
||||
base.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,17 +21,14 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
}
|
||||
}
|
||||
|
||||
public override void Init(MultiStateQuantumObject attachedObject, int id)
|
||||
public override void Init()
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
|
||||
if (QSBCore.ShowQuantumDebugBoxes)
|
||||
{
|
||||
DebugBoxText = DebugBoxManager.CreateBox(AttachedObject.transform, 0, $"Multistate\r\nid:{id}\r\nstate:{CurrentState}").GetComponent<Text>();
|
||||
DebugBoxText = DebugBoxManager.CreateBox(AttachedObject.transform, 0, $"Multistate\r\nid:{ObjectId}\r\nstate:{CurrentState}").GetComponent<Text>();
|
||||
}
|
||||
|
||||
base.Init(attachedObject, id);
|
||||
base.Init();
|
||||
|
||||
StartDelayedReady();
|
||||
QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllObjectsAdded, () =>
|
||||
|
@ -5,14 +5,12 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
{
|
||||
internal class QSBQuantumMoon : QSBQuantumObject<QuantumMoon>
|
||||
{
|
||||
public override void Init(QuantumMoon moonObject, int id)
|
||||
public override void Init()
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = moonObject;
|
||||
ControllingPlayer = QSBCore.IsHost
|
||||
? QSBPlayerManager.LocalPlayerId
|
||||
: QSBPlayerManager.PlayerList.OrderBy(x => x.PlayerId).First().PlayerId;
|
||||
base.Init(moonObject, id);
|
||||
base.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
}
|
||||
}
|
||||
|
||||
public override void Init(T attachedObject, int id)
|
||||
public override void Init()
|
||||
{
|
||||
var debugBundle = QSBCore.DebugAssetBundle;
|
||||
var sphere = debugBundle.LoadAsset<GameObject>("Assets/Prefabs/Sphere.prefab");
|
||||
|
@ -5,13 +5,6 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
{
|
||||
internal class QSBQuantumShuffleObject : QSBQuantumObject<QuantumShuffleObject>
|
||||
{
|
||||
public override void Init(QuantumShuffleObject shuffleObject, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = shuffleObject;
|
||||
base.Init(shuffleObject, id);
|
||||
}
|
||||
|
||||
public void ShuffleObjects(int[] indexArray)
|
||||
{
|
||||
var shuffledObjects = AttachedObject.GetValue<Transform[]>("_shuffledObjects");
|
||||
|
@ -5,10 +5,8 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
{
|
||||
internal class QSBQuantumSocket : WorldObject<QuantumSocket>
|
||||
{
|
||||
public override void Init(QuantumSocket quantumSocket, int id)
|
||||
public override void Init()
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = quantumSocket;
|
||||
AttachedObject.GetType().SetValue("_randomYRotation", false);
|
||||
}
|
||||
}
|
||||
|
@ -6,12 +6,6 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
{
|
||||
public bool IsMeantToBeEnabled;
|
||||
|
||||
public override void Init(QuantumState state, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = state;
|
||||
}
|
||||
|
||||
public void SetVisible(bool visible)
|
||||
{
|
||||
IsMeantToBeEnabled = visible;
|
||||
|
@ -13,11 +13,9 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
{
|
||||
public Text DebugBoxText;
|
||||
|
||||
public override void Init(SocketedQuantumObject quantumObject, int id)
|
||||
public override void Init()
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = quantumObject;
|
||||
base.Init(quantumObject, id);
|
||||
base.Init();
|
||||
if (QSBCore.ShowQuantumDebugBoxes)
|
||||
{
|
||||
DebugBoxText = DebugBoxManager.CreateBox(AttachedObject.transform, 0, $"Socketed\r\nid:{ObjectId}").GetComponent<Text>();
|
||||
|
@ -27,10 +27,8 @@ namespace QSB.SectorSync.WorldObjects
|
||||
public Vector3 Position => Transform.position;
|
||||
public bool IsFakeSector => AttachedObject.GetType() == typeof(FakeSector);
|
||||
|
||||
public override void Init(Sector sector, int id)
|
||||
public override void Init()
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = sector;
|
||||
if (IsFakeSector)
|
||||
{
|
||||
QSBSectorManager.Instance.FakeSectors.Add(this);
|
||||
|
@ -6,12 +6,6 @@ namespace QSB.ShipSync.WorldObjects
|
||||
{
|
||||
internal class QSBShipComponent : WorldObject<ShipComponent>
|
||||
{
|
||||
public override void Init(ShipComponent component, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = component;
|
||||
}
|
||||
|
||||
public void SetDamaged()
|
||||
{
|
||||
DebugLog.DebugWrite($"[S COMPONENT] {AttachedObject} Set damaged.");
|
||||
|
@ -6,12 +6,6 @@ namespace QSB.ShipSync.WorldObjects
|
||||
{
|
||||
internal class QSBShipHull : WorldObject<ShipHull>
|
||||
{
|
||||
public override void Init(ShipHull hull, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = hull;
|
||||
}
|
||||
|
||||
public void SetDamaged()
|
||||
{
|
||||
DebugLog.DebugWrite($"[HULL] {AttachedObject} Set damaged.");
|
||||
|
@ -12,10 +12,8 @@ namespace QSB.Tools.ProbeLauncherTool.WorldObjects
|
||||
private ProbeLauncherEffects _effects;
|
||||
private SingularityWarpEffect _probeRetrievalEffect;
|
||||
|
||||
public override void Init(ProbeLauncher launcher, int id)
|
||||
public override void Init()
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = launcher;
|
||||
_probeRetrievalLength = AttachedObject.GetValue<float>("_probeRetrievalLength");
|
||||
_preLaunchProbeProxy = AttachedObject.GetValue<GameObject>("_preLaunchProbeProxy");
|
||||
_effects = AttachedObject.GetValue<ProbeLauncherEffects>("_effects");
|
||||
|
@ -6,12 +6,6 @@ namespace QSB.Tools.TranslatorTool.TranslationSync.WorldObjects
|
||||
{
|
||||
internal class QSBComputer : WorldObject<NomaiComputer>
|
||||
{
|
||||
public override void Init(NomaiComputer computer, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = computer;
|
||||
}
|
||||
|
||||
public void HandleSetAsTranslated(int id)
|
||||
{
|
||||
if (AttachedObject.IsTranslated(id))
|
||||
|
@ -7,12 +7,6 @@ namespace QSB.Tools.TranslatorTool.TranslationSync.WorldObjects
|
||||
{
|
||||
internal class QSBVesselComputer : WorldObject<NomaiVesselComputer>
|
||||
{
|
||||
public override void Init(NomaiVesselComputer computer, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = computer;
|
||||
}
|
||||
|
||||
public void HandleSetAsTranslated(int id)
|
||||
{
|
||||
if (AttachedObject.IsTranslated(id))
|
||||
|
@ -6,12 +6,6 @@ namespace QSB.Tools.TranslatorTool.TranslationSync.WorldObjects
|
||||
{
|
||||
internal class QSBWallText : WorldObject<NomaiWallText>
|
||||
{
|
||||
public override void Init(NomaiWallText wallText, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = wallText;
|
||||
}
|
||||
|
||||
public void HandleSetAsTranslated(int id)
|
||||
{
|
||||
if (AttachedObject.IsTranslated(id))
|
||||
|
@ -149,7 +149,9 @@ namespace QSB.WorldSync
|
||||
for (var id = 0; id < list.Count; id++)
|
||||
{
|
||||
var obj = CreateWorldObject<TWorldObject>();
|
||||
obj.Init(list[id], id);
|
||||
obj.AttachedObject = list[id];
|
||||
obj.ObjectId = id;
|
||||
obj.Init();
|
||||
WorldObjectsToUnityObjects.Add(list[id], obj);
|
||||
}
|
||||
}
|
||||
|
@ -6,12 +6,12 @@ namespace QSB.WorldSync
|
||||
public abstract class WorldObject<T> : IWorldObject
|
||||
where T : MonoBehaviour
|
||||
{
|
||||
public int ObjectId { get; protected set; }
|
||||
public T AttachedObject { get; protected set; }
|
||||
public int ObjectId { get; set; }
|
||||
public T AttachedObject { get; set; }
|
||||
public string Name => AttachedObject == null ? "<NullObject!>" : AttachedObject.name;
|
||||
public string LogName => $"{QSBPlayerManager.LocalPlayerId}.{ObjectId}:{GetType().Name}";
|
||||
|
||||
public abstract void Init(T attachedObject, int id);
|
||||
public virtual void Init() { }
|
||||
public virtual void OnRemoval() { }
|
||||
public MonoBehaviour ReturnObject() => AttachedObject;
|
||||
|
||||
|
@ -5,12 +5,6 @@ namespace QSB.ZeroGCaveSync.WorldObjects
|
||||
{
|
||||
internal class QSBSatelliteNode : WorldObject<SatelliteNode>
|
||||
{
|
||||
public override void Init(SatelliteNode component, int id)
|
||||
{
|
||||
ObjectId = id;
|
||||
AttachedObject = component;
|
||||
}
|
||||
|
||||
public void SetRepaired()
|
||||
{
|
||||
DebugLog.DebugWrite($"[SATELLITE NODE] {AttachedObject} Set repaired.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user