spencershepard / DCS-Scripts

A small collection of scripts for DCS
MIT License
12 stars 6 forks source link

Scale explosions by surfaceType #10

Open Drofseh opened 1 year ago

Drofseh commented 1 year ago

A bomb that lands on land should do a different amount of damage to nearby objects compared to a bomb landing on a road or in water.

land.SurfaceType returns the following integers:

  LAND             1
  SHALLOW_WATER    2
  WATER            3 
  ROAD             4
  RUNWAY           5

I've been playing with this using the following code:

local surfaceType = land.getSurfaceType(impactPoint)
if surfaceType = 1 then
    surfaceType = 1.25
elseif surfaceType > 3 then
    surfaceType = 1
end

explosive = explosive / surfaceType

I'm not 100% sure if a water impact should do more or less damage. The explosion itself won't go as far, but the incompressibility of water transfers pressure to waterborne objects very effectively. The code I posted will make it do less damage.