Skip to content

Commit

Permalink
Move CompAmmo back to Verb_LaunchProjectileCE
Browse files Browse the repository at this point in the history
Some mods such as Bill Doors' Plasma Weapons will need a recompile
before being able to use the new property.
  • Loading branch information
mszabo-wikia committed Dec 3, 2024
1 parent 6f70974 commit a825857
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
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

0 comments on commit a825857

Please sign in to comment.