Skip to content

Allow warhead to only affect invoker#2237

Open
DeathFishAtEase wants to merge 7 commits into
Phobos-developers:developfrom
DeathFishAtEase:AffectsInvokerOnly
Open

Allow warhead to only affect invoker#2237
DeathFishAtEase wants to merge 7 commits into
Phobos-developers:developfrom
DeathFishAtEase:AffectsInvokerOnly

Conversation

@DeathFishAtEase

Copy link
Copy Markdown
Collaborator
  • In the past, modders used many methods such as Dropping and extremely small CellSpread to prevent a weapon fired by a unit from affecting others, thereby achieving complex combination logic. However, existing methods merely reduced the range of affected objects through various means. Now, you can directly use the following flag to check whether the victim is the unit itself:
    • AffectsInvokerOnly can be used to make the affected object only the unit itself.
    • AffectsInvokerOnly.Reverse can be used to exclude the unit from the affected objects.
    • AffectsInvokerOnly.IgnoreInvokerState can be used to determine whether to consistently avoid affecting other objects regardless of the unit's state.
[CombatDamage]
AffectsInvokerOnly.IgnoreInvokerState=true  ; boolean

[SOMEWARHEAD]                               ; WarheadType
AffectsInvokerOnly=false                    ; boolean
AffectsInvokerOnly.Reverse=false            ; boolean
AffectsInvokerOnly.IgnoreInvokerState=      ; boolean, default to [CombatDamage] -> AffectsInvokerOnly.IgnoreInvokerState

Tip

If you have enabled ApplyPerTargetEffectsOnDetonate to make affects handling completely follow damage propagation, then most of the time you can just use DamageSelf and AllowDamageOnSelf without needing AffectsInvokerOnly.Reverse.

@DeathFishAtEase DeathFishAtEase self-assigned this Jun 2, 2026
@DeathFishAtEase DeathFishAtEase added Needs testing ⚙️T1 T1 maintainer review is sufficient No Documentation Needed No documentation needed whatsoever labels Jun 2, 2026
@phoboscn-bot

Copy link
Copy Markdown

To Chinese users:
This pull request has been mentioned on Phobos CN. There might be relevant details there:

致中文用户:
此拉取请求已在 Phobos CN 上被提及。那里可能有相关详细信息:

https://www.phoboscn.top/t/topic/541/1

@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Otamaa

Otamaa commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Just an reminder , if you do keep old invoker pointer always make sure that is really valid invoker , because in the middle of damaging/detonating state the invoker itself may get killed or deleted and need to be cleanup , if you keep it like this that mean you will potentially referencing an dangling pointer.

@TaranDahl

Copy link
Copy Markdown
Contributor

Just an reminder , if you do keep old invoker pointer always make sure that is really valid invoker , because in the middle of damaging/detonating state the invoker itself may get killed or deleted and need to be cleanup , if you keep it like this that mean you will potentially referencing an dangling pointer.

From my understanding, this step is unnecessary.
IIRC UnInit will be invoked when an entity dies from damage. It marks the entity with IsAlive=false and adds it to the pending deletion list instead of deleting it immediately. All such entities will be cleaned up collectively at the end of the frame.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs testing No Documentation Needed No documentation needed whatsoever ⚙️T1 T1 maintainer review is sufficient

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants