Repository navigation
Conversation
Runs after resolved damage has been applied to a ship (lethal hits run before the destruction callback). Hook variables: Target, Source, Attacker, WeaponClass, WeaponSubtype, SourceKind (PROJECTILE, BEAM, SHOCKWAVE, COLLISION, OTHER), DamageType, ShieldDamage, HullDamage, Quadrant, Ballistic, BeamWeapon and LethalHit. Conditions can filter on the target ship. Nothing is computed unless a script has registered the hook.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #7874.
Adds
On Ship Damage, called after resolved damage has been applied to a ship. It reports what the ship actually lost, after shields, armor and difficulty scaling, which the existing collision hooks (called before damage is resolved) cannot. Lethal hits run before the ship's death processing.Hook variables:
Target,Source(nil if none),Attacker(the firing ship or parent, nil if none),WeaponClass,WeaponSubtype,SourceKind(PROJECTILE,BEAM,SHOCKWAVE,COLLISION,OTHER),DamageType,ShieldDamage,HullDamage,Quadrant,Ballistic,BeamWeapon,LethalHit. Conditions can filter on the target ship.Use case: balancing scripted missions and mods (e.g. tuning how much damage a given beam or turret does to a base) from logged traces rather than by eye.
Cost when unused: one
isActive()check per damage event; nothing else is computed unless a script registers the hook.For review:
WeaponClassis passed as the class name string (NON_WEAPONwhen there is none). If a weaponclass handle is preferred, that is easy to change before this is merged.Testing: a 240-second retail mission with a script tallying the hook: 324 events, 5 lethal, none with zero damage or an invalid target. A no-source explosion (
explosion-effectwith no shockwave) arrives withSource == nil(in #7874's version it was an invalid handle). Builds alone on this branch.