minor js fixes

This commit is contained in:
RandomityGuy 2023-07-22 21:16:46 +05:30
parent b0dc369fde
commit 19522a1f5c
3 changed files with 10 additions and 4 deletions

View file

@ -367,10 +367,10 @@ class Settings {
optionsSettings.reflectionDetail = 2;
if (controlsSettings.controllerVerticalCenter == null)
controlsSettings.controllerVerticalCenter = true;
if (controlsSettings.huntRandom == null)
controlsSettings.huntRandom = false;
if (controlsSettings.fastLoad == null)
controlsSettings.fastLoad = false;
if (optionsSettings.huntRandom == null)
optionsSettings.huntRandom = false;
if (optionsSettings.fastLoad == null)
optionsSettings.fastLoad = false;
#end
if (optionsSettings.maxPixelRatio == 0 #if js || optionsSettings.maxPixelRatio == null #end)
optionsSettings.maxPixelRatio = 1;

View file

@ -3,6 +3,7 @@ package fs;
import hxd.fs.LocalFileSystem;
import src.Settings;
#if hl
class TorqueFileEntry extends LocalEntry {
override function load(?onReady:Void->Void):Void {
#if macro
@ -17,6 +18,7 @@ class TorqueFileEntry extends LocalEntry {
#end
}
}
#end
class TorqueFileSystem extends LocalFileSystem {
#if hl

View file

@ -302,6 +302,7 @@ class MarblePickerGui extends GuiImage {
mbOpt.position = new Vector(380, yPos);
mbOpt.extent = new Vector(815, 94);
mbOpt.setCurrentOption(Settings.optionsSettings.marbleIndex);
var curToken = 0;
mbOpt.onChangeFunc = (idx) -> {
var selectedMarble = marbleData[idx];
Settings.optionsSettings.marbleIndex = idx;
@ -309,9 +310,12 @@ class MarblePickerGui extends GuiImage {
Settings.optionsSettings.marbleSkin = selectedMarble.skin;
Settings.optionsSettings.marbleModel = selectedMarble.dts;
Settings.optionsSettings.marbleShader = selectedMarble.shader;
var changeToken = curToken++;
ResourceLoader.load(Settings.optionsSettings.marbleModel).entry.load(() -> {
@:privateAccess MarbleGame.instance.previewWorld.removeMarble(myMarb);
@:privateAccess MarbleGame.instance.previewWorld.spawnMarble(marb -> {
if (changeToken + 1 != curToken)
return;
var spawnPos = @:privateAccess MarbleGame.instance.scene.camera.pos.add(new Vector(0, 1, 1));
var velAdd = new Vector((1 - 2 * Math.random()) * 2, (1 - 2 * Math.random()) * 1.5, (1 - 2 * Math.random()) * 1);
velAdd = velAdd.add(new Vector(0, 3, 0));