diff --git a/code/__DEFINES/layers.dm b/code/__DEFINES/layers.dm index 3cd19c83ca7..5db672a66ae 100644 --- a/code/__DEFINES/layers.dm +++ b/code/__DEFINES/layers.dm @@ -183,9 +183,12 @@ #define ADMIN_POPUP_LAYER 1 - -///Plane of the "splash" icon used that shows on the lobby screen. Nothing should ever be above this. -#define SPLASHSCREEN_PLANE 9999 +//SKYRAT EDIT: Lobby Cam +///Plane of the "splash" icon used that shows on the lobby screen. Nothing should ever be above this. (Except the logo) +#define BLACK_FADE 9997 +#define SPLASHSCREEN_PLANE 9998 //Previous value: 9999 +#define SKYRAT_LOGO 9999 +//SKYRAT EDIT: Lobby Cam #define LOBBY_BACKGROUND_LAYER 3 #define LOBBY_BUTTON_LAYER 4 diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 8a1f603e074..b259ad49a8d 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -92,6 +92,8 @@ /datum/config_entry/flag/log_ambition // log ambition changes //SKYRAT EDIT ADDITION +/datum/config_entry/flag/lobby_camera // enable lobby camera //SKYRAT EDIT ADDITION + /datum/config_entry/flag/log_econ // log economy actions /datum/config_entry/flag/log_adminchat // log admin chat messages diff --git a/config/skyrat/skyrat_config.txt b/config/skyrat/skyrat_config.txt index 002512f0c15..ecea2aeaf43 100644 --- a/config/skyrat/skyrat_config.txt +++ b/config/skyrat/skyrat_config.txt @@ -96,3 +96,7 @@ SSDECAY_DISABLED ## Disables any ERP preferences for codebases that don't want it. #DISABLE_ERP_PREFERENCES #ERP_EMOTES_TO_DISABLE cum + +## Lobby Camera Intro +## Put # in front to disable +LOBBY_CAMERA diff --git a/modular_skyrat/modules/lobby_cam/code/lobby_cam.dm b/modular_skyrat/modules/lobby_cam/code/lobby_cam.dm new file mode 100644 index 00000000000..4a3822e91ae --- /dev/null +++ b/modular_skyrat/modules/lobby_cam/code/lobby_cam.dm @@ -0,0 +1,36 @@ +/atom/movable/screen/skyrat_logo + name = "Skyrat Station" + icon = 'modular_skyrat/modules/lobby_cam/icons/skyrat_logo.dmi' + icon_state = "skyrat_logo" + screen_loc = "1:16,1:16" + plane = SKYRAT_LOGO + alpha = 0 + +/atom/movable/screen/movable/black_fade + name = "black screen" + icon = 'modular_skyrat/modules/lobby_cam/icons/black_screen.dmi' + icon_state = "1" + screen_loc = "SOUTHWEST to NORTHEAST" + plane = BLACK_FADE + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + +/mob/dead/new_player/Login() + . = ..() + var/atom/movable/screen/skyrat_logo/logo_screen = new() + if (client && SSticker.current_state < GAME_STATE_PLAYING) + client.screen += logo_screen + animate(logo_screen, alpha = 255, time = 5 SECONDS) + +/obj/new_player_cam + name = "floor" + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + density = FALSE + anchored = TRUE + alpha = 0 + invisibility = INVISIBILITY_ABSTRACT + +/datum/preference/toggle/lobby_cam + category = PREFERENCE_CATEGORY_GAME_PREFERENCES + default_value = TRUE + savefile_key = "lobby_cam_pref" + savefile_identifier = PREFERENCE_PLAYER diff --git a/modular_skyrat/modules/lobby_cam/code/lobby_eye_ss.dm b/modular_skyrat/modules/lobby_cam/code/lobby_eye_ss.dm new file mode 100644 index 00000000000..5fc43cb41e1 --- /dev/null +++ b/modular_skyrat/modules/lobby_cam/code/lobby_eye_ss.dm @@ -0,0 +1,117 @@ +SUBSYSTEM_DEF(lobby_eye) + name = "Lobby Eye" + wait = 50 + flags = SS_TICKER + + ///the camera that is linked to the subsystem + var/obj/new_player_cam/linked_camera + ///how many tiles the camera will do + var/path_target = 30 + ///how many tiles into invalid areas can we go + var/invalid_reset = 5 + ///the areas that are considered invalid + var/static/list/invalid_areas = list(/area/space, /area/icemoon) + ///how fast the camera will "move" + var/moving_speed = 2 + ///the screen that will fade in and out + var/atom/movable/screen/movable/black_fade/fading_screen + ///the pathway that the camera will take + var/list/pathway = list() + +/datum/controller/subsystem/lobby_eye/Initialize(start_timeofday) + . = ..() + linked_camera = new() + fading_screen = new() + fire() + +//fades out the skyrat logo in the bottom left +/datum/controller/subsystem/lobby_eye/proc/fade_logo() + for(var/mob/checking_mob as anything in GLOB.new_player_list) + var/atom/movable/screen/skyrat_logo/logo_screen = locate() in checking_mob.client.screen + if(logo_screen?.alpha == 255) + animate(logo_screen, alpha = 0, time = 5 SECONDS) + +//gets everyone on the camera +/datum/controller/subsystem/lobby_eye/proc/lock_eyes() + for(var/mob/checking_mob as anything in GLOB.new_player_list) + if(!checking_mob.client) + continue + if(!checking_mob.client?.prefs.read_preference(/datum/preference/toggle/lobby_cam)) + continue + if(SSticker.current_state < GAME_STATE_PREGAME) + continue + if(!(fading_screen in checking_mob.client?.screen)) + checking_mob.client?.screen += fading_screen + if(checking_mob.client?.eye != linked_camera) + checking_mob.client?.eye = linked_camera + if(checking_mob.lighting_alpha != LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE) + checking_mob.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + +//gets everyone off of the camera +/datum/controller/subsystem/lobby_eye/proc/unlock_eyes() + for(var/mob/checking_mob in GLOB.new_player_list) + if(!checking_mob.client) + continue + if(fading_screen && (fading_screen in checking_mob.client?.screen)) + checking_mob.client?.screen -= fading_screen + if(checking_mob.client?.eye != linked_camera) + continue + checking_mob.client?.eye = checking_mob.client?.mob + +/datum/controller/subsystem/lobby_eye/fire(resumed) + //the config + if(!CONFIG_GET(flag/lobby_camera)) + return + + //fade out the logo and unlock eyes when 10 seconds until round start + var/time_remaining = SSticker.GetTimeLeft() + if(time_remaining <= 20 SECONDS && SSticker.current_state == GAME_STATE_PREGAME) + unlock_eyes() + fade_logo() + return + + //we should only work in pregame + if(SSticker.current_state != GAME_STATE_PREGAME) + unlock_eyes() + return + + //find the starting location + var/turf/starting_turf = get_safe_random_station_turf() + pathway = list(starting_turf) + + //start building the pathway + var/chosen_direction = pick(GLOB.cardinals) + var/invalid_crossed = 0 + var/turf/chosen_turf = starting_turf + for(var/creating_pathway in 1 to path_target) + chosen_turf = get_step(chosen_turf, chosen_direction) + if(!chosen_turf) + break + if(is_type_in_list(get_area(chosen_turf), invalid_areas)) + invalid_crossed++ + if(invalid_crossed >= invalid_reset) + break + pathway += chosen_turf + + //move camera to starting location and lock + linked_camera.loc = starting_turf + lock_eyes() + + //fade in + for(var/fade_in = 1, fade_in < 11, fade_in++) + fading_screen.icon_state = "[fade_in]" + sleep(1) + fading_screen.icon_state = "11" + + //move + for(var/turf/moving_turf in pathway) + linked_camera.loc = moving_turf + sleep(moving_speed) + + //fade out + for(var/fade_out = 11, fade_out > 1, fade_out--) + fading_screen.icon_state = "[fade_out]" + sleep(1) + fading_screen.icon_state = "1" + + fire() diff --git a/modular_skyrat/modules/lobby_cam/icons/black_screen.dmi b/modular_skyrat/modules/lobby_cam/icons/black_screen.dmi new file mode 100644 index 00000000000..5ab639aeb82 Binary files /dev/null and b/modular_skyrat/modules/lobby_cam/icons/black_screen.dmi differ diff --git a/modular_skyrat/modules/lobby_cam/icons/skyrat_logo.dmi b/modular_skyrat/modules/lobby_cam/icons/skyrat_logo.dmi new file mode 100644 index 00000000000..40c9abb34b2 Binary files /dev/null and b/modular_skyrat/modules/lobby_cam/icons/skyrat_logo.dmi differ diff --git a/modular_skyrat/modules/lobby_cam/readme.md b/modular_skyrat/modules/lobby_cam/readme.md new file mode 100644 index 00000000000..69e6867a97c --- /dev/null +++ b/modular_skyrat/modules/lobby_cam/readme.md @@ -0,0 +1,29 @@ +## Title: Lobby Camera + +MODULE ID: LOBBY_CAM + +### Description + +The lobby cam will play after the server finishes initializing and will do some really cool showcasing of the map. +Stolen from Toolbox Station with some improved code. + +### TG Proc Changes + +- N/A + +### Defines + +- N/A + +### Master file additions + +- N/A + +### Included files that are not contained in this module + +- N/A + +### Credits + +Jake Park - Code Revision +Toolbox Station - Code diff --git a/tgstation.dme b/tgstation.dme index 1c6b1526ab0..119646bb318 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -4887,6 +4887,8 @@ #include "modular_skyrat\modules\loadouts\loadout_items\under\loadout_datum_under.dm" #include "modular_skyrat\modules\loadouts\loadout_ui\loadout_manager.dm" #include "modular_skyrat\modules\loadouts\loadout_ui\loadout_outfit_helpers.dm" +#include "modular_skyrat\modules\lobby_cam\code\lobby_cam.dm" +#include "modular_skyrat\modules\lobby_cam\code\lobby_eye_ss.dm" #include "modular_skyrat\modules\mapping\code\color.dm" #include "modular_skyrat\modules\mapping\code\command.dm" #include "modular_skyrat\modules\mapping\code\dungeon.dm" diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/skyrat/lobby_eye.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/skyrat/lobby_eye.tsx new file mode 100644 index 00000000000..6c8517e6f60 --- /dev/null +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/skyrat/lobby_eye.tsx @@ -0,0 +1,8 @@ +import { CheckboxInput, FeatureToggle } from "../../base"; + +export const lobby_cam_pref: FeatureToggle = { + name: "Lobby Eye", + category: "GAMEPLAY", + description: "Toggles if you want to have the camera that pans pre-game", + component: CheckboxInput, +};