Skip to content

Commit

Permalink
Improves note deletions (ParadiseSS13#25460)
Browse files Browse the repository at this point in the history
* Improves not deletions

* balls

* balls the second
  • Loading branch information
AffectedArc07 authored May 17, 2024
1 parent 0339ef6 commit f3a24e2
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 83 deletions.
5 changes: 4 additions & 1 deletion SQL/paradise_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,11 @@ CREATE TABLE `notes` (
`server` varchar(50) NOT NULL,
`crew_playtime` mediumint(8) UNSIGNED DEFAULT '0',
`automated` TINYINT(3) UNSIGNED NULL DEFAULT '0',
`deleted` TINYINT(4) NOT NULL DEFAULT '0',
`deletedby` VARCHAR(32) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
PRIMARY KEY (`id`),
KEY `ckey` (`ckey`)
KEY `ckey` (`ckey`),
KEY `deleted` (`deleted`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

Expand Down
7 changes: 7 additions & 0 deletions SQL/updates/55-56.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Updating DB from 55-56 ~AffectedArc07
# Adds a new column to the notes table for tracking deleted notes
ALTER TABLE `notes`
ADD COLUMN `deleted` TINYINT NOT NULL DEFAULT 0 AFTER `automated`,
ADD COLUMN `deletedby` VARCHAR(32) NULL DEFAULT NULL AFTER `deleted`,
ADD INDEX `deleted` (`deleted`);

2 changes: 1 addition & 1 deletion code/__DEFINES/misc_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@
#define INVESTIGATE_BOMB "bombs"

// The SQL version required by this version of the code
#define SQL_VERSION 55
#define SQL_VERSION 56

// Vending machine stuff
#define CAT_NORMAL (1<<0)
Expand Down
5 changes: 3 additions & 2 deletions code/modules/admin/sql_notes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
adminckey = query_find_note_del.item[3]
qdel(query_find_note_del)

var/datum/db_query/query_del_note = SSdbcore.NewQuery("DELETE FROM notes WHERE id=:note_id", list(
var/datum/db_query/query_del_note = SSdbcore.NewQuery("UPDATE notes SET deleted=1, deletedby=:ckey WHERE id=:note_id", list(
"ckey" = usr.ckey,
"note_id" = note_id
))
if(!query_del_note.warn_execute())
Expand Down Expand Up @@ -193,7 +194,7 @@
var/target_sql_ckey = ckey(target_ckey)
var/datum/db_query/query_get_notes = SSdbcore.NewQuery({"
SELECT id, timestamp, notetext, adminckey, last_editor, server, crew_playtime, round_id, automated
FROM notes WHERE ckey=:targetkey ORDER BY timestamp"}, list(
FROM notes WHERE ckey=:targetkey AND deleted=0 ORDER BY timestamp"}, list(
"targetkey" = target_sql_ckey
))
if(!query_get_notes.warn_execute())
Expand Down
182 changes: 103 additions & 79 deletions config/example/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,39 @@ enable_localhost_autoadmin = true
# +VIEWRUNTIMES = Allows a player to view the runtimes of the server, but not use other debug verbs
admin_ranks = [
# Format: {name = "My Rank", rights = ["+LIST", "+OF", "+RIGHTS"]}
{name = "Mentor", rights = ["+MENTOR"]},
{name = "Trial Admin", rights = ["+ADMIN", "+BAN", "+STEALTH", "+REJUVINATE"]},
{name = "Game Admin", rights = ["+ADMIN", "+BAN", "+STEALTH", "+REJUVINATE", "+DEBUG", "+BUILDMODE", "+EVENT", "+SERVER", "+POSSESS", "+PROCCALL", "+VAREDIT", "+SOUND", "+SPAWN"]},
{name = "Head of Staff", rights = ["+EVERYTHING"]},
{name = "Hosting Provider", rights = ["+EVERYTHING"]},
{name = "Maintainers", rights = ["+EVERYTHING"]}
{ name = "Mentor", rights = [
"+MENTOR",
] },
{ name = "Trial Admin", rights = [
"+ADMIN",
"+BAN",
"+STEALTH",
"+REJUVINATE",
] },
{ name = "Game Admin", rights = [
"+ADMIN",
"+BAN",
"+STEALTH",
"+REJUVINATE",
"+DEBUG",
"+BUILDMODE",
"+EVENT",
"+SERVER",
"+POSSESS",
"+PROCCALL",
"+VAREDIT",
"+SOUND",
"+SPAWN",
] },
{ name = "Head of Staff", rights = [
"+EVERYTHING",
] },
{ name = "Hosting Provider", rights = [
"+EVERYTHING",
] },
{ name = "Maintainers", rights = [
"+EVERYTHING",
] },
]
# List of people and the admin rank they are assigned to
admin_assignments = [
Expand All @@ -82,18 +109,18 @@ admin_assignments = [
allow_admin_ooc_colour = true
# Map of admin rank colours to their respective rank. Note you can use hex or colour name here.
admin_rank_colour_map = [
{name = "Head of Staff", colour = "#e74c3c"},
{name = "Maintainer", colour = "#992d22"},
{name = "Server Dev", colour = "#1abc9c"},
{name = "Community Manager", colour = "#e91e63"},
{name = "Game Admin", colour = "#238afa"},
{name = "Trial Admin", colour = "#7fb6fc"},
{name = "PR Reviewer", colour = "#c27c0e"},
{name = "Mentor", colour = "#f1c40f"},
{ name = "Head of Staff", colour = "#e74c3c" },
{ name = "Maintainer", colour = "#992d22" },
{ name = "Server Dev", colour = "#1abc9c" },
{ name = "Community Manager", colour = "#e91e63" },
{ name = "Game Admin", colour = "#238afa" },
{ name = "Trial Admin", colour = "#7fb6fc" },
{ name = "PR Reviewer", colour = "#c27c0e" },
{ name = "Mentor", colour = "#f1c40f" },
]
# Map of common CIDs that should not be banned, plus their reasons
common_cid_map = [
{cid = "3923664137", reason = "Mass-Match related to Walmart branded prebuilt PCs"}
{ cid = "3923664137", reason = "Mass-Match related to Walmart branded prebuilt PCs" },
]


Expand Down Expand Up @@ -131,7 +158,10 @@ ai_hologram = ["ckeyhere"]
pai_holoform = ["ckeyhere"]
# List of dictionary entries for ckeys with a custom IPC screean
ipc_screens = [
{ckey = "ckeyhere", screens = ["Icon State 1", "Icon State 2"]}
{ ckey = "ckeyhere", screens = [
"Icon State 1",
"Icon State 2",
] },
]


Expand All @@ -145,7 +175,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 = 55
sql_version = 56
# SQL server address. Can be an IP or DNS name
sql_address = "127.0.0.1"
# SQL server port
Expand All @@ -171,20 +201,14 @@ async_thread_limit = 50
# All role IDs must be STRINGS as BYOND doesnt like ints that big
enable_discord_webhooks = false
# List of all webhooks for the primary feed (public channels)
main_webhook_urls = [
"https://webhook.one",
"https://webhook.two"
]
main_webhook_urls = ["https://webhook.one", "https://webhook.two"]
# List of all webhook URLs for the mentor feed (mentorhelps relay)
mentor_webhook_urls = [
"https://mentor.webhook.one",
"https://mentor.webhook.two"
"https://mentor.webhook.two",
]
# List of all webhook URLs for the admin feed (round alerts, ahelps, etc)
admin_webhook_urls = [
"https://admin.webhook.one",
"https://admin.webhook.two"
]
admin_webhook_urls = ["https://admin.webhook.one", "https://admin.webhook.two"]
# Role ID for the admin role on the discord. Set to "" to disable.
# THESE MUST BOTH BE STRINGS. BYOND DOESNT LIKE NUMBERS THIS BIG
admin_role_id = ""
Expand All @@ -204,18 +228,18 @@ forward_all_ahelps = true
# Disable this to disable all random events
allow_random_events = true
# Map of lower bounds for event delays. In minutes.
event_delay_lower_bounds = {mundane = 10, moderate = 30, major = 50}
event_delay_lower_bounds = { mundane = 10, moderate = 30, major = 50 }
# Map of upper bounds for event delays. In minutes.
event_delay_upper_bounds = {mundane = 15, moderate = 45, major = 70}
event_delay_upper_bounds = { mundane = 15, moderate = 45, major = 70 }
# Expected round length in minutes. Changes event weights
expected_round_length = 120
# Initial delays for the first events firing off. If any of these are commented, a random value based on above thresholds is used.
# You must specify an upper and lower bound, or the code cries a lot. The events system is so bad good god.
# Values are in minutes
event_initial_delays = [
#{severity = "mundane", lower_bound = 10, upper_bound = 15},
{severity = "moderate", lower_bound = 25, upper_bound = 40},
{severity = "major", lower_bound = 55, upper_bound = 75},
{ severity = "moderate", lower_bound = 25, upper_bound = 40 },
{ severity = "major", lower_bound = 55, upper_bound = 75 },
]


Expand All @@ -229,20 +253,20 @@ event_initial_delays = [
antag_account_age_restrictions = false
# Gamemode probabilities map for if you are using secret or random
gamemode_probabilities = [
{gamemode = "abduction", probability = 0},
{gamemode = "changeling", probability = 3},
{gamemode = "cult", probability = 3},
{gamemode = "extend-a-traitormongous", probability = 2}, # Autotraitor
{gamemode = "extended", probability = 3},
{gamemode = "nuclear", probability = 2},
{gamemode = "raginmages", probability = 0},
{gamemode = "revolution", probability = 0},
{gamemode = "traitor", probability = 2},
{gamemode = "traitorchan", probability = 3},
{gamemode = "traitorvamp", probability = 3},
{gamemode = "vampire", probability = 3},
{gamemode = "wizard", probability = 2},
{gamemode = "trifecta", probability = 3},
{ gamemode = "abduction", probability = 0 },
{ gamemode = "changeling", probability = 3 },
{ gamemode = "cult", probability = 3 },
{ gamemode = "extend-a-traitormongous", probability = 2 }, # Autotraitor
{ gamemode = "extended", probability = 3 },
{ gamemode = "nuclear", probability = 2 },
{ gamemode = "raginmages", probability = 0 },
{ gamemode = "revolution", probability = 0 },
{ gamemode = "traitor", probability = 2 },
{ gamemode = "traitorchan", probability = 3 },
{ gamemode = "traitorvamp", probability = 3 },
{ gamemode = "vampire", probability = 3 },
{ gamemode = "wizard", probability = 2 },
{ gamemode = "trifecta", probability = 3 },
]
# Do we want the amount of traitors to scale with population?
traitor_scaling = true
Expand Down Expand Up @@ -409,44 +433,44 @@ enable_job_amount_overrides = true
# Job slot amount map. These are overrides. If you dont specify a value here, the code will be used as default. -1 is infinite
job_slot_amounts = [
# Commmand
{name = "Captain", lowpop = 1, highpop = 1},
{name = "Head of Personnel", lowpop = 1, highpop = 1},
{name = "Head of Security", lowpop = 1, highpop = 1},
{name = "Chief Engineer", lowpop = 1, highpop = 1},
{name = "Research Director", lowpop = 1, highpop = 1},
{name = "Chief Medical Officer", lowpop = 1, highpop = 1},
{ name = "Captain", lowpop = 1, highpop = 1 },
{ name = "Head of Personnel", lowpop = 1, highpop = 1 },
{ name = "Head of Security", lowpop = 1, highpop = 1 },
{ name = "Chief Engineer", lowpop = 1, highpop = 1 },
{ name = "Research Director", lowpop = 1, highpop = 1 },
{ name = "Chief Medical Officer", lowpop = 1, highpop = 1 },
# Engineering
{name = "Life Support Specialist", lowpop = 3, highpop = 4},
{name = "Station Engineer", lowpop = 5, highpop = 6},
{ name = "Life Support Specialist", lowpop = 3, highpop = 4 },
{ name = "Station Engineer", lowpop = 5, highpop = 6 },
# Medical
{name = "Chemist", lowpop = 2, highpop = 2},
{name = "Geneticist", lowpop = 2, highpop = 2},
{name = "Medical Doctor", lowpop = 5, highpop = 6},
{name = "Virologist", lowpop = 1, highpop = 1},
{ name = "Chemist", lowpop = 2, highpop = 2 },
{ name = "Geneticist", lowpop = 2, highpop = 2 },
{ name = "Medical Doctor", lowpop = 5, highpop = 6 },
{ name = "Virologist", lowpop = 1, highpop = 1 },
# Science
{name = "Roboticist", lowpop = 2, highpop = 2},
{name = "Scientist", lowpop = 6, highpop = 7},
{ name = "Roboticist", lowpop = 2, highpop = 2 },
{ name = "Scientist", lowpop = 6, highpop = 7 },
# Security
{name = "Detective", lowpop = 1, highpop = 1},
{name = "Security Officer", lowpop = 8, highpop = 9},
{name = "Warden", lowpop = 1, highpop = 1},
{name = "Internal Affairs Agent", lowpop = 2, highpop = 2},
{ name = "Detective", lowpop = 1, highpop = 1 },
{ name = "Security Officer", lowpop = 8, highpop = 9 },
{ name = "Warden", lowpop = 1, highpop = 1 },
{ name = "Internal Affairs Agent", lowpop = 2, highpop = 2 },
# Service
{name = "Bartender", lowpop = 1, highpop = 1},
{name = "Botanist", lowpop = 2, highpop = 2},
{name = "Chaplain", lowpop = 1, highpop = 1},
{name = "Chef", lowpop = 1, highpop = 1},
{name = "Janitor", lowpop = 1, highpop = 2},
{name = "Librarian", lowpop = 1, highpop = 1},
{ name = "Bartender", lowpop = 1, highpop = 1 },
{ name = "Botanist", lowpop = 2, highpop = 2 },
{ name = "Chaplain", lowpop = 1, highpop = 1 },
{ name = "Chef", lowpop = 1, highpop = 1 },
{ name = "Janitor", lowpop = 1, highpop = 2 },
{ name = "Librarian", lowpop = 1, highpop = 1 },
# Cargo/Supply
{name = "Quartermaster", lowpop = 1, highpop = 1},
{name = "Shaft Miner", lowpop = 6, highpop = 6},
{name = "Cargo Technician", lowpop = 3, highpop = 4},
{ name = "Quartermaster", lowpop = 1, highpop = 1 },
{ name = "Shaft Miner", lowpop = 6, highpop = 6 },
{ name = "Cargo Technician", lowpop = 3, highpop = 4 },
# Silicon
{name = "AI", lowpop = 1, highpop = 1},
{name = "Cyborg", lowpop = 1, highpop = 1},
{ name = "AI", lowpop = 1, highpop = 1 },
{ name = "Cyborg", lowpop = 1, highpop = 1 },
# Misc
{name = "Assistant", lowpop = -1, highpop = -1},
{ name = "Assistant", lowpop = -1, highpop = -1 },
]


Expand Down Expand Up @@ -816,11 +840,11 @@ non_repeating_maps = true
# - "Random" = no vote, map is random
# If you dont enter one correctly, it will whine on startup
map_vote_day_types = [
{ day_number = 1, rotation_type = "Vote" }, # Monday
{ day_number = 2, rotation_type = "Random" }, # Tuesday
{ day_number = 3, rotation_type = "Vote" }, # Wednesday
{ day_number = 4, rotation_type = "Random" }, # Thursday
{ day_number = 5, rotation_type = "Vote" }, # Friday
{ day_number = 1, rotation_type = "Vote" }, # Monday
{ day_number = 2, rotation_type = "Random" }, # Tuesday
{ day_number = 3, rotation_type = "Vote" }, # Wednesday
{ day_number = 4, rotation_type = "Random" }, # Thursday
{ day_number = 5, rotation_type = "Vote" }, # Friday
{ day_number = 6, rotation_type = "Nodupes" }, # Saturday
{ day_number = 7, rotation_type = "Nodupes" }, # Sunday
]
Expand Down

0 comments on commit f3a24e2

Please sign in to comment.