From f9e30f8e780ab07a6d944233147d854a3898f6b3 Mon Sep 17 00:00:00 2001 From: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:23:33 -0400 Subject: [PATCH] Cyborgs can now choose what type of brain they spawn with. (#23954) * choose your own brainventure * i kinda remember sql * lets try on Login() instead * wait its actually here * Revert "lets try on Login() instead" This reverts commit 6fd26912b190d1d38fd5c442fc9dcd6f4c49041f. * hold on i gotta sort this out * lol, lmao even * i apparently do not remember sql * Actually remember to switch to varchar * aaaaaaaaaaaaaaaaaaaa * does the comma fix it * i am so fucking stupid lmao * lmao i REALLY dont know sql, thanks AA Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> * the other place to fix a string * sql is now 54, happy birthday sql * autodoc whitespace fix Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> * maybe using the defines i made is a good idea * AA's changes --------- Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> --- SQL/paradise_schema.sql | 1 + SQL/updates/53-54.sql | 5 +++++ code/__DEFINES/misc_defines.dm | 2 +- code/_globalvars/lists/flavor_misc.dm | 7 +++++++ .../client/login_processing/20-load_characters.dm | 3 ++- code/modules/client/preference/character.dm | 15 ++++++++++----- code/modules/client/preference/link_processing.dm | 4 +++- code/modules/client/preference/preferences.dm | 2 ++ code/modules/mob/transform_procs.dm | 10 +++++++--- config/example/config.toml | 2 +- 10 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 SQL/updates/53-54.sql diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql index ea78bcc0d55..60c0dc25dc0 100644 --- a/SQL/paradise_schema.sql +++ b/SQL/paradise_schema.sql @@ -79,6 +79,7 @@ CREATE TABLE `characters` ( `hair_gradient_colour` varchar(7) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#000000', `hair_gradient_alpha` tinyint(3) UNSIGNED NOT NULL DEFAULT '255', `custom_emotes` LONGTEXT COLLATE 'utf8mb4_unicode_ci' DEFAULT NULL, + `cyborg_brain_type` ENUM('MMI', 'Robobrain', 'Positronic') NOT NULL DEFAULT 'MMI', PRIMARY KEY (`id`), KEY `ckey` (`ckey`) ) ENGINE=InnoDB AUTO_INCREMENT=125467 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/SQL/updates/53-54.sql b/SQL/updates/53-54.sql new file mode 100644 index 00000000000..303de0b32be --- /dev/null +++ b/SQL/updates/53-54.sql @@ -0,0 +1,5 @@ +#Updating SQL from 53 to 54 -Wilk +#Add a choice for what type of brain borgs want to have + +ALTER TABLE `characters` + ADD COLUMN `cyborg_brain_type` VARCHAR(11) NOT NULL DEFAULT 'MMI' AFTER `height`; diff --git a/code/__DEFINES/misc_defines.dm b/code/__DEFINES/misc_defines.dm index db931f29746..b3bb3de5491 100644 --- a/code/__DEFINES/misc_defines.dm +++ b/code/__DEFINES/misc_defines.dm @@ -392,7 +392,7 @@ #define INVESTIGATE_BOMB "bombs" // The SQL version required by this version of the code -#define SQL_VERSION 53 +#define SQL_VERSION 54 // Vending machine stuff #define CAT_NORMAL (1<<0) diff --git a/code/_globalvars/lists/flavor_misc.dm b/code/_globalvars/lists/flavor_misc.dm index 19768711ea1..5d588c4793b 100644 --- a/code/_globalvars/lists/flavor_misc.dm +++ b/code/_globalvars/lists/flavor_misc.dm @@ -61,3 +61,10 @@ GLOBAL_LIST_INIT(phonetic_alphabet, list("Alpha", "Bravo", "Charlie", #define DSATCHEL "Department Satchel" #define DDUFFLEBAG "Department Dufflebag" GLOBAL_LIST_INIT(backbaglist, list(DBACKPACK, DSATCHEL, DDUFFLEBAG, GBACKPACK, GSATCHEL, GDUFFLEBAG, LSATCHEL)) + +//Chooseable brain types for borgs +#define MMI_BORG "MMI" +#define ROBOBRAIN_BORG "Robobrain" +#define POSITRONIC_BORG "Positronic" +GLOBAL_LIST_INIT(borg_brain_choices, list(MMI_BORG, ROBOBRAIN_BORG, POSITRONIC_BORG)) +GLOBAL_PROTECT(borg_brain_choices) diff --git a/code/modules/client/login_processing/20-load_characters.dm b/code/modules/client/login_processing/20-load_characters.dm index f22512e75e9..40be0ffc0cd 100644 --- a/code/modules/client/login_processing/20-load_characters.dm +++ b/code/modules/client/login_processing/20-load_characters.dm @@ -60,7 +60,8 @@ hair_gradient_alpha, custom_emotes, physique, - height + height, + cyborg_brain_type FROM characters WHERE ckey=:ckey"}, list( "ckey" = C.ckey )) diff --git a/code/modules/client/preference/character.dm b/code/modules/client/preference/character.dm index 333acaf4d4b..ca75666d651 100644 --- a/code/modules/client/preference/character.dm +++ b/code/modules/client/preference/character.dm @@ -38,7 +38,8 @@ var/species = "Human" var/language = "None" //Secondary language var/autohiss_mode = AUTOHISS_OFF //Species autohiss level. OFF, BASIC, FULL. - + /// If a spawned cyborg should have an MMI, a positronic, or a robobrain. MMI by default + var/cyborg_brain_type = MMI_BORG /// The body accessory name of the mob (e.g. wings, tail). var/body_accessory = null @@ -191,7 +192,8 @@ hair_gradient_offset=:h_grad_offset, hair_gradient_colour=:h_grad_colour, hair_gradient_alpha=:h_grad_alpha, - custom_emotes=:custom_emotes + custom_emotes=:custom_emotes, + cyborg_brain_type=:cyborg_brain_type WHERE ckey=:ckey AND slot=:slot"}, list( // OH GOD SO MANY PARAMETERS @@ -251,6 +253,7 @@ "h_grad_colour" = h_grad_colour, "h_grad_alpha" = h_grad_alpha, "custom_emotes" = json_encode(custom_emotes), + "cyborg_brain_type" = cyborg_brain_type, "ckey" = C.ckey, "slot" = slot_number )) @@ -291,7 +294,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) + hair_gradient, hair_gradient_offset, hair_gradient_colour, hair_gradient_alpha, custom_emotes, cyborg_brain_type) VALUES (:ckey, :slot, :metadata, :name, :be_random_name, :gender, :age, :species, :language, @@ -318,7 +321,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) + :h_grad_style, :h_grad_offset, :h_grad_colour, :h_grad_alpha, :custom_emotes, :cyborg_brain_type) "}, list( // This has too many params for anyone to look at this without going insae "ckey" = C.ckey, @@ -379,6 +382,7 @@ "h_grad_colour" = h_grad_colour, "h_grad_alpha" = h_grad_alpha, "custom_emotes" = json_encode(custom_emotes), + "cyborg_brain_type" = cyborg_brain_type )) if(!query.warn_execute()) @@ -466,6 +470,7 @@ var/custom_emotes_tmp = query.item[55] physique = query.item[56] height = query.item[57] + cyborg_brain_type = query.item[58] //Sanitize var/datum/species/SP = GLOB.all_species[species] @@ -551,7 +556,7 @@ loadout_gear = sanitize_json(loadout_gear) custom_emotes_tmp = sanitize_json(custom_emotes_tmp) custom_emotes = init_custom_emotes(custom_emotes_tmp) - + cyborg_brain_type = sanitize_inlist(cyborg_brain_type, GLOB.borg_brain_choices, initial(cyborg_brain_type)) if(!player_alt_titles) player_alt_titles = new() if(!organ_data) diff --git a/code/modules/client/preference/link_processing.dm b/code/modules/client/preference/link_processing.dm index 41aa9f771ae..f33977c4a3d 100644 --- a/code/modules/client/preference/link_processing.dm +++ b/code/modules/client/preference/link_processing.dm @@ -862,7 +862,9 @@ active_character.organ_data[organ] = null if("Cybernetic") active_character.organ_data[organ] = "cybernetic" - + if("cyborg_brain_type") + var/brain_type = tgui_input_list(user, "What type of brain would you like to have as a cyborg?", "Cyborg Brain Type", GLOB.borg_brain_choices) + active_character.cyborg_brain_type = brain_type if("clientfps") var/version_message if(user.client && user.client.byond_version < 511) diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index d47ab9fb326..902d8313215 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -373,6 +373,8 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts if(!ind) dat += "\[...\]
" else dat += "
" + dat += "

Cyborg Brain Type

" + dat += "[active_character.cyborg_brain_type]
" dat += "

Clothing

" if(S.clothing_flags & HAS_UNDERWEAR) dat += "Underwear: [active_character.underwear]
" diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index d29f82eac76..f5529fab46e 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -92,13 +92,17 @@ if(O.mind && O.mind.assigned_role == "Cyborg") var/obj/item/mmi/new_mmi - switch(O.mind.role_alt_title) - if("Robot") + switch(O.client.prefs.active_character.cyborg_brain_type) + if(ROBOBRAIN_BORG) new_mmi = new /obj/item/mmi/robotic_brain(O) if(new_mmi.brainmob) new_mmi.brainmob.name = O.name - if("Cyborg") + if(MMI_BORG) new_mmi = new /obj/item/mmi(O) + if(POSITRONIC_BORG) + new_mmi = new /obj/item/mmi/robotic_brain/positronic(O) + if(new_mmi.brainmob) + new_mmi.brainmob.name = O.name else // This should never happen, but oh well new_mmi = new /obj/item/mmi(O) diff --git a/config/example/config.toml b/config/example/config.toml index bb01c052363..e09198a3e52 100644 --- a/config/example/config.toml +++ b/config/example/config.toml @@ -145,7 +145,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 = 53 +sql_version = 54 # SQL server address. Can be an IP or DNS name sql_address = "127.0.0.1" # SQL server port