Skip to content

Commit

Permalink
Merge pull request #171 from Evgencheg/master
Browse files Browse the repository at this point in the history
апстрим
  • Loading branch information
Evgencheg authored Sep 20, 2024
2 parents 9901217 + 3538ebe commit 757038a
Show file tree
Hide file tree
Showing 35 changed files with 177 additions and 104 deletions.
26 changes: 26 additions & 0 deletions Content.Client/Standing/LayingDownSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.Timing;
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;

namespace Content.Client.Standing;

Expand All @@ -20,6 +21,8 @@ public override void Initialize()
base.Initialize();

SubscribeLocalEvent<LayingDownComponent, MoveEvent>(OnMovementInput);
SubscribeNetworkEvent<DrawDownedEvent>(OnDowned);
SubscribeLocalEvent<LayingDownComponent, StoodEvent>(OnStood);

SubscribeNetworkEvent<CheckAutoGetUpEvent>(OnCheckAutoGetUp);
}
Expand Down Expand Up @@ -48,6 +51,29 @@ private void OnMovementInput(EntityUid uid, LayingDownComponent component, MoveE
sprite.Rotation = Angle.FromDegrees(90);
}

private void OnDowned(DrawDownedEvent args)
{
var uid = GetEntity(args.Uid);

if (!TryComp<SpriteComponent>(uid, out var sprite)
|| !TryComp<LayingDownComponent>(uid, out var component))
return;

if (!component.OriginalDrawDepth.HasValue)
component.OriginalDrawDepth = sprite.DrawDepth;

sprite.DrawDepth = (int) DrawDepth.SmallMobs;
}

private void OnStood(EntityUid uid, LayingDownComponent component, StoodEvent args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite)
|| !component.OriginalDrawDepth.HasValue)
return;

sprite.DrawDepth = component.OriginalDrawDepth.Value;
}

private void OnCheckAutoGetUp(CheckAutoGetUpEvent ev, EntitySessionEventArgs args)
{
if (!_timing.IsFirstTimePredicted)
Expand Down
18 changes: 18 additions & 0 deletions Content.Server/Flight/FlightSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Content.Shared.Flight.Events;
using Content.Shared.Mobs;
using Content.Shared.Popups;
using Content.Shared.Standing;
using Content.Shared.Stunnable;
using Content.Shared.Zombies;
using Robust.Shared.Audio.Systems;
Expand All @@ -16,6 +17,7 @@ public sealed class FlightSystem : SharedFlightSystem
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly StandingStateSystem _standing = default!;

public override void Initialize()
{
Expand All @@ -27,6 +29,7 @@ public override void Initialize()
SubscribeLocalEvent<FlightComponent, EntityZombifiedEvent>(OnZombified);
SubscribeLocalEvent<FlightComponent, KnockedDownEvent>(OnKnockedDown);
SubscribeLocalEvent<FlightComponent, StunnedEvent>(OnStunned);
SubscribeLocalEvent<FlightComponent, DownedEvent>(OnDowned);
SubscribeLocalEvent<FlightComponent, SleepStateChangedEvent>(OnSleep);
}
public override void Update(float frameTime)
Expand Down Expand Up @@ -103,6 +106,13 @@ private bool CanFly(EntityUid uid, FlightComponent component)
_popupSystem.PopupEntity(Loc.GetString("no-flight-while-zombified"), uid, uid, PopupType.Medium);
return false;
}

if (HasComp<StandingStateComponent>(uid) && _standing.IsDown(uid))
{
_popupSystem.PopupEntity(Loc.GetString("no-flight-while-lying"), uid, uid, PopupType.Medium);
return false;
}

return true;
}

Expand Down Expand Up @@ -142,6 +152,14 @@ private void OnStunned(EntityUid uid, FlightComponent component, ref StunnedEven
ToggleActive(uid, false, component);
}

private void OnDowned(EntityUid uid, FlightComponent component, ref DownedEvent args)
{
if (!component.On)
return;

ToggleActive(uid, false, component);
}

private void OnSleep(EntityUid uid, FlightComponent component, ref SleepStateChangedEvent args)
{
if (!component.On
Expand Down
8 changes: 8 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2471,6 +2471,13 @@ public static readonly CVarDef<float>
public static readonly CVarDef<bool> HoldLookUp =
CVarDef.Create("rest.hold_look_up", false, CVar.CLIENT | CVar.ARCHIVE);

/// <summary>
/// When true, entities that fall to the ground will be able to crawl under tables and
/// plastic flaps, allowing them to take cover from gunshots.
/// </summary>
public static readonly CVarDef<bool> CrawlUnderTables =
CVarDef.Create("rest.crawlundertables", false, CVar.REPLICATED);

#endregion

#region Material Reclaimer
Expand Down Expand Up @@ -2498,5 +2505,6 @@ public static readonly CVarDef<float>
CVarDef.Create("jetpack.enable_in_no_gravity", true, CVar.REPLICATED);

#endregion

}
}
9 changes: 9 additions & 0 deletions Content.Shared/Standing/LayingDownComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public sealed partial class LayingDownComponent : Component

[DataField, AutoNetworkedField]
public bool AutoGetUp;

[DataField, AutoNetworkedField]
public int? OriginalDrawDepth { get; set; }
}

[Serializable, NetSerializable]
Expand All @@ -24,3 +27,9 @@ public sealed class CheckAutoGetUpEvent(NetEntity user) : CancellableEntityEvent
{
public NetEntity User = user;
}

[Serializable, NetSerializable]
public sealed class DrawDownedEvent(NetEntity uid) : EntityEventArgs
{
public NetEntity Uid = uid;
}
8 changes: 8 additions & 0 deletions Content.Shared/Standing/StandingStateSystem.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using Content.Shared.Buckle;
using Content.Shared.Buckle.Components;
using Content.Shared.CCVar;
using Content.Shared.Hands.Components;
using Content.Shared.Movement.Systems;
using Content.Shared.Physics;
using Content.Shared.Rotation;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Serialization;

namespace Content.Shared.Standing;

Expand All @@ -17,6 +20,7 @@ public sealed class StandingStateSystem : EntitySystem
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
[Dependency] private readonly SharedBuckleSystem _buckle = default!;
[Dependency] private readonly IConfigurationManager _config = default!;

// If StandingCollisionLayer value is ever changed to more than one layer, the logic needs to be edited.
private const int StandingCollisionLayer = (int) CollisionGroup.MidImpassable;
Expand Down Expand Up @@ -64,6 +68,10 @@ public bool Down(EntityUid uid, bool playSound = true, bool dropHeldItems = true
Dirty(standingState);
RaiseLocalEvent(uid, new DownedEvent(), false);

// Raising this event will lower the entity's draw depth to the same as a small mob.
if (_config.GetCVar(CCVars.CrawlUnderTables))
RaiseNetworkEvent(new DrawDownedEvent(GetNetEntity(uid)));

// Seemed like the best place to put it
_appearance.SetData(uid, RotationVisuals.RotationState, RotationState.Horizontal, appearance);

Expand Down
6 changes: 3 additions & 3 deletions Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public sealed partial class MeleeWeaponComponent : Component
/// Total width of the angle for wide attacks.
/// </summary>
[DataField, AutoNetworkedField]
public Angle Angle = Angle.FromDegrees(45);
public Angle Angle = Angle.FromDegrees(60);

[DataField, AutoNetworkedField]
public EntProtoId Animation = "WeaponArcPunch";
Expand All @@ -129,10 +129,10 @@ public sealed partial class MeleeWeaponComponent : Component
public bool SwingLeft;

[DataField, AutoNetworkedField]
public float HeavyStaminaCost = 10f;
public float HeavyStaminaCost = 2.5f;

[DataField, AutoNetworkedField]
public int MaxTargets = 1;
public int MaxTargets = 3;

// Sounds

Expand Down
20 changes: 20 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6500,3 +6500,23 @@ Entries:
id: 6374
time: '2024-09-20T02:48:43.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/934
- author: gluesniffler
changes:
- type: Add
message: >-
Adds an optional server variable which allows entities to crawl under
tables.
- type: Tweak
message: >-
Tables and plastic flaps are less resistant to damage, and can now be
targeted by guns by aiming on top of them.
id: 6375
time: '2024-09-20T19:34:02.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/939
- author: ODJ
changes:
- type: Tweak
message: Tweaked melee; Less stamina usage on heavy attacks.
id: 6376
time: '2024-09-20T19:34:46.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/938
3 changes: 2 additions & 1 deletion Resources/Locale/en-US/flight/flight_system.ftl
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
no-flight-while-restrained = You can't fly right now.
no-flight-while-zombified = You can't use your wings right now.
no-flight-while-zombified = You can't use your wings right now.
no-flight-while-lying = You can't fly right now.
1 change: 1 addition & 0 deletions Resources/Locale/ru-RU/flight/flight_system.ftl
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
no-flight-while-restrained = Вы не можете взлететь.
no-flight-while-zombified = Вы не можете использовать ваши крылья.
no-flight-while-lying = Вы не можете летать пока лежите.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
bluntStaminaDamageFactor: 1.5
heavyRateModifier: 0.75
heavyDamageBaseModifier: 1.2
heavyStaminaCost: 10
heavyStaminaCost: 7.5
angle: 75
- type: Item
size: Normal
Expand Down Expand Up @@ -67,7 +67,7 @@
bluntStaminaDamageFactor: 1.5
heavyRateModifier: 0.75
heavyDamageBaseModifier: 1.2
heavyStaminaCost: 10
heavyStaminaCost: 7.5
angle: 75
- type: Item
size: Normal
Expand Down Expand Up @@ -110,7 +110,7 @@
bluntStaminaDamageFactor: 1.5
heavyRateModifier: 0.75
heavyDamageBaseModifier: 1.2
heavyStaminaCost: 15
heavyStaminaCost: 10
angle: 160
- type: Wieldable
- type: IncreaseDamageOnWield
Expand Down Expand Up @@ -234,7 +234,7 @@
bluntStaminaDamageFactor: 2
heavyRateModifier: 0.75
heavyDamageBaseModifier: 1.2
heavyStaminaCost: 10
heavyStaminaCost: 7.5
angle: 75

- type: entity
Expand Down
3 changes: 1 addition & 2 deletions Resources/Prototypes/Entities/Objects/Fun/toys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,11 @@
state: icon
- type: MeleeWeapon
attackRate: 1.5
range: 1.3
range: 1.5
damage:
types:
Blunt: 0.1
heavyDamageBaseModifier: 2
heavyStaminaCost: 5
maxTargets: 8
angle: 25
- type: Clothing
Expand Down
4 changes: 2 additions & 2 deletions Resources/Prototypes/Entities/Objects/Misc/broken_bottle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
components:
- type: Sharp
- type: MeleeWeapon
attackRate: 1.5
range: 1.3
attackRate: 1.4
range: 1.4
damage:
types:
Slash: 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
Blunt: 8
heavyRateModifier: 0.8
heavyDamageBaseModifier: 2
heavyStaminaCost: 15
maxTargets: 8
heavyStaminaCost: 7.5
maxTargets: 6
soundHit:
path: /Audio/Weapons/smash.ogg
- type: Tool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
heavyRateModifier: 0.8
heavyDamageBaseModifier: 1
heavyStaminaCost: 5
maxTargets: 3
maxTargets: 4
- type: Tag
tags:
- Book
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
heavyRateModifier: 1
heavyRangeModifier: 1
heavyDamageBaseModifier: 1.2
heavyStaminaCost: 5
maxTargets: 5
angle: 100
- type: Item
Expand All @@ -48,7 +47,6 @@
heavyRateModifier: 0.9
heavyRangeModifier: 1.25
heavyDamageBaseModifier: 1.2
heavyStaminaCost: 5
maxTargets: 1
angle: 20
- type: Item
Expand Down Expand Up @@ -103,7 +101,7 @@
wideAnimationRotation: 135
swingLeft: true
attackRate: 1.25
range: 1.25
range: 1.4
damage:
types:
Slash: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
heavyRateModifier: 0.8
heavyRangeModifier: 1.25
heavyDamageBaseModifier: 1.25
heavyStaminaCost: 10
heavyStaminaCost: 7.5
maxTargets: 2
angle: 180
soundHit:
Expand Down Expand Up @@ -64,7 +64,7 @@
heavyRateModifier: 0.8
heavyRangeModifier: 1.25
heavyDamageBaseModifier: 1.25
heavyStaminaCost: 10
heavyStaminaCost: 7.5
maxTargets: 2
angle: 180
soundHit:
Expand Down
Loading

0 comments on commit 757038a

Please sign in to comment.