So basically this is a horizontally borrowed feature from another 199x game called Radix (just because I occasionally poked at the map format of Radix and realized we can have it here as well).
In the original engine, the point is that wall has some hitpoints, you can shoot at the wall and once hitpoints reach 0 some scriptable trigger is executed.
Automated glass breaking by explosive effects (without having scripted actors)
DN3D-like forcefield effects (since this actually returns information in the form of "wall X was damaged at X/Y/Z")
Script effects based on any shooting at specific parts of sector linedefs or even sector floor, with numbers (i.e. count of damage, damage type...)
Ideally, once ZScript part is implemented, it should be straightforward to script it in a way that the user only needs to put a specific texture (e.g. lamp or glass) that will do some actions once destroyed (spawn effects, change textures, flags) — with everything else managed from events.
Changes to UDMF entities:
- damagespecial (flag)
- deathspecial (flag)
- GetLineHealth — returns health for either first line by id, or health group's health if it's set
- GetSectorHealth — returns health for either first sector by tag+part(floor/ceiling), or health group's health if it's set
The "health3d" field in the sector is expected to be used in 3D floor control sectors for convenience (along with SECPART_3D and separate trigger things for this).
About health groups:
"Health group" is an object that synchronizes health for all participating geometry (lines and sectors).
This is so that you can have a single visual object composed of multiple sectors/linedefs that will receive damage synchronously.
Any damage-related specials (either by line activation or sector actions) will be called for each of the participating objects.
About logic of receiving damage:
With ACS and line/thing actions, it's simple: hitscans and projectiles inflict damage directly, radius damage inflicts radius damage based on closest part of sector (or closest part of damage group) that's not blocked.
Specials will be executed either on each damage or when health of object is zero (i.e. it dies), depending on which trigger is used (there are two kinds of line activation flags and sector triggers).
With ZScript, I'm planning to make an event that should provide all the detailed information on who hit which object and how, and provide a way to modify received damage in the event callback.
- ZScript interface planned but not implemented
- Portals are not supported for radius damage (p_map.cpp:P_GeometryRadiusAttack) because the logic is complex enough even without portals
- Radius damage is kinda weird with slopes
ACS_ExecuteWithResult combined with health groups is going to return weird values for GetHealthresolved
- Behavior of shooting at portals/skyboxes/other weird line/sector types is undefined (suggestions?)
3D floors not yet implemented — planned as sector triggers in the control sector (with health also taken from the control sector)resolved
Build for testing if anyone is interested: https://www.mediafire.com/file/zblzrcfc ... y.zip/file
PR for GZDoom: https://github.com/coelckers/gzdoom/pull/611
PR for ACC: https://github.com/rheit/acc/pull/74
Example wad (only works with destructiblegeometry branch or build above):
http://www.mediafire.com/file/nahkay69e ... t.wad/file