Skip to content

Commit

Permalink
Merge branch 'main' of github.com:riconutss/troll-engine
Browse files Browse the repository at this point in the history
  • Loading branch information
nebulazorua committed Sep 10, 2023
2 parents f0ab8b1 + c36d0b9 commit c131fe2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 26 deletions.
30 changes: 7 additions & 23 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3683,7 +3683,6 @@ class PlayState extends MusicBeatState
if (!ClientPrefs.ghostTapping)
{
noteMissPress(data);
callOnScripts('noteMissPress', [data]);
}
}
}
Expand Down Expand Up @@ -3819,16 +3818,10 @@ class PlayState extends MusicBeatState

if(callOnHScripts("preNoteMiss", [daNote, field]) == Globals.Function_Stop)
return;
#if LUA_ALLOWED
if(callOnLuas('preNoteMiss', [notes.members.indexOf(daNote), daNote.noteData, daNote.noteType, daNote.isSustainNote, daNote.ID]) == Globals.Function_Stop)
return;
#end

if (daNote.noteScript!=null)
if (daNote.noteScript != null)
{
var script:FunkinScript = daNote.noteScript;

if(callScript(script, "preNoteMiss", [daNote, field]) == Globals.Function_Stop)
if (callScript(daNote.noteScript, "preNoteMiss", [daNote, field]) == Globals.Function_Stop)
return;
}

Expand Down Expand Up @@ -3952,7 +3945,8 @@ class PlayState extends MusicBeatState
//totalPlayed++;
//RecalculateRating();

FlxG.sound.play(Paths.soundRandom('missnote', 1, 3), ClientPrefs.missVolume*FlxG.random.float(0.9, 1));
if (ClientPrefs.missVolume > 0)
FlxG.sound.play(Paths.soundRandom('missnote', 1, 3), ClientPrefs.missVolume * FlxG.random.float(0.9, 1));

for (field in playfields.members)
{
Expand Down Expand Up @@ -4097,24 +4091,13 @@ class PlayState extends MusicBeatState
}
}

// Script shit
var isSus:Bool = note.isSustainNote; //GET OUT OF MY HEAD, GET OUT OF MY HEAD, GET OUT OF MY HEAD
var leData:Int = Math.round(Math.abs(note.noteData));
var leType:String = note.noteType;

if (note.noteScript != null)
{
var script:FunkinScript = note.noteScript;

if (callScript(script, "preGoodNoteHit", [note, field]) == Globals.Function_Stop)
if (callScript(note.noteScript, "preGoodNoteHit", [note, field]) == Globals.Function_Stop)
return;
}
if (callOnHScripts("preGoodNoteHit", [note, field]) == Globals.Function_Stop)
return;
#if LUA_ALLOWED
if (callOnLuas('preGoodNoteHit', [notes.members.indexOf(note), leData, leType, isSus, note.ID]) == Globals.Function_Stop)
return;
#end

if (cpuControlled) saveScore = false; // if botplay hits a note, then you lose scoring

Expand Down Expand Up @@ -4167,7 +4150,8 @@ class PlayState extends MusicBeatState
else if(chars.length==0)
chars = field.characters;

for(char in chars){
for (char in chars)
{
if (char.callOnScripts("playNote", [note, field]) == Globals.Function_Stop)
{
// nada
Expand Down
2 changes: 2 additions & 0 deletions source/hud/BaseHUD.hx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ class BaseHUD extends FlxSpriteGroup {
public function new(iP1:String, iP2:String, songName:String, stats:Stats)
{
super();
this.songName = songName;
this.stats = stats;
}

override public function update(elapsed:Float){
Expand Down
3 changes: 1 addition & 2 deletions source/hud/CommonHUD.hx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ class CommonHUD extends BaseHUD
public function new(iP1:String, iP2:String, songName:String, stats:Stats)
{
super(iP1, iP2, songName, stats);
this.stats = stats;
this.songName = songName;

if (!ClientPrefs.useEpics)
displayedJudges.remove("epic");

Expand Down
2 changes: 1 addition & 1 deletion source/hud/HScriptedHUD.hx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class HScriptedHUD extends BaseHUD {
private var script:FunkinHScript;
override public function new(iP1:String, iP2:String, songName:String, stats:Stats, script:FunkinHScript)
{
super(iP1, iP2, songName, stats);
this.script = script;
script.set("this", this);
script.set("add", add);
Expand All @@ -18,6 +17,7 @@ class HScriptedHUD extends BaseHUD {

stats.changedEvent.add(statChanged);

super(iP1, iP2, songName, stats);
script.call("createHUD", [iP1, iP2, songName]);
}

Expand Down

0 comments on commit c131fe2

Please sign in to comment.