Added events in scripting. The events are fired when something like an entity touches another entity happens. To setup the event one sets a special attribute for an entity with the code for the handler. The engine will automatically setup a flag in the entity's structure to call the event code in the right time and ignore (not try to call code for) entities which do not have events set up. The code for the above behavior is
set-entity-attribute $ent motion-hit-ground "
print $ent hits the ground...
"
set-entity-attribute $ent motion-touch "
print $ent touches \$other-entity
"
set-entity-attribute $ent motion-touched "
print $ent was touched by \$other-entity
"
Ещё видео!