Skip to content

Commit

Permalink
new upstream fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Farrellka-dev committed Jan 3, 2025
1 parent fd3ef2a commit 6db7414
Show file tree
Hide file tree
Showing 18 changed files with 63 additions and 66 deletions.
3 changes: 1 addition & 2 deletions Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ protected override void Open()
_window.OnNameChange += OnNameSelected;
_window.OnVerbChange += verb => SendMessage(new VoiceMaskChangeVerbMessage(verb));
_window.OnVoiceChange += voice => SendMessage(new VoiceMaskChangeVoiceMessage(voice)); // LPP-TTS
_window.OnClose += Close;
}

private void OnNameSelected(string name)
Expand All @@ -42,7 +41,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
13 changes: 3 additions & 10 deletions Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System.Linq;
using Content.Shared.Corvax.TTS;
using Content.Client.UserInterface.Controls;
using Content.Shared.Speech;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using Content.Shared.Corvax.TTS; // LPP-TTS

namespace Content.Client.VoiceMask;

Expand Down Expand Up @@ -35,11 +35,6 @@ public VoiceMaskNameChangeWindow()
OnVerbChange?.Invoke((string?) args.Button.GetItemMetadata(args.Id));
SpeechVerbSelector.SelectId(args.Id);
};

ReloadVerbs(proto);
ReloadVoices(proto); // LPP-TTS

AddVerbs();
}

public void ReloadVerbs(IPrototypeManager proto)
Expand Down Expand Up @@ -73,7 +68,6 @@ private void AddVerb(string name, string? verb)
SpeechVerbSelector.SelectId(id);
}


// LPP-TTS-Start
private void ReloadVoices(IPrototypeManager proto)
{
Expand All @@ -97,7 +91,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)
{
NameSelector.Text = name;
_verb = verb;
Expand All @@ -110,12 +104,11 @@ 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
*/
}
}
12 changes: 6 additions & 6 deletions Content.Server/Administration/Managers/BanManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using JetBrains.Annotations;
using Robust.Shared;

Expand Down Expand Up @@ -206,8 +205,9 @@ public async void CreateServerBan(NetUserId? target, string? targetUsername, Net
_sawmill.Info(logMessage);
_chat.SendAdminAlert(logMessage);

var ban = await _db.GetServerBanAsync(null, target, null);
if (ban != null) SendWebhook(await GenerateBanPayload(ban, minutes));
var modernHWIds = hwid != null ? ImmutableArray.Create(hwid.Hwid) : ImmutableArray<ImmutableArray<byte>>.Empty;
var ban = await _db.GetServerBanAsync(null, target, null, modernHWIds); // Pass modernHWIds here
if (ban != null) SendWebhook(await GenerateBanPayload(ban, minutes)); // Webhook

KickMatchingConnectedPlayers(banDef, "newly placed ban");
}
Expand Down Expand Up @@ -368,7 +368,7 @@ public void PostInject()
}

#region Webhook
public async void WebhookUpdateRoleBans(NetUserId? target, string? targetUsername, NetUserId? banningAdmin, (IPAddress, int)? addressRange, ImmutableArray<byte>? hwid, IReadOnlyCollection<string> roles, uint? minutes, NoteSeverity severity, string reason, DateTimeOffset timeOfBan)
public async void WebhookUpdateRoleBans(NetUserId? target, string? targetUsername, NetUserId? banningAdmin, (IPAddress, int)? addressRange, ImmutableTypedHwid? hwid, IReadOnlyCollection<string> roles, uint? minutes, NoteSeverity severity, string reason, DateTimeOffset timeOfBan)
{
_systems.TryGetEntitySystem(out GameTicker? ticker);
int? roundId = ticker == null || ticker.RoundId == 0 ? null : ticker.RoundId;
Expand Down Expand Up @@ -421,7 +421,7 @@ private async void SendWebhook(WebhookPayload payload)
}
private async Task<WebhookPayload> GenerateJobBanPayload(ServerRoleBanDef banDef, IReadOnlyCollection<string> roles, uint? minutes = null)
{
var hwidString = banDef.HWId != null ? string.Concat(banDef.HWId.Value.Select(x => x.ToString("x2"))) : "null";
var hwidString = banDef.HWId != null ? string.Concat(banDef.HWId.Hwid.Select(x => x.ToString("x2"))) : "null";
var adminName = banDef.BanningAdmin == null
? Loc.GetString("system-user")
: (await _db.GetPlayerRecordByUserId(banDef.BanningAdmin.Value))?.LastSeenUserName ?? Loc.GetString("system-user");
Expand Down Expand Up @@ -518,7 +518,7 @@ private async Task<WebhookPayload> GenerateJobBanPayload(ServerRoleBanDef banDef
private async Task<WebhookPayload> GenerateBanPayload(ServerBanDef banDef, uint? minutes = null)
{
var hwidString = banDef.HWId != null
? string.Concat(banDef.HWId.Value.Select(x => x.ToString("x2")))
? string.Concat(banDef.HWId.Hwid.Select(x => x.ToString("x2")))
: "null";
var adminName = banDef.BanningAdmin == null
? Loc.GetString("system-user")
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Administration/Managers/IBanManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public interface IBanManager
/// <param name="timeOfBan">Time when the ban was applied, used for grouping role bans</param>
public void CreateRoleBan(NetUserId? target, string? targetUsername, NetUserId? banningAdmin, (IPAddress, int)? addressRange, ImmutableTypedHwid? hwid, string role, uint? minutes, NoteSeverity severity, string reason, DateTimeOffset timeOfBan);

public void WebhookUpdateRoleBans(NetUserId? target, string? targetUsername, NetUserId? banningAdmin, (IPAddress, int)? addressRange, ImmutableArray<byte>? hwid, IReadOnlyCollection<string> roles, uint? minutes, NoteSeverity severity, string reason, DateTimeOffset timeOfBan);
public void WebhookUpdateRoleBans(NetUserId? target, string? targetUsername, NetUserId? banningAdmin, (IPAddress, int)? addressRange, ImmutableTypedHwid? hwid, IReadOnlyCollection<string> roles, uint? minutes, NoteSeverity severity, string reason, DateTimeOffset timeOfBan);

/// <summary>
/// Pardons a role ban for the specified target, username or GUID
Expand Down
14 changes: 0 additions & 14 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1055,20 +1055,6 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.IO;
using System.Linq;
using System.Text.Json;
using Content.Server.Chemistry.ReagentEffects;
using Content.Server.EntityEffects.Effects;

namespace Content.Server.Corvax.GuideGenerator;
public sealed class HealthChangeReagentsJsonGenerator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Robust.Shared.Prototypes;
using Content.Shared.Construction.Prototypes;
using Content.Server.Construction.Components;
using Content.Server.Chemistry.ReactionEffects;
using Content.Server.EntityEffects.Effects;

namespace Content.Server.GuideGenerator;

Expand Down
3 changes: 2 additions & 1 deletion Content.Server/Corvax/GuideGenerator/ReagentEffectEntry.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Shared.Chemistry.Reagent;
using Robust.Shared.Prototypes;
using Content.Shared.EntityEffects;
using System.Text.Json.Serialization;
using Content.Server.Chemistry.ReactionEffects;

Expand All @@ -12,7 +13,7 @@ public sealed class ReagentEffectEntry
[JsonPropertyName("description")]
public string Description { get; }

public ReagentEffectEntry(ReagentEffect proto)
public ReagentEffectEntry(EntityEffect proto)
{
var prototype = IoCManager.Resolve<IPrototypeManager>();
var entSys = IoCManager.Resolve<IEntitySystemManager>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using Content.Server.Mind;
using Content.Shared.Examine;
using Content.Shared.Roles.Jobs;
using Content.Shared.Whitelist;

namespace Content.Server.Corvax.HiddenDescription;

public sealed partial class HiddenDescriptionSystem : EntitySystem
{
[Dependency] private readonly MindSystem _mind = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;

public override void Initialize()
{
Expand All @@ -23,8 +25,8 @@ private void OnExamine(Entity<HiddenDescriptionComponent> hiddenDesc, ref Examin
foreach (var item in hiddenDesc.Comp.Entries)
{
var isJobAllow = job?.Prototype != null && item.JobRequired.Contains(job.Prototype.Value);
var isMindWhitelistPassed = item.WhitelistMind.IsValid(mindId);
var isBodyWhitelistPassed = item.WhitelistMind.IsValid(args.Examiner);
var isMindWhitelistPassed = _whitelistSystem.IsValid(item.WhitelistMind, mindId); // Use injected _whitelistSystem
var isBodyWhitelistPassed = _whitelistSystem.IsValid(item.WhitelistMind, args.Examiner); // Use injected _whitelistSystem
var passed = item.NeedAllCheck
? isMindWhitelistPassed && isBodyWhitelistPassed && isJobAllow
: isMindWhitelistPassed || isBodyWhitelistPassed || isJobAllow;
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Database/ServerRoleBanDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ServerRoleBanDef(
ServerRoleUnbanDef? unban,
string role)
{
if (userId == null && address == null && hwId == null)
if (userId == null && address == null && hwId == null)
{
throw new ArgumentException("Must have at least one of banned user, banned address or hardware ID");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public sealed class ServerPreferencesManager : IServerPreferencesManager, IPostI
[Dependency] private readonly ILogManager _log = default!;
[Dependency] private readonly UserDbDataManager _userDb = default!;
[Dependency] private readonly IPrototypeManager _protos = default!;
[Dependency] private readonly IPrototypeManager _protos = default!;
#if LPP_Sponsors // _LostParadise-Sponsors
[Dependency] private readonly SponsorsManager _sponsors = default!;
#endif
Expand Down
5 changes: 4 additions & 1 deletion Content.Server/VoiceMask/VoiceMaskSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ private void OpenUI(VoiceMaskSetNameEvent ev)
private void UpdateUI(Entity<VoiceMaskComponent> entity)
{
if (_uiSystem.HasUi(entity, VoiceMaskUIKey.Key))
_uiSystem.SetUiState(entity.Owner, VoiceMaskUIKey.Key, new VoiceMaskBuiState(GetCurrentVoiceName(entity), entity.Comp.VoiceMaskSpeechVerb));
{
var voice = entity.Comp.VoiceMaskName ?? "Evgen"; // Replace "default-voice" with your default value
_uiSystem.SetUiState(entity.Owner, VoiceMaskUIKey.Key, new VoiceMaskBuiState(GetCurrentVoiceName(entity), voice, entity.Comp.VoiceMaskSpeechVerb));
}
}
#endregion

Expand Down
24 changes: 15 additions & 9 deletions Content.Server/_LostParadise/CarnivoresDiet/AccumulateReagent.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Content.Server.Body.Components;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.EntityEffects;
using Content.Server.EntityEffects.Effects;
using Content.Shared.FixedPoint;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
Expand All @@ -16,7 +18,7 @@ namespace Content.Server.Chemistry.ReagentEffects
// Решение сомнительное, но оно гораздо чище, чем лезть в код метаболирования и добавлять туда группу-исключение с проверкой на наличие реагента в кровеносной системе.

[UsedImplicitly]
public sealed partial class AccumulateReagent : ReagentEffect
public sealed partial class AccumulateReagent : EntityEffect
{
/// <summary>
/// The reagent ID to accumulate. Only one of this and <see cref="Group"/> should be active.
Expand Down Expand Up @@ -60,10 +62,15 @@ public bool ContainsPositiveAdjustEffect(IPrototypeManager prototypeMan, Solutio
return false;
}

public override void Effect(ReagentEffectArgs args)
public override void Effect(EntityEffectBaseArgs args)
{
// Source is where Theobromine is currently coming from
if (args.Source == null)
if (args is not EntityEffectReagentArgs reagentArgs)
{
// Log or handle unexpected argument type
return;
}

if (reagentArgs.Source == null)
return;

if (Reagent == null)
Expand All @@ -72,12 +79,12 @@ public override void Effect(ReagentEffectArgs args)
var prototypeMan = IoCManager.Resolve<IPrototypeManager>();
prototypeMan.TryIndex(Reagent, out ReagentPrototype? reagentProto);

args.EntityManager.TryGetComponent(args.OrganEntity, out MetabolizerComponent? metabolizer);
args.EntityManager.TryGetComponent(reagentArgs.OrganEntity, out MetabolizerComponent? metabolizer);

if (metabolizer?.MetabolismGroups is not List<MetabolismGroupEntry> groups)
return;

if (!ContainsPositiveAdjustEffect(prototypeMan, args.Source, groups))
if (!ContainsPositiveAdjustEffect(prototypeMan, reagentArgs.Source, groups))
return;

if (reagentProto?.Metabolisms == null)
Expand All @@ -86,18 +93,17 @@ public override void Effect(ReagentEffectArgs args)
FixedPoint2 totalCompensationRate = 0;
foreach (var group in groups)
{
// Normally, the rate should only be processed once since a reagent usually only has one group.
if (!reagentProto.Metabolisms.TryGetValue(group.Id, out var reagentEffectsEntry))
continue;

var groupRate = reagentEffectsEntry.MetabolismRate * group.MetabolismRateModifier;
totalCompensationRate += groupRate;
}

// amount *= args.Scale;
args.Source.AddReagent(Reagent, totalCompensationRate);
reagentArgs.Source.AddReagent(Reagent, totalCompensationRate);
}


protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
{
if (Reagent != null && prototype.TryIndex(Reagent, out ReagentPrototype? reagentProto))
Expand Down
20 changes: 16 additions & 4 deletions Content.Server/_LostParadise/CarnivoresDiet/PoorlyDigestible.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Shared.Tag;
using Content.Shared.Whitelist;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -49,15 +50,26 @@ public sealed partial class PoorlyDigestibleFood

public bool AffectsFood(EntityUid foodEnt, IEntityManager entityManager)
{
if (WhitelistTags is null)
if (WhitelistTags is null || WhitelistTags.Count == 0)
return false;

var tagSys = entityManager.System<TagSystem>();

if (BlacklistTags is not null && tagSys.HasAnyTag(foodEnt, BlacklistTags))
return false;
var whitelistProtoIds = WhitelistTags
.Select(tag => new ProtoId<TagPrototype>(tag))
.ToList();

if (BlacklistTags is not null && BlacklistTags.Count > 0)
{
var blacklistProtoIds = BlacklistTags
.Select(tag => new ProtoId<TagPrototype>(tag))
.ToList();

if (tagSys.HasAnyTag(foodEnt, blacklistProtoIds))
return false;
}

return tagSys.HasAnyTag(foodEnt, WhitelistTags);
return tagSys.HasAnyTag(foodEnt, whitelistProtoIds);
}

public Solution ModifySolution(Solution solution)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using Content.Shared.Damage;
using Content.Shared.Verbs;
using Content.Shared._LostParadise.DiamondCrusher;
using Content.Shared.Power;
using Content.Shared.Whitelist;
using Robust.Shared.Collections;
using Robust.Shared.Random;
using Robust.Shared.Timing;
Expand All @@ -23,6 +25,7 @@ public sealed class DiamondCrusherSystem : SharedDiamondCrusherSystem
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly StackSystem _stack = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;

/// <унаследование/>
public override void Initialize()
Expand Down Expand Up @@ -90,7 +93,7 @@ public void FinishCrushing(Entity<DiamondCrusherComponent, EntityStorageComponen
var coords = Transform(ent).Coordinates;
foreach (var contained in contents)
{
if (crusher.CrushingWhitelist.IsValid(contained, EntityManager))
if (_whitelistSystem.IsWhitelistPass(crusher.CrushingWhitelist, contained))
{
var amount = _random.Next(crusher.MinFragments, crusher.MaxFragments);
var stacks = _stack.SpawnMultiple(crusher.FragmentStackProtoId, amount, coords);
Expand Down
7 changes: 0 additions & 7 deletions Content.Shared/DoAfter/DoAfterArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,6 @@ public sealed partial class DoAfterArgs
[DataField("breakOnDamage")]
public bool BreakOnDamage;

// LOST PARADISE (PE4HENIKA)-Start
[DataField("BreakOnMove")]

public bool BreakOnMove;
// LOST PARADISE (PE4HENIKA)-END

/// <summary>
/// Threshold for user damage. This damage has to be dealt in a single event, not over time.
/// </summary>
Expand Down Expand Up @@ -258,7 +252,6 @@ public DoAfterArgs(DoAfterArgs other)
BreakOnWeightlessMove = other.BreakOnWeightlessMove;
MovementThreshold = other.MovementThreshold;
DistanceThreshold = other.DistanceThreshold;
BreakOnMove = other.BreakOnMove; // PE4HENIKA LOST PARADISE
BreakOnDamage = other.BreakOnDamage;
DamageThreshold = other.DamageThreshold;
RequireCanInteract = other.RequireCanInteract;
Expand Down
Loading

0 comments on commit 6db7414

Please sign in to comment.