[1.1.110] on_trigger_created_entity not raised by create-smoke and create-explosion
Posted: Sun Sep 22, 2024 11:58 am
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:
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.
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:
- 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.
- 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.
- Shoot each type of shotgun shell in the player's inventory at least once.
- 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.
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.