Skip to content

Classroom co-operative building and Event Simplification

Compare
Choose a tag to compare
@walterhiggins walterhiggins released this 16 Mar 21:31
· 355 commits to master since this release

Main changes in this release...

  • Co-op building.
    Better (more co-operative - less CPU-intensive) building when multiple players are building on the same server. This should result in better use in classroom environments - no one player can DDOS the server by building something huge.
  • Simplified events handling.
    The callback function for event handling now only takes 1 single
    parameter, the event which triggered the callback. The listener object
    is bound to the callback function so within the callback function
    this refers to the listener object. Unregistering listeners has also
    been greatly simplified. You can have an event handler which fires
    only once by unregistering itself within the callback like this...
events.on('player.PlayerJoinEvent', function( event ) { 
  // do something
  event.player.sendMessage( "You're the first player to join" );

  // unregister so this function is called only once ever.
  this.unregister();
});

The events.on() function also returns the same listener object as
this refered to inside the callback. The listener object has a
single method unregister() which can be called to stop listening for
the event.