Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.public.beforeUnloadChunk = function beforeUnloadChunk (cx, cy) {
- var chunkBeingLoaded = (this.public.requestChunkCallbackList[chunkX] && this.public.requestChunkCallbackList[chunkX][chunkY]) ||
- (this.background.requestChunkCallbackList[chunkX] && this.background.requestChunkCallbackList[chunkX][chunkY])
- var publicCanBeUnloaded = this.public.canBeUnloaded(cx, cy) || (this.public.chunks[cx] && this.public.chunks[cx][cy] == "empty");
- var backgroundCanBeUnloaded = this.background.canBeUnloaded(cx, cy) || (this.background.chunks[cx] && this.background.chunks[cx][cy] == "empty");
- if( !chunkBeingLoaded && (publicCanBeUnloaded || backgroundCanBeUnloaded) ) {
- console.log("Unloading chunk", cx, cy);
- if(publicCanBeUnloaded){
- this.background.chunks[cx][cy] = null;
- delete this.background.chunks[cx][cy];
- }
- if(backgroundCanBeUnloaded){
- this.public.chunks[cx][cy] = null;
- delete this.public.chunks[cx][cy];
- }
- return true;
- }
- return false;
- }.bind(this);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement