Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: aura is now displayed correctly #501

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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