Skip to content

Commit

Permalink
Merge branch 'Fansana:master' into Xenospawners
Browse files Browse the repository at this point in the history
  • Loading branch information
fenndragon committed Sep 2, 2024
2 parents 0f9ba17 + 231a520 commit fbd6b8b
Show file tree
Hide file tree
Showing 410 changed files with 342,693 additions and 1,686 deletions.
8 changes: 8 additions & 0 deletions Content.Client/InteractionVerbs/InteractionVerbsSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Content.Shared.InteractionVerbs;

namespace Content.Client.InteractionVerbs;

// Just here because the shared system is abstract.
public sealed class InteractionVerbsSystem : SharedInteractionVerbsSystem
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.Linq;
using Content.Client.Guidebook;
using Content.Server.Verbs;
using Content.Shared.InteractionVerbs;
using Content.Shared.Verbs;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;

namespace Content.IntegrationTests.Tests.InteractionVerbs;

[TestFixture]
[FixtureLifeCycle(LifeCycle.SingleInstance)]
[TestOf(typeof(InteractionVerbPrototype))]
public sealed class InteractionPrototypesTest
{
public const string TestMobProto = "MobHuman";

[Test]
public async Task ValidatePrototypeContents()
{
await using var pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true });
var server = pair.Server;
await server.WaitIdleAsync();

var entMan = server.ResolveDependency<IEntityManager>();
var protoMan = server.ResolveDependency<IPrototypeManager>();

// TODO probably should test if an entity receives an abstract verb, but Iunno how
foreach (var proto in protoMan.EnumeratePrototypes<InteractionVerbPrototype>())
{
Assert.That(proto.Abstract || proto.Action is not null, $"Non-abstract prototype {proto.ID} lacks an action!");
}


await pair.CleanReturnAsync();
}
}
3 changes: 3 additions & 0 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@ public sealed class PostMapInitTest
"CentComm",
"MeteorArena",
"NukieOutpost",
"Core",
"Pebble", //DeltaV
"Edge", //DeltaV
"Saltern",
"Shoukou", //DeltaV
"Tortuga", //DeltaV
"Arena", //DeltaV
"Asterisk", //DeltaV
"Glacier", //DeltaV
"TheHive", //DeltaV
"Hammurabi", //DeltaV
"Lighthouse", //DeltaV
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Abilities/Psionics/PsionicAbilitiesSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public sealed class PsionicAbilitiesSystem : EntitySystem
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<InnatePsionicPowersComponent, ComponentStartup>(InnatePowerStartup);
SubscribeLocalEvent<InnatePsionicPowersComponent, MapInitEvent>(InnatePowerStartup);
SubscribeLocalEvent<PsionicComponent, ComponentShutdown>(OnPsionicShutdown);
}

/// <summary>
/// Special use-case for a InnatePsionicPowers, which allows an entity to start with any number of Psionic Powers.
/// </summary>
private void InnatePowerStartup(EntityUid uid, InnatePsionicPowersComponent comp, ComponentStartup args)
private void InnatePowerStartup(EntityUid uid, InnatePsionicPowersComponent comp, MapInitEvent args)
{
// Any entity with InnatePowers should also be psionic, but in case they aren't already...
EnsureComp<PsionicComponent>(uid, out var psionic);
Expand Down
3 changes: 2 additions & 1 deletion Content.Server/Body/Components/MetabolizerComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Body.Systems;
using Content.Server.Floofstation.Traits;
using Content.Server.Traits.Assorted;
using Content.Shared.Body.Prototypes;
using Content.Shared.FixedPoint;
Expand Down Expand Up @@ -45,7 +46,7 @@ public sealed partial class MetabolizerComponent : Component
/// List of metabolizer types that this organ is. ex. Human, Slime, Felinid, w/e.
/// </summary>
[DataField]
[Access(typeof(MetabolizerSystem), typeof(LiquorLifelineSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
[Access(typeof(MetabolizerSystem), typeof(LiquorLifelineSystem), typeof(VampirismSystem), Other = AccessPermissions.ReadExecute)] // Floofstation
public HashSet<ProtoId<MetabolizerTypePrototype>>? MetabolizerTypes = null;

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Body/Components/StomachComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Body.Systems;
using Content.Server.Floofstation.Traits;
using Content.Server.Nutrition.EntitySystems;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
Expand Down Expand Up @@ -45,6 +46,7 @@ public sealed partial class StomachComponent : Component
/// A whitelist for what special-digestible-required foods this stomach is capable of eating.
/// </summary>
[DataField]
[Access(Other = AccessPermissions.ReadWriteExecute)] // Floofstation
public EntityWhitelist? SpecialDigestible = null;

/// <summary>
Expand Down
5 changes: 4 additions & 1 deletion Content.Server/Carrying/CarryingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ private void OnMoveInput(EntityUid uid, BeingCarriedComponent component, ref Mov
// Check if the victim is in any way incapacitated, and if not make an escape attempt.
// Escape time scales with the inverse of a mass contest. Being lighter makes escape harder.
if (_actionBlockerSystem.CanInteract(uid, component.Carrier))
_escapeInventorySystem.AttemptEscape(uid, component.Carrier, escape, _contests.MassContest(uid, component.Carrier, false, 2f));
{
var disadvantage = _contests.MassContest(component.Carrier, uid, false, 2f);
_escapeInventorySystem.AttemptEscape(uid, component.Carrier, escape, disadvantage);
}
}

private void OnMoveAttempt(EntityUid uid, BeingCarriedComponent component, UpdateCanMoveEvent args)
Expand Down
165 changes: 82 additions & 83 deletions Content.Server/Chat/TelepathicChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,113 +16,112 @@
using System.Linq;
using System.Text;

namespace Content.Server.Chat
namespace Content.Server.Chat;

/// <summary>
/// Extensions for Telepathic chat stuff
/// </summary>
public sealed class TelepathicChatSystem : EntitySystem
{
/// <summary>
/// Extensions for Telepathic chat stuff
/// </summary>
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly GlimmerSystem _glimmerSystem = default!;
[Dependency] private readonly ChatSystem _chatSystem = default!;
private IEnumerable<INetChannel> GetPsionicChatClients()
{
return Filter.Empty()
.AddWhereAttachedEntity(IsEligibleForTelepathy)
.Recipients
.Select(p => p.ConnectedClient);
}

public sealed class TelepathicChatSystem : EntitySystem
private IEnumerable<INetChannel> GetAdminClients()
{
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly GlimmerSystem _glimmerSystem = default!;
[Dependency] private readonly ChatSystem _chatSystem = default!;
private IEnumerable<INetChannel> GetPsionicChatClients()
{
return Filter.Empty()
.AddWhereAttachedEntity(IsEligibleForTelepathy)
.Recipients
.Select(p => p.ConnectedClient);
}
return _adminManager.ActiveAdmins
.Select(p => p.ConnectedClient);
}

private IEnumerable<INetChannel> GetAdminClients()
{
return _adminManager.ActiveAdmins
.Select(p => p.ConnectedClient);
}
private List<INetChannel> GetDreamers(IEnumerable<INetChannel> removeList)
{
var filtered = Filter.Empty()
.AddWhereAttachedEntity(entity =>
HasComp<PsionicComponent>(entity) && !HasComp<TelepathyComponent>(entity)
|| HasComp<SleepingComponent>(entity)
|| HasComp<SeeingRainbowsComponent>(entity) && !HasComp<PsionicsDisabledComponent>(entity) && !HasComp<PsionicInsulationComponent>(entity))
.Recipients
.Select(p => p.ConnectedClient);

private List<INetChannel> GetDreamers(IEnumerable<INetChannel> removeList)
{
var filtered = Filter.Empty()
.AddWhereAttachedEntity(entity => HasComp<SleepingComponent>(entity) || HasComp<SeeingRainbowsComponent>(entity) && !HasComp<PsionicsDisabledComponent>(entity) && !HasComp<PsionicInsulationComponent>(entity))
.Recipients
.Select(p => p.ConnectedClient);
var filteredList = filtered.ToList();

var filteredList = filtered.ToList();
foreach (var entity in removeList)
filteredList.Remove(entity);

foreach (var entity in removeList)
filteredList.Remove(entity);
return filteredList;
}

return filteredList;
}
private bool IsEligibleForTelepathy(EntityUid entity)
{
return HasComp<TelepathyComponent>(entity)
&& !HasComp<PsionicsDisabledComponent>(entity)
&& !HasComp<PsionicInsulationComponent>(entity)
&& (!TryComp<MobStateComponent>(entity, out var mobstate) || mobstate.CurrentState == MobState.Alive);
}

private bool IsEligibleForTelepathy(EntityUid entity)
{
return HasComp<PsionicComponent>(entity)
&& !HasComp<PsionicsDisabledComponent>(entity)
&& !HasComp<PsionicInsulationComponent>(entity)
&& (!TryComp<MobStateComponent>(entity, out var mobstate) || mobstate.CurrentState == MobState.Alive);
}
public void SendTelepathicChat(EntityUid source, string message, bool hideChat)
{
if (!IsEligibleForTelepathy(source))
return;

public void SendTelepathicChat(EntityUid source, string message, bool hideChat)
{
if (!IsEligibleForTelepathy(source))
return;
var clients = GetPsionicChatClients();
var admins = GetAdminClients();
string messageWrap;
string adminMessageWrap;

var clients = GetPsionicChatClients();
var admins = GetAdminClients();
string messageWrap;
string adminMessageWrap;
messageWrap = Loc.GetString("chat-manager-send-telepathic-chat-wrap-message",
("telepathicChannelName", Loc.GetString("chat-manager-telepathic-channel-name")), ("message", message));

messageWrap = Loc.GetString("chat-manager-send-telepathic-chat-wrap-message",
("telepathicChannelName", Loc.GetString("chat-manager-telepathic-channel-name")), ("message", message));
adminMessageWrap = Loc.GetString("chat-manager-send-telepathic-chat-wrap-message-admin",
("source", source), ("message", message));

adminMessageWrap = Loc.GetString("chat-manager-send-telepathic-chat-wrap-message-admin",
("source", source), ("message", message));
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Telepathic chat from {ToPrettyString(source):Player}: {message}");

_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Telepathic chat from {ToPrettyString(source):Player}: {message}");
_chatManager.ChatMessageToMany(ChatChannel.Telepathic, message, messageWrap, source, hideChat, true, clients.ToList(), Color.PaleVioletRed);

_chatManager.ChatMessageToMany(ChatChannel.Telepathic, message, messageWrap, source, hideChat, true, clients.ToList(), Color.PaleVioletRed);
_chatManager.ChatMessageToMany(ChatChannel.Telepathic, message, adminMessageWrap, source, hideChat, true, admins, Color.PaleVioletRed);

_chatManager.ChatMessageToMany(ChatChannel.Telepathic, message, adminMessageWrap, source, hideChat, true, admins, Color.PaleVioletRed);
if (_random.Prob(0.1f))
_glimmerSystem.Glimmer++;

if (_random.Prob(0.1f))
_glimmerSystem.Glimmer++;
if (_random.Prob(Math.Min(0.33f + ((float) _glimmerSystem.Glimmer / 1500), 1)))
{
float obfuscation = (0.25f + (float) _glimmerSystem.Glimmer / 2000);
var obfuscated = ObfuscateMessageReadability(message, obfuscation);
_chatManager.ChatMessageToMany(ChatChannel.Telepathic, obfuscated, messageWrap, source, hideChat, false, GetDreamers(clients), Color.PaleVioletRed);
}

if (_random.Prob(Math.Min(0.33f + ((float) _glimmerSystem.Glimmer / 1500), 1)))
{
float obfuscation = (0.25f + (float) _glimmerSystem.Glimmer / 2000);
var obfuscated = ObfuscateMessageReadability(message, obfuscation);
_chatManager.ChatMessageToMany(ChatChannel.Telepathic, obfuscated, messageWrap, source, hideChat, false, GetDreamers(clients), Color.PaleVioletRed);
}
foreach (var repeater in EntityQuery<TelepathicRepeaterComponent>())
_chatSystem.TrySendInGameICMessage(repeater.Owner, message, InGameICChatType.Speak, false);
}

foreach (var repeater in EntityQuery<TelepathicRepeaterComponent>())
{
_chatSystem.TrySendInGameICMessage(repeater.Owner, message, InGameICChatType.Speak, false);
}
}
private string ObfuscateMessageReadability(string message, float chance)
{
var modifiedMessage = new StringBuilder(message);

private string ObfuscateMessageReadability(string message, float chance)
for (var i = 0; i < message.Length; i++)
{
var modifiedMessage = new StringBuilder(message);

for (var i = 0; i < message.Length; i++)
if (char.IsWhiteSpace((modifiedMessage[i])))
{
if (char.IsWhiteSpace((modifiedMessage[i])))
{
continue;
}

if (_random.Prob(1 - chance))
{
modifiedMessage[i] = '~';
}
continue;
}

return modifiedMessage.ToString();
if (_random.Prob(1 - chance))
{
modifiedMessage[i] = '~';
}
}

return modifiedMessage.ToString();
}
}
17 changes: 7 additions & 10 deletions Content.Server/Chat/TelepathicRepeaterComponent.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
namespace Content.Server.Chat
{
/// <summary>
/// Repeats whatever is happening in telepathic chat.
/// </summary>
[RegisterComponent]
public sealed partial class TelepathicRepeaterComponent : Component
{
namespace Content.Server.Chat;

/// <summary>
/// Repeats whatever is happening in telepathic chat.
/// </summary>
[RegisterComponent]
public sealed partial class TelepathicRepeaterComponent : Component { }

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Content.Server.Station.Systems;
using Robust.Shared.Utility;

namespace Content.Server.Station.Components;

/// <summary>
/// Loads a surface map on mapinit.
/// </summary>
[RegisterComponent, Access(typeof(StationSurfaceSystem))]
public sealed partial class StationSurfaceComponent : Component
{
/// <summary>
/// Path to the map to load.
/// </summary>
[DataField(required: true)]
public ResPath? MapPath;

/// <summary>
/// The map that was loaded.
/// </summary>
[DataField]
public EntityUid? Map;
}
Loading

0 comments on commit fbd6b8b

Please sign in to comment.