Skip to content

Commit

Permalink
Апстрим 50%
Browse files Browse the repository at this point in the history
  • Loading branch information
Farrellka-dev committed Nov 7, 2024
1 parent 473a594 commit 739ba46
Show file tree
Hide file tree
Showing 42 changed files with 151 additions and 341 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Corvax/TTS/HumanoidProfileEditor.TTS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Content.Shared.Corvax.TTS;
using Content.Shared.Preferences;

namespace Content.Client.Preferences.UI;
namespace Content.Client.Lobby.UI;

public sealed partial class HumanoidProfileEditor
{
Expand Down
36 changes: 0 additions & 36 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -853,42 +853,6 @@ private void ToggleLoadouts(BaseButton.ButtonEventArgs _)
//_controller.UpdateCharacterUI();
}

private void OnDummyUpdate(EntityUid value)
{
_previewSpriteView.SetEntity(value);
}

private void UpdateAntagRequirements()
{
_antagList.DisposeAllChildren();
_antagPreferences.Clear();

foreach (var antag in _prototypeManager.EnumeratePrototypes<AntagPrototype>().OrderBy(a => Loc.GetString(a.Name)))
{
if (!antag.SetPreference)
continue;

var selector = new AntagPreferenceSelector(antag,
_jobPriorities.FirstOrDefault(j => j.Priority == JobPriority.High)?.HighJob
?? new())
{ Margin = new Thickness(3f, 3f, 3f, 0f) };
_antagList.AddChild(selector);
_antagPreferences.Add(selector);
if (selector.Disabled)
{
Profile = Profile?.WithAntagPreference(antag.ID, false);
IsDirty = true;
}

selector.PreferenceChanged += preference =>
{
Profile = Profile?.WithAntagPreference(antag.ID, preference);
IsDirty = true;
};
}

}

private void UpdateRoleRequirements()
{
JobList.DisposeAllChildren();
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected override void UpdateState(BoundUserInterfaceState state)
return;
}

_window.UpdateState(cast.Name, cast.Voice, cast.Verb); // LPP-TTS
_window.UpdateState(cast.Name, /*cast.Voice, */cast.Verb); // LPP-TTS
}

protected override void Dispose(bool disposing)
Expand Down
5 changes: 3 additions & 2 deletions Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void ReloadVoices(IPrototypeManager proto)
}
// LPP-TTS-End

public void UpdateState(string name, string voice, string? verb) // LPP-TTS
public void UpdateState(string name, /*string voice, */string? verb) // LPP-TTS
{
NameSelector.Text = name;
_verb = verb;
Expand All @@ -110,11 +110,12 @@ public void UpdateState(string name, string voice, string? verb) // LPP-TTS
break;
}
}

/*
// LPP-TTS-Start
var voiceIdx = _voices.FindIndex(v => v.ID == voice);
if (voiceIdx != -1)
VoiceSelector.Select(voiceIdx);
// LPP-TTS-End
*/
}
}
14 changes: 14 additions & 0 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,20 @@ public record ExpandICChatRecipientstEvent(EntityUid Source, float VoiceRange, D
{
}

public sealed class TransformSpeakerNameEvent : EntityEventArgs
{
public EntityUid Sender;
public string Name;
public string? SpeechVerb;

public TransformSpeakerNameEvent(EntityUid sender, string name, string? speechVerb = null)
{
Sender = sender;
Name = name;
SpeechVerb = speechVerb;
}
}

/// <summary>
/// Raised broadcast in order to transform speech.transmit
/// </summary>
Expand Down
86 changes: 44 additions & 42 deletions Content.Server/Corvax/TTS/VoiceMaskSystem.TTS.cs
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
using Content.Server.Corvax.TTS;
using Content.Shared.VoiceMask;

namespace Content.Server.VoiceMask;

public partial class VoiceMaskSystem
{
private void InitializeTTS()
{
SubscribeLocalEvent<VoiceMaskComponent, TransformSpeakerVoiceEvent>(OnSpeakerVoiceTransform);
SubscribeLocalEvent<VoiceMaskComponent, VoiceMaskChangeVoiceMessage>(OnChangeVoice);
}

private void OnSpeakerVoiceTransform(EntityUid uid, VoiceMaskComponent component, TransformSpeakerVoiceEvent args)
{
if (component.Enabled)
args.VoiceId = component.VoiceId;
}

private void OnChangeVoice(EntityUid uid, VoiceMaskComponent component, VoiceMaskChangeVoiceMessage message)
{
component.VoiceId = message.Voice;

_popupSystem.PopupEntity(Loc.GetString("voice-mask-voice-popup-success"), uid);

TrySetLastKnownVoice(uid, message.Voice);

UpdateUI(uid, component);
}

private void TrySetLastKnownVoice(EntityUid maskWearer, string? voiceId)
{
if (!HasComp<VoiceMaskComponent>(maskWearer)
|| !_inventory.TryGetSlotEntity(maskWearer, MaskSlot, out var maskEntity)
|| !TryComp<VoiceMaskerComponent>(maskEntity, out var maskComp))
{
return;
}

maskComp.LastSetVoice = voiceId;
}
}
// Я хз как заставить работать после этого: https://github.com/Simple-Station/Einstein-Engines/pull/1147

// using Content.Server.Corvax.TTS;
// using Content.Shared.VoiceMask;

// namespace Content.Server.VoiceMask;

// public partial class VoiceMaskSystem
// {
// private void InitializeTTS()
// {
// SubscribeLocalEvent<VoiceMaskComponent, TransformSpeakerVoiceEvent>(OnSpeakerVoiceTransform);
// SubscribeLocalEvent<VoiceMaskComponent, VoiceMaskChangeVoiceMessage>(OnChangeVoice);
// }

// private void OnSpeakerVoiceTransform(EntityUid uid, VoiceMaskComponent component, TransformSpeakerVoiceEvent args)
// {
// if (component.Enabled)
// args.VoiceId = component.VoiceId;
// }

// private void OnChangeVoice(EntityUid uid, VoiceMaskComponent component, VoiceMaskChangeVoiceMessage message)
// {
// component.VoiceId = message.Voice;

// _popupSystem.PopupEntity(Loc.GetString("voice-mask-voice-popup-success"), uid);

// TrySetLastKnownVoice(uid, message.Voice);

// UpdateUI(uid, component);
// }

// private void TrySetLastKnownVoice(EntityUid maskWearer, string? voiceId)
// {
// if (!HasComp<VoiceMaskComponent>(maskWearer)
// || !_inventory.TryGetSlotEntity(maskWearer, MaskSlot, out var maskEntity)
// || !TryComp<VoiceMaskerComponent>(maskEntity, out var maskComp))
// {
// return;
// }

// maskComp.LastSetVoice = voiceId;
// }
// }
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public async Task SetProfile(NetUserId userId, int slot, ICharacterProfile profi
var tier = sponsor.Tier > 5 ? 5 : sponsor.Tier;
allowedMarkings = allowedMarkings.Concat(Loc.GetString($"sponsor-markings-tier-{tier}").Split(";", StringSplitOptions.RemoveEmptyEntries)).ToArray();
}
profile.EnsureValid(session, collection, allowedMarkings);
profile.EnsureValid(session, _dependencies, allowedMarkings);
#else
profile.EnsureValid(session, _dependencies);
#endif
Expand Down
9 changes: 1 addition & 8 deletions Content.Server/VoiceMask/VoiceMaskComponent.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Content.Shared.Speech;
using Robust.Shared.Prototypes;
using Content.Shared.Humanoid;

namespace Content.Server.VoiceMask;

Expand Down Expand Up @@ -33,15 +32,9 @@ public sealed partial class VoiceMaskComponent : Component
[DataField]
public EntProtoId Action = "ActionChangeVoiceMask";

// LPP-TTS-Start
[DataField]
[ViewVariables(VVAccess.ReadWrite)]
public string VoiceId = SharedHumanoidAppearanceSystem.DefaultVoice;
// LPP-TTS-End

/// <summary>
/// Reference to the action.
/// </summary>
[DataField]
public EntityUid? ActionEntity;
}
}
3 changes: 1 addition & 2 deletions Content.Server/VoiceMask/VoiceMaskSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public override void Initialize()
SubscribeLocalEvent<VoiceMaskComponent, VoiceMaskChangeVerbMessage>(OnChangeVerb);
SubscribeLocalEvent<VoiceMaskComponent, ClothingGotEquippedEvent>(OnEquip);
SubscribeLocalEvent<VoiceMaskSetNameEvent>(OpenUI);
InitializeTTS(); // LPP-TTS
}

private void OnTransformSpeakerName(Entity<VoiceMaskComponent> entity, ref InventoryRelayedEvent<TransformSpeakerSpeechEvent> args)
Expand Down Expand Up @@ -113,4 +112,4 @@ private string GetCurrentVoiceName(Entity<VoiceMaskComponent> entity)
return entity.Comp.VoiceMaskName ?? Loc.GetString("voice-mask-default-name-override");
}
#endregion
}
}
3 changes: 2 additions & 1 deletion Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public HumanoidCharacterProfile FromStream(Stream stream, ICommonSession session

var profile = export.Profile;
var collection = IoCManager.Instance;
profile.EnsureValid(session, collection!);
var sponsorPrototypes = Array.Empty<string>(); //LPP ??
profile.EnsureValid(session, collection!, sponsorPrototypes); // сломалось, Я хз почему

Check failure on line 91 in Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

No overload for method 'EnsureValid' takes 3 arguments

Check failure on line 91 in Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

No overload for method 'EnsureValid' takes 3 arguments

Check failure on line 91 in Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

No overload for method 'EnsureValid' takes 3 arguments

Check failure on line 91 in Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

No overload for method 'EnsureValid' takes 3 arguments

Check failure on line 91 in Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

No overload for method 'EnsureValid' takes 3 arguments

Check failure on line 91 in Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

No overload for method 'EnsureValid' takes 3 arguments

Check failure on line 91 in Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

No overload for method 'EnsureValid' takes 3 arguments

Check failure on line 91 in Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

No overload for method 'EnsureValid' takes 3 arguments
return profile;
}

Expand Down
64 changes: 32 additions & 32 deletions Content.Shared/Preferences/HumanoidCharacterProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public HumanoidCharacterProfile(
string name,
string flavortext,
string species,
string voice, // LPP-Tstring customspeciename,
string voice, // LPP-TTS
string customspeciename,
float height,
float width,
Expand Down Expand Up @@ -233,11 +233,11 @@ public static HumanoidCharacterProfile RandomWithSpecies(string species = Shared
}

// LPP-TTS-Start
var voiceId = random.Pick(prototypeManager
.EnumeratePrototypes<TTSVoicePrototype>()
.Where(o => CanHaveVoice(o, sex)).ToArray()
).ID;
// LPP-TTS-End
var voiceId = random.Pick(prototypeManager
.EnumeratePrototypes<TTSVoicePrototype>()
.Where(o => CanHaveVoice(o, sex)).ToArray()
).ID;
// LPP-TTS-End

var gender = Gender.Epicene;

Expand Down Expand Up @@ -379,10 +379,10 @@ IDependencyCollection collection
|| (speciesPrototype.SponsorOnly && !sponsorPrototypes.Contains(Species)) // _LostParadise-Sponsors
#endif
)
{
Species = SharedHumanoidAppearanceSystem.DefaultSpecies;
speciesPrototype = prototypeManager.Index<SpeciesPrototype>(Species);
}
{
Species = SharedHumanoidAppearanceSystem.DefaultSpecies;
speciesPrototype = prototypeManager.Index<SpeciesPrototype>(Species);
}

var sex = Sex switch
{
Expand Down Expand Up @@ -510,37 +510,37 @@ IDependencyCollection collection
_traitPreferences.UnionWith(traits);

// LPP-TTS-Start
prototypeManager.TryIndex<TTSVoicePrototype>(Voice, out var voice);
if (voice is null || !CanHaveVoice(voice, Sex))
Voice = SharedHumanoidAppearanceSystem.DefaultSexVoice[sex];
// LPP-TTS-End
prototypeManager.TryIndex<TTSVoicePrototype>(Voice, out var voice);
if (voice is null || !CanHaveVoice(voice, Sex))
Voice = SharedHumanoidAppearanceSystem.DefaultSexVoice[sex];
// LPP-TTS-End

_loadoutPreferences.Clear();
_loadoutPreferences.UnionWith(loadouts);
_loadoutPreferences.Clear();
_loadoutPreferences.UnionWith(loadouts);
}

// LPP-TTS-Start
public static bool CanHaveVoice(TTSVoicePrototype voice, Sex sex)
{
return voice.RoundStart && sex == Sex.Unsexed || (voice.Sex == sex || voice.Sex == Sex.Unsexed);
}
// LPP-TTS-End
public static bool CanHaveVoice(TTSVoicePrototype voice, Sex sex)
{
return voice.RoundStart && sex == Sex.Unsexed || (voice.Sex == sex || voice.Sex == Sex.Unsexed);
}
// LPP-TTS-End

public ICharacterProfile Validated(ICommonSession session,
IDependencyCollection collection
public ICharacterProfile Validated(ICommonSession session,
IDependencyCollection collection
#if LPP_Sponsors
, string[] sponsorPrototypes// _LostParadise-Sponsors
, string[] sponsorPrototypes// _LostParadise-Sponsors
#endif
)
{
var profile = new HumanoidCharacterProfile(this);
profile.EnsureValid(session, collection
)
{
var profile = new HumanoidCharacterProfile(this);
profile.EnsureValid(session, collection
#if LPP_Sponsors
, sponsorPrototypes// _LostParadise-Sponsors
, sponsorPrototypes// _LostParadise-Sponsors
#endif
);
return profile;
}
);
return profile;
}

// Sorry this is kind of weird and duplicated,
// Working inside these non entity systems is a bit wack
Expand Down
6 changes: 3 additions & 3 deletions Content.Shared/VoiceMask/SharedVoiceMaskSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ public sealed class VoiceMaskBuiState : BoundUserInterfaceState
{
public readonly string Name;
public readonly string? Verb;
public readonly string Voice; // LPP-TTS
//public readonly string Voice; // LPP-TTS

public VoiceMaskBuiState(string name, string voice, string? verb)
public VoiceMaskBuiState(string name, /*string voice, */string? verb)
{
Name = name;
Verb = verb;
Voice = voice; // LPP-TTS
//Voice = voice; // LPP-TTS
}
}

Expand Down
2 changes: 0 additions & 2 deletions Resources/Prototypes/CharacterItemGroups/securityGroups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,6 @@
id: LoadoutSecurityPistolSvalin
- type: loadout
id: LoadoutSecurityEnergyGunMini
- type: loadout
id: LoadoutSecurityEnergyGunPistol
- type: loadout
id: LoadoutSecurityPistolPollock
- type: loadout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,3 @@
sprites:
- sprite: Mobs/Customization/reptilian_parts.rsi
state: tail_dtiger_wagging

- type: marking
id: LizardSnoutSplotch
bodyPart: Snout
markingCategory: Snout
speciesRestriction: [Reptilian]
sprites:
- sprite: Mobs/Customization/reptilian_parts.rsi
state: snout_splotch_primary
- sprite: Mobs/Customization/reptilian_parts.rsi
state: snout_splotch_secondary
Loading

0 comments on commit 739ba46

Please sign in to comment.