Skip to content

Commit

Permalink
- do not load code automatically after login (it can be up to 6MB),
Browse files Browse the repository at this point in the history
- map tiles fix for shards > 0.
  • Loading branch information
keeshii committed Jun 25, 2019
1 parent 0e3785e commit 25603a2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
20 changes: 9 additions & 11 deletions src/components/CodePane.vue
Expand Up @@ -85,18 +85,14 @@ export default {
}
}
},
mounted() {
if (eventBus.api)
this.load();
else
this.$watch(function() { return eventBus.api }, api => {
console.log('api', api);
if (eventBus.api)
setTimeout( () => this.load(), 1000);
})
},
computed: {
code() {
if (eventBus.api && eventBus.api.modules && this.moduleNames.length === 0) {
this.modules = eventBus.api.modules;
}
if (this.moduleNames.length === 0) {
return '// The code is not loaded. Click "Load all" button.';
}
return this.modules[this.module] || '';
},
moduleNames() {
Expand All @@ -111,9 +107,10 @@ export default {
this.modules = modules;
else
this.modules = {};
eventBus.api.modules = this.modules;
if (!this.modules[this.module]) {
let files = Object.keys(this.modules);
this.module = files[0];
this.module = files.length ? files[0] : '';
}
},
add() {
Expand All @@ -132,6 +129,7 @@ export default {
return;
}
this.modules[name] = '';
this.module = name;
this.isAddVisible = false;
},
remove() {
Expand Down
18 changes: 12 additions & 6 deletions src/components/Console.vue
Expand Up @@ -5,13 +5,15 @@
<div class="console-line" v-for="line in lines" v-html="line"></div>
</div>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<div class="input-group">
<input v-model="command" class="form-control form-control-sm" />
<div class="input-group-append mr-2">
<button @click.prevent="send()" class="btn btn-sm btn-primary">Send</button>
<form>
<div class="input-group">
<input v-model="command" class="form-control form-control-sm" />
<div class="input-group-append mr-2">
<button @click.prevent="send()" class="btn btn-sm btn-primary">Send</button>
</div>
<button @click.prevent="clear()" class="btn btn-sm btn-primary">Clear</button>
</div>
<button @click.prevent="clear()" class="btn btn-sm btn-primary">Clear</button>
</div>
</form>
</nav>
</div>

Expand Down Expand Up @@ -137,4 +139,8 @@ export default {
margin: 0;
}
.console form {
width: 100%;
}
</style>
11 changes: 7 additions & 4 deletions src/components/RoomMap.vue
Expand Up @@ -60,15 +60,18 @@ export default {
if (!this.api) return "";
const {host, port, secure} = this.api.opts;
const roomName = this.api.shard
? this.api.shard + '/' + this.roomName
: this.roomName;
if (host === "screeps.com") { // official server uses a CDN
if (this.roomName.indexOf('/') > -1)
return `https://d3os7yery2usni.cloudfront.net/map/${this.roomName}.png`;
return `https://d3os7yery2usni.cloudfront.net/map3/${this.roomName}.png`;
if (roomName.indexOf('/') > -1)
return `https://d3os7yery2usni.cloudfront.net/map/${roomName}.png`;
return `https://d3os7yery2usni.cloudfront.net/map3/${roomName}.png`;
}
const proto = (secure? 'https' : 'http')
let bg = `${proto}://${host}:${port}/assets/map/${this.roomName}.png`;
let bg = `${proto}://${host}:${port}/assets/map/${roomName}.png`;
// console.log('bg ', bg);
return bg;
},
Expand Down

0 comments on commit 25603a2

Please sign in to comment.