Skip to content

Commit

Permalink
Adds PDA ringtone to character preferences (#27365)
Browse files Browse the repository at this point in the history
* Adds PDA ringtone to character preferences

* Two fixes

* Reset option

* Contra request

* DB update

* linter fix

* SQL update

* file rename

---------

Signed-off-by: Burzah <[email protected]>
Co-authored-by: Burzah <[email protected]>
  • Loading branch information
Miraviel and Burzah authored Nov 30, 2024
1 parent c21be0b commit fca84e2
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 30 deletions.
1 change: 1 addition & 0 deletions SQL/paradise_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ CREATE TABLE `characters` (
`custom_emotes` LONGTEXT COLLATE 'utf8mb4_unicode_ci' DEFAULT NULL,
`runechat_color` VARCHAR(7) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#FFFFFF',
`cyborg_brain_type` ENUM('MMI', 'Robobrain', 'Positronic') NOT NULL DEFAULT 'MMI',
`pda_ringtone` VARCHAR(16) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
PRIMARY KEY (`id`),
KEY `ckey` (`ckey`)
) ENGINE=InnoDB AUTO_INCREMENT=125467 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
Expand Down
5 changes: 5 additions & 0 deletions SQL/updates/62-63.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Updates the DB from 62 to 63
# Adds a PDA ringtone option to character setup

ALTER TABLE `characters`
ADD COLUMN `pda_ringtone` VARCHAR(16) NULL DEFAULT NULL AFTER `cyborg_brain_type`;
2 changes: 1 addition & 1 deletion code/__DEFINES/misc_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@
#define INVESTIGATE_HOTMIC "hotmic"

// The SQL version required by this version of the code
#define SQL_VERSION 62
#define SQL_VERSION 63

// Vending machine stuff
#define CAT_NORMAL (1<<0)
Expand Down
22 changes: 22 additions & 0 deletions code/_globalvars/lists/flavor_misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,25 @@ GLOBAL_LIST_INIT(backbaglist, list(DBACKPACK, DSATCHEL, DDUFFLEBAG, GBACKPACK, G
#define POSITRONIC_BORG "Positronic"
GLOBAL_LIST_INIT(borg_brain_choices, list(MMI_BORG, ROBOBRAIN_BORG, POSITRONIC_BORG))
GLOBAL_PROTECT(borg_brain_choices)

//Chooseable ringtones
//Due to database reasons, the name should be 16 characters long maximum
GLOBAL_LIST_INIT(pda_ringtone_choices, list("beep" = 'sound/machines/twobeep.ogg',
"boop" = 'sound/machines/boop.ogg',
"electronic" = 'sound/machines/notif1.ogg',
"chime" = 'sound/machines/notif2.ogg',
"slip" = 'sound/misc/slip.ogg',
"honk" = 'sound/items/bikehorn.ogg',
"SKREE" = 'sound/voice/shriek1.ogg',
"holy" = 'sound/items/PDA/ambicha4-short.ogg',
"boom" = 'sound/effects/explosionfar.ogg',
"gavel" = 'sound/items/gavel.ogg',
"xeno" = 'sound/voice/hiss1.ogg',
"smoke" = 'sound/magic/smoke.ogg',
"shatter" = 'sound/effects/pylon_shatter.ogg',
"energy" = 'sound/weapons/egloves.ogg',
"flare" = 'sound/goonstation/misc/matchstick_light.ogg',
"interference" = 'sound/misc/interference.ogg',
"zap" = 'sound/effects/eleczap.ogg',
"disgusting" = 'sound/effects/blobattack.ogg',
"hungry" = 'sound/weapons/bite.ogg'))
2 changes: 2 additions & 0 deletions code/game/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@
PDA.ownjob = C.assignment
PDA.ownrank = C.rank
PDA.name = "PDA-[H.real_name] ([PDA.ownjob])"
if(H.client?.prefs.active_character.pda_ringtone)
PDA.ttone = H.client.prefs.active_character.pda_ringtone

/datum/outfit/job/on_mind_initialize(mob/living/carbon/human/H)
. = ..()
Expand Down
3 changes: 2 additions & 1 deletion code/modules/client/login_processing/20-load_characters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
physique,
height,
cyborg_brain_type,
body_type
body_type,
pda_ringtone
FROM characters WHERE ckey=:ckey"}, list(
"ckey" = C.ckey
))
Expand Down
15 changes: 11 additions & 4 deletions code/modules/client/preference/character.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
var/list/custom_emotes = list()
/// Runechat color
var/runechat_color = "#FFFFFF"
/// The ringtone their PDA should start with
var/pda_ringtone

// Fuckery to prevent null characters
/datum/character_save/New()
Expand Down Expand Up @@ -199,7 +201,8 @@
custom_emotes=:custom_emotes,
runechat_color=:runechat_color,
cyborg_brain_type=:cyborg_brain_type,
body_type=:body_type
body_type=:body_type,
pda_ringtone=:pda_ringtone
WHERE ckey=:ckey
AND slot=:slot"}, list(
// OH GOD SO MANY PARAMETERS
Expand Down Expand Up @@ -262,6 +265,7 @@
"custom_emotes" = json_encode(custom_emotes),
"runechat_color" = runechat_color,
"cyborg_brain_type" = cyborg_brain_type,
"pda_ringtone" = pda_ringtone,
"ckey" = C.ckey,
"slot" = slot_number
))
Expand Down Expand Up @@ -302,7 +306,7 @@
player_alt_titles,
disabilities, organ_data, rlimb_data, nanotrasen_relation, physique, height, speciesprefs,
socks, body_accessory, gear, autohiss,
hair_gradient, hair_gradient_offset, hair_gradient_colour, hair_gradient_alpha, custom_emotes, runechat_color, cyborg_brain_type, body_type)
hair_gradient, hair_gradient_offset, hair_gradient_colour, hair_gradient_alpha, custom_emotes, runechat_color, cyborg_brain_type, body_type, pda_ringtone)
VALUES
(:ckey, :slot, :metadata, :name, :be_random_name, :gender,
:age, :species, :language,
Expand All @@ -329,7 +333,7 @@
:playertitlelist,
:disabilities, :organ_list, :rlimb_list, :nanotrasen_relation, :physique, :height, :speciesprefs,
:socks, :body_accessory, :gearlist, :autohiss_mode,
:h_grad_style, :h_grad_offset, :h_grad_colour, :h_grad_alpha, :custom_emotes, :runechat_color, :cyborg_brain_type, :body_type)
:h_grad_style, :h_grad_offset, :h_grad_colour, :h_grad_alpha, :custom_emotes, :runechat_color, :cyborg_brain_type, :body_type, :pda_ringtone)
"}, list(
// This has too many params for anyone to look at this without going insae
"ckey" = C.ckey,
Expand Down Expand Up @@ -392,7 +396,8 @@
"h_grad_alpha" = h_grad_alpha,
"custom_emotes" = json_encode(custom_emotes),
"runechat_color" = runechat_color,
"cyborg_brain_type" = cyborg_brain_type
"cyborg_brain_type" = cyborg_brain_type,
"pda_ringtone" = pda_ringtone
))

if(!query.warn_execute())
Expand Down Expand Up @@ -487,6 +492,7 @@
height = query.item[58]
cyborg_brain_type = query.item[59]
body_type = query.item[60]
pda_ringtone = query.item[61]

//Sanitize
var/datum/species/SP = GLOB.all_species[species]
Expand Down Expand Up @@ -574,6 +580,7 @@
custom_emotes = init_custom_emotes(custom_emotes_tmp)
runechat_color = sanitize_hexcolor(runechat_color)
cyborg_brain_type = sanitize_inlist(cyborg_brain_type, GLOB.borg_brain_choices, initial(cyborg_brain_type))
pda_ringtone = sanitize_inlist(pda_ringtone, GLOB.pda_ringtone_choices, initial(pda_ringtone))
if(!player_alt_titles)
player_alt_titles = new()
if(!organ_data)
Expand Down
7 changes: 7 additions & 0 deletions code/modules/client/preference/link_processing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,13 @@
if(!(brain_type in GLOB.borg_brain_choices))
return
active_character.cyborg_brain_type = brain_type
if("pda_ringtone")
var/ringtone = tgui_input_list(user, "What type of ringtone would you like to have on your PDA?", "PDA Ringtones", list("Reset Default Ringtone") + GLOB.pda_ringtone_choices, active_character.pda_ringtone)
if(!(ringtone in GLOB.pda_ringtone_choices))
if(ringtone == "Reset Default Ringtone")
active_character.pda_ringtone = null
return
active_character.pda_ringtone = ringtone
if("clientfps")
var/version_message
if(user.client && user.client.byond_version < 511)
Expand Down
1 change: 1 addition & 0 deletions code/modules/client/preference/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ GLOBAL_LIST_INIT(special_role_times, list(
dat += "<b>Physique:</b> <a href='byond://?_src_=prefs;preference=physique;task=input'>[active_character.physique]</a><br>"
dat += "<b>Height:</b> <a href='byond://?_src_=prefs;preference=height;task=input'>[active_character.height]</a><br>"
dat += "<b>Cyborg Brain Type:</b> <a href='byond://?_src_=prefs;preference=cyborg_brain_type;task=input'>[active_character.cyborg_brain_type]</a><br>"
dat += "<b>PDA Ringtone:</b> <a href='byond://?_src_=prefs;preference=pda_ringtone;task=input'>[active_character.pda_ringtone]</a><br>"
dat += "<a href='byond://?_src_=prefs;preference=flavor_text;task=input'>Set Flavor Text</a><br>"
if(length(active_character.flavor_text) <= 40)
if(!length(active_character.flavor_text))
Expand Down
24 changes: 2 additions & 22 deletions code/modules/pda/PDA.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,6 @@ GLOBAL_LIST_EMPTY(PDAs)
var/mimeamt = 0 //How many silence left when infected with mime.exe
var/detonate = TRUE // Can the PDA be blown up?
var/ttone = "beep" //The ringtone!
var/list/ttone_sound = list("beep" = 'sound/machines/twobeep.ogg',
"boop" = 'sound/machines/boop.ogg',
"electronic" = 'sound/machines/notif1.ogg',
"chime" = 'sound/machines/notif2.ogg',
"slip" = 'sound/misc/slip.ogg',
"honk" = 'sound/items/bikehorn.ogg',
"SKREE" = 'sound/voice/shriek1.ogg',
"holy" = 'sound/items/PDA/ambicha4-short.ogg',
"boom" = 'sound/effects/explosionfar.ogg',
"gavel" = 'sound/items/gavel.ogg',
"xeno" = 'sound/voice/hiss1.ogg',
"smoke" = 'sound/magic/smoke.ogg',
"shatter" = 'sound/effects/pylon_shatter.ogg',
"energy" = 'sound/weapons/egloves.ogg',
"flare" = 'sound/goonstation/misc/matchstick_light.ogg',
"interference" = 'sound/misc/interference.ogg',
"zap" = 'sound/effects/eleczap.ogg',
"disgusting" = 'sound/effects/blobattack.ogg',
"hungry" = 'sound/weapons/bite.ogg')

var/list/programs = list(
new/datum/data/pda/app/main_menu,
new/datum/data/pda/app/notekeeper,
Expand Down Expand Up @@ -377,8 +357,8 @@ GLOBAL_LIST_EMPTY(PDAs)
if(HAS_TRAIT(SSstation, STATION_TRAIT_PDA_GLITCHED))
playsound(src, pick('sound/machines/twobeep_voice1.ogg', 'sound/machines/twobeep_voice2.ogg'), 50, TRUE)
else
if(ttone in ttone_sound)
S = ttone_sound[ttone]
if(ttone in GLOB.pda_ringtone_choices)
S = GLOB.pda_ringtone_choices[ttone]
else
S = 'sound/machines/twobeep_high.ogg'
playsound(loc, S, 50, TRUE)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/pda/messenger.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
data["charges"] = pda.cartridge.charges ? pda.cartridge.charges : 0

data["ringtone"] = pda.ttone
data["ringtone_list"] = pda.ttone_sound
data["ringtone_list"] = GLOB.pda_ringtone_choices

/datum/data/pda/app/messenger/ui_act(action, list/params)
if(..())
Expand Down
2 changes: 1 addition & 1 deletion config/example/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ ipc_screens = [
# Enable/disable the database on a whole
sql_enabled = false
# SQL version. If this is a mismatch, round start will be delayed
sql_version = 62
sql_version = 63
# SQL server address. Can be an IP or DNS name
sql_address = "127.0.0.1"
# SQL server port
Expand Down

0 comments on commit fca84e2

Please sign in to comment.