Skip to content

Commit

Permalink
Merge pull request #15360 from LarryFrosty/testing
Browse files Browse the repository at this point in the history
Small improvements
  • Loading branch information
ShadowMario authored Oct 10, 2024
2 parents 8911056 + d678f53 commit cf71a1c
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 13 deletions.
4 changes: 2 additions & 2 deletions source/psychlua/DeprecatedFunctions.hx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class DeprecatedFunctions

Lua_helper.add_callback(lua, "objectPlayAnimation", function(obj:String, name:String, forced:Bool = false, ?startFrame:Int = 0) {
FunkinLua.luaTrace("objectPlayAnimation is deprecated! Use playAnim instead", false, true);
if(PlayState.instance.getLuaObject(obj,false) != null) {
PlayState.instance.getLuaObject(obj,false).animation.play(name, forced, false, startFrame);
if(PlayState.instance.getLuaObject(obj) != null) {
PlayState.instance.getLuaObject(obj).animation.play(name, forced, false, startFrame);
return true;
}

Expand Down
16 changes: 8 additions & 8 deletions source/psychlua/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ class FunkinLua {

Lua_helper.add_callback(lua, "getMidpointX", function(variable:String) {
var split:Array<String> = variable.split('.');
var obj:FlxSprite = LuaUtils.getObjectDirectly(split[0]);
var obj:FlxObject = LuaUtils.getObjectDirectly(split[0]);
if(split.length > 1) {
obj = LuaUtils.getVarInArray(LuaUtils.getPropertyLoop(split), split[split.length-1]);
}
Expand All @@ -863,7 +863,7 @@ class FunkinLua {
});
Lua_helper.add_callback(lua, "getMidpointY", function(variable:String) {
var split:Array<String> = variable.split('.');
var obj:FlxSprite = LuaUtils.getObjectDirectly(split[0]);
var obj:FlxObject = LuaUtils.getObjectDirectly(split[0]);
if(split.length > 1) {
obj = LuaUtils.getVarInArray(LuaUtils.getPropertyLoop(split), split[split.length-1]);
}
Expand Down Expand Up @@ -893,7 +893,7 @@ class FunkinLua {
});
Lua_helper.add_callback(lua, "getScreenPositionX", function(variable:String, ?camera:String = 'game') {
var split:Array<String> = variable.split('.');
var obj:FlxSprite = LuaUtils.getObjectDirectly(split[0]);
var obj:FlxObject = LuaUtils.getObjectDirectly(split[0]);
if(split.length > 1) {
obj = LuaUtils.getVarInArray(LuaUtils.getPropertyLoop(split), split[split.length-1]);
}
Expand All @@ -903,7 +903,7 @@ class FunkinLua {
});
Lua_helper.add_callback(lua, "getScreenPositionY", function(variable:String, ?camera:String = 'game') {
var split:Array<String> = variable.split('.');
var obj:FlxSprite = LuaUtils.getObjectDirectly(split[0]);
var obj:FlxObject = LuaUtils.getObjectDirectly(split[0]);
if(split.length > 1) {
obj = LuaUtils.getVarInArray(LuaUtils.getPropertyLoop(split), split[split.length-1]);
}
Expand Down Expand Up @@ -994,8 +994,8 @@ class FunkinLua {
});

Lua_helper.add_callback(lua, "setScrollFactor", function(obj:String, scrollX:Float, scrollY:Float) {
if(game.getLuaObject(obj,false)!=null) {
game.getLuaObject(obj,false).scrollFactor.set(scrollX, scrollY);
if(game.getLuaObject(obj) != null) {
game.getLuaObject(obj).scrollFactor.set(scrollX, scrollY);
return;
}

Expand Down Expand Up @@ -1138,7 +1138,7 @@ class FunkinLua {
}

var split:Array<String> = obj.split('.');
var object:FlxSprite = LuaUtils.getObjectDirectly(split[0]);
var object:FlxBasic = LuaUtils.getObjectDirectly(split[0]);
if(split.length > 1) {
object = LuaUtils.getVarInArray(LuaUtils.getPropertyLoop(split), split[split.length-1]);
}
Expand Down Expand Up @@ -1171,7 +1171,7 @@ class FunkinLua {
return false;
});
Lua_helper.add_callback(lua, "screenCenter", function(obj:String, pos:String = 'xy') {
var spr:FlxSprite = game.getLuaObject(obj);
var spr:FlxObject = game.getLuaObject(obj);

if(spr==null){
var split:Array<String> = obj.split('.');
Expand Down
2 changes: 1 addition & 1 deletion source/psychlua/TextFunctions.hx
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,4 @@ class TextFunctions
}
});
}
}
}
2 changes: 1 addition & 1 deletion source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ class PlayState extends MusicBeatState
#end
}

public function getLuaObject(tag:String, text:Bool=true):FlxSprite
public function getLuaObject(tag:String):Dynamic
return variables.get(tag);

function startCharacterPos(char:Character, ?gfCheck:Bool = false) {
Expand Down
33 changes: 32 additions & 1 deletion source/states/stages/Template.hx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ class Template extends BaseStage
// Code here
}

override function destroy()
{
// Code here
}


override function countdownTick(count:BaseStage.Countdown, num:Int)
override function countdownTick(count:Countdown, num:Int)
{
switch(count)
{
Expand All @@ -37,6 +42,11 @@ class Template extends BaseStage
}
}

override function startSong()
{
// Code here
}

// Steps, Beats and Sections:
// curStep, curDecStep
// curBeat, curDecBeat
Expand Down Expand Up @@ -120,4 +130,25 @@ class Template extends BaseStage
}
}
}

// Note Hit/Miss
override function goodNoteHit(note:Note)
{
// Code here
}

override function opponentNoteHit(note:Note)
{
// Code here
}

override function noteMiss(note:Note)
{
// Code here
}

override function noteMissPress(direction:Int)
{
// Code here
}
}

0 comments on commit cf71a1c

Please sign in to comment.