lobby camera (#10829)

* lobby camera

* Update code/__DEFINES/layers.dm

shouldn't cover up the menu

* make it a subsystem

* adds a setting to disable the lobby eye (per person)

* Update modular_skyrat/modules/lobby_cam/code/lobby_eye_ss.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* Update modular_skyrat/modules/lobby_cam/code/lobby_eye_ss.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* Update modular_skyrat/modules/lobby_cam/code/lobby_eye_ss.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* Update modular_skyrat/modules/lobby_cam/code/lobby_eye_ss.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* Update modular_skyrat/modules/lobby_cam/code/lobby_eye_ss.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
This commit is contained in:
jjpark-kb
2022-01-27 04:02:34 +00:00
committed by GitHub
co-authored by GoldenAlpharex
parent c90575d4d3
commit 272384d0fb
10 changed files with 204 additions and 3 deletions
+6 -3
View File
@@ -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
@@ -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
+4
View File
@@ -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
@@ -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
@@ -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()
Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

@@ -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
+2
View File
@@ -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"
@@ -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,
};