mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-27 12:35:28 +00:00
fix ones in QSB
This commit is contained in:
parent
53be60f505
commit
a0286c3c74
@ -127,6 +127,7 @@ namespace QSB.Animation.NPC.Patches
|
||||
DebugLog.ToConsole($"Error - No player talking to {____dialogueTree.name}!", MessageType.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
var player = QSBPlayerManager.GetPlayer(playerId);
|
||||
|
||||
var distance = player.Body.transform.position - __instance.transform.position;
|
||||
@ -147,6 +148,7 @@ namespace QSB.Animation.NPC.Patches
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var id = QSBWorldSync.GetIdFromTypeSubset(ownerOfThis);
|
||||
QSBEventManager.FireEvent(EventNames.QSBNpcAnimEvent, AnimationEvent.StartConversation, id);
|
||||
return true;
|
||||
@ -160,6 +162,7 @@ namespace QSB.Animation.NPC.Patches
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var id = QSBWorldSync.GetIdFromTypeSubset(ownerOfThis);
|
||||
QSBEventManager.FireEvent(EventNames.QSBNpcAnimEvent, AnimationEvent.EndConversation, id);
|
||||
return true;
|
||||
@ -175,12 +178,14 @@ namespace QSB.Animation.NPC.Patches
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var qsbObj = QSBWorldSync.GetWorldObjects<QSBCharacterAnimController>().First(x => x.GetDialogueTree() == ____dialogueTree);
|
||||
|
||||
if (!____throwingRock && !qsbObj.InConversation() && Time.time > ____nextThrowTime)
|
||||
{
|
||||
__instance.GetType().GetMethod("StartRockThrow", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, null);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ namespace QSB.Animation.NPC.WorldObjects
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_playersInHeadZone.Add(player);
|
||||
}
|
||||
|
||||
@ -26,6 +27,7 @@ namespace QSB.Animation.NPC.WorldObjects
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_playersInHeadZone.Remove(player);
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,7 @@ namespace QSB.Animation.Player
|
||||
{
|
||||
LoadControllers();
|
||||
}
|
||||
|
||||
NetworkAnimator.enabled = true;
|
||||
VisibleAnimator = body.GetComponent<Animator>();
|
||||
Mirror = body.gameObject.AddComponent<AnimatorMirror>();
|
||||
@ -158,11 +159,13 @@ namespace QSB.Animation.Player
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (state)
|
||||
{
|
||||
SuitUp();
|
||||
return;
|
||||
}
|
||||
|
||||
SuitDown();
|
||||
}
|
||||
|
||||
@ -172,15 +175,18 @@ namespace QSB.Animation.Player
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CurrentType = type;
|
||||
if (_unsuitedAnimController == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Unsuited controller is null. ({PlayerId})", MessageType.Error);
|
||||
}
|
||||
|
||||
if (_suitedAnimController == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Suited controller is null. ({PlayerId})", MessageType.Error);
|
||||
}
|
||||
|
||||
RuntimeAnimatorController controller = default;
|
||||
switch (type)
|
||||
{
|
||||
@ -216,6 +222,7 @@ namespace QSB.Animation.Player
|
||||
controller = _riebeckController;
|
||||
break;
|
||||
}
|
||||
|
||||
InvisibleAnimator.runtimeAnimatorController = controller;
|
||||
VisibleAnimator.runtimeAnimatorController = controller;
|
||||
if (type != AnimationType.PlayerSuited && type != AnimationType.PlayerUnsuited)
|
||||
@ -229,6 +236,7 @@ namespace QSB.Animation.Player
|
||||
VisibleAnimator.SetTrigger("Grounded");
|
||||
InvisibleAnimator.SetTrigger("Grounded");
|
||||
}
|
||||
|
||||
NetworkAnimator.animator = InvisibleAnimator; // Probably not needed.
|
||||
Mirror.RebuildFloatParams();
|
||||
for (var i = 0; i < InvisibleAnimator.parameterCount; i++)
|
||||
|
@ -21,15 +21,18 @@ namespace QSB.Animation.Player
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Trying to init AnimatorMirror with null \"from\".", MessageType.Error);
|
||||
}
|
||||
|
||||
if (to == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Trying to init AnimatorMirror with null \"to\".", MessageType.Error);
|
||||
}
|
||||
|
||||
if (to == null || from == null)
|
||||
{
|
||||
// Doing the return this way so you can see if one or both are null
|
||||
return;
|
||||
}
|
||||
|
||||
_from = from;
|
||||
_to = to;
|
||||
if (_from.runtimeAnimatorController == null)
|
||||
@ -40,6 +43,7 @@ namespace QSB.Animation.Player
|
||||
{
|
||||
_to.runtimeAnimatorController = _from.runtimeAnimatorController;
|
||||
}
|
||||
|
||||
foreach (var param in _from.parameters.Where(p => p.type == AnimatorControllerParameterType.Float))
|
||||
{
|
||||
_floatParams.Add(param.name, new AnimFloatParam());
|
||||
@ -52,10 +56,12 @@ namespace QSB.Animation.Player
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_to.runtimeAnimatorController != _from.runtimeAnimatorController)
|
||||
{
|
||||
_to.runtimeAnimatorController = _from.runtimeAnimatorController;
|
||||
}
|
||||
|
||||
SyncParams();
|
||||
SmoothFloats();
|
||||
}
|
||||
@ -73,6 +79,7 @@ namespace QSB.Animation.Player
|
||||
RebuildFloatParams();
|
||||
break;
|
||||
}
|
||||
|
||||
_floatParams[fromParam.name].Target = _from.GetFloat(fromParam.name);
|
||||
break;
|
||||
|
||||
|
@ -30,6 +30,7 @@ namespace QSB.Animation.Player
|
||||
SyncLocalCrouch();
|
||||
return;
|
||||
}
|
||||
|
||||
SyncRemoteCrouch();
|
||||
}
|
||||
|
||||
@ -39,6 +40,7 @@ namespace QSB.Animation.Player
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var jumpChargeFraction = _playerController.GetJumpChargeFraction();
|
||||
_crouchValue = jumpChargeFraction;
|
||||
}
|
||||
@ -49,6 +51,7 @@ namespace QSB.Animation.Player
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CrouchParam.Target = _crouchValue;
|
||||
CrouchParam.Smooth(CrouchSmoothTime);
|
||||
var jumpChargeFraction = CrouchParam.Current;
|
||||
|
@ -26,6 +26,7 @@ namespace QSB.Animation.Player.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
animationSync.VisibleAnimator.SetTrigger(message.Name);
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ namespace QSB.Animation.Player.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QSBPlayerManager.GetPlayer(message.AboutId).AnimationSync.SetAnimationType(message.EnumValue);
|
||||
QSBPlayerManager.GetSyncObject<InstrumentsManager>(message.AboutId).CheckInstrumentProps(message.EnumValue);
|
||||
}
|
||||
|
@ -37,18 +37,22 @@ namespace QSB.Animation.Patches
|
||||
{
|
||||
movementVector = ____playerController.GetRelativeGroundVelocity();
|
||||
}
|
||||
|
||||
if (Mathf.Abs(movementVector.x) < 0.05f)
|
||||
{
|
||||
movementVector.x = 0f;
|
||||
}
|
||||
|
||||
if (Mathf.Abs(movementVector.z) < 0.05f)
|
||||
{
|
||||
movementVector.z = 0f;
|
||||
}
|
||||
|
||||
if (isFlying)
|
||||
{
|
||||
____ungroundedTime = Time.time;
|
||||
}
|
||||
|
||||
var freefallMagnitude = 0f;
|
||||
var timeInFreefall = 0f;
|
||||
var lastGroundBody = ____playerController.GetLastGroundBody();
|
||||
@ -57,6 +61,7 @@ namespace QSB.Animation.Patches
|
||||
freefallMagnitude = (____playerController.GetAttachedOWRigidbody(false).GetVelocity() - lastGroundBody.GetPointVelocity(____playerController.transform.position)).magnitude;
|
||||
timeInFreefall = Time.time - ____ungroundedTime;
|
||||
}
|
||||
|
||||
____animator.SetFloat("RunSpeedX", movementVector.x / 3f);
|
||||
____animator.SetFloat("RunSpeedY", movementVector.z / 3f);
|
||||
____animator.SetFloat("TurnSpeed", ____playerController.GetTurning());
|
||||
@ -79,6 +84,7 @@ namespace QSB.Animation.Patches
|
||||
QSBEventManager.FireEvent(EventNames.QSBAnimTrigger, playerAnimationSync.AttachedNetId, "Land");
|
||||
}
|
||||
}
|
||||
|
||||
if (isGrounded)
|
||||
{
|
||||
var leftFootLift = ____animator.GetFloat("LeftFootLift");
|
||||
@ -92,6 +98,7 @@ namespace QSB.Animation.Patches
|
||||
____leftFootGrounded = false;
|
||||
QSBWorldSync.RaiseEvent(__instance, "OnLeftFootLift");
|
||||
}
|
||||
|
||||
var rightFootLift = ____animator.GetFloat("RightFootLift");
|
||||
if (!____rightFootGrounded && rightFootLift < 0.333f)
|
||||
{
|
||||
@ -104,6 +111,7 @@ namespace QSB.Animation.Patches
|
||||
QSBWorldSync.RaiseEvent(__instance, "OnRightFootLift");
|
||||
}
|
||||
}
|
||||
|
||||
____justBecameGrounded = false;
|
||||
____justTookFallDamage = false;
|
||||
var usingTool = Locator.GetToolModeSwapper().GetToolMode() != ToolMode.None;
|
||||
|
@ -23,16 +23,19 @@ namespace QSB.Animation.Player
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_attachedAnimator == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - _attachedAnimator is null!", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_lookBase == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - _lookBase is null!", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var bone = _attachedAnimator.GetBoneTransform(HumanBodyBones.Head);
|
||||
// Get the camera's local rotation with respect to the player body
|
||||
var lookLocalRotation = Quaternion.Inverse(_attachedAnimator.transform.rotation) * _lookBase.rotation;
|
||||
|
@ -61,17 +61,20 @@ namespace QSB.Animation.Player.Thrusters
|
||||
{
|
||||
num *= _belowMaxThrustScalar;
|
||||
}
|
||||
|
||||
_currentScale = _scaleSpring.Update(_currentScale, num, Time.deltaTime);
|
||||
if (_currentScale < 0f)
|
||||
{
|
||||
_currentScale = 0f;
|
||||
_scaleSpring.ResetVelocity();
|
||||
}
|
||||
|
||||
if (_currentScale <= 0.001f)
|
||||
{
|
||||
_currentScale = 0f;
|
||||
_scaleSpring.ResetVelocity();
|
||||
}
|
||||
|
||||
transform.localScale = Vector3.one * _currentScale;
|
||||
_light.range = _baseLightRadius * _currentScale;
|
||||
_thrusterRenderer.enabled = _currentScale > 0f;
|
||||
|
@ -36,6 +36,7 @@ namespace QSB.Animation.Player.Thrusters
|
||||
DebugLog.ToConsole($"Error - DefaultParticleSystem is null!", OWML.Common.MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
_defaultMainModule = _defaultParticleSystem.main;
|
||||
_defaultEmissionModule = _defaultParticleSystem.emission;
|
||||
_baseDefaultEmissionRate = _defaultEmissionModule.rateOverTime.constant;
|
||||
@ -73,6 +74,7 @@ namespace QSB.Animation.Player.Thrusters
|
||||
{
|
||||
_defaultParticleSystem.Play();
|
||||
}
|
||||
|
||||
_defaultEmissionModule.rateOverTimeMultiplier = _baseDefaultEmissionRate * emissionThrusterScale;
|
||||
_defaultParticleSystem.transform.SetPositionAndRotation(position, rotation);
|
||||
if (_defaultMainModule.customSimulationSpace != hitInfo.transform)
|
||||
|
@ -24,6 +24,7 @@ namespace QSB.CampfireSync.Patches
|
||||
QSBEventManager.FireEvent(EventNames.QSBCampfireState, qsbCampfire.ObjectId, Campfire.State.LIT);
|
||||
Locator.GetFlashlight().TurnOff(false);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ namespace QSB.ConversationSync
|
||||
{
|
||||
DebugLog.ToConsole("Error - Font is null!", MessageType.Error);
|
||||
}
|
||||
|
||||
_boxPrefab.GetComponent<Text>().font = font;
|
||||
_boxPrefab.GetComponent<Text>().color = Color.white;
|
||||
}
|
||||
@ -52,6 +53,7 @@ namespace QSB.ConversationSync
|
||||
DebugLog.ToConsole("Warning - Tried to send conv. event with char id -1.", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
QSBEventManager.FireEvent(EventNames.QSBConversation, (uint)id, text, ConversationType.Character);
|
||||
}
|
||||
|
||||
@ -68,6 +70,7 @@ namespace QSB.ConversationSync
|
||||
DebugLog.ToConsole("Warning - Tried to send conv. start/end event with char id -1.", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
QSBEventManager.FireEvent(EventNames.QSBConversationStartEnd, charId, QSBPlayerManager.LocalPlayerId, state);
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ namespace QSB.ConversationSync.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (message.EnumValue)
|
||||
{
|
||||
case ConversationType.Character:
|
||||
@ -45,6 +46,7 @@ namespace QSB.ConversationSync.Events
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
var tree = QSBWorldSync.OldDialogueTrees[message.ObjectId];
|
||||
UnityEngine.Object.Destroy(ConversationManager.Instance.BoxMappings[tree]);
|
||||
break;
|
||||
|
@ -33,6 +33,7 @@ namespace QSB.ConversationSync.Events
|
||||
{
|
||||
QSBWorldSync.SetDialogueCondition(message.ConditionName, message.ConditionState);
|
||||
}
|
||||
|
||||
DialogueConditionManager.SharedInstance.SetConditionState(message.ConditionName, message.ConditionState);
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ namespace QSB.ConversationSync.Patches
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Index for tree {__instance.name} was -1.", MessageType.Warning);
|
||||
}
|
||||
|
||||
QSBPlayerManager.LocalPlayer.CurrentCharacterDialogueTreeId = index;
|
||||
ConversationManager.Instance.SendConvState(index, true);
|
||||
}
|
||||
@ -36,11 +37,13 @@ namespace QSB.ConversationSync.Patches
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (QSBPlayerManager.LocalPlayer.CurrentCharacterDialogueTreeId == -1)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Ending conversation with CurrentDialogueId of -1! Called from {__instance.name}", MessageType.Warning);
|
||||
return true;
|
||||
}
|
||||
|
||||
ConversationManager.Instance.SendConvState(QSBPlayerManager.LocalPlayer.CurrentCharacterDialogueTreeId, false);
|
||||
ConversationManager.Instance.CloseBoxCharacter(QSBPlayerManager.LocalPlayer.CurrentCharacterDialogueTreeId);
|
||||
QSBPlayerManager.LocalPlayer.CurrentCharacterDialogueTreeId = -1;
|
||||
|
@ -60,6 +60,7 @@ namespace QSB.DeathSync.Patches
|
||||
impact.otherCollider.attachedRigidbody.gameObject.name
|
||||
}));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -127,6 +128,7 @@ namespace QSB.DeathSync.Patches
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -159,6 +161,7 @@ namespace QSB.DeathSync.Patches
|
||||
{
|
||||
____dieNextUpdate = true;
|
||||
}
|
||||
|
||||
DebugLog.DebugWrite(string.Concat(new object[]
|
||||
{
|
||||
"HIGH SPEED IMPACT: ",
|
||||
|
@ -55,6 +55,7 @@ namespace QSB.DeathSync
|
||||
DebugLog.ToConsole($"Warning - Init() ran when ship was null?", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
_shipComponents = shipTransform.GetComponentsInChildren<ShipComponent>();
|
||||
_hatchController = shipTransform.GetComponentInChildren<HatchController>();
|
||||
_cockpitController = shipTransform.GetComponentInChildren<ShipCockpitController>();
|
||||
@ -172,6 +173,7 @@ namespace QSB.DeathSync
|
||||
DebugLog.ToConsole($"Warning - _spawnList was null for player spawner!", MessageType.Warning);
|
||||
return null;
|
||||
}
|
||||
|
||||
return spawnList.FirstOrDefault(spawnPoint =>
|
||||
spawnPoint.GetSpawnLocation() == SpawnLocation.TimberHearth
|
||||
&& spawnPoint.IsShipSpawn() == isShip);
|
||||
|
@ -21,6 +21,7 @@ namespace QSB.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_eventHandler = new MessageHandler<T>(Type);
|
||||
_eventHandler.OnClientReceiveMessage += message => OnReceive(false, message);
|
||||
_eventHandler.OnServerReceiveMessage += message => OnReceive(true, message);
|
||||
|
@ -109,6 +109,7 @@ namespace QSB.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GlobalMessenger.FireEvent(eventName);
|
||||
}
|
||||
|
||||
@ -119,6 +120,7 @@ namespace QSB.Events
|
||||
DebugLog.ToConsole($"Warning - Tried to send event {eventName} while not connected to/hosting server.", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
GlobalMessenger<T>.FireEvent(eventName, arg);
|
||||
}
|
||||
|
||||
@ -129,6 +131,7 @@ namespace QSB.Events
|
||||
DebugLog.ToConsole($"Warning - Tried to send event {eventName} while not connected to/hosting server.", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
GlobalMessenger<T, U>.FireEvent(eventName, arg1, arg2);
|
||||
}
|
||||
|
||||
@ -139,6 +142,7 @@ namespace QSB.Events
|
||||
DebugLog.ToConsole($"Warning - Tried to send event {eventName} while not connected to/hosting server.", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
GlobalMessenger<T, U, V>.FireEvent(eventName, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@ -149,6 +153,7 @@ namespace QSB.Events
|
||||
DebugLog.ToConsole($"Warning - Tried to send event {eventName} while not connected to/hosting server.", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
GlobalMessenger<T, U, V, W>.FireEvent(eventName, arg1, arg2, arg3, arg4);
|
||||
}
|
||||
|
||||
@ -159,6 +164,7 @@ namespace QSB.Events
|
||||
DebugLog.ToConsole($"Warning - Tried to send event {eventName} while not connected to/hosting server.", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
GlobalMessenger<T, U, V, W, X>.FireEvent(eventName, arg1, arg2, arg3, arg4, arg5);
|
||||
}
|
||||
|
||||
@ -169,6 +175,7 @@ namespace QSB.Events
|
||||
DebugLog.ToConsole($"Warning - Tried to send event {eventName} while not connected to/hosting server.", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
GlobalMessenger<T, U, V, W, X, Y>.FireEvent(eventName, arg1, arg2, arg3, arg4, arg5, arg6);
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ namespace QSB.GeyserSync.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var geyser = QSBWorldSync.GetWorldFromId<QSBGeyser>(message.ObjectId);
|
||||
geyser?.SetState(message.State);
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ namespace QSB.GeyserSync.WorldObjects
|
||||
AttachedObject?.ActivateGeyser();
|
||||
return;
|
||||
}
|
||||
|
||||
AttachedObject?.DeactivateGeyser();
|
||||
}
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ namespace QSB.Instruments
|
||||
// TODO : fix for instrument release
|
||||
mr.sharedMaterial = null;
|
||||
}
|
||||
|
||||
drum.transform.parent = _rootObj;
|
||||
drum.transform.rotation = _rootObj.rotation;
|
||||
drum.transform.localPosition = Vector3.zero;
|
||||
@ -94,10 +95,12 @@ namespace QSB.Instruments
|
||||
DebugLog.ToConsole("Error - Tried to start instrument on non-local player!", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Player.PlayingInstrument || !Locator.GetPlayerController().IsGrounded())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_savedType = Player.AnimationSync.CurrentType;
|
||||
CameraManager.Instance.SwitchTo3rdPerson();
|
||||
SwitchToType(type);
|
||||
@ -109,6 +112,7 @@ namespace QSB.Instruments
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CameraManager.Instance.SwitchTo1stPerson();
|
||||
SwitchToType(_savedType);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ namespace QSB.Instruments.QSBCamera
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdatePosition();
|
||||
UpdateInput();
|
||||
UpdateRotation();
|
||||
@ -43,6 +44,7 @@ namespace QSB.Instruments.QSBCamera
|
||||
// Raycast didn't hit collider, get target from camera direction
|
||||
localTargetPoint = RayLength * PercentToMove * localDirection;
|
||||
}
|
||||
|
||||
var targetDistance = Vector3.Distance(origin, transform.TransformPoint(localTargetPoint));
|
||||
var currentDistance = Vector3.Distance(origin, CameraObject.transform.position);
|
||||
var movement = targetDistance < currentDistance
|
||||
|
@ -10,7 +10,6 @@ namespace QSB.Instruments.QSBCamera
|
||||
{
|
||||
public static CameraManager Instance;
|
||||
|
||||
|
||||
public bool IsSetUp { get; private set; }
|
||||
public CameraMode Mode { get; private set; }
|
||||
|
||||
@ -71,16 +70,19 @@ namespace QSB.Instruments.QSBCamera
|
||||
Mode = CameraMode.ThirdPerson;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Mode == CameraMode.ThirdPerson)
|
||||
{
|
||||
DebugLog.ToConsole("Warning - Already in 3rd person!", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (OWInput.GetInputMode() != InputMode.Character)
|
||||
{
|
||||
DebugLog.ToConsole("Warning - Cannot change to 3rd person while not in Character inputmode!", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
OWInput.ChangeInputMode(InputMode.None);
|
||||
QSBEventManager.FireEvent("SwitchActiveCamera", _owCamera);
|
||||
Locator.GetPlayerCamera().mainCamera.enabled = false;
|
||||
@ -89,6 +91,7 @@ namespace QSB.Instruments.QSBCamera
|
||||
var postProcessing = _cameraObj.AddComponent<PostProcessingBehaviour>();
|
||||
postProcessing.profile = Locator.GetPlayerCamera().gameObject.GetComponent<PostProcessingBehaviour>().profile;
|
||||
}
|
||||
|
||||
_camera.enabled = true;
|
||||
Mode = CameraMode.ThirdPerson;
|
||||
}
|
||||
@ -102,11 +105,13 @@ namespace QSB.Instruments.QSBCamera
|
||||
Mode = CameraMode.FirstPerson;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Mode == CameraMode.FirstPerson)
|
||||
{
|
||||
DebugLog.ToConsole("Warning - Already in 1st person!", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
OWInput.ChangeInputMode(InputMode.Character);
|
||||
QSBEventManager.FireEvent("SwitchActiveCamera", Locator.GetPlayerCamera());
|
||||
Locator.GetActiveCamera().mainCamera.enabled = true;
|
||||
|
@ -50,6 +50,7 @@ namespace QSB.ItemSync.Events
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
itemObject.PickUpItem(itemSocket, message.AboutId);
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ namespace QSB.ItemSync.Events
|
||||
DebugLog.ToConsole($"Warning - Trying to start unsocket on socket that is unoccupied! Socket:{(socketWorldObject as IWorldObject).Name}");
|
||||
return;
|
||||
}
|
||||
|
||||
socketWorldObject.RemoveFromSocket();
|
||||
return;
|
||||
case SocketEventType.CompleteUnsocket:
|
||||
|
@ -27,6 +27,7 @@ namespace QSB.ItemSync
|
||||
DebugLog.ToConsole($"Error - Trying to run GetObject (Item) with null unity object!", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
IQSBOWItem worldObj = null;
|
||||
if (unityObject.GetType() == typeof(ScrollItem))
|
||||
{
|
||||
@ -48,6 +49,7 @@ namespace QSB.ItemSync
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - couldn't work out type of OWItem {unityObject.name}.", MessageType.Warning);
|
||||
}
|
||||
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@ -58,6 +60,7 @@ namespace QSB.ItemSync
|
||||
DebugLog.ToConsole($"Error - Trying to run GetObject (Socket) with null unity object!", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
IQSBOWItemSocket worldObj = null;
|
||||
if (unityObject.GetType() == typeof(ScrollSocket))
|
||||
{
|
||||
@ -79,6 +82,7 @@ namespace QSB.ItemSync
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - couldn't work out type of OWItemSocket {unityObject.name}.", MessageType.Warning);
|
||||
}
|
||||
|
||||
return worldObj;
|
||||
}
|
||||
}
|
||||
|
@ -61,10 +61,12 @@ namespace QSB.ItemSync.Patches
|
||||
gameObject2 = gameObject2.transform.parent.gameObject;
|
||||
sectorGroup = gameObject2.GetComponent<ISectorGroup>();
|
||||
}
|
||||
|
||||
if (sectorGroup != null)
|
||||
{
|
||||
sector = sectorGroup.GetSector();
|
||||
}
|
||||
|
||||
var parent = (detachableFragment != null)
|
||||
? detachableFragment.transform
|
||||
: targetRigidbody.transform;
|
||||
@ -79,6 +81,7 @@ namespace QSB.ItemSync.Patches
|
||||
QSBEventManager.FireEvent(EventNames.QSBDropItem, objectId, localPos, hit.normal, parentSector);
|
||||
return false;
|
||||
}
|
||||
|
||||
DebugLog.ToConsole($"Error - No sector found for rigidbody {targetRigidbody.name}!.", MessageType.Error);
|
||||
return false;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ namespace QSB.ItemSync.WorldObjects
|
||||
var qsbObj = ItemManager.GetObject(InitialParent.GetComponent<OWItemSocket>());
|
||||
InitialSocket = qsbObj;
|
||||
}
|
||||
|
||||
QSBPlayerManager.OnRemovePlayer += OnPlayerLeave;
|
||||
}
|
||||
|
||||
@ -38,11 +39,13 @@ namespace QSB.ItemSync.WorldObjects
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (InitialSocket != null)
|
||||
{
|
||||
InitialSocket.PlaceIntoSocket(this);
|
||||
return;
|
||||
}
|
||||
|
||||
AttachedObject.transform.parent = InitialParent;
|
||||
AttachedObject.transform.localPosition = InitialPosition;
|
||||
AttachedObject.transform.localRotation = InitialRotation;
|
||||
@ -63,7 +66,6 @@ namespace QSB.ItemSync.WorldObjects
|
||||
HoldingPlayer = 0;
|
||||
}
|
||||
|
||||
|
||||
public virtual void PickUpItem(Transform holdTransform, uint playerId)
|
||||
{
|
||||
AttachedObject.PickUpItem(holdTransform);
|
||||
|
@ -34,10 +34,12 @@ namespace QSB.LogSync.Events
|
||||
{
|
||||
QSBWorldSync.AddFactReveal(message.FactId, message.SaveGame, message.ShowNotification);
|
||||
}
|
||||
|
||||
if (!QSBCore.WorldObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Locator.GetShipLogManager().RevealFact(message.FactId, message.SaveGame, message.ShowNotification);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ namespace QSB.LogSync.Patches
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QSBEventManager.FireEvent(EventNames.QSBRevealFact, id, saveGame, showNotification);
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@ namespace QSB.Messaging
|
||||
QNetworkServer.handlers.Remove(_eventType);
|
||||
QNetworkManager.singleton.client.handlers.Remove(_eventType);
|
||||
}
|
||||
|
||||
QNetworkServer.RegisterHandler(_eventType, OnServerReceiveMessageHandler);
|
||||
QNetworkManager.singleton.client.RegisterHandler(_eventType, OnClientReceiveMessageHandler);
|
||||
}
|
||||
@ -45,6 +46,7 @@ namespace QSB.Messaging
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QNetworkServer.SendToAll(_eventType, message);
|
||||
}
|
||||
|
||||
@ -54,6 +56,7 @@ namespace QSB.Messaging
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QNetworkManager.singleton.client.Send(_eventType, message);
|
||||
}
|
||||
|
||||
|
@ -57,15 +57,18 @@ namespace QSB.OrbSync.Events
|
||||
DebugLog.ToConsole($"Error - OrbTransformSyncs is empty or null. (ID {message.ObjectId})", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (QSBWorldSync.OldOrbList == null || QSBWorldSync.OldOrbList.Count == 0)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - OldOrbList is empty or null. (ID {message.ObjectId})", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fromPlayer == null)
|
||||
{
|
||||
DebugLog.ToConsole("Error - FromPlayer is null!", MessageType.Error);
|
||||
}
|
||||
|
||||
var orbSync = NomaiOrbTransformSync.OrbTransformSyncs
|
||||
.FirstOrDefault(x => x.AttachedObject == QSBWorldSync.OldOrbList[message.ObjectId].gameObject);
|
||||
if (orbSync == null)
|
||||
@ -73,16 +76,19 @@ namespace QSB.OrbSync.Events
|
||||
DebugLog.ToConsole($"Error - No orb found for user event. (ID {message.ObjectId})", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var orbIdentity = orbSync.GetComponent<QNetworkIdentity>();
|
||||
if (orbIdentity == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Orb identity is null. (ID {message.ObjectId})", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (orbIdentity.ClientAuthorityOwner != null && orbIdentity.ClientAuthorityOwner != fromPlayer)
|
||||
{
|
||||
orbIdentity.RemoveClientAuthority(orbIdentity.ClientAuthorityOwner);
|
||||
}
|
||||
|
||||
orbIdentity.AssignClientAuthority(fromPlayer);
|
||||
orbSync.enabled = true;
|
||||
}
|
||||
@ -94,16 +100,19 @@ namespace QSB.OrbSync.Events
|
||||
DebugLog.ToConsole($"Error - OrbTransformSyncs is empty or null. (ID {message.ObjectId})", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (QSBWorldSync.OldOrbList == null || QSBWorldSync.OldOrbList.Count == 0)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - OldOrbList is empty or null. (ID {message.ObjectId})", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!NomaiOrbTransformSync.OrbTransformSyncs.Any(x => x.AttachedObject == QSBWorldSync.OldOrbList[message.ObjectId].gameObject))
|
||||
{
|
||||
DebugLog.ToConsole($"Error - No NomaiOrbTransformSync has AttachedOrb with objectId {message.ObjectId}!");
|
||||
return;
|
||||
}
|
||||
|
||||
var orb = NomaiOrbTransformSync.OrbTransformSyncs
|
||||
.First(x => x.AttachedObject == QSBWorldSync.OldOrbList[message.ObjectId].gameObject);
|
||||
orb.enabled = true;
|
||||
|
@ -28,6 +28,7 @@ namespace QSB.OrbSync
|
||||
NomaiOrbTransformSync.OrbTransformSyncs.Clear();
|
||||
QSBWorldSync.OldOrbList.ForEach(x => QNetworkServer.Spawn(Instantiate(QSBNetworkManager.Instance.OrbPrefab)));
|
||||
}
|
||||
|
||||
DebugLog.DebugWrite($"Finished orb build with {QSBWorldSync.OldOrbList.Count} orbs.", MessageType.Success);
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ namespace QSB.OrbSync.Patches
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
var orbDistance = Vector3.Distance(orb.transform.position, __instance.transform.position);
|
||||
var triggerRadius = orb.IsBeingDragged() ? ____exitRadius : ____radius;
|
||||
if (____occupyingOrb == null && orbDistance < ____radius)
|
||||
@ -35,14 +36,17 @@ namespace QSB.OrbSync.Patches
|
||||
QSBWorldSync.HandleSlotStateChange(__instance, orb, true);
|
||||
QSBWorldSync.RaiseEvent(__instance, "OnSlotActivated", __instance);
|
||||
}
|
||||
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (____occupyingOrb == null || ____occupyingOrb != orb)
|
||||
{
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (orbDistance > triggerRadius)
|
||||
{
|
||||
QSBWorldSync.HandleSlotStateChange(__instance, orb, false);
|
||||
@ -51,6 +55,7 @@ namespace QSB.OrbSync.Patches
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
|
@ -33,16 +33,19 @@ namespace QSB.OrbSync.TransformSync
|
||||
DebugLog.ToConsole($"Error - Index cannot be found.", OWML.Common.MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (QSBWorldSync.OldOrbList == null || QSBWorldSync.OldOrbList.Count <= _index)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - OldOrbList is null or does not contain index {_index}.", OWML.Common.MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (QSBWorldSync.OldOrbList[_index] == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - OldOrbList index {_index} is null.", OWML.Common.MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
return QSBWorldSync.OldOrbList[_index].gameObject;
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ namespace QSB.OrbSync.WorldObjects
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QSBEventManager.FireEvent(EventNames.QSBOrbSlot, ObjectId, orbId, state);
|
||||
}
|
||||
|
||||
@ -32,6 +33,7 @@ namespace QSB.OrbSync.WorldObjects
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var occOrb = state ? QSBWorldSync.OldOrbList[orbId] : null;
|
||||
AttachedObject.SetValue("_occupyingOrb", occOrb);
|
||||
var ev = state ? "OnSlotActivated" : "OnSlotDeactivated";
|
||||
|
@ -22,6 +22,7 @@ namespace QSB.Patches
|
||||
DebugLog.DebugWrite($"[Unpatch] {item.DeclaringType}.{item.Name}", MessageType.Info);
|
||||
instance.Unpatch(item, HarmonyPatchType.All);
|
||||
}
|
||||
|
||||
_patchedMethods.Clear();
|
||||
}
|
||||
|
||||
@ -54,6 +55,7 @@ namespace QSB.Patches
|
||||
{
|
||||
QSBCore.Helper.HarmonyHelper.AddPostfix(method, GetType(), patchName);
|
||||
}
|
||||
|
||||
_patchedMethods.Add(method);
|
||||
}
|
||||
|
||||
@ -94,6 +96,7 @@ namespace QSB.Patches
|
||||
return assemblyTypes[j];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ namespace QSB.Player.Events
|
||||
player.EntangledObject = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var quantumObject = QSBWorldSync.GetWorldFromId<IQSBQuantumObject>(message.ObjectId);
|
||||
player.EntangledObject = quantumObject;
|
||||
}
|
||||
@ -40,6 +41,7 @@ namespace QSB.Player.Events
|
||||
player.EntangledObject = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var quantumObject = QSBWorldSync.GetWorldFromId<IQSBQuantumObject>(message.ObjectId);
|
||||
player.EntangledObject = quantumObject;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ namespace QSB.Player.Events
|
||||
QSBEventManager.FireEvent(EventNames.QSBPlayerKick, message.AboutId, KickReason.VersionNotMatching);
|
||||
return;
|
||||
}
|
||||
|
||||
var player = QSBPlayerManager.GetPlayer(message.AboutId);
|
||||
player.Name = message.PlayerName;
|
||||
DebugLog.ToAll($"{player.Name} joined!", MessageType.Info);
|
||||
|
@ -27,6 +27,7 @@ namespace QSB.Player.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QSBCore.UnityEvents.FireInNUpdates(() => KickPlayer(message.AboutId), 10);
|
||||
}
|
||||
|
||||
@ -42,9 +43,11 @@ namespace QSB.Player.Events
|
||||
DebugLog.ToAll($"{QSBPlayerManager.GetPlayer(message.AboutId).Name} was kicked.");
|
||||
return;
|
||||
}
|
||||
|
||||
DebugLog.ToAll($"Player id:{message.AboutId} was kicked.");
|
||||
return;
|
||||
}
|
||||
|
||||
DebugLog.ToAll($"Kicked from server. Reason : {message.EnumValue}");
|
||||
}
|
||||
}
|
||||
|
@ -16,11 +16,13 @@ namespace QSB.Player
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var controller = Locator.GetPlayerController();
|
||||
if (controller == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var collidingQuantumObject = controller.GetValue<QuantumObject>("_collidingQuantumObject");
|
||||
if (_previousCollidingQuantumObject != collidingQuantumObject)
|
||||
{
|
||||
|
@ -38,6 +38,7 @@ namespace QSB.Player
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_markerLabel = _player.Name.ToUpper();
|
||||
_isReady = false;
|
||||
|
||||
@ -51,10 +52,12 @@ namespace QSB.Player
|
||||
{
|
||||
_canvasMarker.DestroyMarker();
|
||||
}
|
||||
|
||||
if (_markerTarget != null)
|
||||
{
|
||||
Destroy(_markerTarget.gameObject);
|
||||
}
|
||||
|
||||
Destroy(this);
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ namespace QSB.Player
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FlashLight?.UpdateState(PlayerStates.FlashlightActive);
|
||||
Translator?.ChangeEquipState(PlayerStates.TranslatorEquipped);
|
||||
ProbeLauncher?.ChangeEquipState(PlayerStates.ProbeLauncherEquipped);
|
||||
|
@ -41,6 +41,7 @@ namespace QSB.Player
|
||||
{
|
||||
markerManager.RegisterMarker(_canvasMarker, transform);
|
||||
}
|
||||
|
||||
_canvasMarker.SetLabel(PlayerName.ToUpper());
|
||||
_canvasMarker.SetColor(Color.white);
|
||||
_canvasMarker.SetVisibility(false);
|
||||
@ -56,6 +57,7 @@ namespace QSB.Player
|
||||
{
|
||||
InitMarker();
|
||||
}
|
||||
|
||||
var a = Locator.GetActiveCamera().WorldToScreenPoint(transform.position);
|
||||
var b = Locator.GetActiveCamera().WorldToScreenPoint(_playerTransform.position);
|
||||
var vector = a - b;
|
||||
|
@ -25,11 +25,13 @@ namespace QSB.Player
|
||||
$"{Environment.NewLine} Called from {method.DeclaringType.Name}.{method.Name} ", MessageType.Error);
|
||||
return uint.MaxValue;
|
||||
}
|
||||
|
||||
if (localInstance.NetIdentity == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Trying to get LocalPlayerId when the local PlayerTransformSync instance's QNetworkIdentity is null.", MessageType.Error);
|
||||
return uint.MaxValue;
|
||||
}
|
||||
|
||||
return localInstance.NetIdentity.NetId.Value;
|
||||
}
|
||||
}
|
||||
@ -54,11 +56,13 @@ namespace QSB.Player
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
var player = PlayerList.FirstOrDefault(x => x.PlayerId == id);
|
||||
if (player != null)
|
||||
{
|
||||
return player;
|
||||
}
|
||||
|
||||
var trace = new StackTrace().GetFrame(1).GetMethod();
|
||||
DebugLog.DebugWrite($"Create Player : id<{id}> (Called from {trace.DeclaringType.Name}.{trace.Name})", MessageType.Info);
|
||||
player = new PlayerInfo(id);
|
||||
@ -112,6 +116,7 @@ namespace QSB.Player
|
||||
{
|
||||
cameraList.Add(LocalPlayer);
|
||||
}
|
||||
|
||||
return cameraList;
|
||||
}
|
||||
|
||||
@ -132,6 +137,7 @@ namespace QSB.Player
|
||||
DebugLog.ToConsole($"Warning - Player {playerId} has a null player model!", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var renderer in player.Body.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
renderer.enabled = visible;
|
||||
@ -152,6 +158,7 @@ namespace QSB.Player
|
||||
DebugLog.DebugWrite($"Error - Cannot get closest player from empty player list.", MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
return playerList.Where(x => x.PlayerStates.IsReady).OrderBy(x => Vector3.Distance(x.Body.transform.position, worldPoint)).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,7 @@ namespace QSB.PoolSync
|
||||
s_propID_Ripple2Position = Shader.PropertyToID("_Ripple2Position");
|
||||
s_propID_Ripple2Params = Shader.PropertyToID("_Ripple2Params");
|
||||
}
|
||||
|
||||
_socket = GetComponentInChildren<SharedStoneSocket>();
|
||||
if (_socket != null)
|
||||
{
|
||||
@ -88,6 +89,7 @@ namespace QSB.PoolSync
|
||||
{
|
||||
Debug.LogWarning("SharedStoneSocket not found!", this);
|
||||
}
|
||||
|
||||
UpdatePoolRenderer();
|
||||
_hologramGroup.SetActive(false);
|
||||
UpdateRendererFade();
|
||||
@ -101,6 +103,7 @@ namespace QSB.PoolSync
|
||||
{
|
||||
CustomPlatformList = new List<CustomNomaiRemoteCameraPlatform>(32);
|
||||
}
|
||||
|
||||
CustomPlatformList.Add(this);
|
||||
_playerCamera = Locator.GetPlayerCamera();
|
||||
if (_socket != null)
|
||||
@ -108,6 +111,7 @@ namespace QSB.PoolSync
|
||||
_socket.OnSocketableRemoved += OnSocketableRemoved;
|
||||
_socket.OnSocketableDonePlacing += OnSocketableDonePlacing;
|
||||
}
|
||||
|
||||
enabled = false;
|
||||
QSBPlayerManager.OnRemovePlayer += OnRemovePlayer;
|
||||
}
|
||||
@ -119,15 +123,18 @@ namespace QSB.PoolSync
|
||||
_socket.OnSocketableRemoved -= OnSocketableRemoved;
|
||||
_socket.OnSocketableDonePlacing -= OnSocketableDonePlacing;
|
||||
}
|
||||
|
||||
if (CustomPlatformList != null)
|
||||
{
|
||||
CustomPlatformList.Remove(this);
|
||||
}
|
||||
|
||||
if (_cameraState == CameraState.Connected || _cameraState == CameraState.Connecting_FadeIn || _cameraState == CameraState.Connecting_FadeOut)
|
||||
{
|
||||
DisconnectCamera();
|
||||
SwitchToPlayerCamera();
|
||||
}
|
||||
|
||||
QSBPlayerManager.OnRemovePlayer -= OnRemovePlayer;
|
||||
}
|
||||
|
||||
@ -159,6 +166,7 @@ namespace QSB.PoolSync
|
||||
UpdateHologramTransforms();
|
||||
}
|
||||
}
|
||||
|
||||
if (_platformActive)
|
||||
{
|
||||
UpdatePools(1f, _poolFillLength);
|
||||
@ -167,6 +175,7 @@ namespace QSB.PoolSync
|
||||
{
|
||||
UpdatePools(0f, _poolEmptyLength);
|
||||
}
|
||||
|
||||
switch (_cameraState)
|
||||
{
|
||||
case CameraState.WaitingForPedestalContact:
|
||||
@ -175,6 +184,7 @@ namespace QSB.PoolSync
|
||||
_cameraState = CameraState.Disconnected;
|
||||
ConnectCamera();
|
||||
}
|
||||
|
||||
break;
|
||||
case CameraState.Connecting_FadeIn:
|
||||
_transitionFade = Mathf.MoveTowards(_transitionFade, 1f, Time.deltaTime / _fadeInLength);
|
||||
@ -195,6 +205,7 @@ namespace QSB.PoolSync
|
||||
Locator.GetAudioMixer().MixRemoteCameraPlatform(_fadeInLength);
|
||||
_cameraState = CameraState.Connecting_FadeOut;
|
||||
}
|
||||
|
||||
break;
|
||||
case CameraState.Connecting_FadeOut:
|
||||
_slavePlatform._transitionFade = Mathf.MoveTowards(_slavePlatform._transitionFade, 0f, Time.deltaTime / _fadeInLength);
|
||||
@ -205,6 +216,7 @@ namespace QSB.PoolSync
|
||||
{
|
||||
_cameraState = CameraState.Connected;
|
||||
}
|
||||
|
||||
break;
|
||||
case CameraState.Connected:
|
||||
VerifySectorOccupancy();
|
||||
@ -231,6 +243,7 @@ namespace QSB.PoolSync
|
||||
_hologramGroup.SetActive(false);
|
||||
_cameraState = CameraState.Disconnecting_FadeOut;
|
||||
}
|
||||
|
||||
break;
|
||||
case CameraState.Disconnecting_FadeOut:
|
||||
_transitionFade = Mathf.MoveTowards(_transitionFade, 0f, Time.deltaTime / _fadeOutLength);
|
||||
@ -239,8 +252,10 @@ namespace QSB.PoolSync
|
||||
{
|
||||
_cameraState = CameraState.Disconnected;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (_cameraState == CameraState.Disconnected && !_platformActive && _poolT == 0f)
|
||||
{
|
||||
enabled = false;
|
||||
@ -256,8 +271,10 @@ namespace QSB.PoolSync
|
||||
{
|
||||
_slavePlatform = null;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
UpdatePoolRenderer();
|
||||
_slavePlatform._poolT = _poolT;
|
||||
_slavePlatform.UpdatePoolRenderer();
|
||||
@ -276,16 +293,17 @@ namespace QSB.PoolSync
|
||||
{
|
||||
parentSector.AddOccupant(Locator.GetPlayerSectorDetector());
|
||||
}
|
||||
|
||||
parentSector = parentSector.GetParentSector();
|
||||
}
|
||||
}
|
||||
|
||||
if (_slavePlatform._visualSector2 != null && !_slavePlatform._visualSector2.ContainsOccupant(DynamicOccupant.Player))
|
||||
{
|
||||
_slavePlatform._visualSector2.AddOccupant(Locator.GetPlayerSectorDetector());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void UpdatePoolRenderer()
|
||||
{
|
||||
_poolRenderer.transform.localPosition = new Vector3(0f, _poolHeightCurve.Evaluate(_poolT), 0f);
|
||||
@ -302,6 +320,7 @@ namespace QSB.PoolSync
|
||||
ripplePosition.y = playerPosition.z;
|
||||
rippleParams.x = 0.5f;
|
||||
}
|
||||
|
||||
_poolRenderer.material.SetVector(s_propID_Ripple2Position, ripplePosition);
|
||||
_poolRenderer.material.SetVector(s_propID_Ripple2Params, rippleParams);
|
||||
}
|
||||
@ -321,6 +340,7 @@ namespace QSB.PoolSync
|
||||
_transitionRenderers[i].enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
_ownedCamera.SetImageEffectFade(1f - _transitionFade);
|
||||
}
|
||||
|
||||
@ -339,6 +359,7 @@ namespace QSB.PoolSync
|
||||
DebugLog.ToConsole($"Error - Gameobject for {item.Key.PlayerId} in _playerToHologram is null!", MessageType.Error);
|
||||
continue;
|
||||
}
|
||||
|
||||
var hologram = item.Value.transform.GetChild(0);
|
||||
hologram.position = TransformPoint(item.Key.Body.transform.position, this, _slavePlatform);
|
||||
hologram.rotation = TransformRotation(item.Key.Body.transform.rotation, this, _slavePlatform);
|
||||
@ -362,10 +383,12 @@ namespace QSB.PoolSync
|
||||
{
|
||||
QSBEventManager.FireEvent(EventNames.QSBExitPlatform, CustomPlatformList.IndexOf(this));
|
||||
}
|
||||
|
||||
if (_slavePlatform == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DisconnectCamera();
|
||||
_transitionStone.SetActive(false);
|
||||
_slavePlatform._transitionStone.SetActive(false);
|
||||
@ -374,14 +397,17 @@ namespace QSB.PoolSync
|
||||
{
|
||||
_transitionPedestalAnimator.PlayOpen();
|
||||
}
|
||||
|
||||
if (_slavePlatform._pedestalAnimator != null)
|
||||
{
|
||||
_slavePlatform._pedestalAnimator.PlayOpen();
|
||||
}
|
||||
|
||||
if (_slavePlatform._transitionPedestalAnimator != null)
|
||||
{
|
||||
_slavePlatform._transitionPedestalAnimator.PlayOpen();
|
||||
}
|
||||
|
||||
_sharedStone = null;
|
||||
_platformActive = false;
|
||||
_wasLocalInBounds = false;
|
||||
@ -395,17 +421,20 @@ namespace QSB.PoolSync
|
||||
{
|
||||
Debug.LogError("Placed an empty item or a non SharedStone in a NomaiRemoteCameraPlatform");
|
||||
}
|
||||
|
||||
_slavePlatform = GetPlatform(_sharedStone.GetRemoteCameraID());
|
||||
if (_slavePlatform == null)
|
||||
{
|
||||
Debug.LogError("Shared stone with Remote Camera ID: " + _sharedStone.GetRemoteCameraID() + " has no registered camera platform!");
|
||||
}
|
||||
|
||||
if (_slavePlatform == this || !_slavePlatform.gameObject.activeSelf)
|
||||
{
|
||||
_sharedStone = null;
|
||||
_slavePlatform = null;
|
||||
return;
|
||||
}
|
||||
|
||||
_transitionStone.SetActive(true);
|
||||
_slavePlatform._transitionStone.SetActive(true);
|
||||
_socket.GetPedestalAnimator().PlayClose();
|
||||
@ -413,14 +442,17 @@ namespace QSB.PoolSync
|
||||
{
|
||||
_transitionPedestalAnimator.PlayClose();
|
||||
}
|
||||
|
||||
if (_slavePlatform._pedestalAnimator != null)
|
||||
{
|
||||
_slavePlatform._pedestalAnimator.PlayClose();
|
||||
}
|
||||
|
||||
if (_slavePlatform._transitionPedestalAnimator != null)
|
||||
{
|
||||
_slavePlatform._transitionPedestalAnimator.PlayClose();
|
||||
}
|
||||
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
@ -438,6 +470,7 @@ namespace QSB.PoolSync
|
||||
{
|
||||
_alreadyOccupiedSectors.Add(_visualSector);
|
||||
}
|
||||
|
||||
_slavePlatform._visualSector.AddOccupant(Locator.GetPlayerSectorDetector());
|
||||
var parentSector = _slavePlatform._visualSector.GetParentSector();
|
||||
while (parentSector != null)
|
||||
@ -446,14 +479,17 @@ namespace QSB.PoolSync
|
||||
{
|
||||
_alreadyOccupiedSectors.Add(parentSector);
|
||||
}
|
||||
|
||||
parentSector.AddOccupant(Locator.GetPlayerSectorDetector());
|
||||
parentSector = parentSector.GetParentSector();
|
||||
}
|
||||
}
|
||||
|
||||
if (_slavePlatform._visualSector2 != null)
|
||||
{
|
||||
_slavePlatform._visualSector2.AddOccupant(Locator.GetPlayerSectorDetector());
|
||||
}
|
||||
|
||||
if (_slavePlatform._darkZone != null)
|
||||
{
|
||||
_slavePlatform._darkZone.AddPlayerToZone(true);
|
||||
@ -468,6 +504,7 @@ namespace QSB.PoolSync
|
||||
{
|
||||
_slavePlatform._visualSector.RemoveOccupant(Locator.GetPlayerSectorDetector());
|
||||
}
|
||||
|
||||
var parentSector = _slavePlatform._visualSector.GetParentSector();
|
||||
while (parentSector != null)
|
||||
{
|
||||
@ -475,17 +512,21 @@ namespace QSB.PoolSync
|
||||
{
|
||||
parentSector.RemoveOccupant(Locator.GetPlayerSectorDetector());
|
||||
}
|
||||
|
||||
parentSector = parentSector.GetParentSector();
|
||||
}
|
||||
}
|
||||
|
||||
if (_slavePlatform._visualSector2 != null)
|
||||
{
|
||||
_slavePlatform._visualSector2.RemoveOccupant(Locator.GetPlayerSectorDetector());
|
||||
}
|
||||
|
||||
if (_slavePlatform._darkZone != null)
|
||||
{
|
||||
_slavePlatform._darkZone.RemovePlayerFromZone(true);
|
||||
}
|
||||
|
||||
QSBEventManager.FireEvent(EventNames.QSBExitPlatform, CustomPlatformList.IndexOf(this));
|
||||
GlobalMessenger.FireEvent("ExitNomaiRemoteCamera");
|
||||
_slavePlatform._ownedCamera.Deactivate();
|
||||
@ -506,6 +547,7 @@ namespace QSB.PoolSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var cameraState = _cameraState;
|
||||
if (cameraState != CameraState.Disconnected && cameraState != CameraState.Disconnecting_FadeOut)
|
||||
{
|
||||
@ -518,6 +560,7 @@ namespace QSB.PoolSync
|
||||
{
|
||||
_cameraState = CameraState.Connecting_FadeIn;
|
||||
}
|
||||
|
||||
_oneShotAudioSource.PlayOneShot(AudioType.NomaiRemoteCameraEntry, 1f);
|
||||
enabled = true;
|
||||
}
|
||||
@ -528,6 +571,7 @@ namespace QSB.PoolSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var cameraState = _cameraState;
|
||||
if (cameraState != CameraState.Connected && cameraState != CameraState.Connecting_FadeOut)
|
||||
{
|
||||
@ -551,6 +595,7 @@ namespace QSB.PoolSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_pedestalAnimator.HasMadeContact())
|
||||
{
|
||||
ConnectCamera();
|
||||
@ -569,21 +614,25 @@ namespace QSB.PoolSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_platformActive = false;
|
||||
if (_pedestalAnimator != null)
|
||||
{
|
||||
_pedestalAnimator.PlayOpen();
|
||||
}
|
||||
|
||||
if (_transitionPedestalAnimator != null)
|
||||
{
|
||||
_transitionPedestalAnimator.PlayOpen();
|
||||
}
|
||||
|
||||
if (_slavePlatform != null)
|
||||
{
|
||||
if (_slavePlatform._pedestalAnimator != null)
|
||||
{
|
||||
_slavePlatform._pedestalAnimator.PlayOpen();
|
||||
}
|
||||
|
||||
if (_slavePlatform._transitionPedestalAnimator != null)
|
||||
{
|
||||
_slavePlatform._transitionPedestalAnimator.PlayOpen();
|
||||
@ -615,6 +664,7 @@ namespace QSB.PoolSync
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -628,16 +678,19 @@ namespace QSB.PoolSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var player = QSBPlayerManager.GetPlayer(id);
|
||||
if (!_playerToHologram.Any(x => x.Key == player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var hologram = _playerToHologram.First(x => x.Key == player).Value;
|
||||
if (hologram.activeSelf)
|
||||
{
|
||||
OnRemotePlayerExit(id);
|
||||
}
|
||||
|
||||
_playerToHologram.Remove(player);
|
||||
}
|
||||
|
||||
@ -656,6 +709,7 @@ namespace QSB.PoolSync
|
||||
_playerToHologram[player].SetActive(true);
|
||||
return;
|
||||
}
|
||||
|
||||
var hologramCopy = Instantiate(_playerHologram);
|
||||
hologramCopy.parent = _playerHologram.parent;
|
||||
Destroy(hologramCopy.GetChild(0).GetComponent<PlayerAnimController>());
|
||||
@ -673,6 +727,7 @@ namespace QSB.PoolSync
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - {playerId}'s VisibleAnimator is null!", MessageType.Error);
|
||||
}
|
||||
|
||||
mirror.Init(player.AnimationSync.VisibleAnimator, hologramCopy.GetChild(0).gameObject.GetComponent<Animator>());
|
||||
|
||||
_playerToHologram.Add(player, hologramCopy.gameObject);
|
||||
@ -686,11 +741,13 @@ namespace QSB.PoolSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var player = QSBPlayerManager.GetPlayer(playerId);
|
||||
if (!_playerToHologram.ContainsKey(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_playerToHologram[player].SetActive(false);
|
||||
|
||||
if (!_platformActive)
|
||||
|
@ -11,10 +11,12 @@ namespace QSB.PoolSync
|
||||
{
|
||||
streaming.gameObject.AddComponent<CustomNomaiRemoteCameraStreaming>();
|
||||
}
|
||||
|
||||
foreach (var camera in Resources.FindObjectsOfTypeAll<NomaiRemoteCamera>())
|
||||
{
|
||||
camera.gameObject.AddComponent<CustomNomaiRemoteCamera>();
|
||||
}
|
||||
|
||||
foreach (var platform in Resources.FindObjectsOfTypeAll<NomaiRemoteCameraPlatform>())
|
||||
{
|
||||
platform.gameObject.AddComponent<CustomNomaiRemoteCameraPlatform>();
|
||||
|
@ -13,6 +13,7 @@ namespace QSB.ProbeSync
|
||||
gameObject.Show();
|
||||
return;
|
||||
}
|
||||
|
||||
gameObject.Hide();
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +169,6 @@ namespace QSB
|
||||
offset3 += _debugLineSpacing;
|
||||
}
|
||||
|
||||
|
||||
GUI.Label(new Rect(420, offset3, 200f, 20f), $"Current Flyer : {ShipManager.Instance.CurrentFlyer}");
|
||||
offset3 += _debugLineSpacing;
|
||||
var ship = ShipTransformSync.LocalInstance;
|
||||
@ -197,6 +196,7 @@ namespace QSB
|
||||
GUI.Label(new Rect(420, offset3, 400f, 20f), $"Ship velocity mag. : {ship.GetVelocityChangeMagnitude()}");
|
||||
offset3 += _debugLineSpacing;
|
||||
}
|
||||
|
||||
GUI.Label(new Rect(420, offset3, 200f, 20f), $"Ship sectors :");
|
||||
offset3 += _debugLineSpacing;
|
||||
foreach (var sector in ship.SectorSync.SectorList)
|
||||
@ -241,6 +241,7 @@ namespace QSB
|
||||
{
|
||||
QSBNetworkManager.Instance.networkPort = Port;
|
||||
}
|
||||
|
||||
DebugMode = config.GetSettingsValue<bool>("debugMode");
|
||||
ShowLinesInDebug = config.GetSettingsValue<bool>("showLinesInDebug");
|
||||
}
|
||||
|
@ -112,6 +112,7 @@ namespace QSB
|
||||
child.Target = item.target;
|
||||
Destroy(item);
|
||||
}
|
||||
|
||||
Destroy(go.GetComponent<NetworkTransform>());
|
||||
Destroy(go.GetComponent<NetworkIdentity>());
|
||||
}
|
||||
@ -252,10 +253,12 @@ namespace QSB
|
||||
{
|
||||
Destroy(platform);
|
||||
}
|
||||
|
||||
foreach (var camera in Resources.FindObjectsOfTypeAll<CustomNomaiRemoteCamera>())
|
||||
{
|
||||
Destroy(camera);
|
||||
}
|
||||
|
||||
foreach (var streaming in Resources.FindObjectsOfTypeAll<CustomNomaiRemoteCameraStreaming>())
|
||||
{
|
||||
Destroy(streaming);
|
||||
|
@ -29,6 +29,7 @@ namespace QSB
|
||||
// So objects have time to be deleted, made, whatever
|
||||
QSBCore.UnityEvents.FireOnNextUpdate(() => WorldObjectManager.Rebuild(newScene));
|
||||
}
|
||||
|
||||
OnSceneLoaded?.SafeInvoke(newScene, universe);
|
||||
if (universe)
|
||||
{
|
||||
|
@ -29,6 +29,7 @@ namespace QSB.QuantumSync.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var moon = Locator.GetQuantumMoon();
|
||||
var wasPlayerEntangled = moon.IsPlayerEntangled();
|
||||
var location = new RelativeLocationData(Locator.GetPlayerTransform().GetComponent<OWRigidbody>(), moon.transform);
|
||||
@ -44,6 +45,7 @@ namespace QSB.QuantumSync.Events
|
||||
{
|
||||
Physics.SyncTransforms();
|
||||
}
|
||||
|
||||
constantFoceDetector.AddConstantVolume(owRigidbody.GetAttachedGravityVolume(), true, true);
|
||||
moonBody.SetVelocity(OWPhysics.CalculateOrbitVelocity(owRigidbody, moonBody, message.OrbitAngle) + owRigidbody.GetVelocity());
|
||||
moon.SetValue("_stateIndex", message.StateIndex);
|
||||
@ -57,12 +59,14 @@ namespace QSB.QuantumSync.Events
|
||||
moon.GetType().GetMethod("SetSurfaceState", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(moon, new object[] { -1 });
|
||||
moon.GetValue<AudioSignal>("_quantumSignal").SetSignalActivation(message.StateIndex != 5, 2f);
|
||||
}
|
||||
|
||||
moon.GetValue<ReferenceFrameVolume>("_referenceFrameVolume").gameObject.SetActive(message.StateIndex != 5);
|
||||
moonBody.SetIsTargetable(message.StateIndex != 5);
|
||||
foreach (var obj in moon.GetValue<GameObject[]>("_deactivateAtEye"))
|
||||
{
|
||||
obj.SetActive(message.StateIndex != 5);
|
||||
}
|
||||
|
||||
GlobalMessenger<OWRigidbody>.FireEvent("QuantumMoonChangeState", moonBody);
|
||||
|
||||
if (wasPlayerEntangled)
|
||||
|
@ -28,6 +28,7 @@ namespace QSB.QuantumSync.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var qsbObj = QSBWorldSync.GetWorldFromId<QSBMultiStateQuantumObject>(message.ObjectId);
|
||||
qsbObj.DebugBoxText.text = message.StateIndex.ToString();
|
||||
}
|
||||
@ -38,12 +39,14 @@ namespace QSB.QuantumSync.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var qsbObj = QSBWorldSync.GetWorldFromId<QSBMultiStateQuantumObject>(message.ObjectId);
|
||||
if (qsbObj.ControllingPlayer != message.FromId)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Got MultiStateChangeEvent for {qsbObj.Name} from {message.FromId}, but it's currently controlled by {qsbObj.ControllingPlayer}!", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
qsbObj.ChangeState(message.StateIndex);
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ namespace QSB.QuantumSync.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var obj = QSBWorldSync.GetWorldFromId<QSBQuantumShuffleObject>(message.ObjectId);
|
||||
obj.ShuffleObjects(message.IndexArray);
|
||||
}
|
||||
|
@ -30,12 +30,14 @@ namespace QSB.QuantumSync.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var obj = QSBWorldSync.GetWorldFromId<QSBSocketedQuantumObject>(message.ObjectId);
|
||||
if (obj.ControllingPlayer != message.FromId)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Got SocketStateChangeEvent for {obj.Name} from {message.FromId}, but it's currently controlled by {obj.ControllingPlayer}!", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
obj.MoveToSocket(message);
|
||||
}
|
||||
}
|
||||
|
@ -106,6 +106,7 @@ namespace QSB.QuantumSync.Patches
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool socketNotSuitable;
|
||||
var isSocketIlluminated = (bool)__instance.GetType().GetMethod("CheckIllumination", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, null);
|
||||
|
||||
@ -135,12 +136,14 @@ namespace QSB.QuantumSync.Patches
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
list.RemoveAt(index);
|
||||
if (list.Count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
__instance.GetType().GetMethod("MoveToSocket", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { occupiedSocket });
|
||||
__result = false;
|
||||
return false;
|
||||
@ -158,6 +161,7 @@ namespace QSB.QuantumSync.Patches
|
||||
DebugLog.ToConsole($"Error - Trying to move {__instance.name} to a null socket!", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var objectWorldObject = QSBWorldSync.GetWorldFromUnity<QSBSocketedQuantumObject, SocketedQuantumObject>(__instance);
|
||||
var socketWorldObject = QSBWorldSync.GetWorldFromUnity<QSBQuantumSocket, QuantumSocket>(socket);
|
||||
|
||||
@ -206,7 +210,6 @@ namespace QSB.QuantumSync.Patches
|
||||
____indexList[random] = temp;
|
||||
}
|
||||
|
||||
|
||||
for (var j = 0; j < ____shuffledObjects.Length; j++)
|
||||
{
|
||||
____shuffledObjects[j].localPosition = ____localPositions[____indexList[j]];
|
||||
@ -249,6 +252,7 @@ namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
__instance.GetType().GetMethod("CheckEnabled", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, null);
|
||||
}
|
||||
|
||||
if (____collapseOnStart)
|
||||
{
|
||||
__instance.GetType().GetMethod("Collapse", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { true });
|
||||
@ -269,6 +273,7 @@ namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var isInControl = qsbObj.ControllingPlayer == QSBPlayerManager.LocalPlayerId;
|
||||
return isInControl;
|
||||
}
|
||||
@ -284,6 +289,7 @@ namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var allMultiStates = QSBWorldSync.GetWorldObjects<QSBMultiStateQuantumObject>();
|
||||
var stateObject = QSBWorldSync.GetWorldFromUnity<QSBQuantumState, QuantumState>(__instance);
|
||||
var owner = allMultiStates.First(x => x.QuantumStates.Contains(stateObject));
|
||||
@ -291,6 +297,7 @@ namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var stateIndex = owner.QuantumStates.IndexOf(stateObject);
|
||||
QSBEventManager.FireEvent(
|
||||
EventNames.QSBMultiStateChange,
|
||||
@ -369,6 +376,7 @@ namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
____isProbeInside = true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -390,6 +398,7 @@ namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
____isProbeInside = false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -445,6 +454,7 @@ namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
__instance.GetType().GetMethod("Collapse", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { true });
|
||||
}
|
||||
|
||||
__instance.GetType().GetMethod("SetSurfaceState", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { -1 });
|
||||
QSBEventManager.FireEvent("PlayerExitQuantumMoon");
|
||||
}
|
||||
@ -458,6 +468,7 @@ namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
Physics.SyncTransforms();
|
||||
}
|
||||
|
||||
var component = Locator.GetPlayerCamera().GetComponent<PlayerCameraController>();
|
||||
component.SetDegreesY(component.GetMinDegreesY());
|
||||
____vortexAudio.SetLocalVolume(0f);
|
||||
@ -466,6 +477,7 @@ namespace QSB.QuantumSync.Patches
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
____playerFogBubble.SetFogAlpha(fogAlpha);
|
||||
____shipLandingCamFogBubble.SetFogAlpha(fogAlpha);
|
||||
return false;
|
||||
|
@ -63,6 +63,7 @@ namespace QSB.QuantumSync.Patches
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
var point = __instance.transform.TransformPoint(____localIlluminationOffset);
|
||||
var tupleFlashlights = QSBPlayerManager.GetPlayerFlashlights();
|
||||
var localFlashlight = tupleFlashlights.First;
|
||||
@ -107,6 +108,7 @@ namespace QSB.QuantumSync.Patches
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ namespace QSB.QuantumSync.Patches
|
||||
DebugLog.ToConsole($"Warning - QuantumManager.Shrine is null.", MessageType.Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
var shrineLit = QuantumManager.Shrine.IsPlayerInDarkness();
|
||||
|
||||
// If any of the players in the moon are not in the shrine
|
||||
@ -98,16 +99,19 @@ namespace QSB.QuantumSync.Patches
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Time.time - ____playerWarpTime < 1f)
|
||||
{
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (____stateIndex == 5 && ____isPlayerInside && !__instance.IsPlayerEntangled())
|
||||
{
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
var stateIndex = (____collapseToIndex == -1) ? (int)__instance.GetType().GetMethod("GetRandomStateIndex", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, null) : ____collapseToIndex;
|
||||
@ -120,10 +124,12 @@ namespace QSB.QuantumSync.Patches
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (orbitIndex == -1)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - QM failed to find orbit for state {stateIndex}", MessageType.Error);
|
||||
}
|
||||
|
||||
var orbitRadius = (orbitIndex == -1) ? 10000f : ____orbits[orbitIndex].GetOrbitRadius();
|
||||
var owRigidbody = (orbitIndex == -1) ? Locator.GetAstroObject(AstroObject.Name.Sun).GetOWRigidbody() : ____orbits[orbitIndex].GetAttachedOWRigidbody();
|
||||
var onUnitSphere = UnityEngine.Random.onUnitSphere;
|
||||
@ -132,6 +138,7 @@ namespace QSB.QuantumSync.Patches
|
||||
onUnitSphere.y = 0f;
|
||||
onUnitSphere.Normalize();
|
||||
}
|
||||
|
||||
var position = (onUnitSphere * orbitRadius) + owRigidbody.GetWorldCenterOfMass();
|
||||
if (!Physics.CheckSphere(position, ____sphereCheckRadius, OWLayerMask.physicalMask) || ____collapseToIndex != -1)
|
||||
{
|
||||
@ -140,6 +147,7 @@ namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
Physics.SyncTransforms();
|
||||
}
|
||||
|
||||
if (__instance.IsPlayerEntangled() || !QuantumManager.IsVisibleUsingCameraFrustum((ShapeVisibilityTracker)____visibilityTracker, skipInstantVisibilityCheck).First)
|
||||
{
|
||||
____moonBody.transform.position = position;
|
||||
@ -147,6 +155,7 @@ namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
Physics.SyncTransforms();
|
||||
}
|
||||
|
||||
____visibilityTracker.transform.localPosition = Vector3.zero;
|
||||
____constantForceDetector.AddConstantVolume(owRigidbody.GetAttachedGravityVolume(), true, true);
|
||||
var velocity = owRigidbody.GetVelocity();
|
||||
@ -156,6 +165,7 @@ namespace QSB.QuantumSync.Patches
|
||||
velocity = (initialMotion == null) ? Vector3.zero : initialMotion.GetInitVelocity();
|
||||
____useInitialMotion = false;
|
||||
}
|
||||
|
||||
var orbitAngle = UnityEngine.Random.Range(0, 360);
|
||||
____moonBody.SetVelocity(OWPhysics.CalculateOrbitVelocity(owRigidbody, ____moonBody, orbitAngle) + velocity);
|
||||
____lastStateIndex = ____stateIndex;
|
||||
@ -166,9 +176,11 @@ namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
____stateSkipCounts[k] = (k != ____stateIndex) ? (____stateSkipCounts[k] + 1) : 0;
|
||||
}
|
||||
|
||||
QSBEventManager.FireEvent(EventNames.QSBMoonStateChange, stateIndex, onUnitSphere, orbitAngle);
|
||||
break;
|
||||
}
|
||||
|
||||
____visibilityTracker.transform.localPosition = Vector3.zero;
|
||||
}
|
||||
else
|
||||
@ -176,6 +188,7 @@ namespace QSB.QuantumSync.Patches
|
||||
DebugLog.ToConsole("Warning - Quantum moon orbit position occupied! Aborting collapse.", MessageType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
if (____isPlayerInside)
|
||||
@ -187,16 +200,19 @@ namespace QSB.QuantumSync.Patches
|
||||
__instance.GetType().GetMethod("SetSurfaceState", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { -1 });
|
||||
____quantumSignal.SetSignalActivation(____stateIndex != 5, 2f);
|
||||
}
|
||||
|
||||
____referenceFrameVolume.gameObject.SetActive(____stateIndex != 5);
|
||||
____moonBody.SetIsTargetable(____stateIndex != 5);
|
||||
for (var l = 0; l < ____deactivateAtEye.Length; l++)
|
||||
{
|
||||
____deactivateAtEye[l].SetActive(____stateIndex != 5);
|
||||
}
|
||||
|
||||
GlobalMessenger<OWRigidbody>.FireEvent("QuantumMoonChangeState", ____moonBody);
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ namespace QSB.QuantumSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var quantumObjects = QSBWorldSync.GetWorldObjects<IQSBQuantumObject>().ToList();
|
||||
for (var i = 0; i < quantumObjects.Count; i++)
|
||||
{
|
||||
@ -84,10 +85,12 @@ namespace QSB.QuantumSync
|
||||
DebugLog.ToConsole($"Warning - Trying to run IsVisibleUsingCameraFrustum when there are no players!", MessageType.Warning);
|
||||
return new Tuple<bool, List<PlayerInfo>>(false, null);
|
||||
}
|
||||
|
||||
if (!tracker.gameObject.activeInHierarchy)
|
||||
{
|
||||
return new Tuple<bool, List<PlayerInfo>>(false, null);
|
||||
}
|
||||
|
||||
var frustumMethod = tracker.GetType().GetMethod("IsInFrustum", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
|
||||
var playersWhoCanSee = new List<PlayerInfo>();
|
||||
@ -99,6 +102,7 @@ namespace QSB.QuantumSync
|
||||
DebugLog.ToConsole($"Warning - Camera is null for id:{player.PlayerId}!", MessageType.Warning);
|
||||
continue;
|
||||
}
|
||||
|
||||
var isInFrustum = (bool)frustumMethod.Invoke(tracker, new object[] { player.Camera.GetFrustumPlanes() });
|
||||
if (isInFrustum)
|
||||
{
|
||||
@ -124,6 +128,7 @@ namespace QSB.QuantumSync
|
||||
{
|
||||
return Enumerable.Empty<PlayerInfo>();
|
||||
}
|
||||
|
||||
var worldObj = GetObject(obj);
|
||||
return QSBPlayerManager.PlayerList.Where(x => x.EntangledObject == worldObj);
|
||||
}
|
||||
@ -155,6 +160,7 @@ namespace QSB.QuantumSync
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - couldn't work out type of QuantumObject {unityObject.name}.", MessageType.Warning);
|
||||
}
|
||||
|
||||
return worldObj;
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
{
|
||||
DebugBoxText = DebugBoxManager.CreateBox(AttachedObject.transform, 0, CurrentState.ToString()).GetComponent<Text>();
|
||||
}
|
||||
|
||||
base.Init(attachedObject, id);
|
||||
}
|
||||
|
||||
@ -40,6 +41,7 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
{
|
||||
QuantumStates[CurrentState].SetVisible(false);
|
||||
}
|
||||
|
||||
QuantumStates[newStateIndex].SetVisible(true);
|
||||
AttachedObject.SetValue("_stateIndex", newStateIndex);
|
||||
if (QSBCore.DebugMode)
|
||||
|
@ -43,6 +43,7 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
shape.OnShapeDeactivated += (Shape s)
|
||||
=> QSBCore.UnityEvents.FireOnNextUpdate(() => OnDisable(s));
|
||||
}
|
||||
|
||||
if (GetAttachedShapes().Any(x => !x.enabled || !x.active))
|
||||
{
|
||||
ControllingPlayer = 0u;
|
||||
@ -60,22 +61,26 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
{
|
||||
return new List<Shape>();
|
||||
}
|
||||
|
||||
var visibilityTrackers = AttachedObject.GetValue<VisibilityTracker[]>("_visibilityTrackers");
|
||||
if (visibilityTrackers == null || visibilityTrackers.Length == 0)
|
||||
{
|
||||
return new List<Shape>();
|
||||
}
|
||||
|
||||
if (visibilityTrackers.Any(x => x.GetType() == typeof(RendererVisibilityTracker)))
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - {AttachedObject.name} has a RendererVisibilityTracker!", MessageType.Warning);
|
||||
return new List<Shape>();
|
||||
}
|
||||
|
||||
var totalShapes = new List<Shape>();
|
||||
foreach (var tracker in visibilityTrackers)
|
||||
{
|
||||
var shapes = tracker.GetValue<Shape[]>("_shapes");
|
||||
totalShapes.AddRange(shapes);
|
||||
}
|
||||
|
||||
return totalShapes;
|
||||
}
|
||||
|
||||
@ -86,11 +91,13 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ControllingPlayer != 0)
|
||||
{
|
||||
// controlled by another player, dont care that we activate it
|
||||
return;
|
||||
}
|
||||
|
||||
var id = QSBWorldSync.GetIdFromTypeSubset<IQSBQuantumObject>(this);
|
||||
// no one is controlling this object right now, request authority
|
||||
QSBEventManager.FireEvent(EventNames.QSBQuantumAuthority, id, QSBPlayerManager.LocalPlayerId);
|
||||
@ -102,20 +109,24 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetAttachedShapes().Any(x => x.isActiveAndEnabled))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IsEnabled = false;
|
||||
if (!QSBCore.WorldObjectsReady && !QSBCore.IsServer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ControllingPlayer != QSBPlayerManager.LocalPlayerId)
|
||||
{
|
||||
// not being controlled by us, don't care if we leave area
|
||||
return;
|
||||
}
|
||||
|
||||
var id = QSBWorldSync.GetIdFromTypeSubset<IQSBQuantumObject>(this);
|
||||
// send event to other players that we're releasing authority
|
||||
QSBEventManager.FireEvent(EventNames.QSBQuantumAuthority, id, 0u);
|
||||
|
@ -41,6 +41,7 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
DebugLog.ToConsole($"Couldn't find socket id {message.SocketId}", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var socket = qsbSocket.AttachedObject;
|
||||
if (socket == null)
|
||||
{
|
||||
|
@ -30,6 +30,7 @@ namespace QSB.RoastingSync.Events
|
||||
SendEvent(CreateMessage(-1, roasting));
|
||||
return;
|
||||
}
|
||||
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBCampfire, Campfire>(campfire);
|
||||
SendEvent(CreateMessage(qsbObj.ObjectId, roasting));
|
||||
}
|
||||
@ -47,11 +48,13 @@ namespace QSB.RoastingSync.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.State && message.ObjectId == -1)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Null campfire supplied for start roasting event!", OWML.Common.MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var player = QSBPlayerManager.GetPlayer(message.AboutId);
|
||||
player.RoastingStick.SetActive(message.State);
|
||||
if (message.State)
|
||||
|
@ -29,12 +29,14 @@ namespace QSB.RoastingSync.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var marshmallow = QSBPlayerManager.GetPlayer(message.AboutId).Marshmallow;
|
||||
if (marshmallow == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Marshmallow is null for player {message.AboutId}.", OWML.Common.MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (message.EnumValue)
|
||||
{
|
||||
case MarshmallowEventType.Burn:
|
||||
@ -73,6 +75,7 @@ namespace QSB.RoastingSync.Events
|
||||
DebugLog.DebugWrite($"Error - Campfire for {playerId} is null.", OWML.Common.MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
rigidbody.SetVelocity(player.Campfire.AttachedObject.GetAttachedOWRigidbody(false).GetPointVelocity(stickTip.position) + (stickTip.forward * 3f));
|
||||
rigidbody.SetAngularVelocity(stickTip.right * 10f);
|
||||
if (player.Marshmallow == null)
|
||||
@ -80,6 +83,7 @@ namespace QSB.RoastingSync.Events
|
||||
DebugLog.DebugWrite($"Error - Marshmallow for {playerId} is null.", OWML.Common.MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
tossedMallow.GetComponentInChildren<MeshRenderer>().material.color = player.Marshmallow._burntColor;
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ namespace QSB.RoastingSync.Patches
|
||||
____audioController.PlayMarshmallowCatchFire();
|
||||
QSBEventManager.FireEvent(EventNames.QSBMarshmallowEvent, MarshmallowEventType.Burn);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -52,6 +53,7 @@ namespace QSB.RoastingSync.Patches
|
||||
____mallowState = Marshmallow.MallowState.Shriveling;
|
||||
QSBEventManager.FireEvent(EventNames.QSBMarshmallowEvent, MarshmallowEventType.Shrivel);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -107,6 +109,7 @@ namespace QSB.RoastingSync.Patches
|
||||
QSBEventManager.FireEvent(EventNames.QSBMarshmallowEvent, MarshmallowEventType.Toss);
|
||||
}
|
||||
}
|
||||
|
||||
if (OWInput.IsNewlyPressed(InputLibrary.interact, InputMode.Roasting) && ____marshmallow.IsEdible())
|
||||
{
|
||||
____marshmallow.Eat();
|
||||
|
@ -83,9 +83,11 @@ namespace QSB.RoastingSync
|
||||
{
|
||||
_fireRenderer.enabled = false;
|
||||
}
|
||||
|
||||
transform.localScale = Vector3.one * (1f - shrivelFraction);
|
||||
}
|
||||
}
|
||||
|
||||
_heatPerSecond = 0f;
|
||||
}
|
||||
|
||||
@ -105,6 +107,7 @@ namespace QSB.RoastingSync
|
||||
{
|
||||
_smokeParticles.Play();
|
||||
}
|
||||
|
||||
var smokeColor = new Color(1f, 1f, 1f, num);
|
||||
_smokeParticlesSettings.startColor = smokeColor;
|
||||
}
|
||||
@ -112,6 +115,7 @@ namespace QSB.RoastingSync
|
||||
{
|
||||
_smokeParticles.Stop();
|
||||
}
|
||||
|
||||
Color newColor;
|
||||
if (_toastedFraction < PERFECT_TOASTED_FRACTION)
|
||||
{
|
||||
@ -123,6 +127,7 @@ namespace QSB.RoastingSync
|
||||
var fractionTowardsBurnt = (_toastedFraction - PERFECT_TOASTED_FRACTION) / 0.3f;
|
||||
newColor = Color.Lerp(_toastedColor, _burntColor, fractionTowardsBurnt);
|
||||
}
|
||||
|
||||
_mallowRenderer.material.color = Color.Lerp(_mallowRenderer.material.color, newColor, RAW_TOASTED_FRACTION);
|
||||
_smokeParticles.transform.forward = Locator.GetPlayerTransform().up;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ namespace QSB.SectorSync
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((sync as QNetworkBehaviour).HasAuthority
|
||||
&& sync.AttachedObject.gameObject.activeInHierarchy
|
||||
&& sync.IsReady)
|
||||
@ -44,6 +45,7 @@ namespace QSB.SectorSync
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((sync as QNetworkBehaviour).HasAuthority
|
||||
&& sync.AttachedObject.gameObject.activeInHierarchy
|
||||
&& sync.IsReady)
|
||||
@ -78,6 +80,7 @@ namespace QSB.SectorSync
|
||||
DebugLog.ToConsole($"Error - TimeLoopRing_Body not found!", MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
QSBWorldSync.Init<QSBSector, Sector>();
|
||||
IsReady = QSBWorldSync.GetWorldObjects<QSBSector>().Any();
|
||||
}
|
||||
@ -91,10 +94,12 @@ namespace QSB.SectorSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (closestSector == transformSync.ReferenceSector)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
transformSync.SetReferenceSector(closestSector);
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ namespace QSB.SectorSync
|
||||
_sectorDetector.OnEnterSector -= AddSector;
|
||||
_sectorDetector.OnExitSector -= RemoveSector;
|
||||
}
|
||||
|
||||
_sectorDetector = detector;
|
||||
_sectorDetector.OnEnterSector += AddSector;
|
||||
_sectorDetector.OnExitSector += RemoveSector;
|
||||
@ -54,11 +55,13 @@ namespace QSB.SectorSync
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Can't find QSBSector for sector {sector.name}!", MessageType.Error);
|
||||
}
|
||||
|
||||
if (SectorList.Contains(worldObject))
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Trying to add {sector.name} for {gameObject.name}, but is already in list", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
SectorList.Add(worldObject);
|
||||
}
|
||||
|
||||
@ -70,11 +73,13 @@ namespace QSB.SectorSync
|
||||
DebugLog.ToConsole($"Error - Can't find QSBSector for sector {sector.name}!", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SectorList.Contains(worldObject))
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Trying to remove {sector.name} for {gameObject.name}, but is not in list!", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
SectorList.Remove(worldObject);
|
||||
}
|
||||
|
||||
@ -98,6 +103,7 @@ namespace QSB.SectorSync
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
var ordered = activeNotNullNotBlacklisted
|
||||
.OrderBy(sector => CalculateSectorScore(sector, trans, _attachedOWRigidbody));
|
||||
|
||||
@ -140,6 +146,7 @@ namespace QSB.SectorSync
|
||||
return trigger.GetShape().CalcWorldBounds().radius;
|
||||
}
|
||||
}
|
||||
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@ -152,6 +159,7 @@ namespace QSB.SectorSync
|
||||
var relativeVelocityMagnitude = relativeVelocity.sqrMagnitude; // Remember this is squared for efficiency!
|
||||
return relativeVelocityMagnitude;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ namespace QSB.SectorSync.WorldObjects
|
||||
DebugLog.ToConsole($"Warning - Expected to find a NomaiShuttleController for {AttachedObject.name}!", MessageType.Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!shuttleController.IsPlayerInside())
|
||||
{
|
||||
return false;
|
||||
@ -73,12 +74,14 @@ namespace QSB.SectorSync.WorldObjects
|
||||
DebugLog.ToConsole($"Warning - Expected to find a EyeShuttleController for {AttachedObject.name}!", MessageType.Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!shuttleController.GetValue<bool>("_isPlayerInside"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ namespace QSB.ShipSync.Events
|
||||
{
|
||||
shipNetId.RemoveClientAuthority(shipNetId.ClientAuthorityOwner);
|
||||
}
|
||||
|
||||
shipNetId.AssignClientAuthority(newAuthority);
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ namespace QSB.ShipSync.Patches
|
||||
ShipManager.Instance.ShipTractorBeam.ActivateTractorBeam();
|
||||
QSBEventManager.FireEvent(EventNames.QSBEnableFunnel);
|
||||
}
|
||||
|
||||
QSBEventManager.FireEvent(EventNames.QSBHatchState, true);
|
||||
return true;
|
||||
}
|
||||
@ -35,6 +36,7 @@ namespace QSB.ShipSync.Patches
|
||||
{
|
||||
QSBEventManager.FireEvent(EventNames.QSBHatchState, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -46,6 +48,7 @@ namespace QSB.ShipSync.Patches
|
||||
ShipManager.Instance.ShipTractorBeam.DeactivateTractorBeam();
|
||||
QSBEventManager.FireEvent(EventNames.QSBHatchState, false);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ namespace QSB.ShipSync
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Trying to set current flyer while someone is still flying? Current:{_currentFlyer}, New:{value}", MessageType.Warning);
|
||||
}
|
||||
|
||||
_currentFlyer = value;
|
||||
}
|
||||
}
|
||||
@ -55,6 +56,7 @@ namespace QSB.ShipSync
|
||||
{
|
||||
QNetworkServer.Destroy(ShipTransformSync.LocalInstance.gameObject);
|
||||
}
|
||||
|
||||
QNetworkServer.Spawn(Instantiate(QSBNetworkManager.Instance.ShipPrefab));
|
||||
}
|
||||
|
||||
|
@ -18,10 +18,12 @@ namespace QSB.StatueSync.Patches
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!____waitForPlayerGrounded || !Locator.GetPlayerController().IsGrounded())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var playerBody = Locator.GetPlayerBody().transform;
|
||||
var timberHearth = Locator.GetAstroObject(AstroObject.Name.TimberHearth).transform;
|
||||
QSBEventManager.FireEvent(
|
||||
|
@ -69,6 +69,7 @@ namespace QSB.Syncs
|
||||
DebugLog.DebugWrite($"Error - _referenceTransform has not been set for {_attachedTransform.name}", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
SetRotation(_referenceTransform.InverseTransformRotation(worldRotation));
|
||||
}
|
||||
|
||||
@ -94,6 +95,7 @@ namespace QSB.Syncs
|
||||
DebugLog.DebugWrite($"Error - _referenceTransform has not been set for {_attachedTransform.name}", MessageType.Error);
|
||||
return Vector3.zero;
|
||||
}
|
||||
|
||||
return _referenceTransform.TransformPoint(GetPosition());
|
||||
}
|
||||
|
||||
@ -107,6 +109,7 @@ namespace QSB.Syncs
|
||||
DebugLog.DebugWrite($"Error - _referenceTransform has not been set for {_attachedTransform.name}", MessageType.Error);
|
||||
return Quaternion.identity;
|
||||
}
|
||||
|
||||
return _referenceTransform.TransformRotation(GetRotation());
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ namespace QSB.Syncs.RigidbodySync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var closestSector = SectorSync.GetClosestSector(AttachedObject.transform);
|
||||
if (closestSector != null)
|
||||
{
|
||||
@ -48,6 +49,7 @@ namespace QSB.Syncs.RigidbodySync
|
||||
{
|
||||
_intermediaryTransform = new IntermediaryTransform(transform);
|
||||
}
|
||||
|
||||
if (ReferenceSector != null)
|
||||
{
|
||||
writer.Write(ReferenceSector.ObjectId);
|
||||
@ -56,6 +58,7 @@ namespace QSB.Syncs.RigidbodySync
|
||||
{
|
||||
writer.Write(-1);
|
||||
}
|
||||
|
||||
base.SerializeTransform(writer);
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@ namespace QSB.Syncs.RigidbodySync
|
||||
{
|
||||
DebugLog.ToConsole($"Error - {_logName} is being init-ed when not in the universe!", MessageType.Error);
|
||||
}
|
||||
|
||||
AttachedObject = GetRigidbody();
|
||||
_isInitialized = true;
|
||||
}
|
||||
@ -223,6 +224,7 @@ namespace QSB.Syncs.RigidbodySync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ReferenceTransform = transform;
|
||||
_intermediaryTransform.SetReferenceTransform(transform);
|
||||
}
|
||||
@ -237,6 +239,7 @@ namespace QSB.Syncs.RigidbodySync
|
||||
_previousDistance = distance;
|
||||
return targetPosition;
|
||||
}
|
||||
|
||||
_previousDistance = distance;
|
||||
return Vector3.SmoothDamp(currentPosition, targetPosition, ref _positionSmoothVelocity, SmoothTime);
|
||||
}
|
||||
@ -281,17 +284,20 @@ namespace QSB.Syncs.RigidbodySync
|
||||
DebugLog.ToConsole($"Error - Trying to get relative velocity when AttachedObject is null.", MessageType.Error);
|
||||
return Vector3.zero;
|
||||
}
|
||||
|
||||
if (ReferenceTransform == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Trying to get relative velocity when ReferenceTransform is null. ({AttachedObject.name})", MessageType.Error);
|
||||
return Vector3.zero;
|
||||
}
|
||||
|
||||
var attachedRigid = ReferenceTransform.GetAttachedOWRigidbody();
|
||||
if (attachedRigid == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - ReferenceTransform ({ReferenceTransform.name}) on {AttachedObject.name} has no attached OWRigidBody.", MessageType.Error);
|
||||
return Vector3.zero;
|
||||
}
|
||||
|
||||
var pointVelocity = attachedRigid.GetPointVelocity(AttachedObject.transform.position);
|
||||
return AttachedObject.GetVelocity() - pointVelocity;
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ namespace QSB.Syncs.TransformSync
|
||||
{
|
||||
Destroy(AttachedObject.gameObject);
|
||||
}
|
||||
|
||||
QSBSceneManager.OnSceneLoaded -= OnSceneLoaded;
|
||||
}
|
||||
|
||||
@ -95,10 +96,12 @@ namespace QSB.Syncs.TransformSync
|
||||
{
|
||||
DebugLog.ToConsole($"Error - {_logName} is being init-ed when not in the universe!", MessageType.Error);
|
||||
}
|
||||
|
||||
if (!HasAuthority && AttachedObject != null)
|
||||
{
|
||||
Destroy(AttachedObject.gameObject);
|
||||
}
|
||||
|
||||
AttachedObject = HasAuthority ? InitLocalTransform() : InitRemoteTransform();
|
||||
_isInitialized = true;
|
||||
}
|
||||
@ -195,6 +198,7 @@ namespace QSB.Syncs.TransformSync
|
||||
_intermediaryTransform.EncodeRotation(AttachedObject.transform.rotation);
|
||||
return;
|
||||
}
|
||||
|
||||
var targetPos = _intermediaryTransform.GetTargetPosition_ParentedToReference();
|
||||
var targetRot = _intermediaryTransform.GetTargetRotation_ParentedToReference();
|
||||
if (targetPos != Vector3.zero && _intermediaryTransform.GetTargetPosition_Unparented() != Vector3.zero)
|
||||
@ -225,6 +229,7 @@ namespace QSB.Syncs.TransformSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ReferenceTransform = transform;
|
||||
_intermediaryTransform.SetReferenceTransform(transform);
|
||||
if (AttachedObject == null)
|
||||
@ -235,6 +240,7 @@ namespace QSB.Syncs.TransformSync
|
||||
() => ReparentAttachedObject(transform));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HasAuthority)
|
||||
{
|
||||
ReparentAttachedObject(transform);
|
||||
@ -247,6 +253,7 @@ namespace QSB.Syncs.TransformSync
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Trying to reparent AttachedObject {AttachedObject.name} which wasnt attached to sector!", MessageType.Warning);
|
||||
}
|
||||
|
||||
AttachedObject.transform.SetParent(sectorTransform, true);
|
||||
AttachedObject.transform.localScale = GetType() == typeof(PlayerTransformSync)
|
||||
? Vector3.one / 10
|
||||
@ -261,6 +268,7 @@ namespace QSB.Syncs.TransformSync
|
||||
_previousDistance = distance;
|
||||
return targetPosition;
|
||||
}
|
||||
|
||||
_previousDistance = distance;
|
||||
return Vector3.SmoothDamp(currentPosition, targetPosition, ref _positionSmoothVelocity, SmoothTime);
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ namespace QSB.Syncs.TransformSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var closestSector = SectorSync.GetClosestSector(AttachedObject.transform);
|
||||
if (closestSector != null)
|
||||
{
|
||||
@ -49,6 +50,7 @@ namespace QSB.Syncs.TransformSync
|
||||
{
|
||||
_intermediaryTransform = new IntermediaryTransform(transform);
|
||||
}
|
||||
|
||||
if (ReferenceSector != null)
|
||||
{
|
||||
writer.Write(ReferenceSector.ObjectId);
|
||||
@ -57,6 +59,7 @@ namespace QSB.Syncs.TransformSync
|
||||
{
|
||||
writer.Write(-1);
|
||||
}
|
||||
|
||||
base.SerializeTransform(writer);
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,7 @@ namespace QSB.Syncs.TransformSync
|
||||
{
|
||||
Destroy(AttachedObject.gameObject);
|
||||
}
|
||||
|
||||
QSBSceneManager.OnSceneLoaded -= OnSceneLoaded;
|
||||
}
|
||||
|
||||
@ -176,6 +177,7 @@ namespace QSB.Syncs.TransformSync
|
||||
_intermediaryTransform.EncodeRotation(AttachedObject.transform.rotation);
|
||||
return;
|
||||
}
|
||||
|
||||
var targetPos = _intermediaryTransform.GetTargetPosition_Unparented();
|
||||
var targetRot = _intermediaryTransform.GetTargetRotation_Unparented();
|
||||
if (targetPos != Vector3.zero && _intermediaryTransform.GetTargetPosition_ParentedToReference() != Vector3.zero)
|
||||
@ -206,6 +208,7 @@ namespace QSB.Syncs.TransformSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ReferenceTransform = transform;
|
||||
_intermediaryTransform.SetReferenceTransform(transform);
|
||||
}
|
||||
@ -220,6 +223,7 @@ namespace QSB.Syncs.TransformSync
|
||||
_previousDistance = distance;
|
||||
return targetPosition;
|
||||
}
|
||||
|
||||
_previousDistance = distance;
|
||||
return Vector3.SmoothDamp(currentPosition, targetPosition, ref _positionSmoothVelocity, SmoothTime);
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ namespace QSB.TimeSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var totalSeconds = Mathf.Max(TargetTime - Time.timeSinceLevelLoad, 0f);
|
||||
var minutes = Mathf.FloorToInt(totalSeconds / 60f);
|
||||
var seconds = Mathf.FloorToInt(totalSeconds) % 60;
|
||||
@ -92,6 +93,7 @@ namespace QSB.TimeSync
|
||||
text = "Waiting for server...";
|
||||
break;
|
||||
}
|
||||
|
||||
_text.text = text;
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ namespace QSB.TimeSync
|
||||
_isFirstFastForward = false;
|
||||
Init();
|
||||
}
|
||||
|
||||
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
|
||||
|
||||
GlobalMessenger.AddListener(EventNames.WakeUp, OnWakeUp);
|
||||
@ -63,6 +64,7 @@ namespace QSB.TimeSync
|
||||
{
|
||||
RespawnOnDeath.Instance.Init();
|
||||
}
|
||||
|
||||
_hasWokenUp = true;
|
||||
}
|
||||
|
||||
@ -81,6 +83,7 @@ namespace QSB.TimeSync
|
||||
{
|
||||
_hasWokenUp = true;
|
||||
}
|
||||
|
||||
Init();
|
||||
}
|
||||
else
|
||||
@ -148,6 +151,7 @@ namespace QSB.TimeSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DebugLog.DebugWrite($"START WAITING FOR SERVER LOOP", MessageType.Info);
|
||||
OWTime.SetTimeScale(0f);
|
||||
_state = State.WaitingForServerToDie;
|
||||
@ -161,6 +165,7 @@ namespace QSB.TimeSync
|
||||
TimeSyncUI.TargetTime = _serverTime;
|
||||
return;
|
||||
}
|
||||
|
||||
DebugLog.DebugWrite($"START FASTFORWARD (Target:{_serverTime} Current:{Time.timeSinceLevelLoad})", MessageType.Info);
|
||||
if (Locator.GetActiveCamera() != null)
|
||||
{
|
||||
@ -183,6 +188,7 @@ namespace QSB.TimeSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DebugLog.DebugWrite($"START PAUSING (Target:{_serverTime} Current:{Time.timeSinceLevelLoad})", MessageType.Info);
|
||||
Locator.GetActiveCamera().enabled = false;
|
||||
|
||||
@ -265,6 +271,7 @@ namespace QSB.TimeSync
|
||||
{
|
||||
Locator.GetPlayerCamera().enabled = false;
|
||||
}
|
||||
|
||||
var diff = _serverTime - Time.timeSinceLevelLoad;
|
||||
OWTime.SetTimeScale(Mathf.SmoothStep(MinFastForwardSpeed, MaxFastForwardSpeed, Mathf.Abs(diff) / MaxFastForwardDiff));
|
||||
|
||||
@ -308,11 +315,13 @@ namespace QSB.TimeSync
|
||||
DebugLog.ToConsole($"Warning - CheckTimeDifference() returned over 100 - should have switched into fast-forward!", MessageType.Warning);
|
||||
mappedTimescale = 0f;
|
||||
}
|
||||
|
||||
if (mappedTimescale < 0)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - CheckTimeDifference() returned below 0 - should have switched into pausing!", MessageType.Warning);
|
||||
mappedTimescale = 0f;
|
||||
}
|
||||
|
||||
OWTime.SetTimeScale(mappedTimescale);
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ namespace QSB.Tools
|
||||
light.GetLight().enabled = false;
|
||||
light.GetLight().shadows = LightShadows.Soft;
|
||||
}
|
||||
|
||||
FlashlightOn = false;
|
||||
}
|
||||
|
||||
@ -54,10 +55,12 @@ namespace QSB.Tools
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var light in _lights)
|
||||
{
|
||||
light.GetLight().enabled = true;
|
||||
}
|
||||
|
||||
FlashlightOn = true;
|
||||
var rotation = _root.rotation;
|
||||
_basePivot.rotation = rotation;
|
||||
@ -71,10 +74,12 @@ namespace QSB.Tools
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var light in _lights)
|
||||
{
|
||||
light.GetLight().enabled = false;
|
||||
}
|
||||
|
||||
FlashlightOn = false;
|
||||
}
|
||||
|
||||
@ -99,6 +104,7 @@ namespace QSB.Tools
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var light = _lights[1].GetLight();
|
||||
if (light.enabled)
|
||||
{
|
||||
|
@ -41,6 +41,7 @@ namespace QSB.Tools
|
||||
EquipTool();
|
||||
return;
|
||||
}
|
||||
|
||||
UnequipTool();
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ namespace QSB.TranslationSync.Events
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.EnumValue == NomaiTextType.WallText)
|
||||
{
|
||||
var obj = QSBWorldSync.GetWorldFromId<QSBWallText>(message.ObjectId);
|
||||
|
@ -22,6 +22,7 @@ namespace QSB.TranslationSync.Patches
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QSBEventManager.FireEvent(
|
||||
EventNames.QSBTextTranslated,
|
||||
NomaiTextType.WallText,
|
||||
@ -36,6 +37,7 @@ namespace QSB.TranslationSync.Patches
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QSBEventManager.FireEvent(
|
||||
EventNames.QSBTextTranslated,
|
||||
NomaiTextType.Computer,
|
||||
@ -50,6 +52,7 @@ namespace QSB.TranslationSync.Patches
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QSBEventManager.FireEvent(
|
||||
EventNames.QSBTextTranslated,
|
||||
NomaiTextType.VesselComputer,
|
||||
|
@ -18,6 +18,7 @@ namespace QSB.TranslationSync.WorldObjects
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AttachedObject.SetAsTranslated(id);
|
||||
}
|
||||
|
||||
@ -31,6 +32,7 @@ namespace QSB.TranslationSync.WorldObjects
|
||||
yield return item.GetEntryID();
|
||||
}
|
||||
}
|
||||
|
||||
var inactiveList = AttachedObject.GetValue<List<NomaiComputerRing>>("_inactiveRingList");
|
||||
foreach (var item in inactiveList)
|
||||
{
|
||||
|
@ -19,6 +19,7 @@ namespace QSB.TranslationSync.WorldObjects
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AttachedObject.SetAsTranslated(id);
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ namespace QSB.TranslationSync.WorldObjects
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AttachedObject.SetAsTranslated(id);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ namespace QSB.Utility
|
||||
DebugLog.ToConsole($"Warning - Awake() ran when _isReady is false!", OWML.Common.MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
_particleSystem = GetComponent<ParticleSystem>();
|
||||
if (_particleSystem == null)
|
||||
{
|
||||
@ -31,6 +32,7 @@ namespace QSB.Utility
|
||||
_isReady = false;
|
||||
return;
|
||||
}
|
||||
|
||||
_rotation = transform.rotation;
|
||||
_mainModule = _particleSystem.main;
|
||||
_mainModule.simulationSpace = ParticleSystemSimulationSpace.Custom;
|
||||
|
@ -30,14 +30,17 @@ namespace QSB.Utility
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Keypad7))
|
||||
{
|
||||
GoToVessel();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Keypad8))
|
||||
{
|
||||
InsertWarpCore();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Keypad9))
|
||||
{
|
||||
LoadManager.LoadSceneAsync(OWScene.EyeOfTheUniverse, true, LoadManager.FadeType.ToWhite);
|
||||
|
@ -17,6 +17,7 @@ namespace QSB.Utility
|
||||
{
|
||||
DebugLog.ToConsole("Error - Font is null!", MessageType.Error);
|
||||
}
|
||||
|
||||
_boxPrefab.GetComponent<Text>().font = font;
|
||||
_boxPrefab.GetComponent<Text>().color = Color.white;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ namespace QSB.Utility
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var data = new NotificationData(NotificationTarget.Player, message.ToUpper());
|
||||
NotificationManager.SharedInstance.PostNotification(data);
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ namespace QSB.Utility
|
||||
eventData = new EventData();
|
||||
_eventTable.Add(eventType, eventData);
|
||||
}
|
||||
|
||||
eventData.Callbacks.Add(handler);
|
||||
}
|
||||
}
|
||||
@ -48,6 +49,7 @@ namespace QSB.Utility
|
||||
{
|
||||
throw new InvalidOperationException("GlobalMessenger does not support recursive FireEvent calls to the same eventType.");
|
||||
}
|
||||
|
||||
eventData.IsInvoking = true;
|
||||
eventData.Temp.AddRange(eventData.Callbacks);
|
||||
for (var i = 0; i < eventData.Temp.Count; i++)
|
||||
@ -61,6 +63,7 @@ namespace QSB.Utility
|
||||
DebugLog.ToConsole($"Error - {exception.Message}", MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
eventData.Temp.Clear();
|
||||
eventData.IsInvoking = false;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ namespace QSB.Utility
|
||||
eventData = new EventData();
|
||||
_eventTable.Add(eventType, eventData);
|
||||
}
|
||||
|
||||
eventData.Callbacks.Add(handler);
|
||||
}
|
||||
}
|
||||
@ -48,6 +49,7 @@ namespace QSB.Utility
|
||||
{
|
||||
throw new InvalidOperationException("GlobalMessenger does not support recursive FireEvent calls to the same eventType.");
|
||||
}
|
||||
|
||||
eventData.IsInvoking = true;
|
||||
eventData.Temp.AddRange(eventData.Callbacks);
|
||||
for (var i = 0; i < eventData.Temp.Count; i++)
|
||||
@ -61,6 +63,7 @@ namespace QSB.Utility
|
||||
DebugLog.ToConsole($"Error - {exception.Message}", MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
eventData.Temp.Clear();
|
||||
eventData.IsInvoking = false;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ namespace QSB.Utility
|
||||
eventData = new EventData();
|
||||
_eventTable.Add(eventType, eventData);
|
||||
}
|
||||
|
||||
eventData.Callbacks.Add(handler);
|
||||
}
|
||||
}
|
||||
@ -48,6 +49,7 @@ namespace QSB.Utility
|
||||
{
|
||||
throw new InvalidOperationException("GlobalMessenger does not support recursive FireEvent calls to the same eventType.");
|
||||
}
|
||||
|
||||
eventData.IsInvoking = true;
|
||||
eventData.Temp.AddRange(eventData.Callbacks);
|
||||
for (var i = 0; i < eventData.Temp.Count; i++)
|
||||
@ -61,6 +63,7 @@ namespace QSB.Utility
|
||||
DebugLog.ToConsole($"Error - {exception.Message}", MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
eventData.Temp.Clear();
|
||||
eventData.IsInvoking = false;
|
||||
}
|
||||
|
@ -17,10 +17,12 @@ namespace QSB.Utility
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var repeat in Repeatings)
|
||||
{
|
||||
repeat.Invoke();
|
||||
}
|
||||
|
||||
_checkTimer = 0;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ namespace QSB.Utility
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Material materialCopy;
|
||||
if (!materialMappings.ContainsKey(material))
|
||||
{
|
||||
@ -31,6 +32,7 @@ namespace QSB.Utility
|
||||
{
|
||||
materialCopy = materialMappings[material];
|
||||
}
|
||||
|
||||
materialCopy.SetInt(shaderTestMode, (int)desiredUIComparison);
|
||||
graphic.material = materialCopy;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ namespace QSB.WorldSync
|
||||
DebugLog.ToConsole($"Warning - Tried to find {typeof(TWorldObject).Name} id {id}. Count is {GetWorldObjects<TWorldObject>().Count()}.", MessageType.Warning);
|
||||
return default;
|
||||
}
|
||||
|
||||
return GetWorldObjects<TWorldObject>().ToList()[id];
|
||||
}
|
||||
|
||||
@ -48,16 +49,19 @@ namespace QSB.WorldSync
|
||||
DebugLog.ToConsole($"Error - Trying to run GetWorldFromUnity with a null unity object! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{typeof(TUnityObject).Name}.", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
if (!QSBCore.IsInMultiplayer)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Trying to run GetWorldFromUnity while not in multiplayer!");
|
||||
return default;
|
||||
}
|
||||
|
||||
if (!WorldObjectsToUnityObjects.ContainsKey(unityObject))
|
||||
{
|
||||
DebugLog.ToConsole($"Error - WorldObjectsToUnityObjects does not contain \"{unityObject.name}\"! Called from {new StackTrace().GetFrame(1).GetMethod().Name}", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
return WorldObjectsToUnityObjects[unityObject] as TWorldObject;
|
||||
}
|
||||
|
||||
@ -73,6 +77,7 @@ namespace QSB.WorldSync
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - {(typeSubset as IWorldObject).Name} doesn't exist in list of {typeof(TTypeSubset).Name} !", MessageType.Warning);
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
@ -91,6 +96,7 @@ namespace QSB.WorldSync
|
||||
DebugLog.ToConsole($"Error - Exception in OnRemoval() for {item.GetType()}. Message : {e.InnerException.Message}, Stack trace : {e.InnerException.StackTrace}", MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
WorldObjects.RemoveAll(x => x is TWorldObject);
|
||||
}
|
||||
|
||||
@ -107,6 +113,7 @@ namespace QSB.WorldSync
|
||||
obj.Init(list[id], id);
|
||||
WorldObjectsToUnityObjects.Add(list[id], obj);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -126,6 +133,7 @@ namespace QSB.WorldSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var delegateList = multiDelegate.GetInvocationList().ToList();
|
||||
foreach (var del in delegateList)
|
||||
{
|
||||
@ -140,18 +148,21 @@ namespace QSB.WorldSync
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var qsbSlot = slotList.FirstOrDefault(x => x.AttachedObject == slot);
|
||||
if (qsbSlot == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - No QSBOrbSlot found for {slot.name}!", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var orbSync = NomaiOrbTransformSync.OrbTransformSyncs.FirstOrDefault(x => x.AttachedObject == affectingOrb.gameObject);
|
||||
if (orbSync == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - No NomaiOrbTransformSync found for {affectingOrb.name} (For slot {slot.name})!", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (orbSync.HasAuthority)
|
||||
{
|
||||
qsbSlot.HandleEvent(state, OldOrbList.IndexOf(affectingOrb));
|
||||
@ -165,6 +176,7 @@ namespace QSB.WorldSync
|
||||
DebugLog.ToConsole("Warning - Cannot write to condition dict when not server!", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
DialogueConditions[name] = state;
|
||||
}
|
||||
|
||||
@ -175,10 +187,12 @@ namespace QSB.WorldSync
|
||||
DebugLog.ToConsole("Warning - Cannot write to fact list when not server!", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ShipLogFacts.Any(x => x.Id == id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ShipLogFacts.Add(new FactReveal
|
||||
{
|
||||
Id = id,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user