add hrp ++++ aspect (#587)
This commit is contained in:
@@ -82,6 +82,7 @@ namespace Content.Client.Input
|
|||||||
human.AddFunction(ContentKeyFunctions.Arcade3);
|
human.AddFunction(ContentKeyFunctions.Arcade3);
|
||||||
human.AddFunction(ContentKeyFunctions.LieDown); // WD EDIT
|
human.AddFunction(ContentKeyFunctions.LieDown); // WD EDIT
|
||||||
human.AddFunction(ContentKeyFunctions.OfferItem); // WD EDIT
|
human.AddFunction(ContentKeyFunctions.OfferItem); // WD EDIT
|
||||||
|
human.AddFunction(ContentKeyFunctions.LookUp); // WD EDIT
|
||||||
|
|
||||||
// actions should be common (for ghosts, mobs, etc)
|
// actions should be common (for ghosts, mobs, etc)
|
||||||
common.AddFunction(ContentKeyFunctions.OpenActionsMenu);
|
common.AddFunction(ContentKeyFunctions.OpenActionsMenu);
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ namespace Content.Client.Options.UI.Tabs
|
|||||||
AddButton(ContentKeyFunctions.SaveItemLocation);
|
AddButton(ContentKeyFunctions.SaveItemLocation);
|
||||||
AddButton(ContentKeyFunctions.OfferItem); // WD EDIT
|
AddButton(ContentKeyFunctions.OfferItem); // WD EDIT
|
||||||
AddButton(ContentKeyFunctions.LieDown); // WD EDIT
|
AddButton(ContentKeyFunctions.LieDown); // WD EDIT
|
||||||
|
AddButton(ContentKeyFunctions.LookUp); // WD EDIT
|
||||||
AddCheckBox("ui-options-function-auto-get-up", _cfg.GetCVar(WhiteCVars.AutoGetUp), HandleToggleAutoGetUp); // WD EDIT
|
AddCheckBox("ui-options-function-auto-get-up", _cfg.GetCVar(WhiteCVars.AutoGetUp), HandleToggleAutoGetUp); // WD EDIT
|
||||||
|
|
||||||
AddHeader("ui-options-header-interaction-adv");
|
AddHeader("ui-options-header-interaction-adv");
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Numerics;
|
|||||||
using Content.Client.Viewport;
|
using Content.Client.Viewport;
|
||||||
using Content.Shared._White.Telescope;
|
using Content.Shared._White.Telescope;
|
||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
|
using Content.Shared.Input;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Input;
|
using Robust.Client.Input;
|
||||||
@@ -23,6 +24,7 @@ public sealed class TelescopeSystem : SharedTelescopeSystem
|
|||||||
|
|
||||||
private ScalingViewport? _viewport;
|
private ScalingViewport? _viewport;
|
||||||
|
|
||||||
|
|
||||||
public override void FrameUpdate(float frameTime)
|
public override void FrameUpdate(float frameTime)
|
||||||
{
|
{
|
||||||
base.FrameUpdate(frameTime);
|
base.FrameUpdate(frameTime);
|
||||||
@@ -32,19 +34,25 @@ public sealed class TelescopeSystem : SharedTelescopeSystem
|
|||||||
|
|
||||||
var player = _player.LocalEntity;
|
var player = _player.LocalEntity;
|
||||||
|
|
||||||
if (!TryComp<HandsComponent>(player, out var hands) ||
|
var entity = GetRightEntity(player);
|
||||||
!TryComp<TelescopeComponent>(hands.ActiveHandEntity, out var telescope) ||
|
|
||||||
!TryComp<EyeComponent>(player.Value, out var eye))
|
if (entity == EntityUid.Invalid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var telescope = Comp<TelescopeComponent>(entity);
|
||||||
|
|
||||||
|
if (!TryComp<EyeComponent>(player, out var eye))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var offset = Vector2.Zero;
|
var offset = Vector2.Zero;
|
||||||
|
|
||||||
if (_inputSystem.CmdStates.GetState(EngineKeyFunctions.UseSecondary) != BoundKeyState.Down)
|
if (_inputSystem.CmdStates.GetState(ContentKeyFunctions.LookUp) != BoundKeyState.Down)
|
||||||
{
|
{
|
||||||
RaisePredictiveEvent(new EyeOffsetChangedEvent
|
RaisePredictiveEvent(new EyeOffsetChangedEvent
|
||||||
{
|
{
|
||||||
Offset = offset
|
Offset = offset
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Content.Server._White.AspectsSystem.Aspects.Components;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed partial class ImmersiveAspectComponent : Component
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
100
Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs
Normal file
100
Content.Server/_White/AspectsSystem/Aspects/ImmersiveAspect.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -59,6 +59,7 @@ namespace Content.Shared.Input
|
|||||||
public static readonly BoundKeyFunction ResetZoom = "ResetZoom";
|
public static readonly BoundKeyFunction ResetZoom = "ResetZoom";
|
||||||
public static readonly BoundKeyFunction LieDown = "LieDown"; // WD EDIT
|
public static readonly BoundKeyFunction LieDown = "LieDown"; // WD EDIT
|
||||||
public static readonly BoundKeyFunction OfferItem = "OfferItem"; // WD EDIT
|
public static readonly BoundKeyFunction OfferItem = "OfferItem"; // WD EDIT
|
||||||
|
public static readonly BoundKeyFunction LookUp = "LookUp"; // WD EDIT
|
||||||
|
|
||||||
public static readonly BoundKeyFunction ArcadeUp = "ArcadeUp";
|
public static readonly BoundKeyFunction ArcadeUp = "ArcadeUp";
|
||||||
public static readonly BoundKeyFunction ArcadeDown = "ArcadeDown";
|
public static readonly BoundKeyFunction ArcadeDown = "ArcadeDown";
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ public sealed partial class ContentEyeComponent : Component
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Zoom we're lerping to.
|
/// Zoom we're lerping to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("targetZoom"), AutoNetworkedField]
|
[DataField, AutoNetworkedField]
|
||||||
public Vector2 TargetZoom = Vector2.One;
|
public Vector2 TargetZoom = Vector2.One;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How far we're allowed to zoom out.
|
/// How far we're allowed to zoom out.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("maxZoom"), AutoNetworkedField]
|
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||||
public Vector2 MaxZoom = Vector2.One;
|
public Vector2 MaxZoom = Vector2.One;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Numerics;
|
|||||||
using Content.Shared.Camera;
|
using Content.Shared.Camera;
|
||||||
using Content.Shared.Hands;
|
using Content.Shared.Hands;
|
||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
|
using Content.Shared.Item;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Shared._White.Telescope;
|
namespace Content.Shared._White.Telescope;
|
||||||
@@ -41,19 +42,45 @@ public abstract class SharedTelescopeSystem : EntitySystem
|
|||||||
if (!TryComp(args.User, out EyeComponent? eye))
|
if (!TryComp(args.User, out EyeComponent? eye))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!HasComp<ItemComponent>(ent.Owner))
|
||||||
|
return;
|
||||||
|
|
||||||
SetOffset((args.User, eye), Vector2.Zero, ent);
|
SetOffset((args.User, eye), Vector2.Zero, ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityUid GetRightEntity(EntityUid? ent)
|
||||||
|
{
|
||||||
|
var entity = EntityUid.Invalid;
|
||||||
|
|
||||||
|
if (TryComp<HandsComponent>(ent, out var hands) &&
|
||||||
|
HasComp<TelescopeComponent>(hands.ActiveHandEntity) &&
|
||||||
|
hands.ActiveHandEntity.HasValue)
|
||||||
|
{
|
||||||
|
entity = hands.ActiveHandEntity.Value;
|
||||||
|
}
|
||||||
|
else if (HasComp<TelescopeComponent>(ent))
|
||||||
|
{
|
||||||
|
entity = ent.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnEyeOffsetChanged(EyeOffsetChangedEvent msg, EntitySessionEventArgs args)
|
private void OnEyeOffsetChanged(EyeOffsetChangedEvent msg, EntitySessionEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.SenderSession.AttachedEntity is not { } ent)
|
if (args.SenderSession.AttachedEntity is not { } ent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!TryComp<HandsComponent>(ent, out var hands) ||
|
if (!TryComp(ent, out EyeComponent? eye))
|
||||||
!TryComp<TelescopeComponent>(hands.ActiveHandEntity, out var telescope) ||
|
|
||||||
!TryComp(ent, out EyeComponent? eye))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var entity = GetRightEntity(ent);
|
||||||
|
|
||||||
|
if (entity == EntityUid.Invalid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var telescope = Comp<TelescopeComponent>(entity);
|
||||||
|
|
||||||
var offset = Vector2.Lerp(eye.Offset, msg.Offset, telescope.LerpAmount);
|
var offset = Vector2.Lerp(eye.Offset, msg.Offset, telescope.LerpAmount);
|
||||||
|
|
||||||
SetOffset((ent, eye), offset, telescope);
|
SetOffset((ent, eye), offset, telescope);
|
||||||
@@ -71,6 +98,19 @@ public abstract class SharedTelescopeSystem : EntitySystem
|
|||||||
else
|
else
|
||||||
_eye.SetOffset(ent, offset, ent);
|
_eye.SetOffset(ent, offset, ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetParameters(Entity<TelescopeComponent> ent, float? divisor = null, float? lerpAmount = null)
|
||||||
|
{
|
||||||
|
var telescope = ent.Comp;
|
||||||
|
|
||||||
|
divisor ??= telescope.Divisor;
|
||||||
|
lerpAmount ??= telescope.LerpAmount;
|
||||||
|
|
||||||
|
telescope.Divisor = divisor.Value;
|
||||||
|
telescope.LerpAmount = lerpAmount.Value;
|
||||||
|
|
||||||
|
Dirty(ent.Owner, telescope);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
|
|||||||
@@ -338,6 +338,19 @@
|
|||||||
path: /Audio/White/Aspects/accent.ogg
|
path: /Audio/White/Aspects/accent.ogg
|
||||||
- type: RandomItemAspect
|
- type: RandomItemAspect
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: ImmersiveAspect
|
||||||
|
parent: BaseGameRule
|
||||||
|
noSpawn: true
|
||||||
|
components:
|
||||||
|
- type: Aspect
|
||||||
|
name: "Immersive"
|
||||||
|
description: "В связи с недавними трагичными событиями экипаж станции погрузился в себя"
|
||||||
|
weight: 3
|
||||||
|
startAudio:
|
||||||
|
path: /Audio/White/Aspects/accent.ogg
|
||||||
|
- type: ImmersiveAspect
|
||||||
|
|
||||||
# Disabled this cause polymorph breaks stuff
|
# Disabled this cause polymorph breaks stuff
|
||||||
#- type: entity
|
#- type: entity
|
||||||
# id: SkeletonAspect
|
# id: SkeletonAspect
|
||||||
|
|||||||
@@ -542,4 +542,8 @@ binds:
|
|||||||
key: Num9
|
key: Num9
|
||||||
- function: LieDown
|
- function: LieDown
|
||||||
type: State
|
type: State
|
||||||
key: U
|
key: U
|
||||||
|
- function: LookUp
|
||||||
|
type: State
|
||||||
|
key: MouseRight
|
||||||
|
mod1: Space
|
||||||
|
|||||||
Reference in New Issue
Block a user