Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
mcagabe19 committed Jan 13, 2025
2 parents f7d0e58 + ae5c019 commit 2c72811
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 62 deletions.
7 changes: 0 additions & 7 deletions source/modding/scripts/languages/HScript.hx
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,7 @@ class HScript extends Script {
}

override public function destroy(){
interp?.variables?.clear();
parser = null;
program = null;
interp = null;

for (script in otherScripts) {
script?.destroy();
}
}

override public function setup() {
Expand Down
7 changes: 5 additions & 2 deletions source/modding/scripts/languages/LuaScript.hx
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ class LuaScript extends Script {

override public function destroy() {
trails.clear();
/*Lua.close(lua);
lua = null; */
Lua.close(lua);
}

function getLuaErrorMessage(l) {
Expand Down Expand Up @@ -1154,6 +1153,10 @@ class LuaScript extends Script {
return PlayState.instance.unspawnNotes.length;
});

setFunction("getUnspawnedNoteType", function(id:Int) {
return PlayState.instance.unspawnNotes[id].arrow_Type;
});

setFunction("getUnspawnedNoteNoteType", function(id:Int) {
return PlayState.instance.unspawnNotes[id].arrow_Type;
});
Expand Down
43 changes: 26 additions & 17 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ class PlayState extends MusicBeatState {
**/
var maxHealth:Float = 2;

/**
* Is the player dead?
*/
var dead(get, default):Bool = false;

/**
Current combo (or amount of notes hit in a row without a combo break).
**/
Expand Down Expand Up @@ -911,11 +916,11 @@ class PlayState extends MusicBeatState {
'assets/data/song data/${curSong.toLowerCase()}/',
'mods/${Options.getData("curMod")}/data/scripts/local/',
'mods/${Options.getData("curMod")}/data/song data/${curSong.toLowerCase()}/',
//PolymodAssets.getPath('data/scripts/global/')
// PolymodAssets.getPath('data/scripts/global/')
];

for(mod in ModList.getActiveMods(PolymodHandler.metadataArrays)){
if(FileSystem.exists('mods/$mod/data/scripts/global/')){
for (mod in ModList.getActiveMods(PolymodHandler.metadataArrays)) {
if (FileSystem.exists('mods/$mod/data/scripts/global/')) {
foldersToCheck.push('mods/$mod/data/scripts/global/');
}
}
Expand Down Expand Up @@ -1405,7 +1410,7 @@ class PlayState extends MusicBeatState {
var set:FlxSprite = new FlxSprite().loadGraphic(Paths.gpuBitmap('$introPath/set'));
set.scrollFactor.set();
set.updateHitbox();
set.antialiasing = ui_settings[3] == "true" && Options.getData("antialiasing");
set.antialiasing = ui_settings[3] == "true" && Options.getData("antialiasing");

set.setGraphicSize(set.width * Std.parseFloat(ui_settings[0]) * Std.parseFloat(ui_settings[7]));
set.updateHitbox();
Expand Down Expand Up @@ -2091,7 +2096,7 @@ class PlayState extends MusicBeatState {
if ((Options.getData("resetButton") && !switchedStates && controls.RESET) || (Options.getData("noHit") && misses > 0))
health = minHealth;

if (health <= minHealth && !switchedStates && !invincible && !Options.getData("noDeath")) {
if (dead) {
boyfriend.stunned = true;

persistentUpdate = false;
Expand Down Expand Up @@ -2994,17 +2999,17 @@ class PlayState extends MusicBeatState {
}
}

for (i in 0...justPressedArray.length) {
if (justPressedArray[i]) {
call("keyPressed", [i]);
for (i in 0...justPressedArray.length) {
if (justPressedArray[i]) {
call("keyPressed", [i ?? justPressedArray.length]);
}
}
}

for (i in 0...releasedArray.length) {
if (releasedArray[i]) {
call("keyReleased", [i]);
for (i in 0...releasedArray.length) {
if (releasedArray[i]) {
call("keyReleased", [i ?? justPressedArray.length]);
}
}
}

if (justPressedArray.contains(true) && generatedMusic) {
// variables
Expand Down Expand Up @@ -4035,8 +4040,6 @@ class PlayState extends MusicBeatState {
LuaScript.lua_Cameras.clear();
LuaScript.lua_Jsons.clear();

scripts.clear();
scripts = null;
}

function processEvent(event:Array<Dynamic>) {
Expand Down Expand Up @@ -4202,7 +4205,7 @@ class PlayState extends MusicBeatState {
}

function setupNoteTypeScript(noteType:String) {
if(FlxG.state != this)
if (FlxG.state != this)
return;
#if LUA_ALLOWED
if (!scripts.exists(noteType.toLowerCase()) && Assets.exists(Paths.lua("arrow types/" + noteType))) {
Expand Down Expand Up @@ -4251,7 +4254,8 @@ class PlayState extends MusicBeatState {
insert(members.indexOf(boyfriend), behind);
}

@:noCompletion function set_speed(speed:Float):Float {
@:noCompletion
function set_speed(speed:Float):Float {
if (Options.getData("useCustomScrollSpeed")) {
speed = Options.getData("customScrollSpeed") / songMultiplier;
}
Expand All @@ -4266,6 +4270,11 @@ class PlayState extends MusicBeatState {
return this.speed = speed;
}

@:noCompletion
inline function get_dead():Bool {
return health <= minHealth && !switchedStates && !invincible && !Options.getData("noDeath");
}

public function openChartEditor():Void
{
closeScripts();
Expand Down
41 changes: 19 additions & 22 deletions source/toolbox/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import flixel.FlxSprite;
import flixel.addons.display.FlxGridOverlay;
import flixel.addons.ui.FlxUI;
import flixel.addons.ui.FlxUICheckBox;
import flixel.addons.ui.FlxUIInputText;
import flixel.text.FlxInputText;
import flixel.addons.ui.FlxUINumericStepper;
import flixel.addons.ui.FlxUITabMenu;
import flixel.addons.ui.FlxUISlider;
Expand Down Expand Up @@ -71,12 +71,12 @@ class ChartingState extends MusicBeatState {

var difficulty:String = 'normal';

var typingShit:FlxUIInputText;
var swagShit:FlxUIInputText;
var modchart_Input:FlxUIInputText;
var cutscene_Input:FlxUIInputText;
var endCutscene_Input:FlxUIInputText;
var characterGroup_Input:FlxUIInputText;
var typingShit:FlxInputText;
var swagShit:FlxInputText;
var modchart_Input:FlxInputText;
var cutscene_Input:FlxInputText;
var endCutscene_Input:FlxInputText;
var characterGroup_Input:FlxInputText;

/*
* WILL BE THE CURRENT / LAST PLACED NOTE
Expand Down Expand Up @@ -383,11 +383,11 @@ class ChartingState extends MusicBeatState {
// interactive

// inputs
var UI_songTitle:FlxUIInputText = new FlxUIInputText(10, 30, 70, _song.song, 8);
var UI_songTitle:FlxInputText = new FlxInputText(10, 30, 70, _song.song, 8);
typingShit = UI_songTitle;
blockPressWhileTypingOn.push(typingShit);

var UI_songDiff:FlxUIInputText = new FlxUIInputText(10, UI_songTitle.y + UI_songTitle.height + 2, 70, PlayState.storyDifficultyStr, 8);
var UI_songDiff:FlxInputText = new FlxInputText(10, UI_songTitle.y + UI_songTitle.height + 2, 70, PlayState.storyDifficultyStr, 8);
swagShit = UI_songDiff;
blockPressWhileTypingOn.push(swagShit);

Expand Down Expand Up @@ -468,7 +468,7 @@ class ChartingState extends MusicBeatState {
updateGrid();
};

modchart_Input = new FlxUIInputText(10, check_mute_inst.y + check_mute_inst.height + 2, 70, _song.modchartPath, 8);
modchart_Input = new FlxInputText(10, check_mute_inst.y + check_mute_inst.height + 2, 70, _song.modchartPath, 8);

var check_modchart_tools:FlxUICheckBox = new FlxUICheckBox(modchart_Input.x + (modchart_Input.width * 2) + 20, modchart_Input.y, null, null,
"Modcharting Tools", 100);
Expand All @@ -479,8 +479,8 @@ class ChartingState extends MusicBeatState {
trace('CHECKED!');
};

cutscene_Input = new FlxUIInputText(modchart_Input.x, modchart_Input.y + modchart_Input.height + 2, 70, _song.cutscene, 8);
endCutscene_Input = new FlxUIInputText(cutscene_Input.x, cutscene_Input.y + cutscene_Input.height + 2, 70, _song.endCutscene, 8);
cutscene_Input = new FlxInputText(modchart_Input.x, modchart_Input.y + modchart_Input.height + 2, 70, _song.cutscene, 8);
endCutscene_Input = new FlxInputText(cutscene_Input.x, cutscene_Input.y + cutscene_Input.height + 2, 70, _song.endCutscene, 8);

blockPressWhileTypingOn.push(modchart_Input);
blockPressWhileTypingOn.push(cutscene_Input);
Expand Down Expand Up @@ -592,8 +592,8 @@ class ChartingState extends MusicBeatState {

var cameraShitThing:FlxObject = new FlxObject(0, 0, Std.int(FlxG.width / 2), 4);

var value1:FlxUIInputText;
var value2:FlxUIInputText;
var value1:FlxInputText;
var value2:FlxInputText;

var valueDescriptions:FlxText;

Expand Down Expand Up @@ -622,8 +622,8 @@ class ChartingState extends MusicBeatState {
blockPressWhileScrolling.push(eventDropDown);

// inputs
value1 = new FlxUIInputText(10, 60, 70, eventValue1, 8);
value2 = new FlxUIInputText(value1.x + value1.width + 2, value1.y, 70, eventValue2, 8);
value1 = new FlxInputText(10, 60, 70, eventValue1, 8);
value2 = new FlxInputText(value1.x + value1.width + 2, value1.y, 70, eventValue2, 8);

blockPressWhileTypingOn.push(value1);
blockPressWhileTypingOn.push(value2);
Expand Down Expand Up @@ -787,7 +787,7 @@ class ChartingState extends MusicBeatState {
cur_Note_Type = arrowTypes[Std.parseInt(type)];
});

characterGroup_Input = new FlxUIInputText(typeDropDown.x, setCharacterLeftSide.y + 22, 70, "", 8);
characterGroup_Input = new FlxInputText(typeDropDown.x, setCharacterLeftSide.y + 22, 70, "", 8);

typeDropDown.selectedLabel = cur_Note_Type;

Expand Down Expand Up @@ -1179,7 +1179,7 @@ class ChartingState extends MusicBeatState {

var beatSnap:Int = 16;

private var blockPressWhileTypingOn:Array<FlxUIInputText> = [];
private var blockPressWhileTypingOn:Array<FlxInputText> = [];
private var blockPressWhileTypingOnStepper:Array<FlxUINumericStepper> = [];
private var blockPressWhileScrolling:Array<FlxScrollableDropDownMenu> = [];

Expand All @@ -1199,10 +1199,7 @@ class ChartingState extends MusicBeatState {
if (!blockInput) {
for (stepper in blockPressWhileTypingOnStepper) {
@:privateAccess
var leText:Dynamic = stepper.text_field;
var leText:FlxUIInputText = leText;

if (leText.hasFocus) {
if (cast(stepper.text_field, flixel.addons.ui.FlxInputText).hasFocus) {
FlxG.sound.muteKeys = [];
FlxG.sound.volumeDownKeys = [];
FlxG.sound.volumeUpKeys = [];
Expand Down
6 changes: 3 additions & 3 deletions source/toolbox/StageMakingState.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package toolbox;

import flixel.addons.ui.FlxUIInputText;
import flixel.text.FlxInputText;
import flixel.addons.ui.FlxUINumericStepper;
import flixel.addons.ui.FlxUITabMenu;
import openfl.events.IOErrorEvent;
Expand Down Expand Up @@ -80,7 +80,7 @@ class StageMakingState extends MusicBeatState {
private var alphaStepper:FlxUINumericStepper;
private var alpha_Label:FlxText;

private var fileInput:FlxUIInputText;
private var fileInput:FlxInputText;
private var file_Label:FlxText;

private var scrollStepper:FlxUINumericStepper;
Expand Down Expand Up @@ -207,7 +207,7 @@ class StageMakingState extends MusicBeatState {
alpha_Label.scrollFactor.set();
alpha_Label.cameras = [camHUD];

fileInput = new FlxUIInputText(20, scaleStepper.y + scaleStepper.height + 2, 70, "", 8);
fileInput = new FlxInputText(20, scaleStepper.y + scaleStepper.height + 2, 70, "", 8);
fileInput.scrollFactor.set();
fileInput.cameras = [camHUD];

Expand Down
22 changes: 11 additions & 11 deletions source/toolbox/util/NewModState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import flixel.FlxG;
import utilities.Discord.DiscordClient;
#end
import states.MusicBeatState;
import flixel.addons.ui.FlxUIInputText;
import flixel.text.FlxInputText;
import lime.ui.FileDialog;
import lime.app.Application;
import flixel.tweens.FlxTween;
Expand All @@ -36,7 +36,7 @@ class NewModState extends MusicBeatState{
public var bg:FlxSprite;

public var modNameText:FlxText;
public var modName:FlxUIInputText;
public var modName:FlxInputText;

public var UI_box:FlxUITabMenu;

Expand All @@ -46,19 +46,19 @@ class NewModState extends MusicBeatState{
public var modIconPath:String = Paths.image('template mod');

public var descriptionText:FlxText;
public var description:FlxUIInputText;
public var description:FlxInputText;

public var authorText:FlxText;
public var author:FlxUIInputText;
public var author:FlxInputText;

public var modVersionText:FlxText;
public var modVersion:FlxUIInputText;
public var modVersion:FlxInputText;

public var checkAutoEnable:FlxUICheckBox;
public var checkHideModSwitch:FlxUICheckBox;

public var rpc_idText:FlxText;
public var rpc_id:FlxUIInputText;
public var rpc_id:FlxInputText;

public var createButton:FlxButton;

Expand Down Expand Up @@ -108,7 +108,7 @@ class NewModState extends MusicBeatState{
UI_box.addGroup(tab_Group_mod);
UI_box.scrollFactor.set();

modName = new FlxUIInputText(400, 250);
modName = new FlxInputText(400, 250);
add(modName);

modNameText = new FlxText();
Expand Down Expand Up @@ -144,7 +144,7 @@ class NewModState extends MusicBeatState{
modIcon.y = modNameText.y + 100;
add(modIcon);

description = new FlxUIInputText(modName.x + 300, modName.y);
description = new FlxInputText(modName.x + 300, modName.y);
add(description);

descriptionText = new FlxText();
Expand All @@ -155,7 +155,7 @@ class NewModState extends MusicBeatState{
descriptionText.text = "Description";
add(descriptionText);

author = new FlxUIInputText(description.x , description.y + 45);
author = new FlxInputText(description.x , description.y + 45);
add(author);

authorText = new FlxText();
Expand All @@ -167,7 +167,7 @@ class NewModState extends MusicBeatState{
add(authorText);


modVersion = new FlxUIInputText(authorText.x , authorText.y + 120);
modVersion = new FlxInputText(authorText.x , authorText.y + 120);
modVersion.text = "1.0.0";
add(modVersion);

Expand All @@ -179,7 +179,7 @@ class NewModState extends MusicBeatState{
modVersionText.text = "Mod Version\n(Must follow *.*.*)";
add(modVersionText);

rpc_id = new FlxUIInputText(description.x, modName.y + 300);
rpc_id = new FlxInputText(description.x, modName.y + 300);
add(rpc_id);

rpc_idText = new FlxText();
Expand Down

0 comments on commit 2c72811

Please sign in to comment.