Skip to content

Trench height#4436

Open
Keshash wants to merge 8 commits intoDevelopmentfrom
Trenches
Open

Trench height#4436
Keshash wants to merge 8 commits intoDevelopmentfrom
Trenches

Conversation

@Keshash
Copy link
Contributor

@Keshash Keshash commented Jan 24, 2026

Additions

Describe new functionality added by your code, e.g.

  • adds a mod extension to manage height offsets of buildings that pawns stand on.
  • gives pawns on water terrain a height offset. -0.75 height (not meters) on impassable water, -0.5 on passable.
  • todo : make explosion damage get reduced by height offsets if explosion center is not in a trench (In a separate PR)

Changes

Describe adjustments to existing features made in this merge, e.g.

  • makes pawn height (bottom edge and top edge) never be lower that 0, which fixes pawns shooting too low if they are both in trench. Previous implementation had a bug, where legs were below 0, so pawns aiming at legs were stuck shooting at ground.
  • Makes lower and middle body parts impossible to hit with a bullet, if they are fully below ground

References

Links to the associated issues or other related pull requests, e.g.

Reasoning

Why did you choose to implement things this way, e.g.

  • Pawns in the same trench are now able to hit each other. This solution is not perfect, as it leaves both pawns with very small hitboxes. Which means that pawns in the same trench have lower hit chances than they should. However, distances are low in this situation, so it still works, better than before.
  • Gives raider moving through water a tiny bit of cover. Their ai isn't designed to attack from map edges covered in water, so they just go forth and die without any cover. Water slowing down bullets makes sense and should help AI at least a little. Plus taking cover in a swamp sounds fun.

Use cases for this addition:

  • Allows implementing trenches and raised platforms without VE dependency. (But pathing costs still needs to be handled, so rn its better if we only make foxholes, not connected trenches)
  • Allows turning 1.6 craters into trenches
  • allows submerging pawns into buildings such as turrets

Alternatives

Describe alternative implementations you have considered, e.g.

  • ...

Testing

Use this for testing on small craters:

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="CraterSmall"]</xpath>
		<value>
			<fillPercent>0.01</fillPercent> <!-- needed to be considered cover by AI -->
			<passability>Standable</passability>  <!-- craters were pass-only -->
		</value>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[defName="CraterSmall"]</xpath>
		<value>
			<li Class="CombatExtended.ModExtensionCover">
				<heightOffset>-0.98</heightOffset>  <!-- eyeballed value-->
			</li>
		</value>
	</Operation>

Check tests you have performed:

  • Compiles without warnings
  • Game runs without errors
  • (For compatibility patches) ...with and without patched mod loaded
  • Playtested a colony (specify how long)

@Keshash
Copy link
Contributor Author

Keshash commented Jan 24, 2026

I uploaded this PR as a draft, despite already having another draft, so that code doesn't get lost. My area has severe problems with power blackouts, so it may take a while to finish this.

@github-actions
Copy link

github-actions bot commented Feb 1, 2026

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-21553034152.zip

@github-actions github-actions bot added the Download in Comments This PR has a zipfile download available. label Feb 1, 2026
@github-actions
Copy link

github-actions bot commented Feb 1, 2026

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-21553044100.zip

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-21676133745.zip

@Keshash Keshash marked this pull request as ready for review February 4, 2026 14:53
@Keshash Keshash requested review from a team as code owners February 4, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Download in Comments This PR has a zipfile download available.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Trenches and Platforms from VFE - Security are broken

2 participants