Visible Toggle for strumlines
Default Hud Zoom Ability to disable scripts Fixed shader camera stuff
This commit is contained in:
@@ -4,7 +4,9 @@ import lime.app.Application;
|
||||
import flixel.util.FlxDestroyUtil.IFlxDestroyable;
|
||||
import haxe.io.Path;
|
||||
import hscript.IHScriptCustomConstructor;
|
||||
import flixel.util.FlxStringUtil;
|
||||
|
||||
@:allow(funkin.backend.scripting.ScriptPack)
|
||||
/**
|
||||
* Class used for scripting.
|
||||
*/
|
||||
@@ -159,6 +161,10 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
for(k=>e in getDefaultVariables(this)) {
|
||||
set(k, e);
|
||||
}
|
||||
set("disableScript", () -> {
|
||||
active = false;
|
||||
});
|
||||
set("__script__", this);
|
||||
}
|
||||
|
||||
|
||||
@@ -250,6 +256,17 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
], ERROR);
|
||||
}
|
||||
|
||||
override public function toString():String {
|
||||
return FlxStringUtil.getDebugString(didLoad ? [
|
||||
LabelValuePair.weak("path", path),
|
||||
LabelValuePair.weak("active", active),
|
||||
] : [
|
||||
LabelValuePair.weak("path", path),
|
||||
LabelValuePair.weak("active", active),
|
||||
LabelValuePair.weak("loaded", didLoad),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* PRIVATE HANDLERS - DO NOT TOUCH
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package funkin.backend.scripting;
|
||||
|
||||
import flixel.util.FlxStringUtil;
|
||||
import funkin.backend.scripting.events.CancellableEvent;
|
||||
|
||||
@:access(CancellableEvent)
|
||||
@@ -52,7 +53,8 @@ class ScriptPack extends Script {
|
||||
|
||||
public override function call(func:String, ?parameters:Array<Dynamic>):Dynamic {
|
||||
for(e in scripts)
|
||||
e.call(func, parameters);
|
||||
if(e.active)
|
||||
e.call(func, parameters);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -64,8 +66,9 @@ class ScriptPack extends Script {
|
||||
*/
|
||||
public inline function event<T:CancellableEvent>(func:String, event:T):T {
|
||||
for(e in scripts) {
|
||||
if(!e.active) continue;
|
||||
|
||||
e.call(func, [event]);
|
||||
@:privateAccess
|
||||
if (event.cancelled && !event.__continueCalls) break;
|
||||
}
|
||||
return event;
|
||||
@@ -95,7 +98,7 @@ class ScriptPack extends Script {
|
||||
public override function onDestroy() {
|
||||
for(e in scripts) e.destroy();
|
||||
}
|
||||
|
||||
|
||||
public override function onCreate(path:String) {}
|
||||
|
||||
public function add(script:Script) {
|
||||
@@ -117,4 +120,11 @@ class ScriptPack extends Script {
|
||||
script.setPublicMap(publicVariables);
|
||||
for(k=>e in additionalDefaultVariables) script.set(k, e);
|
||||
}
|
||||
|
||||
override public function toString():String {
|
||||
return FlxStringUtil.getDebugString([
|
||||
LabelValuePair.weak("parent", FlxStringUtil.getClassName(parent, true)),
|
||||
LabelValuePair.weak("total", scripts.length),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package funkin.backend.scripting.events;
|
||||
|
||||
import flixel.util.FlxDestroyUtil.IFlxDestroyable;
|
||||
|
||||
@:allow(ScriptPack)
|
||||
@:allow(funkin.backend.scripting.ScriptPack)
|
||||
@:autoBuild(funkin.backend.system.macros.EventMacro.build())
|
||||
@:noCustomClass
|
||||
class CancellableEvent implements IFlxDestroyable {
|
||||
|
||||
@@ -9,8 +9,8 @@ class CharterStrumline extends UISprite {
|
||||
public var strumLine:ChartStrumLine;
|
||||
public var hitsounds:Bool = true;
|
||||
|
||||
var healthIcon:HealthIcon;
|
||||
var button:CharterStrumlineButton;
|
||||
public var healthIcon:HealthIcon;
|
||||
public var button:CharterStrumlineButton;
|
||||
|
||||
public var curMenu:UIContextMenu = null;
|
||||
|
||||
@@ -24,6 +24,9 @@ class CharterStrumline extends UISprite {
|
||||
healthIcon = new HealthIcon(strumLine.characters != null ? strumLine.characters[0] : null);
|
||||
healthIcon.scale.set(80 / 150, 80 / 150);
|
||||
healthIcon.updateHitbox();
|
||||
if(strumLine.visible == null)
|
||||
strumLine.visible = true;
|
||||
healthIcon.alpha = strumLine.visible ? 1 : 0.4;
|
||||
|
||||
members.push(healthIcon);
|
||||
|
||||
@@ -81,6 +84,15 @@ class CharterStrumlineButton extends UITopMenuButton {
|
||||
icon: strLine.strumLine.type == ADDITIONAL ? 1 : 0
|
||||
},
|
||||
null,
|
||||
{
|
||||
label: "Visible",
|
||||
onSelect: function(_) {
|
||||
strLine.strumLine.visible = !strLine.strumLine.visible;
|
||||
strLine.healthIcon.alpha = strLine.strumLine.visible ? 1 : 0.4;
|
||||
},
|
||||
icon: strLine.strumLine.visible ? 1 : 0
|
||||
},
|
||||
null,
|
||||
{
|
||||
label: "Hitsounds",
|
||||
onSelect: function(_) {
|
||||
|
||||
@@ -348,6 +348,11 @@ class PlayState extends MusicBeatState
|
||||
*/
|
||||
public var defaultCamZoom:Float = 1.05;
|
||||
|
||||
/**
|
||||
* Camera zoom at which the hud lerps to.
|
||||
*/
|
||||
public var defaultHudZoom:Float = 1.0;
|
||||
|
||||
/**
|
||||
* Zoom for the pixel assets.
|
||||
*/
|
||||
@@ -658,6 +663,7 @@ class PlayState extends MusicBeatState
|
||||
|
||||
FlxG.camera.follow(camFollow, LOCKON, 0.04);
|
||||
FlxG.camera.zoom = defaultCamZoom;
|
||||
// camHUD.zoom = defaultHudZoom;
|
||||
if (smoothTransitionData != null && smoothTransitionData.stage == curStage) {
|
||||
FlxG.camera.scroll.set(smoothTransitionData.camX, smoothTransitionData.camY);
|
||||
FlxG.camera.zoom = smoothTransitionData.camZoom;
|
||||
@@ -1153,7 +1159,7 @@ class PlayState extends MusicBeatState
|
||||
if (camZooming)
|
||||
{
|
||||
FlxG.camera.zoom = lerp(FlxG.camera.zoom, defaultCamZoom, 0.05);
|
||||
camHUD.zoom = lerp(camHUD.zoom, 1, 0.05);
|
||||
camHUD.zoom = lerp(camHUD.zoom, defaultHudZoom, 0.05);
|
||||
}
|
||||
|
||||
// RESET = Quick Game Over Screen
|
||||
|
||||
Reference in New Issue
Block a user