Skip to content

Commit

Permalink
finish porting recorder and radio station
Browse files Browse the repository at this point in the history
  • Loading branch information
xTrainx committed Apr 19, 2024
1 parent bf76d13 commit 683125c
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 133 deletions.
12 changes: 4 additions & 8 deletions code/controllers/subsystem/jukeboxes.dm
Original file line number Diff line number Diff line change
@@ -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()

Expand Down Expand Up @@ -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
140 changes: 30 additions & 110 deletions code/game/machinery/dance_machine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,"<span class='notice'>You secure [src] to the floor.</span>")
setAnchored(TRUE)
else if(anchored)
to_chat(user,span_notice("You unsecure and disconnect [src]."))
to_chat(user,"<span class='notice'>You unsecure and disconnect [src].</span>")
setAnchored(FALSE)
playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
return
Expand All @@ -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
Expand All @@ -104,6 +107,7 @@
src.visible_message("<span class ='notice'> ejected the [selected_disk] from the [src]!</span>")
M.forceMove(get_turf(src))
SSjukeboxes.remove_song(M.R)
record_disks -= M
selected_disk = null

/obj/machinery/jukebox/update_icon_state()
Expand All @@ -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,"<span class='warning'>This device must be anchored by a wrench!</span>")
return UI_CLOSE
if(!allowed(user) && !isobserver(user))
to_chat(user,span_warning("Error: Access Denied."))
to_chat(user,"<span class='warning'>Error: Access Denied.</span>")
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,"<span class='warning'>Error: No music tracks have been authorized for your station. Petition Central Command to resolve this issue.</span>")
playsound(src, 'sound/misc/compiler-failure.ogg', 25, TRUE)
return UI_CLOSE
var/list/dat = list()
dat +="<div class='statusDisplay' style='text-align:center'>"
dat += "<b><A href='?src=[REF(src)];action=toggle'>[!active ? "BREAK IT DOWN" : "SHUT IT DOWN"]<b></A><br>"
dat += "</div><br>"
dat += "<A href='?src=[REF(src)];action=select'> Select Track</A><br>"
dat += "<A href='?src=[REF(src)];action=loaded_tracks'> manage loaded tracks</A><br>" // ATOM EDIT- used for track management
dat += "<A href='?src=[REF(src)];action=eject_disk'> eject the currently selected disk</A><br>" //ATOM EDIT- ejects the chosen disk
if(istype(selection))
dat += "Track Selected: [selection.song_name]<br>"
dat += "Track Length: [DisplayTimeText(selection.song_length)]<br><br>"
else
dat += "Track Selected: None!<br><br>"
if(record_disks.len) //ATOM EDIT -start shows information of a the current music library
dat += "number of loaded tracks: [record_disks.len]<br>"
if(istype(selected_disk))
dat += "disk Selected: [selected_disk]<br>"
dat += "with song: [selected_disk.R.song_name]<br>"
dat += "Track duration: [DisplayTimeText(selected_disk.R.song_length)])<br>" //custom tracks should come out as number but just in case
else
dat += "Disk Selected: None!<br><br>" //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)
Expand Down Expand Up @@ -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)
Expand All @@ -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, "<span class='warning'>Error: The device is still resetting from the last activation, it will be ready again in [DisplayTimeText(stop-world.time)].</span>")
playsound(src, 'sound/misc/compiler-failure.ogg', 50, TRUE)
return
activate_music()
Expand All @@ -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, "<span class='warning'>Error: You cannot change the song until the current one is over.</span>")
return
var/list/available = list()
for(var/datum/track/S in SSjukeboxes.songs)
Expand All @@ -242,11 +216,12 @@
if(!record_disks.len)
to_chat(usr, "<span class='warning'>Error: no disks in trays.</span>")
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,"<span class='warning'>Error: no disk chosen.</span>" )
return
if(selection == selected_disk.R)
selection = null
eject_record(selected_disk)
return TRUE
//BIG IRON EDIT -end
if("set_volume")
Expand All @@ -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, "<span class='warning'>Error: The device is still resetting from the last activation, it will be ready again in [DisplayTimeText(stop-world.time)].</span>")
playsound(src, 'sound/misc/compiler-failure.ogg', 50, 1)
return
if(!istype(selection))
to_chat(usr, "<span class='warning'>Error: Severe user incompetence detected.</span>")
playsound(src, 'sound/misc/compiler-failure.ogg', 50, 1)
return
if(!activate_music())
to_chat(usr, "<span class='warning'>Error: Generic hardware failure.</span>")
playsound(src, 'sound/misc/compiler-failure.ogg', 50, 1)
return
updateUsrDialog()
else if(active)
stop = 0
updateUsrDialog()
if("select")
if(active)
to_chat(usr, "<span class='warning'>Error: You cannot change the song until the current one is over.</span>")
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, "<span class='warning'>Error: no tracks on the bin!.</span>")
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, "<span class='warning'>Error: no disks in trays.</span>")
return
if(!selected_disk)
to_chat(usr,"<span class='warning'>Error: no disk chosen.</span>" )
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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions code/game/objects/items/devices/radio/radio.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 0 additions & 5 deletions code/game/objects/items/stacks/crafting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/outfits/standard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion code/modules/research/designs/weapon_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion hailmary.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
37 changes: 32 additions & 5 deletions tgui/packages/tgui/interfaces/Jukebox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Window
width={370}
Expand All @@ -25,16 +32,18 @@ export const Jukebox = (props, context) => {
<Section
title="Song Player"
buttons={(
<Button
icon={active ? 'pause' : 'play'}
content={active ? 'Stop' : 'Play'}
selected={active}
onClick={() => act('toggle')} />
<>
<Button
icon={active ? 'pause' : 'play'}
content={active ? 'Stop' : 'Play'}
selected={active}
onClick={() => act('toggle')} />
<Button
icon={active ? 'pause' : 'play'}
content={active ? 'Eject' : 'Eject'}
selected={active}
onClick={() => act('eject_disk')} />
</>
)}>
<LabeledList>
<LabeledList.Item label="Track Selected">
Expand All @@ -48,13 +57,31 @@ export const Jukebox = (props, context) => {
track: value,
})} />
</LabeledList.Item>
<LabeledList.Item label="Disk Selected">
<Dropdown
overflow-y="scroll"
width="240px"
options={disks.map(disk => disk.name)}
disabled={active}
selected={disk_selected || "Select a Disk"}
onSelected={value => act('select_record', {
record: value,
})} />
</LabeledList.Item>
<LabeledList.Item label="Track Length">
{track_selected ? track_length : "No Track Selected"}
</LabeledList.Item>
<LabeledList.Item label="Track Beat">
{track_selected ? track_beat : "No Track Selected"}
{track_beat === 1 ? " beat" : " beats"}
</LabeledList.Item>
<LabeledList.Item label="Disk Length">
{disk_selected ? disk_selected_length : "No Disk Selected"}
</LabeledList.Item>
<LabeledList.Item label="Disk Beat">
{disk_selected ? disk_selected_beat : "No Disk Selected"}
{disk_selected_beat === 1 ? " beat" : " beats"}
</LabeledList.Item>
</LabeledList>
</Section>
<Section title="Machine Settings">
Expand Down

0 comments on commit 683125c

Please sign in to comment.