-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #647 from qsb-dev/dev
1.0.0
- Loading branch information
Showing
92 changed files
with
1,721 additions
and
562 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# These are supported funding model platforms | ||
|
||
patreon: qsb | ||
custom: ['paypal.me/nebula2056/5', 'paypal.me/johncorby/5'] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using OWML.Common; | ||
using QSB.PlayerBodySetup.Remote; | ||
using QSB.Utility; | ||
using UnityEngine; | ||
|
||
namespace QSB.Animation.Player; | ||
|
||
[UsedInUnityProject] | ||
public class HelmetAnimator : MonoBehaviour | ||
{ | ||
public Transform FakeHelmet; | ||
public Transform FakeHead; | ||
public GameObject SuitGroup; | ||
|
||
private QSBDitheringAnimator _fakeHelmetDitheringAnimator; | ||
|
||
private const float ANIM_TIME = 0.5f; | ||
private bool _isPuttingOnHelmet; | ||
private bool _isTakingOffHelmet; | ||
|
||
public void Start() | ||
{ | ||
_fakeHelmetDitheringAnimator = FakeHelmet.GetComponent<QSBDitheringAnimator>(); | ||
|
||
FakeHead.gameObject.SetActive(false); | ||
} | ||
|
||
public void RemoveHelmet() | ||
{ | ||
if (!SuitGroup.activeSelf) | ||
{ | ||
DebugLog.DebugWrite($"Trying to remove helmet when player is not wearing suit!", MessageType.Error); | ||
return; | ||
} | ||
|
||
_fakeHelmetDitheringAnimator.SetVisible(true); | ||
FakeHelmet.gameObject.SetActive(true); | ||
FakeHead.gameObject.SetActive(true); | ||
_fakeHelmetDitheringAnimator.SetVisible(false, ANIM_TIME); | ||
_isTakingOffHelmet = true; | ||
} | ||
|
||
public void PutOnHelmet() | ||
{ | ||
if (!SuitGroup.activeSelf) | ||
{ | ||
DebugLog.DebugWrite($"Trying to put on helmet when player is not wearing suit!", MessageType.Error); | ||
return; | ||
} | ||
|
||
_fakeHelmetDitheringAnimator.SetVisible(false); | ||
FakeHead.gameObject.SetActive(true); | ||
FakeHelmet.gameObject.SetActive(true); | ||
_fakeHelmetDitheringAnimator.SetVisible(true, ANIM_TIME); | ||
_isPuttingOnHelmet = true; | ||
} | ||
|
||
public void SetHelmetInstant(bool helmetOn) | ||
{ | ||
if (helmetOn) | ||
{ | ||
FakeHelmet.gameObject.SetActive(true); | ||
_fakeHelmetDitheringAnimator.SetVisible(true); | ||
FakeHead.gameObject.SetActive(false); | ||
} | ||
else | ||
{ | ||
_fakeHelmetDitheringAnimator.SetVisible(false); | ||
FakeHelmet.gameObject.SetActive(false); | ||
if (!SuitGroup.activeSelf) | ||
{ | ||
FakeHead.gameObject.SetActive(false); | ||
} | ||
} | ||
} | ||
|
||
private void Update() | ||
{ | ||
if (_isPuttingOnHelmet && _fakeHelmetDitheringAnimator.FullyVisible) | ||
{ | ||
_isPuttingOnHelmet = false; | ||
FakeHead.gameObject.SetActive(false); | ||
} | ||
|
||
if (_isTakingOffHelmet && _fakeHelmetDitheringAnimator.FullyInvisible) | ||
{ | ||
FakeHelmet.gameObject.SetActive(false); | ||
|
||
if (!SuitGroup.activeSelf) | ||
{ | ||
FakeHead.gameObject.SetActive(false); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using QSB.Messaging; | ||
using QSB.Player.TransformSync; | ||
using QSB.WorldSync; | ||
using QSB.Player; | ||
|
||
namespace QSB.Animation.Player.Messages; | ||
|
||
public class PlayerHelmetMessage : QSBMessage<bool> | ||
{ | ||
static PlayerHelmetMessage() | ||
{ | ||
GlobalMessenger.AddListener(OWEvents.PutOnHelmet, () => Handle(true)); | ||
GlobalMessenger.AddListener(OWEvents.RemoveHelmet, () => Handle(false)); | ||
} | ||
|
||
private static void Handle(bool on) | ||
{ | ||
if (PlayerTransformSync.LocalInstance) | ||
{ | ||
new PlayerHelmetMessage(on).Send(); | ||
} | ||
} | ||
|
||
public PlayerHelmetMessage(bool on) : base(on) { } | ||
|
||
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; | ||
|
||
public override void OnReceiveRemote() | ||
{ | ||
var player = QSBPlayerManager.GetPlayer(From); | ||
var animator = player.HelmetAnimator; | ||
if (Data) | ||
{ | ||
animator.PutOnHelmet(); | ||
player.AudioController.PlayWearHelmet(); | ||
} | ||
else | ||
{ | ||
animator.RemoveHelmet(); | ||
player.AudioController.PlayRemoveHelmet(); | ||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.