DCurrent / openbor

OpenBOR is the ultimate 2D side scrolling engine for beat em' ups, shooters, and more!
http://www.chronocrash.com
BSD 3-Clause "New" or "Revised" License
901 stars 121 forks source link

Animation Event OnCreate #258

Open DCurrent opened 2 years ago

DCurrent commented 2 years ago

Description

Animation scripts fire oncreate() event on every frame.

Debugging

Reproduce

  1. Add an animation script to any model text.
  2. Add an oncreate() function with a debug trace (ex: log("\n Hello world!");).
  3. Load the module and play level with entity spawned from model.
  4. Oncreate() fires on each frame along with main().

Expected behavior

Oncreate() should only fire during initial creation of script (i.e. spawning entity).

Version

Unknown. Anecdotally this bug has existed for several years and may have been present since addition of oncreate().

DCurrent commented 7 months ago

Bug remains, and frankly I haven't a clue what to do about it. Nothing in the script parser stands out. My guess is it has something to do with animation scripts assembling a main() instead of having user defined main(), but tracing through uTunnel's logic is like finding a needle in a stack of needles blindfolded.