[Feat] Система лежания и снаряды теперь проходят через лежащих людей, если не целиться в них (#195)

* add: система лежания и вставания

* add: теперь по-умолчанию по лежачим не попадают снаряды

* add: только гуманоиды могут ложиться
This commit is contained in:
Remuchi
2024-03-21 09:54:11 +07:00
committed by GitHub
parent 1b2b313804
commit 673d26f918
17 changed files with 411 additions and 158 deletions

View File

@@ -229,6 +229,9 @@ public sealed partial class GunComponent : Component
public bool ClumsyProof = false;
// WD START
public EntityUid? Target;
[DataField("forceThrowingAngle")]
[ViewVariables(VVAccess.ReadWrite)]
public bool ForceThrowingAngle;

View File

@@ -9,6 +9,7 @@ namespace Content.Shared.Weapons.Ranged.Events;
[Serializable, NetSerializable]
public sealed class RequestShootEvent : EntityEventArgs
{
public NetEntity? Target;
public NetEntity Gun;
public NetCoordinates Coordinates;
}

View File

@@ -144,6 +144,7 @@ public abstract partial class SharedGunSystem : EntitySystem
return;
gun.ShootCoordinates = GetCoordinates(msg.Coordinates);
gun.Target = GetEntity(msg.Target);
Log.Debug($"Set shoot coordinates to {gun.ShootCoordinates}");
AttemptShoot(user.Value, ent, gun);
}
@@ -558,6 +559,12 @@ public abstract partial class SharedGunSystem : EntitySystem
[ByRefEvent]
public record struct AttemptShootEvent(EntityUid User, string? Message, bool Cancelled = false, bool ThrowItems = false);
/// <summary>
/// Raised when an entity is just about to be hit with a hitscan
/// </summary>
[ByRefEvent]
public record struct HitscanHitAttemptEvent(EntityUid HitEntity, EntityUid? Target, bool Cancelled = false);
/// <summary>
/// Raised directed on the gun after firing.
/// </summary>