File tree Expand file tree Collapse file tree
assets/media/entity/objects Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -201,23 +201,37 @@ export default class MwRandomizer {
201201 return ;
202202 }
203203
204+ if ( ! sc . multiworld . locationInfo ) {
205+ return ;
206+ }
207+
208+ const keyLayer = this . animSheet . anims . idleKey . animations [ 1 ] ;
209+ const masterKeyLayer = this . animSheet . anims . idleMasterKey . animations [ 1 ] ;
210+ let layerToAdd = null ;
211+
204212 let newOffY = 0 ;
205213 let flags = sc . multiworld . locationInfo [ this . check . mwids [ 0 ] ] . flags ;
206214 if ( flags & ( ap . ITEM_FLAGS . NEVER_EXCLUDE | ap . ITEM_FLAGS . TRAP ) ) {
207215 // USEFUL and TRAP items get a blue chest
208216 newOffY = 80 ;
217+ layerToAdd = keyLayer ;
218+
209219 } else if ( flags & ap . ITEM_FLAGS . PROGRESSION ) {
210220 // PROGRESSION items get a green chest
211221 newOffY = 136 ;
222+ layerToAdd = masterKeyLayer ;
212223 }
213224
214225 if ( newOffY == 0 ) {
215226 return ;
216227 }
217228
218229 for ( const name of Object . keys ( this . animSheet . anims ) ) {
230+ let animations = this . animSheet . anims [ name ] . animations ;
231+
219232 if ( name . startsWith ( "idle" ) ) {
220- this . animSheet . anims [ name ] . animations [ 0 ] . sheet . offY = newOffY ;
233+ animations [ 0 ] . sheet . offY = newOffY ;
234+ layerToAdd && animations . splice ( 1 , 0 , layerToAdd ) ;
221235 }
222236 if ( name == "open" || name == "end" ) {
223237 this . animSheet . anims [ name ] . animations [ 0 ] . sheet . offY = newOffY + 24 ;
You can’t perform that action at this time.
0 commit comments