Skip to content

Commit

Permalink
SCRIPT EDITOR FINALLY LETS GOOOOOOO
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesisfeline committed Feb 20, 2024
1 parent 58a6c85 commit b3184aa
Show file tree
Hide file tree
Showing 14 changed files with 189 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bugs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ body:
- Lua
- Source
- Lua and Source
- I am not modding
- I was just compiling
- Idk.
validations:
required: true

Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ jobs:
- name: Create Version Tag
run: echo "${{github.run_id}}" > VERSION
- name: Compile
run: |
haxelib fixrepo
haxelib run lime build Project.xml linux --app-version="4.0.0-${{ github.run_id}}"
run: haxelib run lime build Project.xml linux --app-version="4.0.0-${{ github.run_id}}"
- name: Publish Artifact
uses: actions/upload-artifact@v2.2.4
with:
Expand Down Expand Up @@ -115,9 +113,7 @@ jobs:
- name: Create Version Tag
run: echo "${{github.run_id}}" > VERSION
- name: Compile
run: |
haxelib fixrepo
haxelib run lime build mac --app-version="4.0.0-${{ github.run_id}}"
run: haxelib run lime build mac --app-version="4.0.0-${{ github.run_id}}"
- name: Publish Artifact
uses: actions/upload-artifact@v2.2.4
with:
Expand Down
5 changes: 5 additions & 0 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<define name="MODS_ALLOWED" if="desktop || mobile" />
<define name="HSCRIPT_ALLOWED" if="desktop || mobile" />
<define name="LUA_ALLOWED" if="desktop || mobile" />

<define name="CRASH_HANDLER" if="desktop" />
<define name="GITHUB_ALLOWED" />
<!--<define name="FREEPLAY_SECTIONS" />-->
Expand Down Expand Up @@ -93,6 +94,10 @@
<haxelib name="flixel-ui" />
<haxelib name="flixel-addons" />

<haxelib name="haxeui-core" />
<haxelib name="haxeui-openfl" />
<haxelib name="haxeui-flixel" />

<!--Psych stuff needed-->
<haxelib name="linc_luajit" if="LUA_ALLOWED"/>
<haxelib name="SScript" if="HSCRIPT_ALLOWED"/>
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Friday Night Funkin' - Vs. Foxa / Foxa Engine
# Friday Night Funkin' - Vs. Foxa / Alleyway Engine
Not a Psych fork again...

## Story
Expand Down Expand Up @@ -83,9 +83,9 @@ If you want to just play the mod and not compile, just use the action builds (ei

## Customization:

if you wish to disable things like *Lua & Haxe Scripts* or *Video Cutscenes*, you can read over to `Project.xml`
if you wish to disable things like *Lua Scripts* or *Video Cutscenes*, you can read over to `Project.xml`

inside `Project.xml`, you will find several variables to customize Vs. Foxa to your liking
inside `Project.xml`, you will find several variables to customize Vs. Foxa / Alleyway Engine to your liking

to start you off, disabling Videos should be simple, simply Delete the line `"VIDEOS_ALLOWED"` or comment it out by wrapping the line in XML-like comments, like this `<!-- YOUR_LINE_HERE -->`

Expand Down Expand Up @@ -153,6 +153,9 @@ _____________________________________
![Screenshot_3](https://user-images.githubusercontent.com/44785097/144629914-1fe55999-2f18-4cc1-bc70-afe616d74ae5.png)
* Working both for Source code modding and Downloaded builds!

### Built-in script editor
* You can now create or edit your Lua/HScript scripts inside the Chart Editor and Character Editor.

## Story mode menu rework:
![](https://i.imgur.com/UB2EKpV.png)
* Added a different BG to every song (less Tutorial)
Expand Down
15 changes: 15 additions & 0 deletions hmm.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@
"ref": "develop",
"url": "https://github.com/VsFoxaDevs/lime"
},
{
"name": "haxeui-core",
"type": "haxelib",
"version": null
},
{
"name": "haxeui-openfl",
"type": "haxelib",
"version": null
},
{
"name": "haxeui-flixel",
"type": "haxelib",
"version": null
},
{
"name": "openfl",
"type": "git",
Expand Down
4 changes: 4 additions & 0 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class Main extends Sprite

public static var fpsVar:FPS;

public static var instance:Main;

// You can pretty much ignore everything from here on - your code should go in your states.

public static function main():Void
Expand All @@ -70,6 +72,8 @@ class Main extends Sprite
#elseif ios
Sys.setCwd(lime.system.System.applicationStorageDirectory);
#end

instance = this;

if (stage != null)
{
Expand Down
6 changes: 3 additions & 3 deletions source/backend/Conductor.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ typedef BPMChangeEvent =

class Conductor
{
public static var bpm(default, set):Float = 100;
public static var bpm(default, set):Float = 100; // current bpm
public static var crochet:Float = ((60 / bpm) * 1000); // beats in milliseconds
public static var stepCrochet:Float = crochet / 4; // steps in milliseconds
public static var songPosition:Float = 0;
public static var offset:Float = 0;
public static var songPosition:Float = 0; // position of the song
public static var offset:Float = 0; // offset of the song

//public static var safeFrames:Int = 10;
public static var safeZoneOffset:Float = 0; // is calculated in create(), is safeFrames in milliseconds
Expand Down
2 changes: 1 addition & 1 deletion source/backend/Discord.hx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class DiscordClient
_options.details = details;
_options.state = state;
_options.largeImageKey = 'icon';
_options.largeImageText = "Engine Version: " + states.MainMenuState.psychEngineVersion;
_options.largeImageText = "Engine Version: " + states.MainMenuState.alleywayEngineVersion;
_options.smallImageKey = smallImageKey;
// Obtained times are in milliseconds so they are divided so Discord can use it
_options.startTimestamp = Std.int(startTimestamp / 1000);
Expand Down
22 changes: 16 additions & 6 deletions source/import.hx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#if !macro
//Discord API
// Discord API
#if desktop
import backend.Discord;
#end

//Psych
// Psych/Alleyway
#if LUA_ALLOWED
import llua.*;
import llua.Lua;
import psychlua.*;
import psychlua.FunkinLua;
#end

// FlxAnimate
#if flxanimate
import flxanimate.*;
#end
Expand All @@ -20,18 +21,26 @@ import flxanimate.*;
import backend.Achievements;
#end

// Sys
#if sys
import sys.*;
import sys.io.*;
#elseif js
import js.html.*;
#end

// math stuff
import math.*;
import math.Vector3;
import math.VectorHelpers;
//import extraflixel.FlxSprite3D;

// HaxeUI
import haxe.ui.*;
import haxe.ui.components.*;
import haxe.ui.containers.*;
import haxe.ui.containers.windows.*;
import haxe.ui.core.*;
import haxe.ui.events.*;
import backend.Paths;
import backend.Controls;
import backend.CoolUtil;
Expand All @@ -43,14 +52,12 @@ import backend.Conductor;
import backend.BaseStage;
import backend.Difficulty;
import backend.Mods;

import objects.Alphabet;
import objects.BGSprite;

import states.PlayState;
import states.LoadingState;

//Flixel
// Flixel
#if (flixel >= "5.3.0")
import flixel.sound.FlxSound;
#else
Expand All @@ -71,6 +78,7 @@ import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.addons.display.FlxBackdrop;
import flixel.addons.display.FlxGridOverlay;

// HxVLC
#if VIDEOS_ALLOWED
import hxvlc.flixel.*;
import hxvlc.flixel.FlxVideo;
Expand All @@ -80,8 +88,10 @@ import hxvlc.openfl.*;
import flixel.FlxBasic;
import flixel.util.FlxAxes;

import substates.ScriptEditorSubstate;
import states.editors.ChartingState;

// CPP
#if (cpp && windows)
import cppthing.CppApi;
#end
Expand Down
5 changes: 3 additions & 2 deletions source/psychlua/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ class FunkinLua {
set('ratingName', '');
set('ratingFC', '');
set('version', MainMenuState.psychEngineVersion.trim());
set('foxaVersion', 'v3.0');
set('alleywayVersion', MainMenuState.alleywayEngineVersion.trim());
set('foxaVersion', 'v3.0-SE');

set('inGameOver', false);
set('mustHitSection', false);
Expand Down Expand Up @@ -206,7 +207,7 @@ class FunkinLua {
set('splashSkinPostfix', NoteSplash.getSplashSkinPostfix());
set('splashAlpha', ClientPrefs.data.splashAlpha);

// build target (windows, mac, linux, etc.)
// build target (windows, mac, linux, android, etc.)
set('buildTarget', getBuildTarget());

for (name => func in customFunctions)
Expand Down
9 changes: 5 additions & 4 deletions source/states/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ typedef MainMenuData = {
}

class MainMenuState extends MusicBeatState {
public static var psychEngineVersion:String = '0.7.3-foxa'; //This is also used for Discord RPC
public static var psychEngineVersion:String = '0.7.3'; //This is also used for Discord RPC
public static var alleywayEngineVersion:String = '0.2';
public static var curSelected:Int = 0;
private var colorRotation:Int = 1;

Expand All @@ -55,7 +56,7 @@ class MainMenuState extends MusicBeatState {
#if html5
"You're on web. Why the FUCK are you on web? You can't get even decent easter eggs, bitch."
#elseif debug
"You want logs on debug? I'll give you logs on debug. Out of wood, easter eggs can't display like this."
"You want logs on debug? I'll give you logs on debug. Actually no, we're out of wood, becuz easter eggs can't display like this."
#else
"500+ Giftcards! (-CharlesCatYT)",
"bro became starfire from teen titans go (-Monomouse)",
Expand Down Expand Up @@ -182,12 +183,12 @@ class MainMenuState extends MusicBeatState {
char.antialiasing = ClientPrefs.data.antialiasing;
add(char);

final versionShit1:FlxText = new FlxText(12, FlxG.height - 84, 0, 'Alleyway Engine v$psychEngineVersion', 12);
final versionShit1:FlxText = new FlxText(12, FlxG.height - 84, 0, menuJunk.versionText + ' | Alleyway Engine v$alleywayEngineVersion', 12);
versionShit1.active = false;
versionShit1.scrollFactor.set();
versionShit1.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
add(versionShit1);
final versionShit2:FlxText = new FlxText(12, FlxG.height - 64, 0, menuJunk.versionText, 12);
final versionShit2:FlxText = new FlxText(12, FlxG.height - 64, 0, 'Based off on Psych Engine v$psychEngineVersion', 12);
versionShit2.active = false;
versionShit2.scrollFactor.set();
versionShit2.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
Expand Down
13 changes: 7 additions & 6 deletions source/states/editors/CharacterEditorState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CharacterEditorState extends MusicBeatState
var cameraZoomText:FlxText;
var frameAdvanceText:FlxText;

var testModeButton:FlxButton;
var scriptingButton:FlxButton;

var healthBar:Bar;
var healthIcon:HealthIcon;
Expand Down Expand Up @@ -147,20 +147,19 @@ class CharacterEditorState extends MusicBeatState
frameAdvanceText.cameras = [camHUD];
add(frameAdvanceText);

testModeButton = new FlxButton(FlxG.width - 360, 25, "Test OFF", () ->
scriptingButton = new FlxButton(FlxG.width - 360, 25, "Edit Script", () ->
{
testMode = !testMode;
testModeButton.text = (testMode = !testMode) ? "Test ON" : "Test OFF";
openScriptEditor();
});
testModeButton.cameras = [camHUD];
scriptingButton.cameras = [camHUD];

addHelpScreen();
FlxG.mouse.visible = true;
FlxG.camera.zoom = 1;

makeUIMenu();

add(testModeButton);
add(scriptingButton);

updatePointerPos();
updateHealthBar();
Expand Down Expand Up @@ -1220,6 +1219,8 @@ class CharacterEditorState extends MusicBeatState
animationDropDown.setData(FlxUIDropDownMenu.makeStrIdLabelArray(animList, true));
}

function openScriptEditor() {openSubState(new ScriptEditorSubstate());}

// save
var _file:FileReference;
function onSaveComplete(_):Void
Expand Down
7 changes: 7 additions & 0 deletions source/states/editors/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,10 @@ class ChartingState extends MusicBeatState
player2DropDown.selectedLabel = _song.player2;
blockPressWhileScrolling.push(player2DropDown);

var scriptEditor:FlxButton = new FlxButton(player1DropDown.x, player2DropDown.y + 100, "Edit Script", function() {
openScriptEditor();
});

#if MODS_ALLOWED
var directories:Array<String> = [Paths.mods('stages/'), Paths.mods(Mods.currentModDirectory + '/stages/'), Paths.getSharedPath('stages/')];
for(mod in Mods.getGlobalMods())
Expand Down Expand Up @@ -622,6 +626,7 @@ class ChartingState extends MusicBeatState
tab_group_song.add(loadEventJson);
tab_group_song.add(stepperBPM);
tab_group_song.add(stepperSpeed);
tab_group_song.add(scriptEditor);
tab_group_song.add(new FlxText(stepperBPM.x, stepperBPM.y - 15, 0, 'Song BPM:'));
tab_group_song.add(new FlxText(stepperBPM.x + 100, stepperBPM.y - 15, 0, 'Song Offset:'));
tab_group_song.add(new FlxText(stepperSpeed.x, stepperSpeed.y - 15, 0, 'Song Speed:'));
Expand Down Expand Up @@ -3199,6 +3204,8 @@ class ChartingState extends MusicBeatState
return FlxSort.byValues(FlxSort.ASCENDING, Obj1[0], Obj2[0]);
}

function openScriptEditor() {openSubState(new ScriptEditorSubstate());}

private function saveEvents()
{
if(_song.events != null && _song.events.length > 1) _song.events.sort(sortByTime);
Expand Down
Loading

0 comments on commit b3184aa

Please sign in to comment.