Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhials committed Nov 6, 2024
2 parents 719b942 + 58b1555 commit c6e3477
Show file tree
Hide file tree
Showing 70 changed files with 2,135 additions and 1,256 deletions.
26 changes: 15 additions & 11 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,7 @@

# MrStonedOne

/code/__DEFINES/MC.dm @MrStonedOne
/code/controllers/admin.dm @MrStonedOne
/code/controllers/master.dm @MrStonedOne
/code/controllers/failsafe.dm @MrStonedOne
/code/controllers/subsystem.dm @MrStonedOne
/code/controllers/subsystem/timer.dm @MrStonedOne
/code/controllers/configuration/entries @MrStonedOne
/config/ @MrStonedOne

# NamelessFairy

Expand All @@ -184,7 +177,7 @@

# MULTIPLE OWNERS

/SQL/ @Jordie0608 @MrStonedOne
/SQL/ @Jordie0608 @MrStonedOne @scriptis

/_maps/ @EOBGames @Maurukas @MMMiracles @san7890 @ShizCalev

Expand All @@ -194,6 +187,12 @@

/code/__HELPERS/logging/ @dragomagol @ZephyrTFA

/code/__DEFINES/MC.dm @LemonInTheDark @MrStonedOne
/code/controllers/admin.dm @LemonInTheDark @MrStonedOne
/code/controllers/master.dm @LemonInTheDark @MrStonedOne
/code/controllers/failsafe.dm @LemonInTheDark @MrStonedOne
/code/controllers/subsystem.dm @LemonInTheDark @MrStonedOne

/code/controllers/subsystem/air.dm @LemonInTheDark @MrStonedOne

/code/modules/atmospherics/ @Ghilker @LemonInTheDark
Expand All @@ -209,15 +208,20 @@

/code/modules/surgery/ @ExcessiveUseOfCobblestone @Ryll-Ryll

/tools/build/ @MrStonedOne @stylemistake
/tools/tgs_scripts/ @Cyberboss @MrStonedOne
/tools/build/ @MrStonedOne @scriptis @stylemistake
/tools/tgs_scripts/ @Cyberboss @MrStonedOne @scriptis

/tools/WebhookProcessor/ @BraveMole @TiviPlus

# Host Hell

/code/controllers/configuration/entries @MrStonedOne @scriptis
/config/ @MrStonedOne @scriptis

# Expensive files that touching basically always cause performance problems
## Init times
**/*_EXPENSIVE.dm @Mothblocks @LemonInTheDark

# SIC SEMPER TYRANNIS

/code/modules/hydroponics/grown/citrus.dm @optimumtact
/code/modules/hydroponics/grown/citrus.dm @LemonInTheDark @optimumtact
19 changes: 16 additions & 3 deletions SQL/database_changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,28 @@ Any time you make a change to the schema files, remember to increment the databa

Make sure to also update `DB_MAJOR_VERSION` and `DB_MINOR_VERSION`, which can be found in `code/__DEFINES/subsystem.dm`.

The latest database version is 5.27; The query to update the schema revision table is:
The latest database version is 5.28; The query to update the schema revision table is:

```sql
INSERT INTO `schema_revision` (`major`, `minor`) VALUES (5, 27);
INSERT INTO `schema_revision` (`major`, `minor`) VALUES (5, 28);
```
or

```sql
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (5, 27);
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (5, 28);
```

-----------------------------------------------------
Version 5.28, 1 November 2024, by Ghommie
Added `fish_progress` as the first 'progress' subtype of 'datum/award/scores'

```sql
CREATE TABLE `fish_progress` (
`ckey` VARCHAR(32) NOT NULL,
`progress_entry` VARCHAR(32) NOT NULL,
`datetime` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ckey`,`progress_entry`)
) ENGINE=InnoDB;
```

In any query remember to add a prefix to the table names if you use one.
Expand Down
10 changes: 10 additions & 0 deletions SQL/tgstation_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,16 @@ CREATE TABLE `achievement_metadata` (
PRIMARY KEY (`achievement_key`)
) ENGINE=InnoDB;

-- Table structure for table 'x_progress'

DROP TABLE IF EXISTS `fish_progress`;
CREATE TABLE `fish_progress` (
`ckey` VARCHAR(32) NOT NULL,
`progress_entry` VARCHAR(32) NOT NULL,
`datetime` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ckey`,`progress_entry`)
) ENGINE=InnoDB;

--
-- Table structure for table `ticket`
--
Expand Down
10 changes: 10 additions & 0 deletions SQL/tgstation_schema_prefixed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,16 @@ CREATE TABLE `SS13_achievement_metadata` (
PRIMARY KEY (`achievement_key`)
) ENGINE=InnoDB;

-- Table structure for table 'SS13_x_progress'

DROP TABLE IF EXISTS `SS13_fish_progress`;
CREATE TABLE `fish_progress` (
`ckey` VARCHAR(32) NOT NULL,
`progress_entry` VARCHAR(32) NOT NULL,
`datetime` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ckey`,`progress_entry`)
) ENGINE=InnoDB;

--
-- Table structure for table `SS13_ticket`
--
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/achievements.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
/// DB ID for the amount of achievements unlocked by the player.
#define ACHIEVEMENTS_SCORE "Achievements Score"

///DB ID for all the different kinds of fish that you've caught so far.
#define FISH_SCORE "Fish Score"

// Tourist related achievements and scores

//centcom grades (achievement)
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals/signals_subsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@
#define COMSIG_ADDED_POINT_OF_INTEREST "added_point_of_interest"
/// Sent from base of /datum/controller/subsystem/points_of_interest/proc/on_poi_element_removed : (atom/old_poi)
#define COMSIG_REMOVED_POINT_OF_INTEREST "removed_point_of_interest"

///Sent after awards are saved in the database (/datum/controller/subsystem/achievements/save_achievements_to_db)
#define COMSIG_ACHIEVEMENTS_SAVED_TO_DB "achievements_saved_to_db"
5 changes: 5 additions & 0 deletions code/__DEFINES/fish.dm
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@
#define FISH_SOURCE_FLAG_EXPLOSIVE_MALUS (1<<0)
/// The fish source is not elegible for random rewards from bluespace fishing rods
#define FISH_SOURCE_FLAG_NO_BLUESPACE_ROD (1<<1)
/**
* If present, fish that can be caught from this source won't be included in the 'fish caught' score, unless
* present in other sources without this flag as well.
*/
#define FISH_SOURCE_FLAG_SKIP_CATCHABLES (1<<2)

/**
* A macro to ensure the wikimedia filenames of fish icons are unique, especially since there're a couple fish that have
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* make sure you add an update to the schema_version stable in the db changelog
*/
#define DB_MINOR_VERSION 27
#define DB_MINOR_VERSION 28


//! ## Timing subsystem
Expand Down
8 changes: 8 additions & 0 deletions code/__HELPERS/maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@
/proc/reciprocal_add(x, y)
return 1/((1/x)+y)

/// Returns a text string containing N prefixed with a series of zeros with length equal to max_zeros minus log(10, N), rounded down.
/proc/prefix_zeros_to_number(number, max_zeros)
var/zeros = ""
var/how_many_zeros = max_zeros - round(log(10, number))
for(var/zero in 1 to how_many_zeros)
zeros += "0"
return "[zeros][number]"

/// 180s an angle
/proc/reverse_angle(angle)
return (angle + 180) % 360
3 changes: 2 additions & 1 deletion code/controllers/subsystem/achievements.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ SUBSYSTEM_DEF(achievements)
cheevos_to_save += PD.achievements.get_changed_data()
if(!length(cheevos_to_save))
return
SSdbcore.MassInsert(format_table_name("achievements"),cheevos_to_save,duplicate_key = TRUE)
SSdbcore.MassInsert(format_table_name("achievements"), cheevos_to_save, duplicate_key = TRUE)
SEND_SIGNAL(src, COMSIG_ACHIEVEMENTS_SAVED_TO_DB)

//Update the metadata if any are behind
/datum/controller/subsystem/achievements/proc/update_metadata()
Expand Down
9 changes: 6 additions & 3 deletions code/controllers/subsystem/ambience.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ SUBSYSTEM_DEF(ambience)
///Attempts to play an ambient sound to a mob, returning the cooldown in deciseconds
/area/proc/play_ambience(mob/M, sound/override_sound, volume = 27)
var/sound/new_sound = override_sound || pick(ambientsounds)
new_sound = sound(new_sound, repeat = 0, wait = 0, volume = volume, channel = CHANNEL_AMBIENCE)
/// volume modifier for ambience as set by the player in preferences.
var/volume_modifier = (M.client?.prefs.read_preference(/datum/preference/numeric/sound_ambience_volume))/100
new_sound = sound(new_sound, repeat = 0, wait = 0, volume = volume*volume_modifier, channel = CHANNEL_AMBIENCE)
SEND_SOUND(M, new_sound)

return rand(min_ambience_cooldown, max_ambience_cooldown)
Expand Down Expand Up @@ -113,9 +115,10 @@ SUBSYSTEM_DEF(ambience)

var/area/my_area = get_area(src)
var/sound_to_use = my_area.ambient_buzz
var/volume_modifier = client.prefs.read_preference(/datum/preference/numeric/sound_ship_ambience_volume)

if(!sound_to_use || !(client.prefs.read_preference(/datum/preference/toggle/sound_ship_ambience)))
SEND_SOUND(src, sound(null, repeat = 0, wait = 0, channel = CHANNEL_BUZZ))
if(!sound_to_use || !(client.prefs.read_preference(/datum/preference/numeric/sound_ship_ambience_volume)))
SEND_SOUND(src, sound(null, repeat = 0, volume = volume_modifier, wait = 0, channel = CHANNEL_BUZZ))
client.current_ambient_sound = null
return

Expand Down
10 changes: 5 additions & 5 deletions code/controllers/subsystem/dbcore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,17 @@ SUBSYSTEM_DEF(dbcore)
//Take over control of all active queries
var/queries_to_check = queries_active.Copy()
queries_active.Cut()

//Start all waiting queries
for(var/datum/db_query/query in queries_standby)
run_query(query)
queries_to_check += query
queries_standby -= query

//wait for them all to finish
for(var/datum/db_query/query in queries_to_check)
UNTIL(query.process() || REALTIMEOFDAY > endtime)

//log shutdown to the db
var/datum/db_query/query_round_shutdown = SSdbcore.NewQuery(
"UPDATE [format_table_name("round")] SET shutdown_datetime = Now(), end_state = :end_state WHERE id = :round_id",
Expand Down Expand Up @@ -247,7 +247,7 @@ SUBSYSTEM_DEF(dbcore)
/datum/controller/subsystem/dbcore/proc/Connect()
if(IsConnected())
return TRUE

if(connection)
Disconnect() //clear the current connection handle so isconnected() calls stop invoking rustg
connection = null //make sure its cleared even if runtimes happened
Expand Down Expand Up @@ -293,7 +293,7 @@ SUBSYSTEM_DEF(dbcore)
log_sql("Connect() failed | [last_error]")
++failed_connections
//If it failed to establish a connection more than 5 times in a row, don't bother attempting to connect for a time.
if(failed_connections > max_connection_failures)
if(failed_connections > max_connection_failures)
failed_connection_timeout_count++
//basic exponential backoff algorithm
failed_connection_timeout = world.time + ((2 ** failed_connection_timeout_count) SECONDS)
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/modular_computers.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
s///The maximum amount of logs that can be generated before they start overwriting each other.
///The maximum amount of logs that can be generated before they start overwriting each other.
#define MAX_LOG_COUNT 300

SUBSYSTEM_DEF(modular_computers)
Expand Down
45 changes: 43 additions & 2 deletions code/controllers/subsystem/processing/fishing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,37 @@ PROCESSING_SUBSYSTEM_DEF(fishing)
name = "Fishing"
flags = SS_BACKGROUND|SS_POST_FIRE_TIMING
wait = 0.05 SECONDS // If you raise it to 0.1 SECONDS, you better also modify [datum/fish_movement/move_fish()]
///A list of cached fish icons
var/list/cached_fish_icons
///A list of cached fish icons turns into outlines with a queston mark in the middle, denoting fish you haven't caught yet.
var/list/cached_unknown_fish_icons
///An assoc list of identifier strings and the path of a fish that can be gotten from fish sources.
var/list/catchable_fish
///Cached fish properties so we don't have to initalize fish every time
var/list/fish_properties
///A cache of fish that can be caught by each type of fishing lure
var/list/lure_catchables

/datum/controller/subsystem/processing/fishing/Initialize()
///init the properties
..()
cached_fish_icons = list()
cached_unknown_fish_icons = list()
fish_properties = list()
for(var/fish_type in subtypesof(/obj/item/fish))

var/icon/questionmark = icon('icons/effects/random_spawners.dmi', "questionmark")
var/list/mark_dimension = get_icon_dimensions(questionmark)
for(var/obj/item/fish/fish_type as anything in subtypesof(/obj/item/fish))
var/list/fish_dimensions = get_icon_dimensions(fish_type::icon)
var/icon/fish_icon = icon(fish_type::icon, fish_type::icon_state, frame = 1, moving = FALSE)
cached_fish_icons[fish_type] = icon2base64(fish_icon)
var/icon/unknown_icon = icon(fish_icon)
unknown_icon.Blend("#FFFFFF", ICON_SUBTRACT)
unknown_icon.Blend("#070707", ICON_ADD)
var/width = 1 + (fish_dimensions["width"] - mark_dimension["width"]) * 0.5
var/height = 1 + (fish_dimensions["height"] - mark_dimension["height"]) * 0.5
unknown_icon.Blend(questionmark, ICON_OVERLAY, x = width, y = height)
cached_unknown_fish_icons[fish_type] = icon2base64(unknown_icon)

var/obj/item/fish/fish = new fish_type(null, FALSE)
var/list/properties = list()
fish_properties[fish_type] = properties
Expand Down Expand Up @@ -47,6 +69,25 @@ PROCESSING_SUBSYSTEM_DEF(fishing)

qdel(fish)

catchable_fish = list()
var/list/all_catchables = list()
for(var/source_type as anything in GLOB.preset_fish_sources)
var/datum/fish_source/source = GLOB.preset_fish_sources[source_type]
if(!(source.fish_source_flags & FISH_SOURCE_FLAG_SKIP_CATCHABLES))
all_catchables |= source.fish_table
for(var/thing in all_catchables)
if(!ispath(thing, /obj/item/fish))
continue
var/obj/item/fish/fishie = thing
var/fish_id = initial(fishie.fish_id)
if(!fish_id)
stack_trace("[fishie] doesn't have a set 'fish_id' variable despite being a catchable fish")
continue
if(catchable_fish[fish_id])
stack_trace("[fishie] has a 'fish_id' value already assigned to [catchable_fish[fish_id]]. fish_id: [fish_id]")
continue
catchable_fish[fish_id] = fishie

///init the list of things lures can catch
lure_catchables = list()
var/list/fish_types = subtypesof(/obj/item/fish)
Expand Down
7 changes: 4 additions & 3 deletions code/controllers/subsystem/tts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,14 @@ SUBSYSTEM_DEF(tts)
if(QDELING(listening_mob))
stack_trace("TTS tried to play a sound to a deleted mob.")
continue
var/volume_to_play_at = listening_mob.client?.prefs.read_preference(/datum/preference/numeric/sound_tts_volume)
/// volume modifier for TTS as set by the player in preferences.
var/volume_modifier = listening_mob.client?.prefs.read_preference(/datum/preference/numeric/sound_tts_volume)/100
var/tts_pref = listening_mob.client?.prefs.read_preference(/datum/preference/choiced/sound_tts)
if(volume_to_play_at == 0 || (tts_pref == TTS_SOUND_OFF))
if(volume_modifier == 0 || (tts_pref == TTS_SOUND_OFF))
continue

var/sound_volume = ((listening_mob == target)? 60 : 85) + volume_offset
sound_volume = sound_volume * (volume_to_play_at / 100)
sound_volume = sound_volume*volume_modifier
var/datum/language_holder/holder = listening_mob.get_language_holder()
var/audio_to_use = (tts_pref == TTS_SOUND_BLIPS) ? audio_blips : audio
if(!holder.has_language(language))
Expand Down
Loading

0 comments on commit c6e3477

Please sign in to comment.