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.

SniexDejjtik commented 2 weeks ago

where did u put the code or is it still working

Drofseh commented 2 weeks ago

where did u put the code or is it still working

Put it before this line https://github.com/spencershepard/DCS-Scripts/blob/fdeda608cf06550b719800d3077b3d89de1a48cf/Splash_Damage_2_0.lua#L334

SniexDejjtik commented 2 weeks ago

THx mate ima try it im rewriting the full Splash damage with new stuff so this would be cool