Syringe gun! (#32112)
* Init testing * copyright * oops * Tracking the embed entity uid * testing stuff for gradual injection * work * weh * god save me * bleh * Yippee! * Again * Mini syringe ammo * cleaning up * mini syringes have a texture for fill amount * -3 cool points :( * hitboxes * init cleanup * much needed fixes * Fixes
This commit is contained in:
@@ -13,37 +13,43 @@ public sealed partial class EmbeddableProjectileComponent : Component
|
||||
/// <summary>
|
||||
/// Minimum speed of the projectile to embed.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||
[DataField, AutoNetworkedField]
|
||||
public float MinimumSpeed = 5f;
|
||||
|
||||
/// <summary>
|
||||
/// Delete the entity on embedded removal?
|
||||
/// Does nothing if there's no RemovalTime.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool DeleteOnRemove;
|
||||
|
||||
/// <summary>
|
||||
/// How long it takes to remove the embedded object.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||
[DataField, AutoNetworkedField]
|
||||
public float? RemovalTime = 3f;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this entity will embed when thrown, or only when shot as a projectile.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool EmbedOnThrow = true;
|
||||
|
||||
/// <summary>
|
||||
/// How far into the entity should we offset (0 is wherever we collided).
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||
[DataField, AutoNetworkedField]
|
||||
public Vector2 Offset = Vector2.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// Sound to play after embedding into a hit target.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||
[DataField, AutoNetworkedField]
|
||||
public SoundSpecifier? Sound;
|
||||
|
||||
/// <summary>
|
||||
/// Uid of the entity the projectile is embed into.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public EntityUid? EmbeddedIntoUid;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
||||
TryComp<PhysicsComponent>(uid, out var physics);
|
||||
_physics.SetBodyType(uid, BodyType.Dynamic, body: physics, xform: xform);
|
||||
_transform.AttachToGridOrMap(uid, xform);
|
||||
component.EmbeddedIntoUid = null;
|
||||
Dirty(uid, component);
|
||||
|
||||
// Reset whether the projectile has damaged anything if it successfully was removed
|
||||
if (TryComp<ProjectileComponent>(uid, out var projectile))
|
||||
@@ -127,8 +129,10 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
||||
}
|
||||
|
||||
_audio.PlayPredicted(component.Sound, uid, null);
|
||||
component.EmbeddedIntoUid = target;
|
||||
var ev = new EmbedEvent(user, target);
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
private void PreventCollision(EntityUid uid, ProjectileComponent component, ref PreventCollideEvent args)
|
||||
|
||||
Reference in New Issue
Block a user