Procedure of plugins and event sheet in each tick

  1. pretick() in plugins
  2. tick() in behaviors
  3. posttick() in behaviors
  4. tick() in plugins
  5. "condition: every tick" in event sheet
  6. tick2() in behaviors
  7. tick2() in plugins
  8. draw() in engine 

Reference: preview.js, line 2416, function "logic".

Get behavior instance

function GetThisBehavior(inst)
{
    var i, len;
    for (i = 0, len = inst.behavior_insts.length; i < len; i++)
    {
        if (inst.behavior_insts[i] instanceof behaviorProto.Instance)
            return inst.behavior_insts[i];
    }
        return null;
};

See the official DragnDrop behavior.
"behaviorProto" could be changed to specific behavior.

timescale of object

To get dt of instance, use
var dt = this.runtime.getDt(inst);

But only plugin which has "type" to "world" would have my_timescale property. So my_timescale need to be added manually for other case.
For example:
this.my_timescale = -1