mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-10 21:40:19 +00:00
fix ship being broken?
This commit is contained in:
parent
a191c86ed0
commit
1cc6c5cfa3
@ -23,6 +23,7 @@ namespace QSB.DeathSync.Events
|
||||
public override void OnReceiveRemote(bool server, EnumMessage<DeathType> message)
|
||||
{
|
||||
var playerName = QSBPlayerManager.GetPlayer(message.AboutId).Name;
|
||||
// TODO : this is random per client! change this event so it sends the message index and the deathtype?
|
||||
var deathMessage = Necronomicon.GetPhrase(message.Value);
|
||||
DebugLog.ToAll(string.Format(deathMessage, playerName));
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ namespace QSB.DeathSync.Patches
|
||||
QSBCore.Helper.HarmonyHelper.Transpile<ShipDetachableModule>("Detach", typeof(DeathPatches), nameof(ReturnNull));
|
||||
QSBCore.Helper.HarmonyHelper.EmptyMethod<ShipEjectionSystem>("OnPressInteract");
|
||||
QSBCore.Helper.HarmonyHelper.AddPostfix<ShipDamageController>("Awake", typeof(DeathPatches), nameof(DamageController_Exploded));
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<DestructionVolume>("VanishShip", typeof(DeathPatches), nameof(DestructionVolume_VanishShip));
|
||||
}
|
||||
|
||||
public static bool PreFinishDeathSequence(DeathType deathType)
|
||||
@ -58,5 +59,15 @@ namespace QSB.DeathSync.Patches
|
||||
new CodeInstruction(OpCodes.Ret)
|
||||
};
|
||||
}
|
||||
|
||||
public static bool DestructionVolume_VanishShip(DeathType ____deathType)
|
||||
{
|
||||
// Don't want to vanish the ship - that disables the ship completely
|
||||
if (PlayerState.IsInsideShip() || PlayerState.UsingShipComputer() || PlayerState.AtFlightConsole())
|
||||
{
|
||||
Locator.GetDeathManager().KillPlayer(____deathType);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -35,6 +35,7 @@ namespace QSB.DeathSync
|
||||
|
||||
public void Init()
|
||||
{
|
||||
DebugLog.DebugWrite($"init");
|
||||
var playerTransform = Locator.GetPlayerTransform();
|
||||
_playerResources = playerTransform.GetComponent<PlayerResources>();
|
||||
_spaceSuit = Locator.GetPlayerSuit();
|
||||
@ -47,7 +48,7 @@ namespace QSB.DeathSync
|
||||
var shipTransform = Locator.GetShipTransform();
|
||||
if (shipTransform == null)
|
||||
{
|
||||
DebugLog.DebugWrite($"Warning - Init() ran when ship was null?", MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - Init() ran when ship was null?", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
_shipComponents = shipTransform.GetComponentsInChildren<ShipComponent>();
|
||||
@ -75,7 +76,7 @@ namespace QSB.DeathSync
|
||||
DebugLog.ToConsole("Warning - _playerSpawnPoint is null!", MessageType.Warning);
|
||||
Init();
|
||||
}
|
||||
|
||||
DebugLog.DebugWrite($"reset player");
|
||||
// Cant use _playerSpawner.DebugWarp because that will warp the ship if the player is in it
|
||||
var playerBody = Locator.GetPlayerBody();
|
||||
playerBody.WarpToPositionRotation(_playerSpawnPoint.transform.position, _playerSpawnPoint.transform.rotation);
|
||||
@ -99,9 +100,10 @@ namespace QSB.DeathSync
|
||||
|
||||
if (_shipBody == null)
|
||||
{
|
||||
DebugLog.DebugWrite($"Warning - Tried to reset ship, but the ship is null!", MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - Tried to reset ship, but the ship is null!", MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
DebugLog.DebugWrite($"reset ship");
|
||||
|
||||
_shipBody.SetVelocity(_shipSpawnPoint.GetPointVelocity());
|
||||
_shipBody.WarpToPositionRotation(_shipSpawnPoint.transform.position, _shipSpawnPoint.transform.rotation);
|
||||
|
@ -44,7 +44,7 @@ namespace QSB.QuantumSync.Events
|
||||
var obj = objects.ToList()[message.ObjectId];
|
||||
if (obj.ControllingPlayer != 0 && message.AuthorityOwner != 0)
|
||||
{
|
||||
DebugLog.DebugWrite($"Warning - object {obj.Name} already has owner {obj.ControllingPlayer}, but trying to be replaced by {message.AuthorityOwner}!", MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - object {obj.Name} already has owner {obj.ControllingPlayer}, but trying to be replaced by {message.AuthorityOwner}!", MessageType.Warning);
|
||||
}
|
||||
obj.ControllingPlayer = message.AuthorityOwner;
|
||||
if (obj.ControllingPlayer == 0 && obj.IsEnabled)
|
||||
|
@ -40,7 +40,7 @@ namespace QSB.QuantumSync.Patches
|
||||
var worldObject = QSBWorldSync.GetWorldObject<QSBSocketedQuantumObject>(id);
|
||||
if (worldObject == null)
|
||||
{
|
||||
DebugLog.DebugWrite($"Worldobject is null for id {id}!");
|
||||
DebugLog.ToConsole($"Worldobject is null for id {id}!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace QSB.QuantumSync.Patches
|
||||
if (!skipInstantVisibilityCheck)
|
||||
{
|
||||
var method = new StackTrace().GetFrame(3).GetMethod();
|
||||
DebugLog.DebugWrite($"Warning - Tried to change moon state while still observed. Called by {method.DeclaringType}.{method.Name}", MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - Tried to change moon state while still observed. Called by {method.DeclaringType}.{method.Name}", MessageType.Warning);
|
||||
}
|
||||
__result = false;
|
||||
return false;
|
||||
|
@ -30,13 +30,13 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
var qsbSocket = QSBWorldSync.GetWorldObject<QSBQuantumSocket>(message.SocketId);
|
||||
if (qsbSocket == null)
|
||||
{
|
||||
DebugLog.DebugWrite($"Couldn't find socket id {message.SocketId}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Couldn't find socket id {message.SocketId}", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
var socket = qsbSocket.AttachedObject;
|
||||
if (socket == null)
|
||||
{
|
||||
DebugLog.DebugWrite($"QSBSocket id {message.SocketId} has no attached socket.", MessageType.Error);
|
||||
DebugLog.ToConsole($"QSBSocket id {message.SocketId} has no attached socket.", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace QSB.SectorSync
|
||||
{
|
||||
if (QSBWorldSync.GetWorldObjects<QSBSector>().Count() == 0)
|
||||
{
|
||||
DebugLog.DebugWrite($"Error - Can't get closest sector, as there are no QSBSectors!", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - Can't get closest sector, as there are no QSBSectors!", MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
return QSBWorldSync.GetWorldObjects<QSBSector>()
|
||||
|
@ -53,7 +53,7 @@ namespace QSB.Utility
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
DebugLog.DebugWrite($"Error invoking delegate! Message : {ex.Message} Stack Trace : {Environment.NewLine}{ex.StackTrace}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error invoking delegate! Message : {ex.Message} Stack Trace : {Environment.NewLine}{ex.StackTrace}", MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace QSB.Utility
|
||||
{
|
||||
if (AttachedComponent == null)
|
||||
{
|
||||
DebugLog.DebugWrite($"Attached component is null! Attached to {gameObject.name}", OWML.Common.MessageType.Error);
|
||||
DebugLog.ToConsole($"Attached component is null! Attached to {gameObject.name}", OWML.Common.MessageType.Error);
|
||||
return;
|
||||
}
|
||||
var state = AttachedComponent.isActiveAndEnabled ? ComponentState.Enabled : ComponentState.Disabled;
|
||||
|
Loading…
x
Reference in New Issue
Block a user