Added @Player.QuitGame(doFade) command

Quits the game and goes back to the Main Menu (with optionally a fade out and in)
This commit is contained in:
JappaWakka 2024-04-26 09:51:59 +02:00
parent 6360c93368
commit d5d291bdda
2 changed files with 36 additions and 0 deletions

View File

@ -376,6 +376,41 @@
Dim newOpacity As Single = sng(argument.Replace("~", Screen.Level.OwnPlayer.Opacity.ToString().Replace(".", GameController.DecSeparator)))
Screen.Level.OwnPlayer.Opacity = newOpacity
IsReady = True
Case "quitgame"
'Reset VoltorbFlipScreen's Variables
VoltorbFlip.VoltorbFlipScreen.CurrentLevel = 1
VoltorbFlip.VoltorbFlipScreen.PreviousLevel = 1
VoltorbFlip.VoltorbFlipScreen.ConsecutiveWins = 0
VoltorbFlip.VoltorbFlipScreen.TotalFlips = 0
VoltorbFlip.VoltorbFlipScreen.CurrentCoins = 0
VoltorbFlip.VoltorbFlipScreen.TotalCoins = -1
If JoinServerScreen.Online = True Then
Core.ServersManager.ServerConnection.Disconnect()
End If
World.setDaytime = -1
World.setSeason = Nothing
Chat.ClearChat()
ScriptStorage.Clear()
GameModeManager.SetGameModePointer("Kolben")
Localization.LocalizationTokens.Clear()
Localization.LoadTokenFile(GameMode.DefaultLocalizationsPath, False)
Core.OffsetMaps.Clear()
TextureManager.TextureList.Clear()
TextureManager.TextureRectList.Clear()
Whirlpool.LoadedWaterTemp = False
Core.Player.RunToggled = False
If argument <> "" Then
If CBool(argument) = True Then
Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New PressStartScreen(), Color.Black, False, 15))
Else
Core.SetScreen(New PressStartScreen())
End If
Else
Core.SetScreen(New PressStartScreen())
End If
Core.Player.loadedSave = False
Case Else
IsReady = True
End Select

View File

@ -533,6 +533,7 @@ Namespace ScriptVersion2
r(New ScriptCommand("player", "setrivalname", {New ScriptArgument("name", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Sets the rival's name."))
r(New ScriptCommand("player", "setrivalskin", {New ScriptArgument("skin", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Sets the rival's skin."))
r(New ScriptCommand("player", "setopacity", {New ScriptArgument("opacity", ScriptArgument.ArgumentTypes.Sng)}.ToList(), "Sets the player entity's opacity."))
r(New ScriptCommand("player", "QuitGame", {New ScriptArgument("doFade", ScriptArgument.ArgumentTypes.Bool, True, "")}.ToList(), "Quits the game and goes back to the Main Menu (with optionally a fade out and in)."))
' Constructs:
r(New ScriptCommand("player", "position", "sngarr", {New ScriptArgument("coordinate", ScriptArgument.ArgumentTypes.StrArr, {"x", "y", "z"}, True, "")}.ToList(), "Returns the position of the player. The normal coordinate combination is ""X,Y,Z"".", ",", True))