From 683125ccea793c0f857e7080222438daa545a7fe Mon Sep 17 00:00:00 2001 From: xTrainx Date: Fri, 19 Apr 2024 01:41:09 -0400 Subject: [PATCH] finish porting recorder and radio station --- code/controllers/subsystem/jukeboxes.dm | 12 +- code/game/machinery/dance_machine.dm | 140 ++++-------------- .../game/objects/items/devices/radio/radio.dm | 2 - code/game/objects/items/stacks/crafting.dm | 5 - code/modules/clothing/outfits/standard.dm | 2 +- .../research/designs/weapon_designs.dm | 2 +- hailmary.dme | 3 +- tgui/packages/tgui/interfaces/Jukebox.js | 37 ++++- 8 files changed, 70 insertions(+), 133 deletions(-) diff --git a/code/controllers/subsystem/jukeboxes.dm b/code/controllers/subsystem/jukeboxes.dm index 97e4814038e..3d9964c22dc 100644 --- a/code/controllers/subsystem/jukeboxes.dm +++ b/code/controllers/subsystem/jukeboxes.dm @@ -1,7 +1,7 @@ SUBSYSTEM_DEF(jukeboxes) name = "Jukeboxes" wait = 5 - var/list/songs = list() + var/list/datum/track/songs = list() var/list/activejukeboxes = list() var/list/freejukeboxchannels = list() @@ -118,18 +118,14 @@ SUBSYSTEM_DEF(jukeboxes) //BIG IRON EDIT start /datum/controller/subsystem/jukeboxes/proc/add_song(datum/track/NS) //proc usted to add a song, when a disk is added to a jukebox if(SSjukeboxes.songs.len) - var/tracks = 1 for(var/datum/track/CT in SSjukeboxes.songs) - if(NS.song_associated_id == SSjukeboxes.songs[tracks].song_associated_id) + if(NS.song_associated_id == CT.song_associated_id) return FALSE - tracks ++ SSjukeboxes.songs += NS /datum/controller/subsystem/jukeboxes/proc/remove_song(datum/track/NS) //proc usted to remove a song, when a disk is removed from a jukebox - var/tracks = 1 for(var/datum/track/RT in SSjukeboxes.songs) - if(NS.song_associated_id == SSjukeboxes.songs[tracks].song_associated_id) + if(NS.song_associated_id == RT.song_associated_id) SSjukeboxes.songs -= NS return TRUE - tracks ++ -//ATOM EDIT -end +//BIG IRON EDIT -end diff --git a/code/game/machinery/dance_machine.dm b/code/game/machinery/dance_machine.dm index 27d3451deac..eeacfa3e6b4 100644 --- a/code/game/machinery/dance_machine.dm +++ b/code/game/machinery/dance_machine.dm @@ -13,7 +13,7 @@ var/datum/track/selection = null var/obj/item/lock_part/lock = null //BIG IRON EDIT START var/open_tray = FALSE //usted to determine if the jukebox is open or not, needs a key - var/list/record_disks = list() //list of inserted disk inthe jukebox + var/list/obj/item/record_disk/record_disks = list() //list of inserted disk inthe jukebox var/obj/item/record_disk/selected_disk = null //the disk chosen to view or ejection /obj/machinery/jukebox/constructed //BIG IRON EDIT start- a sub jukebox with access for everyone @@ -59,10 +59,10 @@ if(!active && !(flags_1 & NODECONSTRUCT_1)) if(istype(O, /obj/item/wrench)) if(!anchored && !isinspace()) - to_chat(user,span_notice("You secure [src] to the floor.")) + to_chat(user,"You secure [src] to the floor.") setAnchored(TRUE) else if(anchored) - to_chat(user,span_notice("You unsecure and disconnect [src].")) + to_chat(user,"You unsecure and disconnect [src].") setAnchored(FALSE) playsound(src, 'sound/items/deconstruct.ogg', 50, 1) return @@ -85,8 +85,11 @@ to_chat(usr, "The Disk Tray is not open!") return var/obj/item/record_disk/I = O + if(!I.R.song_associated_id) + to_chat(user, span_warning("This record is empty!")) + return for(var/datum/track/RT in SSjukeboxes.songs) - if(I.R.song_associated_id == SSjukeboxes.songs[RT].song_associated_id) + if(I.R.song_associated_id == RT.song_associated_id) to_chat(user, span_warning("this track is already added to the jukebox!")) return record_disks += I @@ -104,6 +107,7 @@ src.visible_message(" ejected the [selected_disk] from the [src]!") M.forceMove(get_turf(src)) SSjukeboxes.remove_song(M.R) + record_disks -= M selected_disk = null /obj/machinery/jukebox/update_icon_state() @@ -114,39 +118,17 @@ /obj/machinery/jukebox/ui_status(mob/user) if(!anchored) - to_chat(user,span_warning("This device must be anchored by a wrench!")) + to_chat(user,"This device must be anchored by a wrench!") return UI_CLOSE if(!allowed(user) && !isobserver(user)) - to_chat(user,span_warning("Error: Access Denied.")) + to_chat(user,"Error: Access Denied.") user.playsound_local(src, 'sound/misc/compiler-failure.ogg', 25, TRUE) return UI_CLOSE if(!SSjukeboxes.songs.len && !isobserver(user)) - to_chat(user,span_warning("Error: No music tracks have been authorized for your station. Petition Central Command to resolve this issue.")) + to_chat(user,"Error: No music tracks have been authorized for your station. Petition Central Command to resolve this issue.") playsound(src, 'sound/misc/compiler-failure.ogg', 25, TRUE) return UI_CLOSE - var/list/dat = list() - dat +="
" - dat += "[!active ? "BREAK IT DOWN" : "SHUT IT DOWN"]
" - dat += "

" - dat += " Select Track
" - dat += " manage loaded tracks
" // ATOM EDIT- used for track management - dat += " eject the currently selected disk
" //ATOM EDIT- ejects the chosen disk - if(istype(selection)) - dat += "Track Selected: [selection.song_name]
" - dat += "Track Length: [DisplayTimeText(selection.song_length)]

" - else - dat += "Track Selected: None!

" - if(record_disks.len) //ATOM EDIT -start shows information of a the current music library - dat += "number of loaded tracks: [record_disks.len]
" - if(istype(selected_disk)) - dat += "disk Selected: [selected_disk]
" - dat += "with song: [selected_disk.R.song_name]
" - dat += "Track duration: [DisplayTimeText(selected_disk.R.song_length)])
" //custom tracks should come out as number but just in case - else - dat += "Disk Selected: None!

" //ATOM EDIT -end - var/datum/browser/popup = new(user, "vending", "[name]", 400, 350) - popup.set_content(dat.Join()) - popup.open() + return ..() /obj/machinery/jukebox/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) @@ -179,19 +161,11 @@ data["track_selected"] = selection.song_name data["track_length"] = DisplayTimeText(selection.song_length) data["track_beat"] = selection.song_beat - data["volume"] = volume - data["loaded tracks"] = list() //ATOM EDIT -start- most of these are shown if at least a disk is in the jukebox - var/TN = 1 - for(var/obj/item/record_disk in record_disks[TN]) - var/list/track_data = list( - name = record_disks[TN] - ) - data["loaded tracks"] += list(track_data) - TN ++ if(selected_disk) - data["disk_selected"] = selected_disk.R.song_name - data["disk_selected_lengt"] = selected_disk.R.song_length - data["disk_beat"] = selected_disk.R.song_beat //ATOM EDIT- end + data["disk_selected"] = selected_disk + data["disk_selected_length"] = DisplayTimeText(selected_disk.R.song_length) + data["disk_selected_beat"] = selected_disk.R.song_beat + data["volume"] = volume return data /obj/machinery/jukebox/ui_act(action, list/params) @@ -205,7 +179,7 @@ return if(!active) if(stop > world.time) - to_chat(usr, span_warning("Error: The device is still resetting from the last activation, it will be ready again in [DisplayTimeText(stop-world.time)].")) + to_chat(usr, "Error: The device is still resetting from the last activation, it will be ready again in [DisplayTimeText(stop-world.time)].") playsound(src, 'sound/misc/compiler-failure.ogg', 50, TRUE) return activate_music() @@ -216,7 +190,7 @@ return TRUE if("select_track") if(active) - to_chat(usr, span_warning("Error: You cannot change the song until the current one is over.")) + to_chat(usr, "Error: You cannot change the song until the current one is over.") return var/list/available = list() for(var/datum/track/S in SSjukeboxes.songs) @@ -242,11 +216,12 @@ if(!record_disks.len) to_chat(usr, "Error: no disks in trays.") return - selected_disk = availabletracks[selecteddisk] - return TRUE - if("eject_disk") // this one ejects a currently selected disk if(!selected_disk) - to_chat(usr, span_warning("Error: no disk selected.")) + to_chat(usr,"Error: no disk chosen." ) + return + if(selection == selected_disk.R) + selection = null + eject_record(selected_disk) return TRUE //BIG IRON EDIT -end if("set_volume") @@ -263,69 +238,11 @@ else if(text2num(new_volume) != null) volume = text2num(new_volume) return TRUE - -/obj/machinery/jukebox/Topic(href, href_list) - if(..()) - return - add_fingerprint(usr) - switch(href_list["action"]) - if("toggle") - if (QDELETED(src)) - return - if(!active) - if(stop > world.time) - to_chat(usr, "Error: The device is still resetting from the last activation, it will be ready again in [DisplayTimeText(stop-world.time)].") - playsound(src, 'sound/misc/compiler-failure.ogg', 50, 1) - return - if(!istype(selection)) - to_chat(usr, "Error: Severe user incompetence detected.") - playsound(src, 'sound/misc/compiler-failure.ogg', 50, 1) - return - if(!activate_music()) - to_chat(usr, "Error: Generic hardware failure.") - playsound(src, 'sound/misc/compiler-failure.ogg', 50, 1) - return - updateUsrDialog() - else if(active) - stop = 0 - updateUsrDialog() - if("select") - if(active) - to_chat(usr, "Error: You cannot change the song until the current one is over.") - return - - var/list/available = list() - for(var/datum/track/S in SSjukeboxes.songs) - available[S.song_name] = S - var/selected = input(usr, "Choose your song", "Track:") as null|anything in available - if(QDELETED(src) || !selected || !istype(available[selected], /datum/track)) - return - selection = available[selected] - updateUsrDialog() - if("loaded_tracks") //ATOM EDIT -start- how an user chooses a disk - if(!record_disks.len) - to_chat(usr, "Error: no tracks on the bin!.") - return - var/list/availabledisks = list() - for(var/obj/item/record_disk/RR in record_disks) - availabledisks[RR.name] = RR - var/selecteddisk = input(usr, "Choose a disk to eject", "disk:") as null|anything in availabledisks - if(QDELETED(src) || !selecteddisk || !istype(availabledisks[selecteddisk], /obj/item/record_disk)) - return - selected_disk = availabledisks[selecteddisk] - updateUsrDialog() - if("eject_disk") // sanity check for the disk ejection - if(!record_disks.len) - to_chat(usr, "Error: no disks in trays.") - return - if(!selected_disk) - to_chat(usr,"Error: no disk chosen." ) - eject_record(selected_disk) - selected_disk = null - updateUsrDialog() -//ATOM EDIT -end /obj/machinery/jukebox/proc/activate_music() + if(!selection) + visible_message("Track is no longer avaible") + return var/jukeboxslottotake = SSjukeboxes.addjukebox(src, selection, 2) if(jukeboxslottotake) active = TRUE @@ -825,7 +742,10 @@ loaded_song_name = music_file.song_name loaded_song_length = music_file.song_length loaded_song_beat = music_file.song_beat - loaded_song_associated_id = "CS[music_file.song_associated_id]" + if(!findtext(music_file.song_associated_id, "CS", 1, 2)) + loaded_song_associated_id = music_file.song_associated_id + else + loaded_song_associated_id = "CS[music_file.song_associated_id]" diskProcess() if("Burn custom music") loaded_song_path = input(user, "Choose a custom song!") as null|sound //uses the server AllowedUpload, by the time of writting,it was about 1024kb diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index 395b68438fa..85f722f42ad 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -101,8 +101,6 @@ LAZYREMOVE(GLOB.legion_radios, src) if(FACTION_BROTHERHOOD) LAZYREMOVE(GLOB.bos_radios, src) - if(FACTION_ENCLAVE) - LAZYREMOVE(GLOB.enclave_radios, src) GLOB.radio_list -= src //Big-Iron, removes radio from radio list lmao remove_radio_all(src) //Just to be sure QDEL_NULL(wires) diff --git a/code/game/objects/items/stacks/crafting.dm b/code/game/objects/items/stacks/crafting.dm index 7377bd85077..f3051260c2a 100644 --- a/code/game/objects/items/stacks/crafting.dm +++ b/code/game/objects/items/stacks/crafting.dm @@ -89,11 +89,6 @@ GLOBAL_LIST_INIT(electronicparts_recipes, list ( \ . = ..() . += GLOB.electronicparts_recipes //BIG IRON EDIT end - -GLOBAL_LIST_INIT(electronicparts_recipes, list(\ - new/datum/stack_recipe("ion arrowhead", /obj/item/stack/arrowhead/ion, 1, 1, 1 SECONDS),\ - )) - /obj/item/stack/crafting/electronicparts/get_main_recipes() . = ..() . += GLOB.electronicparts_recipes diff --git a/code/modules/clothing/outfits/standard.dm b/code/modules/clothing/outfits/standard.dm index 99bb08e97db..6078534b5f3 100644 --- a/code/modules/clothing/outfits/standard.dm +++ b/code/modules/clothing/outfits/standard.dm @@ -412,7 +412,7 @@ suit_store = /obj/item/tank/internals/emergency_oxygen/double back = /obj/item/storage/backpack/holding box = /obj/item/storage/box/debugtools - neck = /obj/item/storage/belt/holster/ranger4570bayonet + neck = /obj/item/storage/belt/shoulderholster/ranger4570bayonet l_pocket = /obj/item/ammo_box/tube/m44 r_pocket = /obj/item/gun/ballistic/revolver/m29/snub backpack_contents = list( diff --git a/code/modules/research/designs/weapon_designs.dm b/code/modules/research/designs/weapon_designs.dm index cd96afdcea9..bd07fe8dd83 100644 --- a/code/modules/research/designs/weapon_designs.dm +++ b/code/modules/research/designs/weapon_designs.dm @@ -410,7 +410,7 @@ id = "rechargerrifle" build_type = PROTOLATHE materials = list (/datum/material/iron = 8000, /datum/material/glass = 2000, /datum/material/uranium = 1000, /datum/material/gold = 500) - build_path = /obj/item/gun/energy/laser/rechargerrifle + build_path = /obj/item/gun/energy/laser/wattz/recharger category = list("Weapons") /datum/design/rechargerpistol diff --git a/hailmary.dme b/hailmary.dme index 187895d7a79..8a51ed3859d 100644 --- a/hailmary.dme +++ b/hailmary.dme @@ -1332,7 +1332,6 @@ #include "code\game\objects\structures\guncase.dm" #include "code\game\objects\structures\headpike.dm" #include "code\game\objects\structures\hivebot.dm" -#include "code\game\objects\structures\HMG.dm" #include "code\game\objects\structures\holosign.dm" #include "code\game\objects\structures\janicart.dm" #include "code\game\objects\structures\kitchen_spike.dm" @@ -3888,4 +3887,6 @@ #include "modular_BD2\blacksmith\code\smithed_items.dm" #include "modular_BD2\general\code\modular_BD2.dm" #include "modular_BD2\legio_invicta\code\legio_invicta.dm" +#include "modular_big-iron\code\game\machinery\radio_station.dm" +#include "modular_big-iron\code\game\objects\circuitboards\radio_station.dm" // END_INCLUDE diff --git a/tgui/packages/tgui/interfaces/Jukebox.js b/tgui/packages/tgui/interfaces/Jukebox.js index aae8916d65b..bc19343683d 100644 --- a/tgui/packages/tgui/interfaces/Jukebox.js +++ b/tgui/packages/tgui/interfaces/Jukebox.js @@ -11,12 +11,19 @@ export const Jukebox = (props, context) => { track_selected, track_length, track_beat, + disk_selected, + disk_selected_length, + disk_selected_beat, volume, } = data; const songs = flow([ sortBy( song => song.name), ])(data.songs || []); + const disks = flow([ + sortBy( + disk => disk.name), + ])(data.disks || []); return ( {
act('toggle')} /> + <> +