Skip to content

Commit

Permalink
Merge pull request #183 from SpicyDarkFox/dbg
Browse files Browse the repository at this point in the history
Какой-то фикс
  • Loading branch information
Evgencheg authored Sep 22, 2024
2 parents 966e8ab + 905c69a commit 8b3d87b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 26 deletions.
5 changes: 3 additions & 2 deletions Content.Client/Corvax/TTS/TTSSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ private void OnPlayTTS(PlayTTSEvent ev)
if ((_language.UnderstoodLanguages.Contains(ev.LanguageProtoId) || isadmin) && ev.LanguageProtoId != "Sign")
_contentRoot.AddOrUpdateFile(filePath, ev.Data);
else
_contentRoot.AddOrUpdateFile(filePath, ev.LanguageData);
return; //временно отключена озвучка языков
//_contentRoot.AddOrUpdateFile(filePath, ev.LanguageData);
}
else
_contentRoot.AddOrUpdateFile(filePath, ev.Data);
Expand All @@ -111,7 +112,7 @@ private void OnPlayTTS(PlayTTSEvent ev)
}
else
{
_audio.PlayGlobal(soundPath, Filter.Local(), false);
//_audio.PlayGlobal(soundPath, Filter.Local(), false); // поскольку источника нет/не видно, то пусть молчит
}

_contentRoot.RemoveFile(filePath);
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Corvax/TTS/TTSSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ private async void HandleSay(EntityUid uid, string message, string speaker, Lang
if (soundData is null) return;

var languageSoundData = await GenerateTTS(_language.ObfuscateSpeech(message, language), speaker); // Languages TTS support
if (languageSoundData is null) return; // Languages TTS support
if (languageSoundData is null) return; // Languages TTS support

RaiseNetworkEvent(new PlayTTSEvent(soundData,languageSoundData, language, GetNetEntity(uid)), Filter.Pvs(uid));
RaiseNetworkEvent(new PlayTTSEvent(soundData, languageSoundData, language, GetNetEntity(uid)), Filter.Pvs(uid));
}

private async void HandleWhisper(EntityUid uid, string message, string obfMessage, string speaker, LanguagePrototype language)
Expand Down
63 changes: 41 additions & 22 deletions Content.Server/Database/ServerDbBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,31 +86,50 @@ public async Task SaveCharacterSlotAsync(NetUserId userId, ICharacterProfile? pr
throw new NotImplementedException();
}

var oldProfile = db.DbContext.Profile
.Include(p => p.Preference)
.Where(p => p.Preference.UserId == userId.UserId)
.Include(p => p.Jobs)
.Include(p => p.Antags)
.Include(p => p.Traits)
using (var transaction = await db.DbContext.Database.BeginTransactionAsync())
{
var oldProfile = db.DbContext.Profile
.Include(p => p.Preference)
.Where(p => p.Preference.UserId == userId.UserId)
.Include(p => p.Jobs)
.Include(p => p.Antags)
.Include(p => p.Traits)
#if LPP_Sponsors
.Include(p => p.Donate) // Lost Paradise Donate Preferences
.Include(p => p.Donate) // Lost Paradise Donate Preferences
#endif
.Include(p => p.Loadouts)
.AsSplitQuery()
.SingleOrDefault(h => h.Slot == slot);

var newProfile = ConvertProfiles(humanoid, slot, oldProfile);
if (oldProfile == null)
{
var prefs = await db.DbContext
.Preference
.Include(p => p.Profiles)
.SingleAsync(p => p.UserId == userId.UserId);

prefs.Profiles.Add(newProfile);
.Include(p => p.Loadouts)
.AsSplitQuery()
.SingleOrDefault(h => h.Slot == slot);
try
{
if (oldProfile is not null)
{
oldProfile.Jobs.Clear();
oldProfile.Antags.Clear();
oldProfile.Traits.Clear();
await db.DbContext.SaveChangesAsync(); // отдельно удаляем данные из ролей, антагов и traits, чем бы оно ни было.
// Можно дальше убрать эти операции из ConvertProfiles, ибо они уже исполнены.
}

var newProfile = ConvertProfiles(humanoid, slot, oldProfile);
if (oldProfile == null)
{
var prefs = await db.DbContext
.Preference
.Include(p => p.Profiles)
.SingleAsync(p => p.UserId == userId.UserId);

prefs.Profiles.Add(newProfile);
}

await db.DbContext.SaveChangesAsync(); // Сохраняем добавление данных.
}
catch (Exception ex)
{
await transaction.RollbackAsync(); // при ошибке вернём всё обратно
throw ex;
}
}

await db.DbContext.SaveChangesAsync();
}

private static async Task DeleteCharacterSlot(ServerDbContext db, NetUserId userId, int slot)
Expand Down
3 changes: 3 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@
- type: Loadout
prototypes: [ MobAghostGear ]
- type: SupermatterImmune
- type: MovementSpeedModifier
baseWalkSpeed : 35
baseSprintSpeed : 25

- type: entity
id: ActionAGhostShowSolar
Expand Down

0 comments on commit 8b3d87b

Please sign in to comment.