mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-20 15:41:01 +00:00
wabba dabba doo wip
This commit is contained in:
parent
558221491e
commit
d11591b904
@ -35,15 +35,13 @@ namespace QSB.MeteorSync.Events
|
||||
if (msg.Integrity <= 0)
|
||||
{
|
||||
msg.IsThruWhiteHole = qsbFragment.IsThruWhiteHole;
|
||||
|
||||
var refBody = GetRefBody(msg.IsThruWhiteHole);
|
||||
var body = qsbFragment.AttachedObject.transform.parent.parent.GetAttachedOWRigidbody();
|
||||
|
||||
if (msg.IsThruWhiteHole)
|
||||
{
|
||||
msg.LeashLength = qsbFragment.LeashLength;
|
||||
}
|
||||
|
||||
var refBody = GetRefBody(msg.IsThruWhiteHole);
|
||||
var body = qsbFragment.AttachedObject.transform.parent.parent.GetAttachedOWRigidbody();
|
||||
msg.Pos = refBody.transform.InverseTransformPoint(body.transform.position);
|
||||
msg.Rot = refBody.transform.InverseTransformRotation(body.transform.rotation);
|
||||
msg.Vel = GetRelativeVelocity(body, refBody);
|
||||
@ -70,14 +68,11 @@ namespace QSB.MeteorSync.Events
|
||||
// the detach is delay, so wait even more until that happens lol
|
||||
QSBCore.UnityEvents.FireInNUpdates(() =>
|
||||
{
|
||||
var refBody = GetRefBody(msg.IsThruWhiteHole);
|
||||
var body = qsbFragment.AttachedObject.transform.parent.parent.GetAttachedOWRigidbody();
|
||||
|
||||
if (msg.IsThruWhiteHole && !qsbFragment.IsThruWhiteHole)
|
||||
{
|
||||
qsbFragment.DetachableFragment.ChangeFragmentSector(MeteorManager.WhiteHoleVolume._whiteHoleSector,
|
||||
MeteorManager.WhiteHoleVolume._whiteHoleProxyShadowSuperGroup);
|
||||
body.gameObject.AddComponent<DebrisLeash>().Init(MeteorManager.WhiteHoleVolume._whiteHoleBody,
|
||||
qsbFragment.Body.gameObject.AddComponent<DebrisLeash>().Init(MeteorManager.WhiteHoleVolume._whiteHoleBody,
|
||||
msg.LeashLength);
|
||||
}
|
||||
else if (msg.IsThruWhiteHole && qsbFragment.IsThruWhiteHole)
|
||||
@ -91,6 +86,8 @@ namespace QSB.MeteorSync.Events
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
var refBody = GetRefBody(msg.IsThruWhiteHole);
|
||||
var body = qsbFragment.Body;
|
||||
var targetPos = refBody.transform.TransformPoint(msg.Pos);
|
||||
var targetRot = refBody.transform.TransformRotation(msg.Rot);
|
||||
var targetVel = refBody.GetPointVelocity(targetPos) + msg.Vel;
|
||||
|
@ -8,31 +8,27 @@ namespace QSB.MeteorSync.Events
|
||||
{
|
||||
public float Integrity;
|
||||
public float OrigIntegrity;
|
||||
public float LeashLength;
|
||||
|
||||
public Vector3 Pos;
|
||||
public Quaternion Rot;
|
||||
public Vector3 Vel;
|
||||
public Vector3 AngVel;
|
||||
public bool IsThruWhiteHole;
|
||||
public float LeashLength;
|
||||
|
||||
public override void Deserialize(QNetworkReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
Integrity = reader.ReadSingle();
|
||||
OrigIntegrity = reader.ReadSingle();
|
||||
LeashLength = reader.ReadSingle();
|
||||
if (Integrity <= 0)
|
||||
{
|
||||
Pos = reader.ReadVector3();
|
||||
Rot = reader.ReadQuaternion();
|
||||
Vel = reader.ReadVector3();
|
||||
AngVel = reader.ReadVector3();
|
||||
|
||||
IsThruWhiteHole = reader.ReadBoolean();
|
||||
if (IsThruWhiteHole)
|
||||
{
|
||||
LeashLength = reader.ReadSingle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,18 +37,10 @@ namespace QSB.MeteorSync.Events
|
||||
base.Serialize(writer);
|
||||
writer.Write(Integrity);
|
||||
writer.Write(OrigIntegrity);
|
||||
writer.Write(LeashLength);
|
||||
if (Integrity <= 0)
|
||||
{
|
||||
writer.Write(Pos);
|
||||
writer.Write(Rot);
|
||||
writer.Write(Vel);
|
||||
writer.Write(AngVel);
|
||||
|
||||
writer.Write(IsThruWhiteHole);
|
||||
if (IsThruWhiteHole)
|
||||
{
|
||||
writer.Write(LeashLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ namespace QSB.MeteorSync
|
||||
// wait a bit because meteors get created late
|
||||
QSBCore.UnityEvents.FireInNUpdates(() =>
|
||||
{
|
||||
WhiteHoleVolume = QSBWorldSync.GetUnityObjects<WhiteHoleVolume>().First();
|
||||
QSBWorldSync.Init<QSBMeteorLauncher, MeteorLauncher>();
|
||||
QSBWorldSync.Init<QSBMeteor, MeteorController>();
|
||||
QSBWorldSync.Init<QSBFragment, FragmentIntegrity>();
|
||||
WhiteHoleVolume = QSBWorldSync.GetUnityObjects<WhiteHoleVolume>().First();
|
||||
Ready = true;
|
||||
}, 10);
|
||||
}
|
||||
|
@ -105,5 +105,13 @@ namespace QSB.MeteorSync.Patches
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(MeteorController), nameof(MeteorController.Impact))]
|
||||
public static bool Impact(MeteorController __instance,
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using QSB.WorldSync;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.MeteorSync.WorldObjects
|
||||
{
|
||||
@ -9,6 +10,11 @@ namespace QSB.MeteorSync.WorldObjects
|
||||
ObjectId = id;
|
||||
AttachedObject = attachedObject;
|
||||
DetachableFragment = AttachedObject.GetRequiredComponent<DetachableFragment>();
|
||||
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
LeashLength = Random.Range(MeteorManager.WhiteHoleVolume._debrisDistMin, MeteorManager.WhiteHoleVolume._debrisDistMax);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRemoval()
|
||||
@ -19,17 +25,13 @@ namespace QSB.MeteorSync.WorldObjects
|
||||
|
||||
public DetachableFragment DetachableFragment;
|
||||
public bool IsThruWhiteHole => DetachableFragment._sector._parentSector == MeteorManager.WhiteHoleVolume._whiteHoleSector;
|
||||
public OWRigidbody refBody => IsThruWhiteHole ? MeteorManager.WhiteHoleVolume._whiteHoleBody :
|
||||
Locator._brittleHollow._owRigidbody;
|
||||
public OWRigidbody Body => IsThruWhiteHole ? AttachedObject.transform.parent.parent.GetAttachedOWRigidbody() :
|
||||
AttachedObject.GetAttachedOWRigidbody();
|
||||
|
||||
public float LeashLength
|
||||
{
|
||||
get => AttachedObject.GetComponent<DebrisLeash>()._leashLength;
|
||||
set
|
||||
{
|
||||
var debrisLeash = AttachedObject.GetComponent<DebrisLeash>();
|
||||
debrisLeash._deccelerating = false;
|
||||
debrisLeash._leashLength = value;
|
||||
}
|
||||
}
|
||||
/// what the leash length will be when we eventually detach and fall thru white hole
|
||||
public float LeashLength;
|
||||
|
||||
public void AddDamage(float damage)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user