Page 1 of 1

[1.1.110] on_trigger_created_entity not raised by create-smoke and create-explosion

Posted: Sun Sep 22, 2024 11:58 am
by k2aj
Caught this while trying to code a custom ammo which spawned poison clouds (I was trying to use on_trigger_created_entity to do something with the spawned poison cloud after it was was created).

CreateEntityTriggerEffectItem has a field called trigger_created_entity. According to modding API documentation, if this is set to true on_trigger_created_entity will be raised when the entity is created.

The bug: this only works for CreateEntityTriggerEffectItem and CreateFireTriggerEffectItem. CreateSmokeTriggerEffectItem and CreateExplosionTriggerEffectItem don't raise the event, even though they inherit from CreateEntityTriggerEffectItem.

Steps to reproduce:
  1. Install the attached mod (trigger-created-entity-bug-report_0.1.0.zip)
    • The mod registers a listener for on_trigger_created_entity which prints a global chat message when that event is raised.
  2. Load the attached save file (trigger-created-entity-bugreport-save.zip)
    • The player starts with 4 types of custom shotgun shells in their inventory.
    • Each shotgun shell when fired will create an entity at target position using CreateEntityTriggerEffectItem / CreateFireTriggerEffectItem / etc. with trigger_created_entity set to true (the shotgun shell name tells which TriggerEffectItem is used). This should cause a message to be printed in the chat due to the aforementioned event listener.
  3. Shoot each type of shotgun shell in the player's inventory at least once.
Observed behavior:
  • CreateEntityTriggerEffectItem and CreateFireTriggerEffectItem shotgun shells cause a message to be printed in chat when fired.
  • CreateSmokeTriggerEffectItem and CreateExplosionTriggerEffectItem shotgun shells do not cause a message to be printed in chat when fired.
Expected behavior:
All custom shotgun shells added by the mod cause a message to be printed in chat when fired.

Note:
In most cases this bug is easy to work around by replacing the use of CreateSmokeTriggerEffectItem / CreateExplosionTriggerEffectItem with CreateEntityTriggerEffectItem. However, this workaround is not obvious, and if someone isn't aware of the bug finding the workaround can take a significant amount of time (speaking from personal experience).

If this is intended behavior / too niche to fix, a note warning about this behavior in the documentation of CreateSmokeTriggerEffectItem / CreateExplosionTriggerEffectItem would be appreciated.

Re: [1.1.110] on_trigger_created_entity not raised by create-smoke and create-explosion

Posted: Thu Oct 10, 2024 4:36 pm
by Rseding91
Technically, create-smoke and create-explosion are different triggers which do not include the "trigger_created_entity" logic.