Crawling Part 1: The Knockdownening (#36881)
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> Co-authored-by: ScarKy0 <scarky0@onet.eu>
This commit is contained in:
committed by
GitHub
parent
cfb0a95035
commit
dec2d42a1d
@@ -384,11 +384,14 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
var shotEv = new GunShotEvent(user, ev.Ammo);
|
||||
RaiseLocalEvent(gunUid, ref shotEv);
|
||||
|
||||
if (userImpulse && TryComp<PhysicsComponent>(user, out var userPhysics))
|
||||
{
|
||||
if (_gravity.IsWeightless(user, userPhysics))
|
||||
CauseImpulse(fromCoordinates, toCoordinates.Value, user, userPhysics);
|
||||
}
|
||||
if (!userImpulse || !TryComp<PhysicsComponent>(user, out var userPhysics))
|
||||
return;
|
||||
|
||||
var shooterEv = new ShooterImpulseEvent();
|
||||
RaiseLocalEvent(user, ref shooterEv);
|
||||
|
||||
if (shooterEv.Push || _gravity.IsWeightless(user, userPhysics))
|
||||
CauseImpulse(fromCoordinates, toCoordinates.Value, user, userPhysics);
|
||||
}
|
||||
|
||||
public void Shoot(
|
||||
@@ -629,6 +632,16 @@ public record struct AttemptShootEvent(EntityUid User, string? Message, bool Can
|
||||
[ByRefEvent]
|
||||
public record struct GunShotEvent(EntityUid User, List<(EntityUid? Uid, IShootable Shootable)> Ammo);
|
||||
|
||||
/// <summary>
|
||||
/// Raised on an entity after firing a gun to see if any components or systems would allow this entity to be pushed
|
||||
/// by the gun they're firing. If true, GunSystem will create an impulse on our entity.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public record struct ShooterImpulseEvent()
|
||||
{
|
||||
public bool Push;
|
||||
};
|
||||
|
||||
public enum EffectLayers : byte
|
||||
{
|
||||
Unshaded,
|
||||
|
||||
Reference in New Issue
Block a user