attempt fix mega + gyro

This commit is contained in:
RandomityGuy 2024-05-28 20:13:52 +05:30
parent 3999836d41
commit 638ed7b3da

View file

@ -999,17 +999,19 @@ class Marble extends GameObject {
var hardBounceSpeed = minVelocityBounceHard; var hardBounceSpeed = minVelocityBounceHard;
var bounceSoundNum = Math.floor(Math.random() * 4); var bounceSoundNum = Math.floor(Math.random() * 4);
var sndList = ((time - this.megaMarbleEnableTime < 10) var sndList = ((time - this.megaMarbleEnableTime < 10)
|| (this.megaMarbleUseTick > 0 && (this.level.timeState.ticks - this.megaMarbleUseTick) < 312)) ? [ || (this.megaMarbleUseTick > 0
"data/sound/mega_bouncehard1.wav", && ((Net.isHost && (this.level.timeState.ticks - this.megaMarbleUseTick) <= 312)
"data/sound/mega_bouncehard2.wav", || (Net.isClient && (this.serverTicks - this.megaMarbleUseTick) <= 312)))) ? [
"data/sound/mega_bouncehard3.wav", "data/sound/mega_bouncehard1.wav",
"data/sound/mega_bouncehard4.wav" "data/sound/mega_bouncehard2.wav",
] : [ "data/sound/mega_bouncehard3.wav",
"data/sound/bouncehard1.wav", "data/sound/mega_bouncehard4.wav"
"data/sound/bouncehard2.wav", ] : [
"data/sound/bouncehard3.wav", "data/sound/bouncehard1.wav",
"data/sound/bouncehard4.wav" "data/sound/bouncehard2.wav",
]; "data/sound/bouncehard3.wav",
"data/sound/bouncehard4.wav"
];
var snd = ResourceLoader.getResource(sndList[bounceSoundNum], ResourceLoader.getAudio, this.soundResources); var snd = ResourceLoader.getResource(sndList[bounceSoundNum], ResourceLoader.getAudio, this.soundResources);
@ -1065,7 +1067,9 @@ class Marble extends GameObject {
slipVolume = 0; slipVolume = 0;
if (time.currentAttemptTime - this.megaMarbleEnableTime < 10 if (time.currentAttemptTime - this.megaMarbleEnableTime < 10
|| (this.megaMarbleUseTick > 0 && (this.level.timeState.ticks - this.megaMarbleUseTick) < 312)) { || (this.megaMarbleUseTick > 0
&& ((Net.isHost && (this.level.timeState.ticks - this.megaMarbleUseTick) <= 312)
|| (Net.isClient && (this.serverTicks - this.megaMarbleUseTick) <= 312)))) {
if (this.rollMegaSound != null) { if (this.rollMegaSound != null) {
rollMegaSound.volume = rollVolume; rollMegaSound.volume = rollVolume;
rollSound.volume = 0; rollSound.volume = 0;
@ -1702,7 +1706,7 @@ class Marble extends GameObject {
if (this.megaMarbleUseTick > 0) { if (this.megaMarbleUseTick > 0) {
if (Net.isHost) { if (Net.isHost) {
if ((timeState.ticks - this.megaMarbleUseTick) < 312 && this.megaMarbleUseTick > 0) { if ((timeState.ticks - this.megaMarbleUseTick) <= 312 && this.megaMarbleUseTick > 0) {
this._radius = 0.675; this._radius = 0.675;
this.collider.radius = 0.675; this.collider.radius = 0.675;
} else if ((timeState.ticks - this.megaMarbleUseTick) > 312) { } else if ((timeState.ticks - this.megaMarbleUseTick) > 312) {
@ -1715,7 +1719,7 @@ class Marble extends GameObject {
} }
} }
if (Net.isClient) { if (Net.isClient) {
if (this.serverTicks - this.megaMarbleUseTick < 312 && this.megaMarbleUseTick > 0) { if (this.serverTicks - this.megaMarbleUseTick <= 312 && this.megaMarbleUseTick > 0) {
this._radius = 0.675; this._radius = 0.675;
this.collider.radius = 0.675; this.collider.radius = 0.675;
} else { } else {
@ -2226,7 +2230,8 @@ class Marble extends GameObject {
if (this.level == null) if (this.level == null)
return 1; return 1;
if (this.level.timeState.currentAttemptTime - this.megaMarbleEnableTime < 10 if (this.level.timeState.currentAttemptTime - this.megaMarbleEnableTime < 10
|| (this.megaMarbleUseTick > 0 && (this.level.timeState.ticks - this.megaMarbleUseTick) < 312)) { || (Net.isHost && this.megaMarbleUseTick > 0 && (this.level.timeState.ticks - this.megaMarbleUseTick) < 312)
|| (Net.isClient && this.megaMarbleUseTick > 0 && (this.serverTicks - this.megaMarbleUseTick) < 312)) {
return 5; return 5;
} else { } else {
return 1; return 1;