Merge pull request #353 from misternebula/c#9

C# 9
This commit is contained in:
_nebula 2021-11-20 21:23:25 +00:00 committed by GitHub
commit 1a3a364906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
128 changed files with 248 additions and 337 deletions

View File

@ -19,7 +19,7 @@ namespace QSB.Anglerfish.Events
private void Handler(QSBAngler qsbAngler) => SendEvent(CreateMessage(qsbAngler)); private void Handler(QSBAngler qsbAngler) => SendEvent(CreateMessage(qsbAngler));
private AnglerChangeStateMessage CreateMessage(QSBAngler qsbAngler) => new AnglerChangeStateMessage private AnglerChangeStateMessage CreateMessage(QSBAngler qsbAngler) => new()
{ {
ObjectId = qsbAngler.ObjectId, ObjectId = qsbAngler.ObjectId,
EnumValue = qsbAngler.AttachedObject._currentState, EnumValue = qsbAngler.AttachedObject._currentState,

View File

@ -228,7 +228,7 @@ namespace QSB.Anglerfish.Patches
} }
} }
__instance._targetPos = qsbAngler.TargetTransform.position + normalized * num2; __instance._targetPos = qsbAngler.TargetTransform.position + (normalized * num2);
__instance.RotateTowardsTarget(__instance._targetPos, __instance._turnSpeed, __instance._quickTurnSpeed); __instance.RotateTowardsTarget(__instance._targetPos, __instance._turnSpeed, __instance._quickTurnSpeed);
if (__instance._turningInPlace) if (__instance._turningInPlace)
{ {
@ -287,8 +287,8 @@ namespace QSB.Anglerfish.Patches
return false; return false;
} }
if (__instance._currentState == AnglerfishController.AnglerState.Consuming if (__instance._currentState is AnglerfishController.AnglerState.Consuming
|| __instance._currentState == AnglerfishController.AnglerState.Stunned) or AnglerfishController.AnglerState.Stunned)
{ {
return false; return false;
} }
@ -311,8 +311,8 @@ namespace QSB.Anglerfish.Patches
} }
else else
{ {
if (__instance._currentState != AnglerfishController.AnglerState.Lurking if (__instance._currentState is not AnglerfishController.AnglerState.Lurking
&& __instance._currentState != AnglerfishController.AnglerState.Investigating) and not AnglerfishController.AnglerState.Investigating)
{ {
return false; return false;
} }

View File

@ -13,7 +13,7 @@ namespace QSB.Anglerfish.TransformSync
public override bool UseInterpolation => false; public override bool UseInterpolation => false;
private QSBAngler _qsbAngler; private QSBAngler _qsbAngler;
private static readonly List<AnglerTransformSync> _instances = new List<AnglerTransformSync>(); private static readonly List<AnglerTransformSync> _instances = new();
protected override OWRigidbody GetRigidbody() protected override OWRigidbody GetRigidbody()
=> _qsbAngler.AttachedObject._anglerBody; => _qsbAngler.AttachedObject._anglerBody;

View File

@ -13,7 +13,7 @@ namespace QSB.Animation.NPC.Events
private void Handler(AnimationEvent animEvent, int index) => SendEvent(CreateMessage(animEvent, index)); private void Handler(AnimationEvent animEvent, int index) => SendEvent(CreateMessage(animEvent, index));
private NpcAnimationMessage CreateMessage(AnimationEvent animEvent, int index) => new NpcAnimationMessage private NpcAnimationMessage CreateMessage(AnimationEvent animEvent, int index) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
AnimationEvent = animEvent, AnimationEvent = animEvent,

View File

@ -6,7 +6,7 @@ namespace QSB.Animation.NPC.WorldObjects
{ {
internal class QSBCharacterAnimController : NpcAnimController<CharacterAnimController> internal class QSBCharacterAnimController : NpcAnimController<CharacterAnimController>
{ {
private readonly List<PlayerInfo> _playersInHeadZone = new List<PlayerInfo>(); private readonly List<PlayerInfo> _playersInHeadZone = new();
public List<PlayerInfo> GetPlayersInHeadZone() public List<PlayerInfo> GetPlayersInHeadZone()
=> _playersInHeadZone; => _playersInHeadZone;

View File

@ -6,7 +6,7 @@ namespace QSB.Animation.NPC.WorldObjects
{ {
internal class QSBSolanumAnimController : WorldObject<SolanumAnimController> internal class QSBSolanumAnimController : WorldObject<SolanumAnimController>
{ {
private readonly List<PlayerInfo> _playersInHeadZone = new List<PlayerInfo>(); private readonly List<PlayerInfo> _playersInHeadZone = new();
public override void Init(SolanumAnimController controller, int id) public override void Init(SolanumAnimController controller, int id)
{ {

View File

@ -225,7 +225,7 @@ namespace QSB.Animation.Player
InvisibleAnimator.runtimeAnimatorController = controller; InvisibleAnimator.runtimeAnimatorController = controller;
VisibleAnimator.runtimeAnimatorController = controller; VisibleAnimator.runtimeAnimatorController = controller;
if (type != AnimationType.PlayerSuited && type != AnimationType.PlayerUnsuited) if (type is not AnimationType.PlayerSuited and not AnimationType.PlayerUnsuited)
{ {
VisibleAnimator.SetTrigger("Playing"); VisibleAnimator.SetTrigger("Playing");
InvisibleAnimator.SetTrigger("Playing"); InvisibleAnimator.SetTrigger("Playing");

View File

@ -13,7 +13,7 @@ namespace QSB.Animation.Player
private Animator _from; private Animator _from;
private Animator _to; private Animator _to;
private readonly Dictionary<string, AnimFloatParam> _floatParams = new Dictionary<string, AnimFloatParam>(); private readonly Dictionary<string, AnimFloatParam> _floatParams = new();
public void Init(Animator from, Animator to) public void Init(Animator from, Animator to)
{ {

View File

@ -12,7 +12,7 @@ namespace QSB.Animation.Player.Events
private void Handler(uint attachedNetId, string name) => SendEvent(CreateMessage(attachedNetId, name)); private void Handler(uint attachedNetId, string name) => SendEvent(CreateMessage(attachedNetId, name));
private AnimationTriggerMessage CreateMessage(uint attachedNetId, string name) => new AnimationTriggerMessage private AnimationTriggerMessage CreateMessage(uint attachedNetId, string name) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
AttachedNetId = attachedNetId, AttachedNetId = attachedNetId,

View File

@ -14,7 +14,7 @@ namespace QSB.Animation.Player.Events
private void Handler(uint player, AnimationType type) => SendEvent(CreateMessage(player, type)); private void Handler(uint player, AnimationType type) => SendEvent(CreateMessage(player, type));
private EnumMessage<AnimationType> CreateMessage(uint player, AnimationType type) => new EnumMessage<AnimationType> private EnumMessage<AnimationType> CreateMessage(uint player, AnimationType type) => new()
{ {
AboutId = player, AboutId = player,
EnumValue = type EnumValue = type

View File

@ -23,7 +23,7 @@ namespace QSB.Animation.Player.Events
private void HandleSuitUp() => SendEvent(CreateMessage(true)); private void HandleSuitUp() => SendEvent(CreateMessage(true));
private void HandleSuitDown() => SendEvent(CreateMessage(false)); private void HandleSuitDown() => SendEvent(CreateMessage(false));
private ToggleMessage CreateMessage(bool value) => new ToggleMessage private ToggleMessage CreateMessage(bool value) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ToggleValue = value ToggleValue = value

View File

@ -8,7 +8,7 @@ namespace QSB.Animation.Player.Thrusters
private Thruster _thruster; private Thruster _thruster;
private Light _light; private Light _light;
private AnimationCurve _scaleByThrust = AnimationCurve.Linear(0f, 0f, 1f, 1f); private AnimationCurve _scaleByThrust = AnimationCurve.Linear(0f, 0f, 1f, 1f);
private DampedSpring _scaleSpring = new DampedSpring(); private DampedSpring _scaleSpring = new();
private float _belowMaxThrustScalar = 1f; private float _belowMaxThrustScalar = 1f;
private MeshRenderer _thrusterRenderer; private MeshRenderer _thrusterRenderer;
private Vector3 _thrusterFilter; private Vector3 _thrusterFilter;

View File

@ -47,23 +47,12 @@ namespace QSB.Animation.Player.Thrusters
var gameObject = controller.gameObject; var gameObject = controller.gameObject;
var oldThruster = controller.GetValue<Thruster>("_thruster"); var oldThruster = controller.GetValue<Thruster>("_thruster");
var oldLight = controller.GetValue<Light>("_light"); var oldLight = controller.GetValue<Light>("_light");
var localPos = oldThruster switch
// pain
Vector3 localPos;
switch (oldThruster)
{ {
case Thruster.Up_RightThruster: Thruster.Up_RightThruster or Thruster.Up_LeftThruster => new Vector3(0, 0, 3),
case Thruster.Up_LeftThruster: Thruster.Down_RightThruster or Thruster.Down_LeftThruster => new Vector3(0, 0, 7),
localPos = new Vector3(0, 0, 3); _ => new Vector3(0, 0, 5),
break; };
case Thruster.Down_RightThruster:
case Thruster.Down_LeftThruster:
localPos = new Vector3(0, 0, 7);
break;
default:
localPos = new Vector3(0, 0, 5);
break;
}
oldLight.transform.localPosition = localPos; oldLight.transform.localPosition = localPos;
var oldAnimCurve = controller.GetValue<AnimationCurve>("_scaleByThrust"); var oldAnimCurve = controller.GetValue<AnimationCurve>("_scaleByThrust");

View File

@ -14,7 +14,7 @@ namespace QSB.CampfireSync.Events
private void Handler(int objId, Campfire.State state) => SendEvent(CreateMessage(objId, state)); private void Handler(int objId, Campfire.State state) => SendEvent(CreateMessage(objId, state));
private EnumWorldObjectMessage<Campfire.State> CreateMessage(int objId, Campfire.State state) => new EnumWorldObjectMessage<Campfire.State> private EnumWorldObjectMessage<Campfire.State> CreateMessage(int objId, Campfire.State state) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ObjectId = objId, ObjectId = objId,

View File

@ -17,7 +17,7 @@ namespace QSB.ClientServerStateSync.Events
private void Handler(ClientState state) => SendEvent(CreateMessage(state)); private void Handler(ClientState state) => SendEvent(CreateMessage(state));
private EnumMessage<ClientState> CreateMessage(ClientState state) => new EnumMessage<ClientState> private EnumMessage<ClientState> CreateMessage(ClientState state) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
EnumValue = state EnumValue = state

View File

@ -15,7 +15,7 @@ namespace QSB.ClientServerStateSync.Events
private void Handler(ServerState state) => SendEvent(CreateMessage(state)); private void Handler(ServerState state) => SendEvent(CreateMessage(state));
private EnumMessage<ServerState> CreateMessage(ServerState state) => new EnumMessage<ServerState> private EnumMessage<ServerState> CreateMessage(ServerState state) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
EnumValue = state EnumValue = state

View File

@ -133,9 +133,9 @@ namespace QSB.ClientServerStateSync
if (_currentState == ServerState.WaitingForAllPlayersToReady) if (_currentState == ServerState.WaitingForAllPlayersToReady)
{ {
if (QSBPlayerManager.PlayerList.All(x if (QSBPlayerManager.PlayerList.All(x
=> x.State == ClientState.WaitingForOthersToReadyInSolarSystem => x.State is ClientState.WaitingForOthersToReadyInSolarSystem
|| x.State == ClientState.AliveInSolarSystem or ClientState.AliveInSolarSystem
|| x.State == ClientState.AliveInEye)) or ClientState.AliveInEye))
{ {
DebugLog.DebugWrite($"All ready!!"); DebugLog.DebugWrite($"All ready!!");
QSBEventManager.FireEvent(EventNames.QSBStartLoop); QSBEventManager.FireEvent(EventNames.QSBStartLoop);

View File

@ -14,7 +14,7 @@ namespace QSB.ConversationSync.Events
private void Handler(uint id, string message, ConversationType type) => SendEvent(CreateMessage(id, message, type)); private void Handler(uint id, string message, ConversationType type) => SendEvent(CreateMessage(id, message, type));
private ConversationMessage CreateMessage(uint id, string message, ConversationType type) => new ConversationMessage private ConversationMessage CreateMessage(uint id, string message, ConversationType type) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ObjectId = (int)id, ObjectId = (int)id,

View File

@ -15,7 +15,7 @@ namespace QSB.ConversationSync.Events
private void Handler(int objId, uint playerId, bool state) => SendEvent(CreateMessage(objId, playerId, state)); private void Handler(int objId, uint playerId, bool state) => SendEvent(CreateMessage(objId, playerId, state));
private ConversationStartEndMessage CreateMessage(int objId, uint playerId, bool state) => new ConversationStartEndMessage private ConversationStartEndMessage CreateMessage(int objId, uint playerId, bool state) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
TreeId = objId, TreeId = objId,

View File

@ -12,7 +12,7 @@ namespace QSB.ConversationSync.Events
private void Handler(string name, bool state) => SendEvent(CreateMessage(name, state)); private void Handler(string name, bool state) => SendEvent(CreateMessage(name, state));
private DialogueConditionMessage CreateMessage(string name, bool state) => new DialogueConditionMessage private DialogueConditionMessage CreateMessage(string name, bool state) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ConditionName = name, ConditionName = name,

View File

@ -15,7 +15,7 @@ namespace QSB.DeathSync.Events
private void Handler(EndLoopReason type) => SendEvent(CreateMessage(type)); private void Handler(EndLoopReason type) => SendEvent(CreateMessage(type));
private EnumMessage<EndLoopReason> CreateMessage(EndLoopReason type) => new EnumMessage<EndLoopReason> private EnumMessage<EndLoopReason> CreateMessage(EndLoopReason type) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
EnumValue = type EnumValue = type

View File

@ -15,7 +15,7 @@ namespace QSB.DeathSync.Events
private void Handler(DeathType type) => SendEvent(CreateMessage(type)); private void Handler(DeathType type) => SendEvent(CreateMessage(type));
private PlayerDeathMessage CreateMessage(DeathType type) => new PlayerDeathMessage private PlayerDeathMessage CreateMessage(DeathType type) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
EnumValue = type, EnumValue = type,

View File

@ -14,7 +14,7 @@ namespace QSB.DeathSync.Events
private void Handler() => SendEvent(CreateMessage()); private void Handler() => SendEvent(CreateMessage());
private PlayerMessage CreateMessage() => new PlayerMessage private PlayerMessage CreateMessage() => new()
{ {
AboutId = LocalPlayerId AboutId = LocalPlayerId
}; };

View File

@ -5,7 +5,7 @@ namespace QSB.DeathSync
{ {
public static class Necronomicon public static class Necronomicon
{ {
private static readonly Dictionary<DeathType, string[]> Darkhold = new Dictionary<DeathType, string[]> private static readonly Dictionary<DeathType, string[]> Darkhold = new()
{ {
{ DeathType.Default, new[] // Running out of health { DeathType.Default, new[] // Running out of health
{ {

View File

@ -14,7 +14,7 @@ namespace QSB.ElevatorSync.Events
private void Handler(int id, bool isGoingUp) => SendEvent(CreateMessage(id, isGoingUp)); private void Handler(int id, bool isGoingUp) => SendEvent(CreateMessage(id, isGoingUp));
private BoolWorldObjectMessage CreateMessage(int id, bool isGoingUp) => new BoolWorldObjectMessage private BoolWorldObjectMessage CreateMessage(int id, bool isGoingUp) => new()
{ {
State = isGoingUp, State = isGoingUp,
ObjectId = id ObjectId = id

View File

@ -39,7 +39,7 @@ namespace QSB.Events
{ {
public static bool Ready { get; private set; } public static bool Ready { get; private set; }
private static List<IQSBEvent> _eventList = new List<IQSBEvent>(); private static List<IQSBEvent> _eventList = new();
public static void Init() public static void Init()
{ {

View File

@ -13,7 +13,7 @@ namespace QSB.FrequencySync.Events
private void Handler(SignalFrequency frequency) => SendEvent(CreateMessage(frequency)); private void Handler(SignalFrequency frequency) => SendEvent(CreateMessage(frequency));
private EnumMessage<SignalFrequency> CreateMessage(SignalFrequency frequency) => new EnumMessage<SignalFrequency> private EnumMessage<SignalFrequency> CreateMessage(SignalFrequency frequency) => new()
{ {
AboutId = QSBPlayerManager.LocalPlayerId, AboutId = QSBPlayerManager.LocalPlayerId,
EnumValue = frequency EnumValue = frequency

View File

@ -13,7 +13,7 @@ namespace QSB.FrequencySync.Events
private void Handler(SignalName name) => SendEvent(CreateMessage(name)); private void Handler(SignalName name) => SendEvent(CreateMessage(name));
private EnumMessage<SignalName> CreateMessage(SignalName name) => new EnumMessage<SignalName> private EnumMessage<SignalName> CreateMessage(SignalName name) => new()
{ {
AboutId = QSBPlayerManager.LocalPlayerId, AboutId = QSBPlayerManager.LocalPlayerId,
EnumValue = name EnumValue = name

View File

@ -14,7 +14,7 @@ namespace QSB.GeyserSync.Events
private void Handler(int id, bool state) => SendEvent(CreateMessage(id, state)); private void Handler(int id, bool state) => SendEvent(CreateMessage(id, state));
private BoolWorldObjectMessage CreateMessage(int id, bool state) => new BoolWorldObjectMessage private BoolWorldObjectMessage CreateMessage(int id, bool state) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ObjectId = id, ObjectId = id,

View File

@ -20,7 +20,7 @@ namespace QSB.ItemSync.Events
private void Handler(int objectId, Vector3 position, Vector3 normal, Sector sector) private void Handler(int objectId, Vector3 position, Vector3 normal, Sector sector)
=> SendEvent(CreateMessage(objectId, position, normal, sector)); => SendEvent(CreateMessage(objectId, position, normal, sector));
private DropItemMessage CreateMessage(int objectId, Vector3 position, Vector3 normal, Sector sector) => new DropItemMessage private DropItemMessage CreateMessage(int objectId, Vector3 position, Vector3 normal, Sector sector) => new()
{ {
ObjectId = objectId, ObjectId = objectId,
Position = position, Position = position,

View File

@ -20,7 +20,7 @@ namespace QSB.ItemSync.Events
private void Handler(int itemId) private void Handler(int itemId)
=> SendEvent(CreateMessage(itemId)); => SendEvent(CreateMessage(itemId));
private WorldObjectMessage CreateMessage(int itemid) => new WorldObjectMessage private WorldObjectMessage CreateMessage(int itemid) => new()
{ {
AboutId = QSBPlayerManager.LocalPlayerId, AboutId = QSBPlayerManager.LocalPlayerId,
ObjectId = itemid ObjectId = itemid
@ -33,39 +33,19 @@ namespace QSB.ItemSync.Events
var itemType = itemObject.GetItemType(); var itemType = itemObject.GetItemType();
player.HeldItem = itemObject; player.HeldItem = itemObject;
var itemSocket = itemType switch
Transform itemSocket = null;
switch (itemType)
{ {
case ItemType.Scroll: ItemType.Scroll => player.ScrollSocket,
itemSocket = player.ScrollSocket; ItemType.SharedStone => player.SharedStoneSocket,
break; ItemType.WarpCore => ((QSBWarpCoreItem)itemObject).IsVesselCoreType()
case ItemType.SharedStone: ? player.VesselCoreSocket
itemSocket = player.SharedStoneSocket; : player.WarpCoreSocket,
break; ItemType.Lantern => player.SimpleLanternSocket,
case ItemType.WarpCore: ItemType.DreamLantern => player.DreamLanternSocket,
itemSocket = ((QSBWarpCoreItem)itemObject).IsVesselCoreType() ItemType.SlideReel => player.SlideReelSocket,
? player.VesselCoreSocket ItemType.VisionTorch => player.VisionTorchSocket,
: player.WarpCoreSocket; _ => player.ItemSocket,
break; };
case ItemType.Lantern:
itemSocket = player.SimpleLanternSocket;
break;
case ItemType.DreamLantern:
itemSocket = player.DreamLanternSocket;
break;
case ItemType.SlideReel:
itemSocket = player.SlideReelSocket;
break;
case ItemType.VisionTorch:
itemSocket = player.VisionTorchSocket;
break;
default:
itemSocket = player.ItemSocket;
break;
}
itemObject.PickUpItem(itemSocket, message.AboutId); itemObject.PickUpItem(itemSocket, message.AboutId);
} }
} }

View File

@ -20,7 +20,7 @@ namespace QSB.ItemSync.Events
private void Handler(int socketId, int itemId, SocketEventType type) private void Handler(int socketId, int itemId, SocketEventType type)
=> SendEvent(CreateMessage(socketId, itemId, type)); => SendEvent(CreateMessage(socketId, itemId, type));
private SocketItemMessage CreateMessage(int socketId, int itemId, SocketEventType type) => new SocketItemMessage private SocketItemMessage CreateMessage(int socketId, int itemId, SocketEventType type) => new()
{ {
AboutId = QSBPlayerManager.LocalPlayerId, AboutId = QSBPlayerManager.LocalPlayerId,
SocketId = socketId, SocketId = socketId,

View File

@ -12,7 +12,7 @@ namespace QSB.LogSync.Events
private void Handler(string id, bool saveGame, bool showNotification) => SendEvent(CreateMessage(id, saveGame, showNotification)); private void Handler(string id, bool saveGame, bool showNotification) => SendEvent(CreateMessage(id, saveGame, showNotification));
private RevealFactMessage CreateMessage(string id, bool saveGame, bool showNotification) => new RevealFactMessage private RevealFactMessage CreateMessage(string id, bool saveGame, bool showNotification) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
FactId = id, FactId = id,

View File

@ -196,26 +196,14 @@ namespace QSB.Menus
public void OnKicked(KickReason reason) public void OnKicked(KickReason reason)
{ {
string text; var text = reason switch
switch (reason)
{ {
case KickReason.QSBVersionNotMatching: KickReason.QSBVersionNotMatching => "Server refused connection as QSB version does not match.",
text = "Server refused connection as QSB version does not match."; KickReason.GameVersionNotMatching => "Server refused connection as Outer Wilds version does not match.",
break; KickReason.GamePlatformNotMatching => "Server refused connection as Outer Wilds platform does not match. (Steam/Epic)",
case KickReason.GameVersionNotMatching: KickReason.None => "Kicked from server. No reason given.",
text = "Server refused connection as Outer Wilds version does not match."; _ => $"Kicked from server. KickReason:{reason}",
break; };
case KickReason.GamePlatformNotMatching:
text = "Server refused connection as Outer Wilds platform does not match. (Steam/Epic)";
break;
case KickReason.None:
text = "Kicked from server. No reason given.";
break;
default:
text = $"Kicked from server. KickReason:{reason}";
break;
}
OpenInfoPopup(text, "OK"); OpenInfoPopup(text, "OK");
DisconnectButton.gameObject.SetActive(false); DisconnectButton.gameObject.SetActive(false);
@ -230,17 +218,11 @@ namespace QSB.Menus
return; return;
} }
string text; var text = error switch
switch (error)
{ {
case NetworkError.Timeout: NetworkError.Timeout => "Client disconnected with error!\r\nConnection timed out.",
text = "Client disconnected with error!\r\nConnection timed out."; _ => $"Client disconnected with error!\r\nNetworkError:{error}",
break; };
default:
text = $"Client disconnected with error!\r\nNetworkError:{error}";
break;
}
OpenInfoPopup(text, "OK"); OpenInfoPopup(text, "OK");
DisconnectButton.gameObject.SetActive(false); DisconnectButton.gameObject.SetActive(false);

View File

@ -17,7 +17,7 @@ namespace QSB.MeteorSync.Events
private void Handler(QSBFragment qsbFragment, float damage) => private void Handler(QSBFragment qsbFragment, float damage) =>
SendEvent(CreateMessage(qsbFragment, damage)); SendEvent(CreateMessage(qsbFragment, damage));
private FragmentDamageMessage CreateMessage(QSBFragment qsbFragment, float damage) => new FragmentDamageMessage private FragmentDamageMessage CreateMessage(QSBFragment qsbFragment, float damage) => new()
{ {
ObjectId = qsbFragment.ObjectId, ObjectId = qsbFragment.ObjectId,
Damage = damage Damage = damage

View File

@ -73,11 +73,11 @@ namespace QSB.MeteorSync.Events
var whiteHoleVolume = MeteorManager.WhiteHoleVolume; var whiteHoleVolume = MeteorManager.WhiteHoleVolume;
var attachedFluidDetector = body.GetAttachedFluidDetector(); var attachedFluidDetector = body.GetAttachedFluidDetector();
var attachedForceDetector = body.GetAttachedForceDetector(); var attachedForceDetector = body.GetAttachedForceDetector();
if (attachedFluidDetector != null && attachedFluidDetector is ConstantFluidDetector constantFluidDetector) if (attachedFluidDetector is not null and ConstantFluidDetector constantFluidDetector)
{ {
constantFluidDetector.SetDetectableFluid(whiteHoleVolume._fluidVolume); constantFluidDetector.SetDetectableFluid(whiteHoleVolume._fluidVolume);
} }
if (attachedForceDetector != null && attachedForceDetector is ConstantForceDetector constantForceDetector) if (attachedForceDetector is not null and ConstantForceDetector constantForceDetector)
{ {
constantForceDetector.ClearAllFields(); constantForceDetector.ClearAllFields();
} }

View File

@ -17,7 +17,7 @@ namespace QSB.MeteorSync.Events
private void Handler(QSBMeteorLauncher qsbMeteorLauncher) => private void Handler(QSBMeteorLauncher qsbMeteorLauncher) =>
SendEvent(CreateMessage(qsbMeteorLauncher)); SendEvent(CreateMessage(qsbMeteorLauncher));
private MeteorLaunchMessage CreateMessage(QSBMeteorLauncher qsbMeteorLauncher) => new MeteorLaunchMessage private MeteorLaunchMessage CreateMessage(QSBMeteorLauncher qsbMeteorLauncher) => new()
{ {
ObjectId = qsbMeteorLauncher.ObjectId, ObjectId = qsbMeteorLauncher.ObjectId,
MeteorId = qsbMeteorLauncher.MeteorId, MeteorId = qsbMeteorLauncher.MeteorId,

View File

@ -17,7 +17,7 @@ namespace QSB.MeteorSync.Events
private void Handler(QSBMeteorLauncher qsbMeteorLauncher) => SendEvent(CreateMessage(qsbMeteorLauncher)); private void Handler(QSBMeteorLauncher qsbMeteorLauncher) => SendEvent(CreateMessage(qsbMeteorLauncher));
private WorldObjectMessage CreateMessage(QSBMeteorLauncher qsbMeteorLauncher) => new WorldObjectMessage private WorldObjectMessage CreateMessage(QSBMeteorLauncher qsbMeteorLauncher) => new()
{ {
ObjectId = qsbMeteorLauncher.ObjectId ObjectId = qsbMeteorLauncher.ObjectId
}; };

View File

@ -17,7 +17,7 @@ namespace QSB.MeteorSync.Events
private void Handler(QSBMeteor qsbMeteor) => SendEvent(CreateMessage(qsbMeteor)); private void Handler(QSBMeteor qsbMeteor) => SendEvent(CreateMessage(qsbMeteor));
private WorldObjectMessage CreateMessage(QSBMeteor qsbMeteor) => new WorldObjectMessage private WorldObjectMessage CreateMessage(QSBMeteor qsbMeteor) => new()
{ {
ObjectId = qsbMeteor.ObjectId ObjectId = qsbMeteor.ObjectId
}; };

View File

@ -52,7 +52,7 @@ namespace QSB.MeteorSync.Patches
} }
if (meteorController != null) if (meteorController != null)
{ {
var linearVelocity = __instance._parentBody.GetPointVelocity(__instance.transform.position) + __instance.transform.TransformDirection(__instance._launchDirection) * qsbMeteorLauncher.LaunchSpeed; var linearVelocity = __instance._parentBody.GetPointVelocity(__instance.transform.position) + (__instance.transform.TransformDirection(__instance._launchDirection) * qsbMeteorLauncher.LaunchSpeed);
var angularVelocity = __instance.transform.forward * 2f; var angularVelocity = __instance.transform.forward * 2f;
meteorController.Launch(null, __instance.transform.position, __instance.transform.rotation, linearVelocity, angularVelocity); meteorController.Launch(null, __instance.transform.position, __instance.transform.rotation, linearVelocity, angularVelocity);
if (__instance._audioSector.ContainsOccupant(DynamicOccupant.Player)) if (__instance._audioSector.ContainsOccupant(DynamicOccupant.Player))
@ -134,7 +134,7 @@ namespace QSB.MeteorSync.Patches
{ {
var vector = __instance._attachedBody.GetPosition() - __instance._anchorBody.GetPosition(); var vector = __instance._attachedBody.GetPosition() - __instance._anchorBody.GetPosition();
var d = Mathf.Min(distance, qsbFragment.LeashLength - vector.magnitude); var d = Mathf.Min(distance, qsbFragment.LeashLength - vector.magnitude);
__instance._attachedBody.SetPosition(__instance._anchorBody.GetPosition() + vector.normalized * d); __instance._attachedBody.SetPosition(__instance._anchorBody.GetPosition() + (vector.normalized * d));
} }
return false; return false;

View File

@ -118,7 +118,7 @@ namespace QSB.MeteorSync.Patches
qsbMeteorLauncher.MeteorId = qsbMeteor.ObjectId; qsbMeteorLauncher.MeteorId = qsbMeteor.ObjectId;
qsbMeteorLauncher.LaunchSpeed = Random.Range(__instance._minLaunchSpeed, __instance._maxLaunchSpeed); qsbMeteorLauncher.LaunchSpeed = Random.Range(__instance._minLaunchSpeed, __instance._maxLaunchSpeed);
var linearVelocity = __instance._parentBody.GetPointVelocity(__instance.transform.position) + __instance.transform.TransformDirection(__instance._launchDirection) * qsbMeteorLauncher.LaunchSpeed; var linearVelocity = __instance._parentBody.GetPointVelocity(__instance.transform.position) + (__instance.transform.TransformDirection(__instance._launchDirection) * qsbMeteorLauncher.LaunchSpeed);
var angularVelocity = __instance.transform.forward * 2f; var angularVelocity = __instance.transform.forward * 2f;
meteorController.Launch(null, __instance.transform.position, __instance.transform.rotation, linearVelocity, angularVelocity); meteorController.Launch(null, __instance.transform.position, __instance.transform.rotation, linearVelocity, angularVelocity);
if (__instance._audioSector.ContainsOccupant(DynamicOccupant.Player)) if (__instance._audioSector.ContainsOccupant(DynamicOccupant.Player))
@ -184,7 +184,7 @@ namespace QSB.MeteorSync.Patches
{ {
var vector = __instance._attachedBody.GetPosition() - __instance._anchorBody.GetPosition(); var vector = __instance._attachedBody.GetPosition() - __instance._anchorBody.GetPosition();
var d = Mathf.Min(distance, qsbFragment.LeashLength - vector.magnitude); var d = Mathf.Min(distance, qsbFragment.LeashLength - vector.magnitude);
__instance._attachedBody.SetPosition(__instance._anchorBody.GetPosition() + vector.normalized * d); __instance._attachedBody.SetPosition(__instance._anchorBody.GetPosition() + (vector.normalized * d));
} }
return false; return false;

View File

@ -36,8 +36,6 @@ namespace QSB.MeteorSync.WorldObjects
public float LeashLength; public float LeashLength;
public void AddDamage(float damage) public void AddDamage(float damage)
{ => AttachedObject.AddDamage(damage);
AttachedObject.AddDamage(damage);
}
} }
} }

View File

@ -13,7 +13,7 @@ namespace QSB.OrbSync.Events
private void Handler(int slotId, int orbId, bool slotState) => SendEvent(CreateMessage(slotId, orbId, slotState)); private void Handler(int slotId, int orbId, bool slotState) => SendEvent(CreateMessage(slotId, orbId, slotState));
private OrbSlotMessage CreateMessage(int slotId, int orbId, bool slotState) => new OrbSlotMessage private OrbSlotMessage CreateMessage(int slotId, int orbId, bool slotState) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
SlotId = slotId, SlotId = slotId,

View File

@ -19,7 +19,7 @@ namespace QSB.OrbSync.Events
private void Handler(int id) => SendEvent(CreateMessage(id)); private void Handler(int id) => SendEvent(CreateMessage(id));
private WorldObjectMessage CreateMessage(int id) => new WorldObjectMessage private WorldObjectMessage CreateMessage(int id) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ObjectId = id ObjectId = id

View File

@ -12,7 +12,7 @@ namespace QSB.OrbSync
{ {
public class OrbManager : WorldObjectManager public class OrbManager : WorldObjectManager
{ {
private List<GameObject> _orbs = new List<GameObject>(); private List<GameObject> _orbs = new();
protected override void RebuildWorldObjects(OWScene scene) protected override void RebuildWorldObjects(OWScene scene)
{ {

View File

@ -9,7 +9,7 @@ namespace QSB.OrbSync.TransformSync
{ {
internal class NomaiOrbTransformSync : UnsectoredTransformSync internal class NomaiOrbTransformSync : UnsectoredTransformSync
{ {
public static List<NomaiOrbTransformSync> OrbTransformSyncs = new List<NomaiOrbTransformSync>(); public static List<NomaiOrbTransformSync> OrbTransformSyncs = new();
private int _index => OrbTransformSyncs.IndexOf(this); private int _index => OrbTransformSyncs.IndexOf(this);

View File

@ -37,10 +37,10 @@ namespace QSB.Patches
public static event Action<QSBPatchTypes> OnPatchType; public static event Action<QSBPatchTypes> OnPatchType;
public static event Action<QSBPatchTypes> OnUnpatchType; public static event Action<QSBPatchTypes> OnUnpatchType;
private static List<QSBPatch> _patchList = new List<QSBPatch>(); private static List<QSBPatch> _patchList = new();
private static List<QSBPatchTypes> _patchedTypes = new List<QSBPatchTypes>(); private static List<QSBPatchTypes> _patchedTypes = new();
public static Dictionary<QSBPatchTypes, Harmony> TypeToInstance = new Dictionary<QSBPatchTypes, Harmony>(); public static Dictionary<QSBPatchTypes, Harmony> TypeToInstance = new();
public static void Init() public static void Init()
{ {

View File

@ -44,7 +44,7 @@ namespace QSB.Player.Events
private void Handler(EnterLeaveType type, int objectId = -1) => SendEvent(CreateMessage(type, objectId)); private void Handler(EnterLeaveType type, int objectId = -1) => SendEvent(CreateMessage(type, objectId));
private EnumWorldObjectMessage<EnterLeaveType> CreateMessage(EnterLeaveType type, int objectId) => new EnumWorldObjectMessage<EnterLeaveType> private EnumWorldObjectMessage<EnterLeaveType> CreateMessage(EnterLeaveType type, int objectId) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
EnumValue = type, EnumValue = type,

View File

@ -14,7 +14,7 @@ namespace QSB.Player.Events
private void Handler(int id) => SendEvent(CreateMessage(id)); private void Handler(int id) => SendEvent(CreateMessage(id));
private WorldObjectMessage CreateMessage(int id) => new WorldObjectMessage private WorldObjectMessage CreateMessage(int id) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ObjectId = id ObjectId = id

View File

@ -13,7 +13,7 @@ namespace QSB.Player.Events
private void Handler() => SendEvent(CreateMessage(QSBPlayerManager.LocalPlayer)); private void Handler() => SendEvent(CreateMessage(QSBPlayerManager.LocalPlayer));
private PlayerInformationMessage CreateMessage(PlayerInfo player) => new PlayerInformationMessage private PlayerInformationMessage CreateMessage(PlayerInfo player) => new()
{ {
AboutId = player.PlayerId, AboutId = player.PlayerId,
PlayerName = player.Name, PlayerName = player.Name,

View File

@ -13,7 +13,7 @@ namespace QSB.Player.Events
private void Handler(string name) => SendEvent(CreateMessage(name)); private void Handler(string name) => SendEvent(CreateMessage(name));
private PlayerJoinMessage CreateMessage(string name) => new PlayerJoinMessage private PlayerJoinMessage CreateMessage(string name) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
PlayerName = name, PlayerName = name,

View File

@ -16,7 +16,7 @@ namespace QSB.Player.Events
private void Handler(uint player, KickReason reason) => SendEvent(CreateMessage(player, reason)); private void Handler(uint player, KickReason reason) => SendEvent(CreateMessage(player, reason));
private EnumMessage<KickReason> CreateMessage(uint player, KickReason reason) => new EnumMessage<KickReason> private EnumMessage<KickReason> CreateMessage(uint player, KickReason reason) => new()
{ {
AboutId = player, AboutId = player,
EnumValue = reason EnumValue = reason

View File

@ -14,7 +14,7 @@ namespace QSB.Player.Events
private void Handler(bool ready) => SendEvent(CreateMessage(ready)); private void Handler(bool ready) => SendEvent(CreateMessage(ready));
private ToggleMessage CreateMessage(bool ready) => new ToggleMessage private ToggleMessage CreateMessage(bool ready) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ToggleValue = ready ToggleValue = ready

View File

@ -23,7 +23,7 @@ namespace QSB.Player.Events
private void Handler() => SendEvent(CreateMessage()); private void Handler() => SendEvent(CreateMessage());
private PlayerMessage CreateMessage() => new PlayerMessage private PlayerMessage CreateMessage() => new()
{ {
AboutId = LocalPlayerId AboutId = LocalPlayerId
}; };

View File

@ -56,6 +56,7 @@ namespace QSB.Player
{ {
DebugLog.ToConsole($"Warning - {PlayerId}.Body is null!", MessageType.Warning); DebugLog.ToConsole($"Warning - {PlayerId}.Body is null!", MessageType.Warning);
} }
return _body; return _body;
} }
set set
@ -64,6 +65,7 @@ namespace QSB.Player
{ {
DebugLog.ToConsole($"Warning - Setting {PlayerId}.Body to null.", MessageType.Warning); DebugLog.ToConsole($"Warning - Setting {PlayerId}.Body to null.", MessageType.Warning);
} }
_body = value; _body = value;
} }
} }
@ -75,18 +77,7 @@ namespace QSB.Player
// Tools // Tools
public GameObject ProbeBody { get; set; } public GameObject ProbeBody { get; set; }
public QSBProbe Probe { get; set; } public QSBProbe Probe { get; set; }
public QSBFlashlight FlashLight public QSBFlashlight FlashLight => CameraBody?.GetComponentInChildren<QSBFlashlight>();
{
get
{
if (CameraBody == null)
{
return null;
}
return CameraBody.GetComponentInChildren<QSBFlashlight>();
}
}
public QSBTool Signalscope => GetToolByType(ToolType.Signalscope); public QSBTool Signalscope => GetToolByType(ToolType.Signalscope);
public QSBTool Translator => GetToolByType(ToolType.Translator); public QSBTool Translator => GetToolByType(ToolType.Translator);
public QSBProbeLauncherTool ProbeLauncher => (QSBProbeLauncherTool)GetToolByType(ToolType.ProbeLauncher); public QSBProbeLauncherTool ProbeLauncher => (QSBProbeLauncherTool)GetToolByType(ToolType.ProbeLauncher);
@ -109,8 +100,8 @@ namespace QSB.Player
// Animation // Animation
public AnimationSync AnimationSync => QSBPlayerManager.GetSyncObject<AnimationSync>(PlayerId); public AnimationSync AnimationSync => QSBPlayerManager.GetSyncObject<AnimationSync>(PlayerId);
public bool PlayingInstrument => AnimationSync.CurrentType != AnimationType.PlayerSuited public bool PlayingInstrument => AnimationSync.CurrentType is not AnimationType.PlayerSuited
&& AnimationSync.CurrentType != AnimationType.PlayerUnsuited; and not AnimationType.PlayerUnsuited;
public JetpackAccelerationSync JetpackAcceleration { get; set; } public JetpackAccelerationSync JetpackAcceleration { get; set; }
// Misc // Misc

View File

@ -41,11 +41,11 @@ namespace QSB.Player
public static PlayerInfo LocalPlayer => GetPlayer(LocalPlayerId); public static PlayerInfo LocalPlayer => GetPlayer(LocalPlayerId);
public static List<PlayerInfo> PlayerList { get; } = new List<PlayerInfo>(); public static List<PlayerInfo> PlayerList { get; } = new List<PlayerInfo>();
private static readonly List<PlayerSyncObject> PlayerSyncObjects = new List<PlayerSyncObject>(); private static readonly List<PlayerSyncObject> PlayerSyncObjects = new();
public static PlayerInfo GetPlayer(uint id) public static PlayerInfo GetPlayer(uint id)
{ {
if (id == uint.MaxValue || id == 0U) if (id is uint.MaxValue or 0U)
{ {
return default; return default;
} }
@ -129,7 +129,7 @@ namespace QSB.Player
} }
public static Tuple<Flashlight, IEnumerable<QSBFlashlight>> GetPlayerFlashlights() public static Tuple<Flashlight, IEnumerable<QSBFlashlight>> GetPlayerFlashlights()
=> new Tuple<Flashlight, IEnumerable<QSBFlashlight>>(Locator.GetFlashlight(), PlayerList.Where(x => x.FlashLight != null).Select(x => x.FlashLight)); => new(Locator.GetFlashlight(), PlayerList.Where(x => x.FlashLight != null).Select(x => x.FlashLight));
public static void ShowAllPlayers() public static void ShowAllPlayers()
=> PlayerList.Where(x => x != LocalPlayer).ToList().ForEach(x => ChangePlayerVisibility(x.PlayerId, true)); => PlayerList.Where(x => x != LocalPlayer).ToList().ForEach(x => ChangePlayerVisibility(x.PlayerId, true));

View File

@ -55,7 +55,7 @@ namespace QSB.PoolSync
private bool _anyoneStillOnPlatform; private bool _anyoneStillOnPlatform;
private bool _wasLocalInBounds; private bool _wasLocalInBounds;
private CameraState _cameraState; private CameraState _cameraState;
private readonly Dictionary<PlayerInfo, GameObject> _playerToHologram = new Dictionary<PlayerInfo, GameObject>(); private readonly Dictionary<PlayerInfo, GameObject> _playerToHologram = new();
private void Awake() private void Awake()
{ {
@ -129,7 +129,7 @@ namespace QSB.PoolSync
CustomPlatformList.Remove(this); CustomPlatformList.Remove(this);
} }
if (_cameraState == CameraState.Connected || _cameraState == CameraState.Connecting_FadeIn || _cameraState == CameraState.Connecting_FadeOut) if (_cameraState is CameraState.Connected or CameraState.Connecting_FadeIn or CameraState.Connecting_FadeOut)
{ {
DisconnectCamera(); DisconnectCamera();
SwitchToPlayerCamera(); SwitchToPlayerCamera();
@ -231,7 +231,7 @@ namespace QSB.PoolSync
_slavePlatform.UpdatePoolRenderer(); _slavePlatform.UpdatePoolRenderer();
if (_slavePlatform._transitionFade == 1f) if (_slavePlatform._transitionFade == 1f)
{ {
_slavePlatform._poolT = ((!(_slavePlatform._sharedStone == null)) ? 1f : 0f); _slavePlatform._poolT = (!(_slavePlatform._sharedStone == null)) ? 1f : 0f;
_slavePlatform._showPlayerRipples = false; _slavePlatform._showPlayerRipples = false;
_slavePlatform._activePlayerHolo = null; _slavePlatform._activePlayerHolo = null;
_slavePlatform.UpdatePoolRenderer(); _slavePlatform.UpdatePoolRenderer();
@ -550,7 +550,7 @@ namespace QSB.PoolSync
} }
var cameraState = _cameraState; var cameraState = _cameraState;
if (cameraState != CameraState.Disconnected && cameraState != CameraState.Disconnecting_FadeOut) if (cameraState is not CameraState.Disconnected and not CameraState.Disconnecting_FadeOut)
{ {
if (cameraState == CameraState.Disconnecting_FadeIn) if (cameraState == CameraState.Disconnecting_FadeIn)
{ {
@ -574,7 +574,7 @@ namespace QSB.PoolSync
} }
var cameraState = _cameraState; var cameraState = _cameraState;
if (cameraState != CameraState.Connected && cameraState != CameraState.Connecting_FadeOut) if (cameraState is not CameraState.Connected and not CameraState.Connecting_FadeOut)
{ {
if (cameraState == CameraState.Connecting_FadeIn) if (cameraState == CameraState.Connecting_FadeIn)
{ {

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LangVersion>9</LangVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -88,6 +91,7 @@
<Compile Include="ConversationSync\ConversationManager.cs" /> <Compile Include="ConversationSync\ConversationManager.cs" />
<Compile Include="DeathSync\EndLoopReason.cs" /> <Compile Include="DeathSync\EndLoopReason.cs" />
<Compile Include="DeathSync\Events\EndLoopEvent.cs" /> <Compile Include="DeathSync\Events\EndLoopEvent.cs" />
<Compile Include="Player\PlayerState.cs" />
<Compile Include="RespawnSync\Events\PlayerRespawnEvent.cs" /> <Compile Include="RespawnSync\Events\PlayerRespawnEvent.cs" />
<Compile Include="DeathSync\Events\StartLoopEvent.cs" /> <Compile Include="DeathSync\Events\StartLoopEvent.cs" />
<Compile Include="DeathSync\Patches\MapPatches.cs" /> <Compile Include="DeathSync\Patches\MapPatches.cs" />
@ -147,7 +151,6 @@
<Compile Include="Player\Events\RequestStateResyncEvent.cs" /> <Compile Include="Player\Events\RequestStateResyncEvent.cs" />
<Compile Include="Player\GamePlatform.cs" /> <Compile Include="Player\GamePlatform.cs" />
<Compile Include="Player\Patches\PlayerPatches.cs" /> <Compile Include="Player\Patches\PlayerPatches.cs" />
<Compile Include="Player\PlayerState.cs" />
<Compile Include="PoolSync\CustomNomaiRemoteCameraPlatform.cs" /> <Compile Include="PoolSync\CustomNomaiRemoteCameraPlatform.cs" />
<Compile Include="PoolSync\CustomNomaiRemoteCameraStreaming.cs" /> <Compile Include="PoolSync\CustomNomaiRemoteCameraStreaming.cs" />
<Compile Include="ItemSync\Events\DropItemEvent.cs" /> <Compile Include="ItemSync\Events\DropItemEvent.cs" />

View File

@ -38,6 +38,6 @@ namespace QSB
} }
private static bool InUniverse(OWScene scene) => private static bool InUniverse(OWScene scene) =>
scene == OWScene.SolarSystem || scene == OWScene.EyeOfTheUniverse; scene is OWScene.SolarSystem or OWScene.EyeOfTheUniverse;
} }
} }

View File

@ -15,7 +15,7 @@ namespace QSB.QuantumSync.Events
private void Handler(int stateIndex, Vector3 onUnitSphere, int orbitAngle) => SendEvent(CreateMessage(stateIndex, onUnitSphere, orbitAngle)); private void Handler(int stateIndex, Vector3 onUnitSphere, int orbitAngle) => SendEvent(CreateMessage(stateIndex, onUnitSphere, orbitAngle));
private MoonStateChangeMessage CreateMessage(int stateIndex, Vector3 onUnitSphere, int orbitAngle) => new MoonStateChangeMessage private MoonStateChangeMessage CreateMessage(int stateIndex, Vector3 onUnitSphere, int orbitAngle) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
StateIndex = stateIndex, StateIndex = stateIndex,

View File

@ -15,7 +15,7 @@ namespace QSB.QuantumSync.Events
private void Handler(int objid, int stateIndex) => SendEvent(CreateMessage(objid, stateIndex)); private void Handler(int objid, int stateIndex) => SendEvent(CreateMessage(objid, stateIndex));
private MultiStateChangeMessage CreateMessage(int objid, int stateIndex) => new MultiStateChangeMessage private MultiStateChangeMessage CreateMessage(int objid, int stateIndex) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ObjectId = objid, ObjectId = objid,

View File

@ -13,7 +13,7 @@ namespace QSB.QuantumSync.Events
private void Handler(int objId, uint authorityOwner) => SendEvent(CreateMessage(objId, authorityOwner)); private void Handler(int objId, uint authorityOwner) => SendEvent(CreateMessage(objId, authorityOwner));
private QuantumAuthorityMessage CreateMessage(int objId, uint authorityOwner) => new QuantumAuthorityMessage private QuantumAuthorityMessage CreateMessage(int objId, uint authorityOwner) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ObjectId = objId, ObjectId = objId,

View File

@ -13,7 +13,7 @@ namespace QSB.QuantumSync.Events
private void Handler(int objid, int[] indexArray) => SendEvent(CreateMessage(objid, indexArray)); private void Handler(int objid, int[] indexArray) => SendEvent(CreateMessage(objid, indexArray));
private QuantumShuffleMessage CreateMessage(int objid, int[] indexArray) => new QuantumShuffleMessage private QuantumShuffleMessage CreateMessage(int objid, int[] indexArray) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ObjectId = objid, ObjectId = objid,

View File

@ -16,7 +16,7 @@ namespace QSB.QuantumSync.Events
private void Handler(int objid, int socketid, Quaternion localRotation) => SendEvent(CreateMessage(objid, socketid, localRotation)); private void Handler(int objid, int socketid, Quaternion localRotation) => SendEvent(CreateMessage(objid, socketid, localRotation));
private SocketStateChangeMessage CreateMessage(int objid, int socketid, Quaternion localRotation) => new SocketStateChangeMessage private SocketStateChangeMessage CreateMessage(int objid, int socketid, Quaternion localRotation) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ObjectId = objid, ObjectId = objid,

View File

@ -17,7 +17,7 @@ namespace QSB.RespawnSync.Events
private void Handler(uint playerId) => SendEvent(CreateMessage(playerId)); private void Handler(uint playerId) => SendEvent(CreateMessage(playerId));
private PlayerMessage CreateMessage(uint playerId) => new PlayerMessage private PlayerMessage CreateMessage(uint playerId) => new()
{ {
AboutId = playerId AboutId = playerId
}; };

View File

@ -16,7 +16,7 @@ namespace QSB.RespawnSync
public bool RespawnNeeded => _playersPendingRespawn.Count != 0; public bool RespawnNeeded => _playersPendingRespawn.Count != 0;
private List<PlayerInfo> _playersPendingRespawn = new List<PlayerInfo>(); private List<PlayerInfo> _playersPendingRespawn = new();
private NotificationData _previousNotification; private NotificationData _previousNotification;
private GameObject _owRecoveryPoint; private GameObject _owRecoveryPoint;
private GameObject _qsbRecoveryPoint; private GameObject _qsbRecoveryPoint;

View File

@ -35,7 +35,7 @@ namespace QSB.RoastingSync.Events
SendEvent(CreateMessage(qsbObj.ObjectId, roasting)); SendEvent(CreateMessage(qsbObj.ObjectId, roasting));
} }
private BoolWorldObjectMessage CreateMessage(int objectId, bool roasting) => new BoolWorldObjectMessage private BoolWorldObjectMessage CreateMessage(int objectId, bool roasting) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
State = roasting, State = roasting,
@ -57,14 +57,9 @@ namespace QSB.RoastingSync.Events
var player = QSBPlayerManager.GetPlayer(message.AboutId); var player = QSBPlayerManager.GetPlayer(message.AboutId);
player.RoastingStick.SetActive(message.State); player.RoastingStick.SetActive(message.State);
if (message.State) player.Campfire = message.State
{ ? QSBWorldSync.GetWorldFromId<QSBCampfire>(message.ObjectId)
player.Campfire = QSBWorldSync.GetWorldFromId<QSBCampfire>(message.ObjectId); : null;
}
else
{
player.Campfire = null;
}
} }
} }
} }

View File

@ -18,7 +18,7 @@ namespace QSB.RoastingSync.Events
private void Handler(MarshmallowEventType type) => SendEvent(CreateMessage(type)); private void Handler(MarshmallowEventType type) => SendEvent(CreateMessage(type));
private EnumMessage<MarshmallowEventType> CreateMessage(MarshmallowEventType type) => new EnumMessage<MarshmallowEventType> private EnumMessage<MarshmallowEventType> CreateMessage(MarshmallowEventType type) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
EnumValue = type EnumValue = type

View File

@ -21,7 +21,7 @@ namespace QSB.SatelliteSync.Events
private void Handler(bool usingProjector) => SendEvent(CreateMessage(usingProjector)); private void Handler(bool usingProjector) => SendEvent(CreateMessage(usingProjector));
private BoolMessage CreateMessage(bool usingProjector) => new BoolMessage private BoolMessage CreateMessage(bool usingProjector) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
Value = usingProjector Value = usingProjector

View File

@ -13,7 +13,7 @@ namespace QSB.SatelliteSync.Events
private void Handler(bool forward) => SendEvent(CreateMessage(forward)); private void Handler(bool forward) => SendEvent(CreateMessage(forward));
private BoolMessage CreateMessage(bool forward) => new BoolMessage private BoolMessage CreateMessage(bool forward) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
Value = forward Value = forward

View File

@ -13,12 +13,12 @@ namespace QSB.SectorSync
{ {
public static QSBSectorManager Instance { get; private set; } public static QSBSectorManager Instance { get; private set; }
public bool IsReady { get; private set; } public bool IsReady { get; private set; }
public List<QSBSector> FakeSectors = new List<QSBSector>(); public List<QSBSector> FakeSectors = new();
private void OnEnable() => RepeatingManager.Repeatings.Add(this); private void OnEnable() => RepeatingManager.Repeatings.Add(this);
private void OnDisable() => RepeatingManager.Repeatings.Remove(this); private void OnDisable() => RepeatingManager.Repeatings.Remove(this);
public List<BaseSectoredSync> SectoredSyncs = new List<BaseSectoredSync>(); public List<BaseSectoredSync> SectoredSyncs = new();
public void Invoke() public void Invoke()
{ {

View File

@ -13,7 +13,7 @@ namespace QSB.SectorSync
public class SectorSync : MonoBehaviour public class SectorSync : MonoBehaviour
{ {
public bool IsReady { get; private set; } public bool IsReady { get; private set; }
public List<QSBSector> SectorList = new List<QSBSector>(); public List<QSBSector> SectorList = new();
private OWRigidbody _attachedOWRigidbody; private OWRigidbody _attachedOWRigidbody;
private SectorDetector _sectorDetector; private SectorDetector _sectorDetector;

View File

@ -63,7 +63,7 @@ namespace QSB.SectorSync.WorldObjects
return false; return false;
} }
if (AttachedObject.name == "Sector_Shuttle" || AttachedObject.name == "Sector_NomaiShuttleInterior") if (AttachedObject.name is "Sector_Shuttle" or "Sector_NomaiShuttleInterior")
{ {
if (QSBSceneManager.CurrentScene == OWScene.SolarSystem) if (QSBSceneManager.CurrentScene == OWScene.SolarSystem)
{ {

View File

@ -28,7 +28,7 @@ namespace QSB.ShipSync.Events
private void Handler(bool flying) => SendEvent(CreateMessage(flying)); private void Handler(bool flying) => SendEvent(CreateMessage(flying));
private BoolMessage CreateMessage(bool flying) => new BoolMessage private BoolMessage CreateMessage(bool flying) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
Value = flying Value = flying

View File

@ -15,7 +15,7 @@ namespace QSB.ShipSync.Events
private void Handler() => SendEvent(CreateMessage()); private void Handler() => SendEvent(CreateMessage());
private PlayerMessage CreateMessage() => new PlayerMessage private PlayerMessage CreateMessage() => new()
{ {
AboutId = LocalPlayerId AboutId = LocalPlayerId
}; };

View File

@ -16,7 +16,7 @@ namespace QSB.ShipSync.Events
private void Handler(bool open) => SendEvent(CreateMessage(open)); private void Handler(bool open) => SendEvent(CreateMessage(open));
private BoolMessage CreateMessage(bool open) => new BoolMessage private BoolMessage CreateMessage(bool open) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
Value = open Value = open

View File

@ -224,7 +224,7 @@ namespace QSB.ShipSync.Patches
return false; return false;
} }
____integrity = Mathf.Min(____integrity + Time.deltaTime / ____repairTime, 1f); ____integrity = Mathf.Min(____integrity + (Time.deltaTime / ____repairTime), 1f);
QSBEventManager.FireEvent(EventNames.QSBHullRepairTick, __instance, ____integrity); QSBEventManager.FireEvent(EventNames.QSBHullRepairTick, __instance, ____integrity);
if (____integrity >= 1f) if (____integrity >= 1f)

View File

@ -37,7 +37,7 @@ namespace QSB.ShipSync
} }
} }
private List<PlayerInfo> _playersInShip = new List<PlayerInfo>(); private List<PlayerInfo> _playersInShip = new();
private uint _currentFlyer = uint.MaxValue; private uint _currentFlyer = uint.MaxValue;

View File

@ -17,7 +17,7 @@ namespace QSB.StatueSync.Events
private void Handler(Vector3 position, Quaternion rotation, float degrees) private void Handler(Vector3 position, Quaternion rotation, float degrees)
=> SendEvent(CreateMessage(position, rotation, degrees)); => SendEvent(CreateMessage(position, rotation, degrees));
private StartStatueMessage CreateMessage(Vector3 position, Quaternion rotation, float degrees) => new StartStatueMessage private StartStatueMessage CreateMessage(Vector3 position, Quaternion rotation, float degrees) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
PlayerPosition = position, PlayerPosition = position,

View File

@ -18,7 +18,7 @@ namespace QSB.Syncs
public abstract class SyncBase : QNetworkTransform public abstract class SyncBase : QNetworkTransform
{ {
private static readonly Dictionary<uint, Dictionary<Type, SyncBase>> _storedTransformSyncs = new Dictionary<uint, Dictionary<Type, SyncBase>>(); private static readonly Dictionary<uint, Dictionary<Type, SyncBase>> _storedTransformSyncs = new();
public static T GetPlayers<T>(PlayerInfo player) public static T GetPlayers<T>(PlayerInfo player)
where T : SyncBase where T : SyncBase

View File

@ -11,7 +11,7 @@ namespace QSB.TimeSync.Events
private void Handler(float time, int count) => SendEvent(CreateMessage(time, count)); private void Handler(float time, int count) => SendEvent(CreateMessage(time, count));
private ServerTimeMessage CreateMessage(float time, int count) => new ServerTimeMessage private ServerTimeMessage CreateMessage(float time, int count) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ServerTime = time, ServerTime = time,

View File

@ -324,7 +324,7 @@ namespace QSB.TimeSync
// Checks to pause/fastforward // Checks to pause/fastforward
if (clientState == ClientState.NotLoaded || clientState == ClientState.InTitleScreen) if (clientState is ClientState.NotLoaded or ClientState.InTitleScreen)
{ {
return; return;
} }
@ -400,7 +400,7 @@ namespace QSB.TimeSync
{ {
var diff = GetTimeDifference(); var diff = GetTimeDifference();
if (diff > PauseOrFastForwardThreshold || diff < -PauseOrFastForwardThreshold) if (diff is > PauseOrFastForwardThreshold or < (-PauseOrFastForwardThreshold))
{ {
WakeUpOrSleep(); WakeUpOrSleep();
return; return;

View File

@ -23,7 +23,7 @@ namespace QSB.Tools.FlashlightTool.Events
private void HandleTurnOn() => SendEvent(CreateMessage(true)); private void HandleTurnOn() => SendEvent(CreateMessage(true));
private void HandleTurnOff() => SendEvent(CreateMessage(false)); private void HandleTurnOff() => SendEvent(CreateMessage(false));
private ToggleMessage CreateMessage(bool value) => new ToggleMessage private ToggleMessage CreateMessage(bool value) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ToggleValue = value ToggleValue = value

View File

@ -4,7 +4,7 @@ namespace QSB.Tools.FlashlightTool
{ {
internal static class FlashlightCreator internal static class FlashlightCreator
{ {
private static readonly Vector3 FlashlightOffset = new Vector3(0.7196316f, -0.2697681f, 0.3769455f); private static readonly Vector3 FlashlightOffset = new(0.7196316f, -0.2697681f, 0.3769455f);
internal static void CreateFlashlight(Transform cameraBody) internal static void CreateFlashlight(Transform cameraBody)
{ {

View File

@ -57,7 +57,7 @@ namespace QSB.Tools.ProbeLauncherTool.Events
SendEvent(CreateMessage(false)); SendEvent(CreateMessage(false));
} }
private ToggleMessage CreateMessage(bool value) => new ToggleMessage private ToggleMessage CreateMessage(bool value) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ToggleValue = value ToggleValue = value

View File

@ -17,7 +17,7 @@ namespace QSB.Tools.ProbeLauncherTool.Events
private void Handler(QSBProbeLauncher launcher) => SendEvent(CreateMessage(launcher)); private void Handler(QSBProbeLauncher launcher) => SendEvent(CreateMessage(launcher));
private BoolWorldObjectMessage CreateMessage(QSBProbeLauncher launcher) => new BoolWorldObjectMessage private BoolWorldObjectMessage CreateMessage(QSBProbeLauncher launcher) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ObjectId = launcher.ObjectId ObjectId = launcher.ObjectId

View File

@ -16,7 +16,7 @@ namespace QSB.Tools.ProbeLauncherTool.Events
private void Handler() => SendEvent(CreateMessage()); private void Handler() => SendEvent(CreateMessage());
private PlayerMessage CreateMessage() => new PlayerMessage private PlayerMessage CreateMessage() => new()
{ {
AboutId = LocalPlayerId AboutId = LocalPlayerId
}; };

View File

@ -16,7 +16,7 @@ namespace QSB.Tools.ProbeLauncherTool.Events
private void Handler(bool playEffects) => SendEvent(CreateMessage(playEffects)); private void Handler(bool playEffects) => SendEvent(CreateMessage(playEffects));
private BoolMessage CreateMessage(bool playEffects) => new BoolMessage private BoolMessage CreateMessage(bool playEffects) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
Value = playEffects Value = playEffects

View File

@ -17,7 +17,7 @@ namespace QSB.Tools.ProbeLauncherTool.Events
private void Handler(QSBProbeLauncher launcher, bool playEffects) => SendEvent(CreateMessage(launcher, playEffects)); private void Handler(QSBProbeLauncher launcher, bool playEffects) => SendEvent(CreateMessage(launcher, playEffects));
private BoolWorldObjectMessage CreateMessage(QSBProbeLauncher launcher, bool playEffects) => new BoolWorldObjectMessage private BoolWorldObjectMessage CreateMessage(QSBProbeLauncher launcher, bool playEffects) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ObjectId = launcher.ObjectId, ObjectId = launcher.ObjectId,

View File

@ -4,7 +4,7 @@ namespace QSB.Tools.ProbeLauncherTool
{ {
internal static class ProbeLauncherCreator internal static class ProbeLauncherCreator
{ {
private static readonly Vector3 ProbeLauncherOffset = new Vector3(0.5745087f, -0.26f, 0.4453125f); private static readonly Vector3 ProbeLauncherOffset = new(0.5745087f, -0.26f, 0.4453125f);
internal static void CreateProbeLauncher(Transform cameraBody) internal static void CreateProbeLauncher(Transform cameraBody)
{ {

View File

@ -16,7 +16,7 @@ namespace QSB.Tools.ProbeTool.Events
private void Handler(ProbeEvent probeEvent) => SendEvent(CreateMessage(probeEvent)); private void Handler(ProbeEvent probeEvent) => SendEvent(CreateMessage(probeEvent));
private EnumMessage<ProbeEvent> CreateMessage(ProbeEvent probeEvent) => new EnumMessage<ProbeEvent> private EnumMessage<ProbeEvent> CreateMessage(ProbeEvent probeEvent) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
EnumValue = probeEvent EnumValue = probeEvent

View File

@ -16,7 +16,7 @@ namespace QSB.Tools.ProbeTool.Events
private void Handler(float duration) => SendEvent(CreateMessage(duration)); private void Handler(float duration) => SendEvent(CreateMessage(duration));
private FloatMessage CreateMessage(float duration) => new FloatMessage private FloatMessage CreateMessage(float duration) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
Value = duration Value = duration

View File

@ -23,7 +23,7 @@ namespace QSB.Tools.SignalscopeTool.Events
private void HandleEquip(Signalscope var) => SendEvent(CreateMessage(true)); private void HandleEquip(Signalscope var) => SendEvent(CreateMessage(true));
private void HandleUnequip() => SendEvent(CreateMessage(false)); private void HandleUnequip() => SendEvent(CreateMessage(false));
private ToggleMessage CreateMessage(bool value) => new ToggleMessage private ToggleMessage CreateMessage(bool value) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ToggleValue = value ToggleValue = value

View File

@ -4,7 +4,7 @@ namespace QSB.Tools.SignalscopeTool
{ {
internal static class SignalscopeCreator internal static class SignalscopeCreator
{ {
private static readonly Vector3 SignalscopeScale = new Vector3(1.5f, 1.5f, 1.5f); private static readonly Vector3 SignalscopeScale = new(1.5f, 1.5f, 1.5f);
internal static void CreateSignalscope(Transform cameraBody) internal static void CreateSignalscope(Transform cameraBody)
{ {

View File

@ -23,7 +23,7 @@ namespace QSB.Tools.TranslatorTool.Events
private void HandleEquip() => SendEvent(CreateMessage(true)); private void HandleEquip() => SendEvent(CreateMessage(true));
private void HandleUnequip() => SendEvent(CreateMessage(false)); private void HandleUnequip() => SendEvent(CreateMessage(false));
private ToggleMessage CreateMessage(bool value) => new ToggleMessage private ToggleMessage CreateMessage(bool value) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ToggleValue = value ToggleValue = value

View File

@ -25,9 +25,7 @@ namespace QSB.Tools.TranslatorTool
} }
public override void OnDisable() public override void OnDisable()
{ => _translatorProp.OnFinishUnequipAnimation();
_translatorProp.OnFinishUnequipAnimation();
}
public override void EquipTool() public override void EquipTool()
{ {
@ -72,7 +70,7 @@ namespace QSB.Tools.TranslatorTool
if (_currentNomaiText != null) if (_currentNomaiText != null)
{ {
tooCloseToTarget = (num < _currentNomaiText.GetMinimumReadableDistance()); tooCloseToTarget = num < _currentNomaiText.GetMinimumReadableDistance();
if (_currentNomaiText is NomaiWallText) if (_currentNomaiText is NomaiWallText)
{ {
@ -83,7 +81,7 @@ namespace QSB.Tools.TranslatorTool
if (distToCenter > _lastLineDist + 0.1f) if (distToCenter > _lastLineDist + 0.1f)
{ {
_lastHighlightedTextLine = nomaiTextLine; _lastHighlightedTextLine = nomaiTextLine;
_lastLineWasTranslated = (nomaiTextLine != null && nomaiTextLine.IsTranslated()); _lastLineWasTranslated = nomaiTextLine != null && nomaiTextLine.IsTranslated();
_lastLineLocked = false; _lastLineLocked = false;
} }
else else
@ -105,7 +103,7 @@ namespace QSB.Tools.TranslatorTool
else else
{ {
_lastHighlightedTextLine = nomaiTextLine; _lastHighlightedTextLine = nomaiTextLine;
_lastLineWasTranslated = (nomaiTextLine != null && nomaiTextLine.IsTranslated()); _lastLineWasTranslated = nomaiTextLine != null && nomaiTextLine.IsTranslated();
} }
if (nomaiTextLine && !nomaiTextLine.IsHidden() && nomaiTextLine.IsActive()) if (nomaiTextLine && !nomaiTextLine.IsHidden() && nomaiTextLine.IsActive())

View File

@ -15,8 +15,8 @@ namespace QSB.Tools.TranslatorTool
const float _fadeLength = 0.66f; const float _fadeLength = 0.66f;
public float _scanSpeed = 1f; public float _scanSpeed = 1f;
public readonly Color _baseProjectorColor = new Color(0.3545942f, 2.206932f, 4.594794f, 1f); public readonly Color _baseProjectorColor = new(0.3545942f, 2.206932f, 4.594794f, 1f);
public readonly Color _baseLightColor = new Color(0.1301365f, 0.2158605f, 0.6239606f, 1f); public readonly Color _baseLightColor = new(0.1301365f, 0.2158605f, 0.6239606f, 1f);
public Quaternion _baseRotation; public Quaternion _baseRotation;
private bool _tooCloseToTarget; private bool _tooCloseToTarget;
@ -92,7 +92,7 @@ namespace QSB.Tools.TranslatorTool
_switchTime = Mathf.MoveTowards(_switchTime, 1f, Time.deltaTime / _switchLength); _switchTime = Mathf.MoveTowards(_switchTime, 1f, Time.deltaTime / _switchLength);
var smoothedSwitchTime = Mathf.SmoothStep(0f, 1f, _switchTime); var smoothedSwitchTime = Mathf.SmoothStep(0f, 1f, _switchTime);
_scanTime += Time.deltaTime * _scanSpeed; _scanTime += Time.deltaTime * _scanSpeed;
var num = Mathf.Cos(_scanTime + _scanOffset) * 0.5f + 0.5f; var num = (Mathf.Cos(_scanTime + _scanOffset) * 0.5f) + 0.5f;
var pointAlongLine = _nomaiTextLine.GetPointAlongLine(num); var pointAlongLine = _nomaiTextLine.GetPointAlongLine(num);
var rhs = _nomaiTextLine.GetPointAlongLine(num + 0.1f) - _nomaiTextLine.GetPointAlongLine(num - 0.1f); var rhs = _nomaiTextLine.GetPointAlongLine(num + 0.1f) - _nomaiTextLine.GetPointAlongLine(num - 0.1f);
var vector = pointAlongLine - transform.position; var vector = pointAlongLine - transform.position;
@ -108,7 +108,7 @@ namespace QSB.Tools.TranslatorTool
_switchTime = Mathf.MoveTowards(_switchTime, 1f, Time.deltaTime / _switchLength); _switchTime = Mathf.MoveTowards(_switchTime, 1f, Time.deltaTime / _switchLength);
var t2 = Mathf.SmoothStep(0f, 1f, _switchTime); var t2 = Mathf.SmoothStep(0f, 1f, _switchTime);
_scanTime += Time.deltaTime * _scanSpeed; _scanTime += Time.deltaTime * _scanSpeed;
var t3 = Mathf.Cos(_scanTime + _scanOffset) * 0.5f + 0.5f; var t3 = (Mathf.Cos(_scanTime + _scanOffset) * 0.5f) + 0.5f;
t3 = Mathf.Lerp(0.25f, 0.75f, t3); t3 = Mathf.Lerp(0.25f, 0.75f, t3);
var pointOnRing = _nomaiComputerRing.GetPointOnRing(t3, transform.position); var pointOnRing = _nomaiComputerRing.GetPointOnRing(t3, transform.position);
var forward = pointOnRing - transform.position; var forward = pointOnRing - transform.position;
@ -125,7 +125,7 @@ namespace QSB.Tools.TranslatorTool
var smoothedSwitchTime = Mathf.SmoothStep(0f, 1f, _switchTime); var smoothedSwitchTime = Mathf.SmoothStep(0f, 1f, _switchTime);
_scanTime += Time.deltaTime * _scanSpeed; _scanTime += Time.deltaTime * _scanSpeed;
var t5 = Mathf.Cos(_scanTime + _scanOffset) * 0.5f + 0.5f; var t5 = (Mathf.Cos(_scanTime + _scanOffset) * 0.5f) + 0.5f;
t5 = Mathf.Lerp(0.25f, 0.75f, t5); t5 = Mathf.Lerp(0.25f, 0.75f, t5);
var pointOnRing2 = _nomaiVesselComputerRing.GetPointOnRing(t5, transform.position); var pointOnRing2 = _nomaiVesselComputerRing.GetPointOnRing(t5, transform.position);
var forward2 = pointOnRing2 - transform.position; var forward2 = pointOnRing2 - transform.position;

View File

@ -5,7 +5,7 @@ namespace QSB.Tools.TranslatorTool
{ {
internal static class TranslatorCreator internal static class TranslatorCreator
{ {
private static readonly Vector3 TranslatorScale = new Vector3(0.75f, 0.75f, 0.75f); private static readonly Vector3 TranslatorScale = new(0.75f, 0.75f, 0.75f);
internal static void CreateTranslator(Transform cameraBody) internal static void CreateTranslator(Transform cameraBody)
{ {

View File

@ -13,7 +13,7 @@ namespace QSB.TranslationSync.Events
private void Handler(NomaiTextType type, int objId, int textId) => SendEvent(CreateMessage(type, objId, textId)); private void Handler(NomaiTextType type, int objId, int textId) => SendEvent(CreateMessage(type, objId, textId));
private SetAsTranslatedMessage CreateMessage(NomaiTextType type, int objId, int textId) => new SetAsTranslatedMessage private SetAsTranslatedMessage CreateMessage(NomaiTextType type, int objId, int textId) => new()
{ {
AboutId = LocalPlayerId, AboutId = LocalPlayerId,
ObjectId = objId, ObjectId = objId,

View File

@ -24,7 +24,7 @@ namespace QSB.Utility
private const float Column4 = Column3 + FixedWidth; private const float Column4 = Column3 + FixedWidth;
private float column4Offset = 10f; private float column4Offset = 10f;
private GUIStyle guiStyle = new GUIStyle() private GUIStyle guiStyle = new()
{ {
fontSize = 9 fontSize = 9
}; };

Some files were not shown because too many files have changed in this diff Show More