Skip to content

Commit

Permalink
Merge pull request #501 from alisonrag/bugfix/fix-aura-display
Browse files Browse the repository at this point in the history
fix: aura is now displayed correctly
  • Loading branch information
MrAntares authored Jan 8, 2025
2 parents 8d030d1 + 0d288e9 commit 07e396b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/Renderer/Entity/EntityAura.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function(EffectConst, MapPreferences)
{
this.isLoaded = false; // to avoid duplicate aura effects
this.entity = entity; // reference to attached entity
this.lastAuraState = 0; // save last aura state to track changes on aura/aura2 command
}

/**
Expand All @@ -43,8 +44,11 @@ function(EffectConst, MapPreferences)
if( MapPreferences.aura > 0 && this.entity.clevel >= 99) {
// check if entity is visible
if(this.entity.isVisible()) {
// aura is already loaded
// check if aura state has changed
if(this.lastAuraState !== MapPreferences.aura && this.isLoaded)
this.remove( effectManager );
if(!this.isLoaded) {
// aura is already loaded
// select effects based on /aura preference
var effects = MapPreferences.aura < 2 ? simpleEffects : normalEffects;
// add aura effects
Expand All @@ -54,14 +58,21 @@ function(EffectConst, MapPreferences)
position: this.entity.position,
effectId: effects[effectIndex]
} );
}
// set flag to avoid duplicate aura effects
this.isLoaded = true;
}
// set flag to avoid duplicate aura effects
this.isLoaded = true;
// save current aura state
this.lastAuraState = MapPreferences.aura;
}
} else {
// remove aura if entity is invisible
this.remove( effectManager );
}
} else if (this.isLoaded) {
// remove aura if entity does not qualify
this.remove( effectManager );
// save current aura state
this.lastAuraState = MapPreferences.aura;
}
};

Expand Down
2 changes: 2 additions & 0 deletions src/Renderer/Entity/EntityRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ define( function( require )
var Altitude = require('Renderer/Map/Altitude');
var Session = require('Engine/SessionStorage');
var JobId = require('DB/Jobs/JobConst');
var getModule = require;


var _last_body_dir = 0;
Expand Down Expand Up @@ -324,6 +325,7 @@ define( function( require )
if (this.shield > 0 && !behind) {
renderElement( this, this.files.shield, 'shield', _position, true );
}
this.aura.load(getModule('Renderer/EffectManager'));
}
};
}();
Expand Down

0 comments on commit 07e396b

Please sign in to comment.