mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-20 15:41:01 +00:00
Death errors workaround, and allow more death types (#79)
* Fix network animator errors when nothing to animate Clsoes #75 * Broadcast death after all the death logic has been dealt with for #77 * Remove black hole from death type whitelist
This commit is contained in:
parent
361da9cbbb
commit
34f75c672f
@ -11,6 +11,12 @@ namespace QSB.TimeSync
|
||||
{
|
||||
private static RespawnOnDeath _instance;
|
||||
|
||||
private static readonly DeathType[] _allowedDeathTypes = {
|
||||
DeathType.BigBang,
|
||||
DeathType.Supernova,
|
||||
DeathType.TimeLoop
|
||||
};
|
||||
|
||||
private SpawnPoint _shipSpawnPoint;
|
||||
private SpawnPoint _playerSpawnPoint;
|
||||
private OWRigidbody _shipBody;
|
||||
@ -21,13 +27,13 @@ namespace QSB.TimeSync
|
||||
private HatchController _hatchController;
|
||||
private ShipCockpitController _cockpitController;
|
||||
private PlayerSpacesuit _spaceSuit;
|
||||
|
||||
private MessageHandler<DeathMessage> _deathHandler;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_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.Events.Subscribe<PlayerResources>(OWML.Common.Events.AfterStart);
|
||||
QSB.Helper.Events.OnEvent += OnEvent;
|
||||
}
|
||||
@ -145,9 +151,7 @@ namespace QSB.TimeSync
|
||||
{
|
||||
public static bool PreFinishDeathSequence(DeathType deathType)
|
||||
{
|
||||
BroadcastDeath(deathType);
|
||||
|
||||
if (deathType == DeathType.Supernova)
|
||||
if (_allowedDeathTypes.Contains(deathType))
|
||||
{
|
||||
// Allow real death
|
||||
return true;
|
||||
@ -160,7 +164,7 @@ namespace QSB.TimeSync
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void BroadcastDeath(DeathType deathType)
|
||||
public static void BroadcastDeath(DeathType deathType)
|
||||
{
|
||||
var message = new DeathMessage
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user