Adds toggles3 (#27397)

This commit is contained in:
AffectedArc07
2024-11-24 14:23:27 +00:00
committed by GitHub
parent e37b83a0b9
commit 5e5c75bf48
8 changed files with 28 additions and 4 deletions
+1
View File
@@ -280,6 +280,7 @@ CREATE TABLE `player` (
`default_slot` smallint(4) DEFAULT '1',
`toggles` int(11) DEFAULT NULL,
`toggles_2` int(11) DEFAULT NULL,
`toggles_3` int(11) DEFAULT NULL,
`sound` mediumint(8) DEFAULT '31',
`light` MEDIUMINT(3) NOT NULL DEFAULT '7',
`glowlevel` TINYINT(1) NOT NULL DEFAULT '1',
+4
View File
@@ -0,0 +1,4 @@
# Updating the SQL from version 61 to version 12. -AffectedArc07
# Adds a new bitflag column for toggles
ALTER TABLE `player` ADD COLUMN `toggles_3` INT NULL DEFAULT NULL AFTER `toggles_2`;
+1 -1
View File
@@ -423,7 +423,7 @@
#define INVESTIGATE_HOTMIC "hotmic"
// The SQL version required by this version of the code
#define SQL_VERSION 61
#define SQL_VERSION 62
// Vending machine stuff
#define CAT_NORMAL (1<<0)
+14 -1
View File
@@ -80,13 +80,26 @@
#define TOGGLES_2_DEFAULT (PREFTOGGLE_2_FANCYUI|PREFTOGGLE_2_ITEMATTACK|PREFTOGGLE_2_WINDOWFLASHING|PREFTOGGLE_2_RUNECHAT|PREFTOGGLE_2_DEATHMESSAGE|PREFTOGGLE_2_SEE_ITEM_OUTLINES|PREFTOGGLE_2_THOUGHT_BUBBLE|PREFTOGGLE_2_DANCE_DISCO|PREFTOGGLE_2_MOD_ACTIVATION_METHOD|PREFTOGGLE_2_SWAP_INPUT_BUTTONS|PREFTOGGLE_2_LARGE_INPUT_BUTTONS)
// toggles_3 variables. These MUST be prefixed with PREFTOGGLE_3
#define TOGGLES_3_TOTAL 1023 // If you add or remove a preference toggle above, make sure you update this define with the total value of the toggles combined.
// When you add a toggle here, inform AA on merge so the column can be zeroed out. This needs to exist to avoid the compiler freaking out
// Also update the above value to the actual total
#define TOGGLES_3_DEFAULT (1)
// Sanity checks
// I should really convert these to a JSON list at some point hnnnnnng
#if TOGGLES_TOTAL > 16777215
#error toggles bitflag over 16777215. Please use toggles_2.
#endif
#if TOGGLES_2_TOTAL > 16777215
#error toggles_2 bitflag over 16777215. Please make an issue report and postpone the feature you are working on.
#error toggles_2 bitflag over 16777215. Please use toggles_3.
#endif
#if TOGGLES_3_TOTAL > 16777215
#error toggles_3 bitflag over 16777215. Please make an issue report and postpone the feature you are working on.
#endif
// This is a list index. Required to start at 1 instead of 0 so it's properly placed in the list
@@ -32,7 +32,8 @@
server_region,
muted_adminsounds_ckeys,
viewrange,
map_vote_pref_json
map_vote_pref_json,
toggles_3
FROM player
WHERE ckey=:ckey"}, list(
"ckey" = C.ckey
@@ -63,6 +63,7 @@ GLOBAL_LIST_INIT(special_role_times, list(
var/UI_style = "Midnight"
var/toggles = TOGGLES_DEFAULT
var/toggles2 = TOGGLES_2_DEFAULT // Created because 1 column has a bitflag limit of 24 (BYOND limitation not MySQL)
var/toggles3 = TOGGLES_3_DEFAULT // Created for see above. I need to JSONify this at some point -aa07
var/sound = SOUND_DEFAULT
var/light = LIGHT_DEFAULT
/// Glow level for the lighting. Takes values from GLOW_HIGH to GLOW_DISABLE.
@@ -34,6 +34,7 @@
raw_muted_admins = query.item[26]
viewrange = query.item[27]
raw_fptp = query.item[28]
toggles3 = text2num(query.item[29])
lastchangelog_2 = lastchangelog // Clone please
@@ -43,6 +44,7 @@
default_slot = sanitize_integer(default_slot, 1, max_save_slots, initial(default_slot))
toggles = sanitize_integer(toggles, 0, TOGGLES_TOTAL, initial(toggles))
toggles2 = sanitize_integer(toggles2, 0, TOGGLES_2_TOTAL, initial(toggles2))
toggles3 = sanitize_integer(toggles3, 0, TOGGLES_3_TOTAL, initial(toggles3))
sound = sanitize_integer(sound, 0, 65535, initial(sound))
UI_style_color = sanitize_hexcolor(UI_style_color, initial(UI_style_color))
UI_style_alpha = sanitize_integer(UI_style_alpha, 0, 255, initial(UI_style_alpha))
@@ -94,6 +96,7 @@
default_slot=:defaultslot,
toggles=:toggles,
toggles_2=:toggles2,
toggles_3=:toggles3,
atklog=:atklog,
sound=:sound,
light=:light,
@@ -123,6 +126,7 @@
// Even though its a number in the DB, you have to use num2text here, otherwise byond adds scientific notation to the number
"toggles" = num2text(toggles, CEILING(log(10, (TOGGLES_TOTAL)), 1)),
"toggles2" = num2text(toggles2, CEILING(log(10, (TOGGLES_2_TOTAL)), 1)),
"toggles3" = num2text(toggles3, CEILING(log(10, (TOGGLES_3_TOTAL)), 1)),
"atklog" = atklog,
"sound" = sound,
"light" = light,
+1 -1
View File
@@ -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 = 61
sql_version = 62
# SQL server address. Can be an IP or DNS name
sql_address = "127.0.0.1"
# SQL server port