mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-06 01:00:16 +00:00
feature folders (#166)
This commit is contained in:
parent
bef2bf7c43
commit
7cc033ec8a
@ -1,6 +1,7 @@
|
||||
using UnityEngine.Networking;
|
||||
using QSB.Messaging;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace QSB.Messaging
|
||||
namespace QSB.Animation
|
||||
{
|
||||
public class AnimTriggerMessage : PlayerMessage
|
||||
{
|
@ -174,7 +174,7 @@ namespace QSB.Animation
|
||||
}
|
||||
}
|
||||
|
||||
public void SuitUp()
|
||||
private void SuitUp()
|
||||
{
|
||||
_bodyAnim.runtimeAnimatorController = _suitedAnimController;
|
||||
_anim.runtimeAnimatorController = _suitedAnimController;
|
||||
@ -182,7 +182,7 @@ namespace QSB.Animation
|
||||
_suitedGraphics.SetActive(true);
|
||||
}
|
||||
|
||||
public void SuitDown()
|
||||
private void SuitDown()
|
||||
{
|
||||
_bodyAnim.runtimeAnimatorController = _unsuitedAnimController;
|
||||
_anim.runtimeAnimatorController = _unsuitedAnimController;
|
||||
@ -190,6 +190,18 @@ namespace QSB.Animation
|
||||
_suitedGraphics.SetActive(false);
|
||||
}
|
||||
|
||||
public void SetSuitState(bool state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
SuitUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
SuitDown();
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isLocalPlayer)
|
||||
|
@ -1,6 +1,7 @@
|
||||
using QSB.Messaging;
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
|
||||
namespace QSB.Events
|
||||
namespace QSB.Animation
|
||||
{
|
||||
public class PlayerSuitEvent : QSBEvent<ToggleMessage>
|
||||
{
|
28
QSB/DeathSync/DeathPatches.cs
Normal file
28
QSB/DeathSync/DeathPatches.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System.Linq;
|
||||
using QSB.Events;
|
||||
|
||||
namespace QSB.DeathSync
|
||||
{
|
||||
public static class DeathPatches
|
||||
{
|
||||
public static bool PreFinishDeathSequence(DeathType deathType)
|
||||
{
|
||||
if (RespawnOnDeath.Instance.AllowedDeathTypes.Contains(deathType))
|
||||
{
|
||||
// Allow real death
|
||||
return true;
|
||||
}
|
||||
|
||||
RespawnOnDeath.Instance.ResetShip();
|
||||
RespawnOnDeath.Instance.ResetPlayer();
|
||||
|
||||
// Prevent original death method from running.
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void BroadcastDeath(DeathType deathType)
|
||||
{
|
||||
GlobalMessenger<DeathType>.FireEvent(EventNames.QSBPlayerDeath, deathType);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace QSB.Events
|
||||
namespace QSB.DeathSync
|
||||
{
|
||||
public static class Necronomicon
|
||||
{
|
@ -1,7 +1,8 @@
|
||||
using QSB.Messaging;
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
using QSB.Utility;
|
||||
|
||||
namespace QSB.Events
|
||||
namespace QSB.DeathSync
|
||||
{
|
||||
public class PlayerDeathEvent : QSBEvent<PlayerDeathMessage>
|
||||
{
|
@ -1,6 +1,7 @@
|
||||
using UnityEngine.Networking;
|
||||
using QSB.Messaging;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace QSB.Messaging
|
||||
namespace QSB.DeathSync
|
||||
{
|
||||
public class PlayerDeathMessage : PlayerMessage
|
||||
{
|
@ -4,7 +4,7 @@ using Harmony;
|
||||
using OWML.ModHelper.Events;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.TimeSync
|
||||
namespace QSB.DeathSync
|
||||
{
|
||||
public class PreventShipDestruction : MonoBehaviour
|
||||
{
|
@ -3,16 +3,16 @@ using OWML.ModHelper.Events;
|
||||
using QSB.Events;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.TimeSync
|
||||
namespace QSB.DeathSync
|
||||
{
|
||||
/// <summary>
|
||||
/// Client-only-side component for managing respawning after death.
|
||||
/// </summary>
|
||||
public class RespawnOnDeath : MonoBehaviour
|
||||
{
|
||||
private static RespawnOnDeath _instance;
|
||||
public static RespawnOnDeath Instance;
|
||||
|
||||
private static readonly DeathType[] AllowedDeathTypes = {
|
||||
public readonly DeathType[] AllowedDeathTypes = {
|
||||
DeathType.BigBang,
|
||||
DeathType.Supernova,
|
||||
DeathType.TimeLoop
|
||||
@ -31,10 +31,10 @@ namespace QSB.TimeSync
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
Instance = this;
|
||||
|
||||
QSB.Helper.HarmonyHelper.AddPrefix<DeathManager>("KillPlayer", typeof(Patches), nameof(Patches.PreFinishDeathSequence));
|
||||
QSB.Helper.HarmonyHelper.AddPostfix<DeathManager>("KillPlayer", typeof(Patches), nameof(Patches.BroadcastDeath));
|
||||
QSB.Helper.HarmonyHelper.AddPrefix<DeathManager>("KillPlayer", typeof(DeathPatches), nameof(DeathPatches.PreFinishDeathSequence));
|
||||
QSB.Helper.HarmonyHelper.AddPostfix<DeathManager>("KillPlayer", typeof(DeathPatches), nameof(DeathPatches.BroadcastDeath));
|
||||
QSB.Helper.Events.Subscribe<PlayerResources>(OWML.Common.Events.AfterStart);
|
||||
QSB.Helper.Events.Event += OnEvent;
|
||||
}
|
||||
@ -132,28 +132,5 @@ namespace QSB.TimeSync
|
||||
spawnPoint.GetSpawnLocation() == SpawnLocation.TimberHearth && spawnPoint.IsShipSpawn() == isShip
|
||||
);
|
||||
}
|
||||
|
||||
internal static class Patches
|
||||
{
|
||||
public static bool PreFinishDeathSequence(DeathType deathType)
|
||||
{
|
||||
if (AllowedDeathTypes.Contains(deathType))
|
||||
{
|
||||
// Allow real death
|
||||
return true;
|
||||
}
|
||||
|
||||
_instance.ResetShip();
|
||||
_instance.ResetPlayer();
|
||||
|
||||
// Prevent original death method from running.
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void BroadcastDeath(DeathType deathType)
|
||||
{
|
||||
GlobalMessenger<DeathType>.FireEvent(EventNames.QSBPlayerDeath, deathType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,10 @@
|
||||
using QSB.ElevatorSync;
|
||||
using QSB.Animation;
|
||||
using QSB.DeathSync;
|
||||
using QSB.ElevatorSync;
|
||||
using QSB.GeyserSync;
|
||||
using QSB.TimeSync;
|
||||
using QSB.Tools;
|
||||
using QSB.TransformSync;
|
||||
|
||||
namespace QSB.Events
|
||||
{
|
||||
|
@ -49,15 +49,7 @@ namespace QSB
|
||||
Translator.ChangeEquipState(FlagsHelper.IsSet(State, State.Translator));
|
||||
ProbeLauncher.ChangeEquipState(FlagsHelper.IsSet(State, State.ProbeLauncher));
|
||||
Signalscope.ChangeEquipState(FlagsHelper.IsSet(State, State.Signalscope));
|
||||
|
||||
if (FlagsHelper.IsSet(State, State.Suit))
|
||||
{
|
||||
PlayerRegistry.GetAnimationSync(NetId).SuitUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerRegistry.GetAnimationSync(NetId).SuitDown();
|
||||
}
|
||||
PlayerRegistry.GetAnimationSync(NetId).SetSuitState(FlagsHelper.IsSet(State, State.Suit));
|
||||
}
|
||||
|
||||
public bool GetState(State state)
|
||||
|
@ -119,6 +119,8 @@
|
||||
<Compile Include="Animation\AnimControllerPatch.cs" />
|
||||
<Compile Include="Animation\AnimFloatParam.cs" />
|
||||
<Compile Include="Animation\AnimTrigger.cs" />
|
||||
<Compile Include="Animation\AnimTriggerMessage.cs" />
|
||||
<Compile Include="DeathSync\DeathPatches.cs" />
|
||||
<Compile Include="ElevatorSync\ElevatorDirection.cs" />
|
||||
<Compile Include="ElevatorSync\QSBElevator.cs" />
|
||||
<Compile Include="ElevatorSync\ElevatorEvent.cs" />
|
||||
@ -126,26 +128,25 @@
|
||||
<Compile Include="ElevatorSync\ElevatorMessage.cs" />
|
||||
<Compile Include="ElevatorSync\ElevatorPatches.cs" />
|
||||
<Compile Include="Events\EventNames.cs" />
|
||||
<Compile Include="Events\PlayerDeathEvent.cs" />
|
||||
<Compile Include="Events\PlayerFlashlightEvent.cs" />
|
||||
<Compile Include="DeathSync\PlayerDeathEvent.cs" />
|
||||
<Compile Include="Tools\PlayerFlashlightEvent.cs" />
|
||||
<Compile Include="Events\PlayerJoinEvent.cs" />
|
||||
<Compile Include="Events\PlayerLeaveEvent.cs" />
|
||||
<Compile Include="Events\PlayerProbeEvent.cs" />
|
||||
<Compile Include="Tools\PlayerProbeEvent.cs" />
|
||||
<Compile Include="Events\PlayerReadyEvent.cs" />
|
||||
<Compile Include="Events\PlayerSectorEvent.cs" />
|
||||
<Compile Include="TransformSync\PlayerSectorEvent.cs" />
|
||||
<Compile Include="Events\PlayerStatesRequestEvent.cs" />
|
||||
<Compile Include="Events\PlayerSuitEvent.cs" />
|
||||
<Compile Include="Events\ServerTimeEvent.cs" />
|
||||
<Compile Include="Animation\PlayerSuitEvent.cs" />
|
||||
<Compile Include="TimeSync\ServerTimeEvent.cs" />
|
||||
<Compile Include="GeyserSync\GeyserEvent.cs" />
|
||||
<Compile Include="GeyserSync\GeyserManager.cs" />
|
||||
<Compile Include="GeyserSync\GeyserMessage.cs" />
|
||||
<Compile Include="GeyserSync\QSBGeyser.cs" />
|
||||
<Compile Include="Messaging\AnimTriggerMessage.cs" />
|
||||
<Compile Include="Messaging\PlayerDeathMessage.cs" />
|
||||
<Compile Include="DeathSync\PlayerDeathMessage.cs" />
|
||||
<Compile Include="Messaging\PlayerLeaveMessage.cs" />
|
||||
<Compile Include="Events\PlayerProbeLauncherEvent.cs" />
|
||||
<Compile Include="Events\PlayerSignalscopeEvent.cs" />
|
||||
<Compile Include="Events\PlayerTranslatorEvent.cs" />
|
||||
<Compile Include="Tools\PlayerProbeLauncherEvent.cs" />
|
||||
<Compile Include="Tools\PlayerSignalscopeEvent.cs" />
|
||||
<Compile Include="Tools\PlayerTranslatorEvent.cs" />
|
||||
<Compile Include="Events\QSBEvent.cs" />
|
||||
<Compile Include="Messaging\PlayerJoinMessage.cs" />
|
||||
<Compile Include="Messaging\ToggleMessage.cs" />
|
||||
@ -159,15 +160,15 @@
|
||||
<Compile Include="Events\EventList.cs" />
|
||||
<Compile Include="Messaging\PlayerStateMessage.cs" />
|
||||
<Compile Include="Events\PlayerState.cs" />
|
||||
<Compile Include="Events\Necronomicon.cs" />
|
||||
<Compile Include="DeathSync\Necronomicon.cs" />
|
||||
<Compile Include="Utility\DebugLog.cs" />
|
||||
<Compile Include="Messaging\PlayerMessage.cs" />
|
||||
<Compile Include="Messaging\MessageHandler.cs" />
|
||||
<Compile Include="Messaging\MessageType.cs" />
|
||||
<Compile Include="PlayerInfo.cs" />
|
||||
<Compile Include="State.cs" />
|
||||
<Compile Include="TimeSync\PreventShipDestruction.cs" />
|
||||
<Compile Include="TimeSync\RespawnOnDeath.cs" />
|
||||
<Compile Include="DeathSync\PreventShipDestruction.cs" />
|
||||
<Compile Include="DeathSync\RespawnOnDeath.cs" />
|
||||
<Compile Include="PlayerRegistry.cs" />
|
||||
<Compile Include="TransformSync\PlayerCameraSync.cs" />
|
||||
<Compile Include="Utility\FlagsHelper.cs" />
|
||||
@ -179,9 +180,9 @@
|
||||
<Compile Include="TimeSync\PreserveTimeScale.cs" />
|
||||
<Compile Include="TransformSync\ShipTransformSync.cs" />
|
||||
<Compile Include="TransformSync\TransformSync.cs" />
|
||||
<Compile Include="Messaging\SectorMessage.cs" />
|
||||
<Compile Include="TransformSync\SectorMessage.cs" />
|
||||
<Compile Include="TransformSync\SectorSync.cs" />
|
||||
<Compile Include="Messaging\ServerTimeMessage.cs" />
|
||||
<Compile Include="TimeSync\ServerTimeMessage.cs" />
|
||||
<Compile Include="TimeSync\WakeUpSync.cs" />
|
||||
<Compile Include="QSBNetworkManager.cs" />
|
||||
<Compile Include="QSB.cs" />
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using OWML.ModHelper.Events;
|
||||
using QSB.Animation;
|
||||
using QSB.DeathSync;
|
||||
using QSB.Events;
|
||||
using QSB.GeyserSync;
|
||||
using QSB.TimeSync;
|
||||
|
@ -1,7 +1,7 @@
|
||||
using QSB.Messaging;
|
||||
using QSB.TimeSync;
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
|
||||
namespace QSB.Events
|
||||
namespace QSB.TimeSync
|
||||
{
|
||||
public class ServerTimeEvent : QSBEvent<ServerTimeMessage>
|
||||
{
|
@ -1,6 +1,7 @@
|
||||
using UnityEngine.Networking;
|
||||
using QSB.Messaging;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace QSB.Messaging
|
||||
namespace QSB.TimeSync
|
||||
{
|
||||
public class ServerTimeMessage : PlayerMessage
|
||||
{
|
@ -1,6 +1,7 @@
|
||||
using QSB.Messaging;
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
|
||||
namespace QSB.Events
|
||||
namespace QSB.Tools
|
||||
{
|
||||
public class PlayerFlashlightEvent : QSBEvent<ToggleMessage>
|
||||
{
|
@ -1,6 +1,7 @@
|
||||
using QSB.Messaging;
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
|
||||
namespace QSB.Events
|
||||
namespace QSB.Tools
|
||||
{
|
||||
public class PlayerProbeEvent : QSBEvent<ToggleMessage>
|
||||
{
|
@ -1,7 +1,8 @@
|
||||
using QSB.Messaging;
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
using QSB.Utility;
|
||||
|
||||
namespace QSB.Events
|
||||
namespace QSB.Tools
|
||||
{
|
||||
public class PlayerProbeLauncherEvent : QSBEvent<ToggleMessage>
|
||||
{
|
@ -1,7 +1,8 @@
|
||||
using QSB.Messaging;
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
using QSB.Utility;
|
||||
|
||||
namespace QSB.Events
|
||||
namespace QSB.Tools
|
||||
{
|
||||
public class PlayerSignalscopeEvent : QSBEvent<ToggleMessage>
|
||||
{
|
@ -1,7 +1,8 @@
|
||||
using QSB.Messaging;
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
using QSB.Utility;
|
||||
|
||||
namespace QSB.Events
|
||||
namespace QSB.Tools
|
||||
{
|
||||
public class PlayerTranslatorEvent : QSBEvent<ToggleMessage>
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using QSB.Messaging;
|
||||
using QSB.TransformSync;
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
using QSB.Utility;
|
||||
|
||||
namespace QSB.Events
|
||||
namespace QSB.TransformSync
|
||||
{
|
||||
public class PlayerSectorEvent : QSBEvent<SectorMessage>
|
||||
{
|
@ -1,6 +1,7 @@
|
||||
using UnityEngine.Networking;
|
||||
using QSB.Messaging;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace QSB.Messaging
|
||||
namespace QSB.TransformSync
|
||||
{
|
||||
public class SectorMessage : PlayerMessage
|
||||
{
|
Loading…
Reference in New Issue
Block a user