Merge pull request #110 from frosty-dev/ups

Ups
This commit is contained in:
Jabak
2024-08-09 15:33:58 +03:00
committed by GitHub
107 changed files with 33271 additions and 30779 deletions

View File

@@ -0,0 +1,7 @@
namespace Content.Server._White.AspectsSystem.Aspects.Components;
[RegisterComponent]
public sealed partial class ImmersiveAspectComponent : Component
{
}

View File

@@ -0,0 +1,100 @@
using System.Numerics;
using Content.Server.GameTicking.Rules.Components;
using Content.Server._White.AspectsSystem.Aspects.Components;
using Content.Server._White.AspectsSystem.Base;
using Content.Server.GameTicking;
using Content.Shared._White.Telescope;
using Content.Shared.Humanoid;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems;
namespace Content.Server._White.AspectsSystem.Aspects;
public sealed class ImmersiveAspect : AspectSystem<ImmersiveAspectComponent>
{
[Dependency] private readonly SharedContentEyeSystem _eye = default!;
[Dependency] private readonly SharedTelescopeSystem _telescope = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(HandleLateJoin);
}
protected override void Started(EntityUid uid, ImmersiveAspectComponent component, GameRuleComponent gameRule,
GameRuleStartedEvent args)
{
base.Started(uid, component, gameRule, args);
WayToHRPPlusPlus();
}
private void WayToHRPPlusPlus()
{
var humans = EntityQuery<HumanoidAppearanceComponent>();
foreach (var human in humans)
{
var entity = human.Owner;
if (!HasComp<ContentEyeComponent>(entity))
continue;
FuckUpEye(entity, 0.6f);
AddTelescope(entity);
}
}
private void FuckUpEye(EntityUid human, float modifier)
{
_eye.SetMaxZoom(human, new Vector2(modifier));
_eye.SetZoom(human, new Vector2(modifier));
}
private void AddTelescope(EntityUid human)
{
var telescope = EnsureComp<TelescopeComponent>(human);
_telescope.SetParameters((human, telescope), 0.15f, 0.07f);
}
private void HandleLateJoin(PlayerSpawnCompleteEvent ev)
{
if (!ev.LateJoin)
return;
if (!HasComp<ContentEyeComponent>(ev.Mob))
return;
var query = EntityQueryEnumerator<ImmersiveAspectComponent, GameRuleComponent>();
while (query.MoveNext(out var ruleEntity, out _, out var gameRule))
{
if (!GameTicker.IsGameRuleAdded(ruleEntity, gameRule))
continue;
FuckUpEye(ev.Mob, 0.6f);
AddTelescope(ev.Mob);
}
}
protected override void Ended(EntityUid uid, ImmersiveAspectComponent component, GameRuleComponent gameRule, GameRuleEndedEvent args)
{
base.Ended(uid, component, gameRule, args);
var humans = EntityQuery<HumanoidAppearanceComponent>();
foreach (var human in humans)
{
var entity = human.Owner;
if (!HasComp<ContentEyeComponent>(entity))
continue;
FuckUpEye(entity, 1f);
RemComp<TelescopeComponent>(entity);
}
}
}

View File

@@ -84,11 +84,16 @@ public sealed class MessagesCartridgeSystem : EntitySystem
var stationId = _stationSystem.GetOwningStation(uid);
if (!stationId.HasValue)
return;
var content = messageEvent.StringInput;
if (content.Length > 1000)
content = content.Substring(0, 997) + "...";
MessagesMessageData messageData = new()
{
SenderId = userId,
ReceiverId = component.ChatUid.Value,
Content = messageEvent.StringInput,
Content = content,
Time = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan)
};
var packet = new NetworkPayload()