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

generic projectile label override #3378

Merged
merged 3 commits into from
Sep 8, 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
1 change: 1 addition & 0 deletions Defs/Ammo/Pistols/45ACP.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
<dropsCasings>true</dropsCasings>
<casingMoteDefname>Fleck_PistolAmmoCasings</casingMoteDefname>
<casingFilthDefname>Filth_PistolAmmoCasings</casingFilthDefname>
<genericLabelOverride>pistol</genericLabelOverride>
</projectile>
</ThingDef>

Expand Down
3 changes: 2 additions & 1 deletion Languages/English/Keyed/Keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@
<!-- Ranged Attack -->
<CE_OutOfBounds>Out of bounds</CE_OutOfBounds>
<CE_NoSelfTarget>Can't target self</CE_NoSelfTarget>
<CE_NoLoS>No line of sight</CE_NoLoS>
<CE_NoLoS>No line of sight</CE_NoLoS>
<CE_BlockedRoof>Blocked by roof</CE_BlockedRoof>
<CE_BlockedShield>Shooting disallowed by </CE_BlockedShield>
<CE_BlockedMaxRange>Outside of range</CE_BlockedMaxRange>
<CE_BlockedMinRange>Within minimum range</CE_BlockedMinRange>
<CE_GenericBullet>bullet</CE_GenericBullet>

<!-- Artillery -->
<CE_ArtilleryTarget_Distance>Distance: {0}/{1} Tiles</CE_ArtilleryTarget_Distance>
Expand Down
3 changes: 2 additions & 1 deletion Source/CombatExtended/CombatExtended/AmmoGeneralizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ static AmmoGeneralizer()
var sameClass = ammoSource.ammoTypes.Find(x => x.ammo.ammoClass == link.ammo.ammoClass);
if (sameClass != null)
{
link.projectile.label = ammoSource.label + " bullet " + "(" + link.ammo.ammoClass.labelShort + ")";
string labelNew = (link.projectile.projectile is ProjectilePropertiesCE projPropCE && projPropCE.genericLabelOverride != null) ? projPropCE.genericLabelOverride : ammoSource.label;
link.projectile.label = labelNew + " " + "CE_GenericBullet".Translate() + " (" + link.ammo.ammoClass.labelShort + ")";
newAmmos.Add(new AmmoLink { ammo = sameClass.ammo, projectile = link.projectile });
}

Expand Down
1 change: 1 addition & 0 deletions Source/CombatExtended/CombatExtended/Defs/AmmoDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public List<AmmoSetDef> AmmoSetDefs
}
}

[NoTranslate]
private string oldDescription;
public void AddDescriptionParts()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public class ProjectilePropertiesCE : ProjectileProperties
public ThingDef detonateMoteDef;
public FleckDef detonateFleckDef;
public float detonateEffectsScaleOverride = -1;
[MustTranslate]
public string genericLabelOverride = null;

#region Bunker Buster fields
/// <summary>
Expand Down
Loading