mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-13 08:56:49 +01:00
7d058fc613
V2 of [previous music playing PR](https://github.com/Aurorastation/Aurora.3/pull/21466). TLDR no longer uses the connect_range component for implementation because it turned out a bit too inflexible for overlapping music players. Removes a NanoUI template for the [TGUI update](https://github.com/Aurorastation/Aurora.3/pull/21046). New changelog: - refactor: "Ported Jukebox's NanoUI interface to TGUI." - refactor: "Ported Jukebox audio playing functionality to a component." - refactor: "Sound keys refactored from singletons to datums, along with larger breakout of sound.dm to allow for easier SFX updates in future." - code_imp: "Expanded track datums to include track lengths." - code_imp: "Reorganized music file folders for more intuitive access." - rscadd: "Earphone status feedback text now includes track length." - rscadd: "Added autoplay functionality to earphones." - bugfix: "Fixed earphones' 'Previous Song' verb not sending you to the end of the playlist when used while the first track is selected." - bugfix: "Fixed gain adjustment for 'Konyang-1' (-23 dB -> standard -9.8 dB)." - bugfix: "Fixed y-offset of audioconsole-running overlay animation to line up with the actual screen." --------- Co-authored-by: VMSolidus <evilexecutive@gmail.com>
164 lines
5.5 KiB
Plaintext
164 lines
5.5 KiB
Plaintext
/obj/item/gamehelm
|
|
name = "\improper InUs Game-Helm"
|
|
desc = "The latest device in any self respecting gamer's arsenal, brought to you by the Ingi Usang Entertainment Corporation. Remember to hide it under your desk if the captain walks by."
|
|
desc_extended = "The Game-Helm was designed by a subsidiary of NanoTrasen, Ingi Usang Entertainment Co., with games \
|
|
being able to be purchased from an online marketplace hosted by InUs. Thousands of popular and obscure titles are available on the \
|
|
console. Besides being the perfect present, it's also capable of video streaming and sharing files over authorized \
|
|
connections. A quick and easy way to upload your latest montage to the extranet."
|
|
icon = 'icons/obj/gamehelm.dmi'
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
update_icon_on_init = TRUE
|
|
|
|
var/case_color = "white"
|
|
var/open = FALSE
|
|
|
|
var/playing_game = FALSE
|
|
var/current_screen_state = null
|
|
var/static/list/game_type_to_state = list(
|
|
"anime game" = "screen_anime",
|
|
"shooter game" = "screen_shooter",
|
|
"strategy game" = "screen_strategy",
|
|
"piloting game" = "screen_pilot",
|
|
"horror game" = "screen_dread",
|
|
"simulation game" = "screen_emotive",
|
|
"exploration game" = "screen_exploration",
|
|
"music service" = "screen_music",
|
|
"video service" = "screen_video",
|
|
"toggle device mute" = null,
|
|
"turn off the system" = null
|
|
)
|
|
|
|
var/static/list/non_game_states = list(
|
|
"screen_music",
|
|
"screen_video"
|
|
)
|
|
|
|
var/static/list/game_actions = list(
|
|
"hits all the buttons at the same time" = "hit all the buttons at the same time",
|
|
"rapidly hits a bunch of buttons" = "rapidly hit a bunch of buttons",
|
|
"tilts the %NAME% to the right" = "tilt the %NAME% to the right",
|
|
"tilts the %NAME% to the left" = "tilt the %NAME% to the left",
|
|
"swipes across the %NAME%'s screen" = "swipe across the %NAME%'s screen"
|
|
)
|
|
|
|
var/next_action_time = 0
|
|
var/action_time_cooldown = 10 SECONDS
|
|
|
|
var/muted = FALSE
|
|
|
|
/obj/item/gamehelm/mechanics_hints(mob/user, distance, is_adjacent)
|
|
. += ..()
|
|
. += "You can ALT-click the game-helm to open it up and turn it on. Click on the open device to play."
|
|
|
|
/obj/item/gamehelm/update_icon()
|
|
ClearOverlays()
|
|
if(open)
|
|
icon_state = "open_[case_color]"
|
|
AddOverlays("buttons_open")
|
|
else
|
|
icon_state = "closed_[case_color]"
|
|
AddOverlays("buttons_closed")
|
|
if(current_screen_state)
|
|
AddOverlays(current_screen_state)
|
|
|
|
/obj/item/gamehelm/process()
|
|
if(world.time < next_action_time)
|
|
return
|
|
next_action_time = world.time + action_time_cooldown
|
|
|
|
if(playing_game)
|
|
if(!muted)
|
|
playsound(loc, SFX_ARCADE, 20)
|
|
if(ismob(loc))
|
|
var/picked_action = pick(game_actions)
|
|
var/self_action = game_actions[picked_action]
|
|
picked_action = replacetext(picked_action, "%NAME%", name)
|
|
self_action = replacetext(self_action, "%NAME%", name)
|
|
loc.visible_message("<b>[loc]</b> [picked_action]!", SPAN_NOTICE("You [self_action]!"), range = 3)
|
|
else
|
|
if(!muted)
|
|
playsound(loc, SFX_COMPUTER_BEEP, 20)
|
|
|
|
/obj/item/gamehelm/AltClick(mob/user)
|
|
if(use_check(user))
|
|
return
|
|
toggle_state(user)
|
|
|
|
/obj/item/gamehelm/proc/toggle_state(mob/user)
|
|
open = !open
|
|
update_icon()
|
|
if(open)
|
|
user.visible_message("<b>[user]</b> flips open \the [src] with a satisfying snap!", SPAN_NOTICE("You flip open \the [src] with a satisfying snap!"), range = 3)
|
|
else
|
|
user.visible_message("<b>[user]</b> flips \the [src] shut with a satisfying snap!", SPAN_NOTICE("You flip \the [src] shut with a satisfying snap!"), range = 3)
|
|
set_game(null)
|
|
playsound(user, 'sound/weapons/blade_open.ogg', 30)
|
|
|
|
/obj/item/gamehelm/proc/set_game(var/screen_type)
|
|
current_screen_state = screen_type
|
|
playing_game = !(current_screen_state in non_game_states)
|
|
update_icon()
|
|
if(current_screen_state)
|
|
START_PROCESSING(SSprocessing, src)
|
|
else
|
|
STOP_PROCESSING(SSprocessing, src)
|
|
|
|
/obj/item/gamehelm/attack_self(mob/user)
|
|
if(open)
|
|
var/choice = tgui_input_list(user, "What do you want to play?", "Game Helm", game_type_to_state)
|
|
if(choice == "turn off the system")
|
|
user.visible_message("<b>[user]</b> hits the power button on \the [src] and it quickly shuts down.", SPAN_NOTICE("You hit the power button on \the [src] and it quickly shuts down."), range = 3)
|
|
if(!muted)
|
|
playsound(loc, 'sound/machines/softbeep.ogg', 20)
|
|
set_game(null)
|
|
return
|
|
if(choice == "toggle device mute")
|
|
muted = !muted
|
|
to_chat(user, SPAN_NOTICE("You hit the mute button, [muted ? "disabling" : "enabling"] the device audio."))
|
|
if(!muted)
|
|
playsound(loc, 'sound/machines/softbeep.ogg', 20)
|
|
return
|
|
if(current_screen_state)
|
|
user.visible_message("<b>[user]</b> taps on a few buttons and \the [src] swaps to a different application!", SPAN_NOTICE("You tap on a few buttons and \the [src] swaps to a different application!"), range = 3)
|
|
else
|
|
user.visible_message("<b>[user]</b> taps on a few buttons and \the [src] springs to life!", SPAN_NOTICE("You tap on a few buttons and \the [src] springs to life!"), range = 3)
|
|
if(!muted)
|
|
playsound(loc, SFX_COMPUTER_BOOP, 25)
|
|
set_game(game_type_to_state[choice])
|
|
return ..()
|
|
|
|
/obj/item/gamehelm/Destroy()
|
|
STOP_PROCESSING(SSprocessing, src)
|
|
return ..()
|
|
|
|
//The colours!
|
|
/obj/item/gamehelm/blue
|
|
case_color = "blue"
|
|
|
|
/obj/item/gamehelm/red
|
|
case_color = "red"
|
|
|
|
/obj/item/gamehelm/black
|
|
case_color = "black"
|
|
|
|
/obj/item/gamehelm/pink
|
|
case_color = "pink"
|
|
|
|
/obj/item/gamehelm/purple
|
|
case_color = "purple"
|
|
|
|
/obj/item/gamehelm/brown
|
|
case_color = "brown"
|
|
|
|
/obj/item/gamehelm/green
|
|
case_color = "green"
|
|
|
|
/obj/item/gamehelm/yellow
|
|
case_color = "yellow"
|
|
|
|
/obj/item/gamehelm/turquoise
|
|
case_color = "turquoise"
|
|
|
|
/obj/item/gamehelm/weathered
|
|
case_color = "weathered"
|