SmartlyDressedGames / Unturned-Docs

Documentation for Unturned's modding features.
135 stars 49 forks source link

Clarification on Child_Explosion_Armor_Multiplier/Explosion behaviour #326

Open Ongjming opened 2 months ago

Ongjming commented 2 months ago

Child_Explosion_Armor_Multiplier in the 3.29.5.0 Update Notes described it as affecting only the vehicle when explosion hit any barricades on the vehicle, this led me to assuming that the barricade will take full damage.

As described in the docs however, its description led me to assume that whenever explosion hits, that particular barricade and the vehicle itself will both take the damage multiplied by this multiplier.

If explosion is 100 damage, Child_Explosion_Armor_Multiplier is 0.2 In the first case vehicle will take 20 damage no matter which barricade is hit, the barricade that is hit takes 100 damage. In the latter case both vehicle and the hit barricade will both take 20 damage.

I am leaning towards the later description.

This led to a second question for clarifying: If the explosion is huge and covers a wide diameter, does the hit (and thus damage) only register for the very first point of contact of the explosion? (Assuming the scan is done from the center of the explosion with a radius spreading out thereafter over time) Or is everything visually covered (and whatever radius is specified) by the explosion affected by the explosion?

First case: 1 barricade and vehicle get the hit, explosion doesn't penetrate. Second case: Multiple barricades that is engulfed in explosion radius will be affected, vehicle possibly only affected once.... maybe?

Also for normal bullet hits on the barricades, I have no experience of that but I am assuming only the barricades will be hit rather than the vehicle? (i.e. 100 damage from bullet goes to barricade, vehicle is safe.)

Then for passenger there is Passenger_Explosion_Armor. Do passengers get hit by explosions no matter which part of the vehicle/barricades attached to the vehicle gets hit?

Sorry if the post is redundant, from where I am coming from it might be very obvious that I don't usually pvp, hence no practical experiencing of explosives.

(Will delete if this is so, thanks!)

SDGNelson commented 2 months ago

The way it works code-wise is: If the explosion sphere overlaps the pivot of a vehicle, find the closest point on the vehicle to the explosion center, and then do a line-of-sight test from the center of the explosion to that point on the vehicle. If the test hits something attached to the vehicle, multiply the damage by both the vehicle and server config's child explosion armor multiplier, and apply damage. If the test hits anything else not attached to the vehicle it blocks the damage.