Skip to content

Commit

Permalink
update instrumentation of evaporate -> shear off terminology, #236
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Oct 11, 2021
1 parent 6b4c327 commit 5fd9a41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions js/friction/model/FrictionModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ class FrictionModel extends PhetioObject {
this.scheduledShearingAmount = 0;

// @public (phet-io) - Instrumented so that PhET-iO clients can get a message when an atom shears off
this.shearingEmitter = new Emitter( {
tandem: tandem.createTandem( 'shearingEmitter' ),
this.shearedOffEmitter = new Emitter( {
tandem: tandem.createTandem( 'shearedOffEmitter' ),
phetioDocumentation: 'Emits when atoms shear off from the top book',
phetioReadOnly: true
} );
Expand Down Expand Up @@ -220,7 +220,8 @@ class FrictionModel extends PhetioObject {

// @public (read-only) {NumberProperty} - number of rows of atoms available to shear off, goes down as book wears away
this.atomRowsToShearOffProperty = new NumberProperty( TOP_BOOK_ATOM_STRUCTURE.length - 1, {
tandem: tandem.createTandem( 'atomRowsToShearOffProperty' )
tandem: tandem.createTandem( 'atomRowsToShearOffProperty' ),
phetioReadOnly: true
} );

// @private - are books in contact?
Expand Down Expand Up @@ -248,7 +249,7 @@ class FrictionModel extends PhetioObject {
// {number} the count of how many atoms have been sheared off
this.numberOfAtomsShearedOff = 0;

this.shearingEmitter.addListener( () => {
this.shearedOffEmitter.addListener( () => {
this.numberOfAtomsShearedOff += 1;
} );

Expand Down Expand Up @@ -440,7 +441,7 @@ class FrictionModel extends PhetioObject {
// randomly choose an non-sheared-off atom and shear off it
const atomsToShearOff = dotRandom.sample( notYetShearedAtoms );
atomsToShearOff.shearOff();
this.shearingEmitter.emit();
this.shearedOffEmitter.emit();

// cause some cooling due to shearing
this.scheduledShearingAmount = this.scheduledShearingAmount + SHEAR_OFF_AMPLITUDE_REDUCTION;
Expand Down
2 changes: 1 addition & 1 deletion js/friction/view/FrictionScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class FrictionScreenView extends ScreenView {
rateChangesAffectPlayingSounds: false
} );
soundManager.addSoundGenerator( moleculeBreakOffSoundClip );
model.shearingEmitter.addListener( () => {
model.shearedOffEmitter.addListener( () => {

// don't play for every sheared off atom or it's too noisy
if ( model.numberOfAtomsShearedOff % 4 === 0 ) {
Expand Down

0 comments on commit 5fd9a41

Please sign in to comment.