Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CompAmmo back to Verb_LaunchProjectileCE #3580

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class Verb_LaunchProjectileCE : Verb
protected float distance = 10f;

public CompCharges compCharges = null;
public CompAmmoUser compAmmo = null;

public CompFireModes compFireModes = null;
public CompChangeableProjectile compChangeable = null;
Expand Down Expand Up @@ -139,6 +140,8 @@ public float ShootingAccuracy
public float SightsEfficiency => EquipmentSource?.GetStatValue(CE_StatDefOf.SightsEfficiency) ?? 1f;
public virtual float SwayAmplitude => Mathf.Max(0, (4.5f - ShootingAccuracy) * (EquipmentSource?.GetStatValue(CE_StatDefOf.SwayFactor) ?? 1f));

public virtual CompAmmoUser CompAmmo => compAmmo ??= EquipmentSource?.TryGetComp<CompAmmoUser>();

public virtual ThingDef Projectile
{
get
Expand Down
11 changes: 1 addition & 10 deletions Source/CombatExtended/CombatExtended/Verbs/Verb_ShootCE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public class Verb_ShootCE : Verb_LaunchProjectileCE

public Vector3 drawPos;

private CompAmmoUser compAmmo;

#endregion

#region Properties
Expand Down Expand Up @@ -128,14 +126,7 @@ public float AimAngle
// Whether our shooter is currently under suppressive fire
private bool IsSuppressed => ShooterPawn?.TryGetComp<CompSuppressable>()?.isSuppressed ?? false;

public CompAmmoUser CompAmmo
{
get
{
compAmmo ??= EquipmentSource?.TryGetComp<CompAmmoUser>();
return compAmmo;
}
}
public override CompAmmoUser CompAmmo => base.CompAmmo;

public override ThingDef Projectile => CompAmmo?.CurrentAmmo != null ? CompAmmo.CurAmmoProjectile : base.Projectile;

Expand Down
Loading