Skip to content

Commit

Permalink
more anti-cheat
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLikesKirby committed Jun 17, 2024
1 parent 656f24f commit 0916bb7
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 13 deletions.
2 changes: 2 additions & 0 deletions source/PauseSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ class PauseSubState extends MusicBeatSubstate
FlxG.mouse.visible = false;
FreeplayState.isaCustomSong = false;
PlayState.blueBalls = 0;
PlayState.chartEditorMode = false;
PlayState.cantSaveScore = false;
if (PlayState.isStoryMode) {
FlxG.switchState(new StoryMenuState());
} else {
Expand Down
135 changes: 122 additions & 13 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ class PlayState extends MusicBeatState

var talking:Bool = true;
var songScore:Int = 0;
public static var chartEditorMode:Bool = false;
public static var cantSaveScore:Bool = false;

public static var blueBalls:Int = 0;

Expand Down Expand Up @@ -628,7 +630,7 @@ class PlayState extends MusicBeatState

pMode = FlxG.save.data.practiceMode;

notbeingalittleCheater = !botPlay && !pMode && !oppM;
notbeingalittleCheater = !botPlay && !pMode && !oppM && !cantSaveScore;
trace(notbeingalittleCheater);

modchartoption = !FlxG.save.data.modchart;
Expand Down Expand Up @@ -4028,6 +4030,8 @@ class PlayState extends MusicBeatState
FlxG.switchState(new PlayState());
return;
default:
chartEditorMode = true;
cantSaveScore = true;
#if SHADERS_ENABLED
resetShader();
#end
Expand All @@ -4041,6 +4045,8 @@ class PlayState extends MusicBeatState
if (adminMode) {
if (FlxG.keys.justPressed.THREE)
{
chartEditorMode = true;
cantSaveScore = true;
if(FlxTransitionableState.skipNextTransIn)
{
Transition.nextCamera = null;
Expand Down Expand Up @@ -4141,6 +4147,7 @@ class PlayState extends MusicBeatState
FlxG.switchState(new AnimationDebug(boyfriend.curCharacter));
if (FlxG.keys.justPressed.TWO) //Go 10 seconds into the future :O
{
cantSaveScore = true;
FlxG.sound.music.pause();
vocals.pause();
boyfriend.stunned = true;
Expand Down Expand Up @@ -4632,7 +4639,17 @@ class PlayState extends MusicBeatState

if (adminMode) {
if (FlxG.keys.justPressed.ONE)
if (!chartEditorMode) {
endSong();
} else {
#if SHADERS_ENABLED
resetShader();
#end
FlxG.switchState(new ChartingState());
#if desktop
DiscordClient.changePresence("Chart Editor", null, null, true);
#end
}
}

if (updatevels)
Expand Down Expand Up @@ -4848,11 +4865,32 @@ class PlayState extends MusicBeatState
new FlxTimer().start(5.5, function(timer:FlxTimer)
{
if(isStoryMode) {
if (!chartEditorMode) {
FlxG.sound.music.stop();
nextSong();
} else {
FlxG.sound.music.stop();
#if SHADERS_ENABLED
resetShader();
#end
FlxG.switchState(new ChartingState());
#if desktop
DiscordClient.changePresence("Chart Editor", null, null, true);
#end
}
}
else {
FlxG.switchState(new FreeplayState());
if (!chartEditorMode) {
FlxG.switchState(new ResultsScreen());
} else {
#if SHADERS_ENABLED
resetShader();
#end
FlxG.switchState(new ChartingState());
#if desktop
DiscordClient.changePresence("Chart Editor", null, null, true);
#end
}
}
});
}
Expand Down Expand Up @@ -4931,6 +4969,8 @@ class PlayState extends MusicBeatState
case 'roofs':
if (storyDifficulty == 0) CharacterSelectState.unlockCharacter('redshaggy');
}



if (isStoryMode)
{
Expand Down Expand Up @@ -4972,6 +5012,7 @@ class PlayState extends MusicBeatState
switch (curSong.toLowerCase())
{
case 'polygonized':
if (!chartEditorMode) {
CharacterSelectState.unlockCharacter('tristan');
if (health >= 0.1)
{
Expand All @@ -4990,6 +5031,15 @@ class PlayState extends MusicBeatState
{
FlxG.switchState(new EndingState('badEnding', 'badEnding'));
}
} else {
#if SHADERS_ENABLED
resetShader();
#end
FlxG.switchState(new ChartingState());
#if desktop
DiscordClient.changePresence("Chart Editor", null, null, true);
#end
}
case 'maze':
canPause = false;
FlxG.sound.music.volume = 0;
Expand All @@ -5000,9 +5050,19 @@ class PlayState extends MusicBeatState
doof.scrollFactor.set();
doof.finishThing = function()
{
if (!chartEditorMode) {
CharacterSelectState.unlockCharacter('bambi-new');
FlxG.sound.playMusic(Paths.music('freakyMenu'));
FlxG.switchState(new StoryMenuState());
} else {
#if SHADERS_ENABLED
resetShader();
#end
FlxG.switchState(new ChartingState());
#if desktop
DiscordClient.changePresence("Chart Editor", null, null, true);
#end
}
};
doof.cameras = [camDialogue];
schoolIntro(doof, false);
Expand All @@ -5016,18 +5076,48 @@ class PlayState extends MusicBeatState
doof.scrollFactor.set();
doof.finishThing = function()
{
if (!chartEditorMode) {
FlxG.sound.playMusic(Paths.music('freakyMenu'));
FlxG.switchState(new StoryMenuState());
} else {
#if SHADERS_ENABLED
resetShader();
#end
FlxG.switchState(new ChartingState());
#if desktop
DiscordClient.changePresence("Chart Editor", null, null, true);
#end
}
};
doof.cameras = [camDialogue];
schoolIntro(doof, false);
case 'rano':
if (!chartEditorMode) {
var menu:CreditsMenuState = new CreditsMenuState();
menu.DoFunnyScroll = true;
FlxG.switchState(menu);
} else {
#if SHADERS_ENABLED
resetShader();
#end
FlxG.switchState(new ChartingState());
#if desktop
DiscordClient.changePresence("Chart Editor", null, null, true);
#end
}
default:
if (!chartEditorMode) {
FlxG.sound.playMusic(Paths.music('freakyMenu'));
FlxG.switchState(new StoryMenuState());
} else {
#if SHADERS_ENABLED
resetShader();
#end
FlxG.switchState(new ChartingState());
#if desktop
DiscordClient.changePresence("Chart Editor", null, null, true);
#end
}
}
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;
Expand Down Expand Up @@ -5102,12 +5192,32 @@ class PlayState extends MusicBeatState
STUPDVARIABLETHATSHOULDNTBENEEDED = marcello;
new FlxTimer().start(5.5, THROWPHONEMARCELLO);
default:
if (!chartEditorMode) {
nextSong();
} else {
#if SHADERS_ENABLED
resetShader();
#end
FlxG.switchState(new ChartingState());
#if desktop
DiscordClient.changePresence("Chart Editor", null, null, true);
#end
}
}
}
}
else
{
rssongScore = songScore;
rsmisses = misses;
rsaccuracy = truncateFloat(accuracy, 2);
rsshits = shits;
rsbads = bads;
rsgoods = goods;
rssicks = sicks;
rscombo = maxCombo;
rstotalNotesHit = noteHits;
rssong = kadeEngineWatermark.text;
if (storyDifficulty == 0) {
var completedSongs:Array<String> = [];
var mustCompleteSongs:Array<String> = ['House', 'Insanity', 'Polygonized', 'Blocked', 'Corn-Theft', 'Maze', 'Splitathon', 'Shredder', 'Greetings', 'Interdimensional', 'Rano'];
Expand Down Expand Up @@ -5163,18 +5273,17 @@ class PlayState extends MusicBeatState
}
return;
}
rssongScore = songScore;
rsmisses = misses;
rsaccuracy = truncateFloat(accuracy, 2);
rsshits = shits;
rsbads = bads;
rsgoods = goods;
rssicks = sicks;
rscombo = maxCombo;
rstotalNotesHit = noteHits;
rssong = kadeEngineWatermark.text;

if (!chartEditorMode) {
FlxG.switchState(new ResultsScreen());
} else {
#if SHADERS_ENABLED
resetShader();
#end
FlxG.switchState(new ChartingState());
#if desktop
DiscordClient.changePresence("Chart Editor", null, null, true);
#end
}
}
if(FlxTransitionableState.skipNextTransIn)
{
Expand Down

0 comments on commit 0916bb7

Please sign in to comment.