From d5e3fcadadce6c9e3f95dd272b240080633d4c4a Mon Sep 17 00:00:00 2001 From: Lyssa <75037904+thecatontheceiling@users.noreply.github.com> Date: Mon, 28 Oct 2024 20:42:34 +0400 Subject: [PATCH] Add files via upload --- BurnerPhone.gd | 4 +- ButtonClass.gd | 2 + ControllerManager.gd | 7 +--- EndingManager.gd | 13 +++--- GlobalVariables.gd | 99 +++++++++++++++++++++++++++++++++++++++++++- MenuManager.gd | 72 ++++++++++++++++++++++++++++++-- OptionsManager.gd | 8 ++-- Steam.gd | 27 +++++++++--- 8 files changed, 204 insertions(+), 28 deletions(-) diff --git a/BurnerPhone.gd b/BurnerPhone.gd index b78efe7..113360b 100644 --- a/BurnerPhone.gd +++ b/BurnerPhone.gd @@ -12,7 +12,7 @@ func SendDialogue(): var fulldia = "" if (len != 1): randindex = randi_range(1, len - 1) - if(randindex == 8): randindex -= 1 + if(randindex == 8 or randindex == 7): randindex -= 1 if (sequence[randindex] == "blank"): secondpart = tr("BLANKROUND") % "" else: secondpart = tr("LIVEROUND") % "" match (randindex): @@ -28,8 +28,6 @@ func SendDialogue(): firstpart = tr("SEQUENCE6") 6: firstpart = tr("SEQUENCE7") - 7: - firstpart = tr("SEQUENCE7") fulldia = tr(firstpart) + "\n" + "... " + tr(secondpart) else: fulldia = tr("UNFORTUNATE") dia.ShowText_Forever(fulldia) diff --git a/ButtonClass.gd b/ButtonClass.gd index 4b37e7d..2ecc848 100644 --- a/ButtonClass.gd +++ b/ButtonClass.gd @@ -17,6 +17,7 @@ class_name ButtonClass extends Node @export var ui_opacity_inactive : float = 1 @export var ui_opacity_active : float = .78 @export var resetting : bool +@export var pipe : LobbyManager @export var adding_cursor : bool @export var t : Label var mainActive = true @@ -62,4 +63,5 @@ func OnPress(): if (isDynamic && playing): speaker_press.play() if (rebind != null): rebindManager.GetRebind(rebind) if (language): options.AdjustLanguage(alias) + if (pipe != null): pipe.Pipe(alias) emit_signal("is_pressed") diff --git a/ControllerManager.gd b/ControllerManager.gd index b571ad9..1395b2d 100644 --- a/ControllerManager.gd +++ b/ControllerManager.gd @@ -42,24 +42,21 @@ func _input(event): if(event is InputEventJoypadButton): cursor.controller_active = true SetPrevFocus(true) - if (printing): print("JOYPAD BUTTON") cursor.SetCursor(cursor.cursor_visible, false) elif(event is InputEventKey): if (!IsEventAssignedToNavigation(event)): return cursor.controller_active = true SetPrevFocus(true) - if (printing):print("EVENT KEY") cursor.SetCursor(cursor.cursor_visible, false) #DISABLE CONTROLLER - elif(event is InputEventMouse): + elif(event is InputEventMouseMotion): + if event.velocity == Vector2(0, 0): return cursor.controller_active = false SetPrevFocus(false) - if (printing):print("EVENT MOUSE") cursor.SetCursor(cursor.cursor_visible, false) elif(event is InputEventMouseButton): cursor.controller_active = false SetPrevFocus(false) - if (printing):print("EVENT MOUSE BUTTON") cursor.SetCursor(cursor.cursor_visible, false) var navigationBinds = ["ui_up", "ui_down", "ui_left", "ui_right"] diff --git a/EndingManager.gd b/EndingManager.gd index 9ab9b87..bcab3a1 100644 --- a/EndingManager.gd +++ b/EndingManager.gd @@ -151,13 +151,14 @@ func FinalScore(): if (endless_overwriting): total_cash = endless_score cash_gl = total_cash + var dots = "................................................................" var text_congratulations = tr("CONGRATULATIONS") % [playername] - var text_shotsFired = tr("SHOTS FIRED") + " " + str(shots_fired) - if (endless_overwriting): text_shotsFired = tr("ROUNDS BEAT") + " " + str(endless_roundsbeat) - var text_shellsEjected = tr("SHELLS EJECTED") + " " + str(shells_ejected) - var text_doorsKicked = tr("DOORS KICKED") + " " + str(doors_kicked) - var text_cigSmoked = tr("CIGS SMOKED") + " " + str(cigarettes_smoked) - var text_beerDrank = tr("ML DRANK") + " " + str(ml_of_beer_drank) + var text_shotsFired = tr("SHOTS FIRED") + " " + dots; label_array[0].get_child(2).text = str(shots_fired) + if (endless_overwriting): text_shotsFired = tr("ROUNDS BEAT") + " " + dots; label_array[0].get_child(2).text = str(shots_fired) + var text_shellsEjected = tr("SHELLS EJECTED") + " " + dots; label_array[1].get_child(2).text = str(shots_fired) + var text_doorsKicked = tr("DOORS KICKED") + " " + dots; label_array[2].get_child(2).text = str(shots_fired) + var text_cigSmoked = tr("CIGS SMOKED") + " " + dots; label_array[3].get_child(2).text = str(shots_fired) + var text_beerDrank = tr("ML DRANK") + " " + dots; label_array[4].get_child(2).text = str(shots_fired) var text_totalcash = tr("TOTAL CASH") + " " + str(total_cash) + " $" #if (endless_overwriting): text_shotsFired = "rounds beat ........ " + str(endless_roundsbeat) diff --git a/GlobalVariables.gd b/GlobalVariables.gd index 67a0b36..2b348c9 100644 --- a/GlobalVariables.gd +++ b/GlobalVariables.gd @@ -1,13 +1,15 @@ extends Node -var currentVersion_nr = "v1.2.2" -var currentVersion_hotfix = 0 +var currentVersion_nr = "v1.9.905" +var currentVersion_hotfix = 3 var using_steam = true var currentVersion = "" var versuffix_steam = " (STEAM)" var versuffix_itch = " (ITCH.IO)" +var discord_link = "https://discord.gg/UdjMNaKkQe" + var using_gl = false var controllerEnabled = false var music_enabled = true @@ -20,6 +22,99 @@ var default_color_blank = Color(0.29, 0.5, 1) var colorblind_color_live = Color(1, 1, 1) var colorblind_color_blank = Color(0.34, 0.34, 0.34) +var mp_debugging = false #mp debugging with temporary bots +var mp_printing_to_console = true #whether or not disconnect messages, etc are printed to console +var mp_debug_keys_enabled = false #whether or not the debug keys are enabled +var printing_packets = true #whether or not packets get logged +var sending_lobby_change_alerts_to_console = false #whether or not lobby status changes are sent to the console in lobby +var forcing_lobby_enter_from_main_menu = false #whether or not the game immediately goes to lobby scene from main menu +var message_to_forward = "" #message to forward through scenes, for instance a disconnect message +var original_volume_linear_interaction #original volume for bus 3 (interactions) +var original_volume_linear_music #original volume for bus 1 (music) +var debug_round_index_to_end_game_at : int #the game ends when this round index is met +var disband_lobby_after_exiting_main_scene = false #whether or not the lobby is disbanded when exiting to lobby scene from main +var exiting_to_lobby_after_inactivity = false #when a user is inactive for a set amount of time, all users exit to the lobby +var timeouts_enabled = false #whether or not timeouts are enabled for adrenaline, turn, shotgun target selection, item grabbing, etc +var skipping_intro = false #whether or not to skip the intro +var lobby_id_found_in_command_line = 0 #lobby ID for when a player joins through an invite with the game closed +var running_short_intro_in_lobby_scene : bool = false #if the user is entering the lobby scene from mp main, or has a command line lobby ID, skip the bootup animation +var command_line_checked = false #whether or not the command line has been checked on running the game. +var version_to_check : String = "" #full version string that includes major, minor, patch, hotfix +var steam_id_version_checked_array : Array[int] #array of steam IDs that have the version checked. this must match the steam lobby member array IDs. + func _ready(): if using_steam: currentVersion = currentVersion_nr + versuffix_steam else: currentVersion = currentVersion_nr + versuffix_itch + debug_round_index_to_end_game_at = 2 + original_volume_linear_interaction = db_to_linear(AudioServer.get_bus_volume_db(3)) + original_volume_linear_music = db_to_linear(AudioServer.get_bus_volume_db(1)) + version_to_check = currentVersion_nr + "." + str(currentVersion_hotfix) + print("running full version name: ", version_to_check) + +func _unhandled_input(event): + if GlobalVariables.mp_debugging: + if event.is_action_pressed("debug_q"): + SwapLanguage(false) + if event.is_action_pressed("debug_e"): + SwapLanguage(true) + if event.is_action_pressed("-"): + Engine.time_scale = .05 + if event.is_action_pressed(","): + Engine.time_scale = 1 + if event.is_action_pressed("."): + Engine.time_scale = 10 + if event.is_action_pressed("end"): + Engine.time_scale = 0 + +var language_array = ["EN", "EE", "RU", "ES LATAM", "ES", "FR", "IT", "JA", "KO", "PL", "PT", "DE", "TR", "UA", "ZHS", "ZHT"] +var index = 0 +func SwapLanguage(dir : bool): + return + if dir: + if index == language_array.size() - 1: + index = 0 + else: + index += 1 + else: + if index == 0: + index = language_array.size() - 1 + else: + index -= 1 + TranslationServer.set_locale(language_array[index]) + print("setting locale to: ", language_array[index]) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MenuManager.gd b/MenuManager.gd index b3ffdd9..8b0e09c 100644 --- a/MenuManager.gd +++ b/MenuManager.gd @@ -23,6 +23,8 @@ class_name MenuManager extends Node @export var anim_creds : AnimationPlayer @export var version : Label +var viewing_intro : bool + func _ready(): Show("main") buttons[0].connect("is_pressed", Start) @@ -41,6 +43,7 @@ func _ready(): buttons[17].connect("is_pressed", ReturnToLastScreen) buttons[18].connect("is_pressed", ResetControls) buttons[19].connect("is_pressed", DiscordLink) + buttons[22].connect("is_pressed", StartMultiplayer) buttons_options[0].connect("is_pressed", IncreaseVol) buttons_options[1].connect("is_pressed", DecreaseVol) @@ -55,19 +58,49 @@ func _ready(): Intro() +func _process(delta): + T() + +func CheckCommandLine(): + var arguments = OS.get_cmdline_args() + for argument in arguments: + if (arguments.size() > 0): + #if (GlobalSteam.LOBBY_INVITE_ARG): + # join_lobby(int(argument)) + pass + + if argument == "+connect_lobby": + GlobalSteam.LOBBY_INVITE_ARG = true + var failsafed = true +var fs2 = false func _input(event): if (event.is_action_pressed("ui_cancel") && failsafed): if (currentScreen != "main"): ReturnToLastScreen() if (event.is_action_pressed("exit game") && failsafed): if (currentScreen != "main"): ReturnToLastScreen() + if (event.is_action_pressed("exit game") && !fs2 && viewing_intro): + SkipIntro() + fs2 = true func Intro(): cursor.SetCursor(false, false) - await get_tree().create_timer(.5, false).timeout + if GlobalVariables.lobby_id_found_in_command_line != 0 && !GlobalVariables.command_line_checked: + print("lobby id found in command line. dont run the menu intro") + return + viewing_intro = true speaker_music.play() animator_intro.play("splash screen") - await get_tree().create_timer(9, false).timeout + c = true + +func SkipIntro(): + c = false + animator_intro.stop() + animator_intro.play("skip intro") + FinishIntro() + +func FinishIntro(): + viewing_intro = false mouseblocker.visible = false cursor.SetCursor(true, false) controller.settingFilter = true @@ -76,6 +109,15 @@ func Intro(): controller.previousFocus = firstFocus_main assigningFocus = true +var t = 0 +var c = false +var fs = false +func T(): + if c: t+= get_process_delta_time() + if t > 9 && !fs: + FinishIntro() + fs = true + func Buttons(state : bool): if (!state): for i in buttons: @@ -134,6 +176,7 @@ func Show(what : String): func ReturnToLastScreen(): print("return to last screen") + if currentScreen == "credits": anim_creds.play("RESET") if (currentScreen) == "sub options": lastScreen = "main" if (currentScreen) == "rebind controls": lastScreen = "sub options" if (currentScreen == "audio video" or currentScreen == "language" or currentScreen == "controller" or currentScreen == "rebind controls"): optionmanager.SaveSettings() @@ -161,6 +204,22 @@ func Start(): print("changing scene to: main") get_tree().change_scene_to_file("res://scenes/main.tscn") +func StartMultiplayer(): + Buttons(false) + ResetButtons() + for screen in screens: screen.visible = false + title.visible = false + controller.previousFocus = null + speaker_music.stop() + animator_intro.play("snap") + for w in waterfalls: w.pause() + speaker_start.play() + cursor.SetCursor(false, false) + savefile.ClearSave() + await get_tree().create_timer(4, false).timeout + print("changing scene to: lobby") + get_tree().change_scene_to_file("res://multiplayer/scenes/mp_lobby.tscn") + func Credits(): Show("credits") ResetButtons() @@ -174,6 +233,13 @@ func Exit(): await get_tree().create_timer(.5, false).timeout get_tree().quit() +func DisableMenu(): + Buttons(false) + ResetButtons() + speaker_music.stop() + animator_intro.play("snap2") + cursor.SetCursor(false, false) + func ResetControls(): optionmanager.ResetControls() ResetButtons() @@ -183,7 +249,7 @@ func ToggleMusic(): func ToggleColorblind(): optionmanager.ToggleColorblind() func DiscordLink(): - OS.shell_open("https://discord.gg/cr-channel-1158444754325999747") + OS.shell_open(GlobalVariables.discord_link) func RebindControls(): Show("rebind controls") ResetButtons() diff --git a/OptionsManager.gd b/OptionsManager.gd index dab3874..cf29bcc 100644 --- a/OptionsManager.gd +++ b/OptionsManager.gd @@ -49,7 +49,7 @@ var setting_colorblind = false var setting_music_enabled = true func _ready(): - Printout() + print("your version %s does not match this %s version" % [900, 400]) LoadSettings() if (!receivedFile): setting_windowed = defaultOption_windowed @@ -106,7 +106,6 @@ func AdjustLanguage(alias : String): setting_language = alias ApplySettings_language() menu.ResetButtons() - return func ApplySettings_volume(): AudioServer.set_bus_volume_db(0, linear_to_db(setting_volume)) @@ -121,8 +120,9 @@ func AdjustSettings_music(): func ApplySettings_music(): if (setting_music_enabled): anim_vinyl.speed_scale = 1 else: anim_vinyl.speed_scale = 0 - AudioServer.set_bus_mute(1, !setting_music_enabled) - AudioServer.set_bus_mute(2, !setting_music_enabled) + AudioServer.set_bus_mute(1, !setting_music_enabled) #music + AudioServer.set_bus_mute(2, !setting_music_enabled) #music secondary + AudioServer.set_bus_mute(4, !setting_music_enabled) #music resolve AudioServer.get_property_list() GlobalVariables.music_enabled = setting_music_enabled diff --git a/Steam.gd b/Steam.gd index 01a14d0..70a1e38 100644 --- a/Steam.gd +++ b/Steam.gd @@ -2,14 +2,31 @@ extends Node var appid : int = 2835570 +const PACKET_READ_LIMIT: int = 32 + +var DATA +var LOBBY_ID = 0 +var LOBBY_MEMBERS = [] +var USER_ID_LIST_TO_IGNORE : Array[int] +var LOBBY_INVITE_ARG = false +var STEAM_ID = 0 +var STEAM_NAME = "" +var ONLINE = false +var HOST_ID = 0 + func _ready(): - if GlobalVariables.using_steam: - process_priority = 1000 - set_process_internal(true) - InitializeSteam() + process_priority = 1000 + set_process_internal(true) + InitializeSteam() + + ONLINE = Steam.loggedOn() + STEAM_ID = Steam.getSteamID() + STEAM_NAME = Steam.getPersonaName() + print("online ... ", ONLINE, " ... steam id ... ", STEAM_ID, " ... steam name ... ", STEAM_NAME) func _process(_delta: float) -> void: - if GlobalVariables.using_steam: Steam.run_callbacks() + #OS.delay_msec(17) + Steam.run_callbacks() func InitializeSteam(): if GlobalVariables.using_steam: