mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-10 21:40:19 +00:00
fix probe not working
This commit is contained in:
parent
f4483b27b3
commit
11bf557464
@ -27,21 +27,6 @@ namespace QSB.ProbeSync.Events
|
|||||||
var player = QSBPlayerManager.GetPlayer(message.AboutId);
|
var player = QSBPlayerManager.GetPlayer(message.AboutId);
|
||||||
var probe = player.Probe;
|
var probe = player.Probe;
|
||||||
|
|
||||||
switch (message.EnumValue)
|
|
||||||
{
|
|
||||||
case ProbeEvent.Anchor:
|
|
||||||
case ProbeEvent.Unanchor:
|
|
||||||
case ProbeEvent.Launch:
|
|
||||||
player.PlayerStates.ProbeActive = true;
|
|
||||||
probe.SetState(true);
|
|
||||||
break;
|
|
||||||
case ProbeEvent.Destroy:
|
|
||||||
case ProbeEvent.Retrieve:
|
|
||||||
player.PlayerStates.ProbeActive = false;
|
|
||||||
probe.SetState(false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
probe.HandleEvent(message.EnumValue);
|
probe.HandleEvent(message.EnumValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using QSB.Utility;
|
using QSB.Player;
|
||||||
|
using QSB.Utility;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace QSB.ProbeSync
|
namespace QSB.ProbeSync
|
||||||
@ -19,6 +20,7 @@ namespace QSB.ProbeSync
|
|||||||
private RulesetDetector _rulesetDetector;
|
private RulesetDetector _rulesetDetector;
|
||||||
private SingularityWarpEffect _warpEffect;
|
private SingularityWarpEffect _warpEffect;
|
||||||
private bool _isRetrieving;
|
private bool _isRetrieving;
|
||||||
|
private PlayerInfo _owner;
|
||||||
|
|
||||||
public RulesetDetector GetRulesetDetector()
|
public RulesetDetector GetRulesetDetector()
|
||||||
=> _rulesetDetector;
|
=> _rulesetDetector;
|
||||||
@ -32,31 +34,49 @@ namespace QSB.ProbeSync
|
|||||||
_isRetrieving = false;
|
_isRetrieving = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
private void Start()
|
||||||
|
{
|
||||||
|
gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void OnDestroy()
|
||||||
{
|
{
|
||||||
_warpEffect.OnWarpComplete -= OnWarpComplete;
|
_warpEffect.OnWarpComplete -= OnWarpComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetOwner(PlayerInfo player)
|
||||||
|
{
|
||||||
|
if (_owner != null)
|
||||||
|
{
|
||||||
|
DebugLog.ToConsole($"Warning - Trying to set owner of probe that already has an owner!", OWML.Common.MessageType.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
_owner = player;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnWarpComplete()
|
private void OnWarpComplete()
|
||||||
{
|
{
|
||||||
DebugLog.DebugWrite($"OnWarpComplete");
|
DebugLog.DebugWrite($"OnWarpComplete");
|
||||||
//gameObject.SetActive(false);
|
gameObject.SetActive(false);
|
||||||
|
transform.parent = null;
|
||||||
transform.localScale = Vector3.one;
|
transform.localScale = Vector3.one;
|
||||||
_isRetrieving = false;
|
_isRetrieving = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsRetrieving()
|
public bool IsRetrieving()
|
||||||
{
|
=> IsLaunched() && _isRetrieving;
|
||||||
return IsLaunched() && _isRetrieving;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsLaunched()
|
public bool IsLaunched()
|
||||||
{
|
=> gameObject.activeSelf;
|
||||||
return gameObject.activeSelf;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HandleEvent(ProbeEvent probeEvent)
|
public void HandleEvent(ProbeEvent probeEvent)
|
||||||
{
|
{
|
||||||
|
if (_owner == null)
|
||||||
|
{
|
||||||
|
DebugLog.ToConsole($"Error - Trying to handle event on probe with no owner.", OWML.Common.MessageType.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (probeEvent)
|
switch (probeEvent)
|
||||||
{
|
{
|
||||||
case ProbeEvent.Launch:
|
case ProbeEvent.Launch:
|
||||||
@ -66,6 +86,13 @@ namespace QSB.ProbeSync
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebugLog.DebugWrite($"LAUNCH!");
|
||||||
|
|
||||||
|
gameObject.SetActive(true);
|
||||||
|
transform.parent = null;
|
||||||
|
transform.position = _owner.ProbeLauncher.transform.position;
|
||||||
|
transform.rotation = _owner.ProbeLauncher.transform.rotation;
|
||||||
|
|
||||||
OnLaunchProbe();
|
OnLaunchProbe();
|
||||||
break;
|
break;
|
||||||
case ProbeEvent.Anchor:
|
case ProbeEvent.Anchor:
|
||||||
@ -75,10 +102,15 @@ namespace QSB.ProbeSync
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebugLog.DebugWrite($"ANCHOR!");
|
||||||
|
|
||||||
OnAnchorProbe();
|
OnAnchorProbe();
|
||||||
break;
|
break;
|
||||||
case ProbeEvent.Unanchor:
|
case ProbeEvent.Unanchor:
|
||||||
DebugLog.DebugWrite($"OnUnanchorProbe");
|
DebugLog.DebugWrite($"OnUnanchorProbe");
|
||||||
|
|
||||||
|
DebugLog.DebugWrite($"UNANCHOR!");
|
||||||
|
|
||||||
OnUnanchorProbe();
|
OnUnanchorProbe();
|
||||||
break;
|
break;
|
||||||
case ProbeEvent.Retrieve:
|
case ProbeEvent.Retrieve:
|
||||||
@ -88,6 +120,8 @@ namespace QSB.ProbeSync
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebugLog.DebugWrite($"RETRIEVE!");
|
||||||
|
|
||||||
OnRetrieveProbe();
|
OnRetrieveProbe();
|
||||||
break;
|
break;
|
||||||
case ProbeEvent.Destroy:
|
case ProbeEvent.Destroy:
|
||||||
@ -115,23 +149,14 @@ namespace QSB.ProbeSync
|
|||||||
DebugLog.DebugWrite($"start warp out");
|
DebugLog.DebugWrite($"start warp out");
|
||||||
_warpEffect.WarpObjectOut(duration);
|
_warpEffect.WarpObjectOut(duration);
|
||||||
|
|
||||||
if (_warpEffect.gameObject.activeInHierarchy == false)
|
if (OnStartRetrieveProbe == null)
|
||||||
{
|
{
|
||||||
DebugLog.DebugWrite($"warp effect GO is not active!");
|
DebugLog.ToConsole($"Warning - OnStartRetrieveProbe is null!", OWML.Common.MessageType.Warning);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetState(bool state)
|
|
||||||
{
|
|
||||||
if (state)
|
|
||||||
{
|
|
||||||
gameObject.SetActive(true);
|
|
||||||
gameObject.Show();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gameObject.Hide();
|
OnStartRetrieveProbe(duration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -44,6 +44,7 @@ namespace QSB.Tools
|
|||||||
{
|
{
|
||||||
var qsbProbe = newProbe.gameObject.AddComponent<QSBProbe>();
|
var qsbProbe = newProbe.gameObject.AddComponent<QSBProbe>();
|
||||||
player.Probe = qsbProbe;
|
player.Probe = qsbProbe;
|
||||||
|
qsbProbe.SetOwner(player);
|
||||||
|
|
||||||
// Probe_Body
|
// Probe_Body
|
||||||
Object.Destroy(newProbe.GetComponent<ProbeAnchor>());
|
Object.Destroy(newProbe.GetComponent<ProbeAnchor>());
|
||||||
@ -154,6 +155,8 @@ namespace QSB.Tools
|
|||||||
newProbe.Find("RecallEffect").gameObject.GetComponent<SingularityController>().enabled = true;
|
newProbe.Find("RecallEffect").gameObject.GetComponent<SingularityController>().enabled = true;
|
||||||
newProbe.Find("RecallEffect").gameObject.GetComponent<SingularityWarpEffect>().enabled = true;
|
newProbe.Find("RecallEffect").gameObject.GetComponent<SingularityWarpEffect>().enabled = true;
|
||||||
newProbe.Find("RecallEffect").name = "RemoteProbeRecallEffect";
|
newProbe.Find("RecallEffect").name = "RemoteProbeRecallEffect";
|
||||||
|
|
||||||
|
newProbe.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CreateStowTransforms(Transform cameraBody)
|
private static void CreateStowTransforms(Transform cameraBody)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user