Skip to content

Commit

Permalink
Introduce core_99_startup.js
Browse files Browse the repository at this point in the history
Its main job is to call $.system.onStartup(), but it also move a few demo objects to $.startRoom.
  • Loading branch information
cpcallen committed Jun 15, 2020
1 parent 7c8973f commit 11d884a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bin/dump-core
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ mkdir -p var/dump

# Make way for dump. Ignore errors.
rm var/dump/*.js || true
rm core/core_[1-9]*.js || true
rm core/core_[1-8]*.js || true
rm database/core_*.js || true
rm database/db_*.js || true

# Get last .city file.
city=$( (cd database && ls -1 *.city |tail -1) )
city=$( (cd database && ls -1 *.city |sort |tail -1) )

# Run dump.
server/dump "database/${city}" core/dump_spec.json core

# Link core file into database.
(cd database && ln -s ../core/core*.js .)
# Link core file into database, except core_99_startup.js
(cd database && ln -s ../core/core_[0-8]*.js .)
32 changes: 32 additions & 0 deletions core/core_99_startup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @fileoverview Start core database. Note that, unlike most of the
* rest of the files in the core/ directory, this is hand-written.
*
* It assumed this file will be used when starting a full database
* dump; for that, a file in database/, generated by dump, will
* restart listeners intead.
*/

$.system.onStartup();
$.tutorial.moveTo($.startRoom);
$.pot.moveTo($.startRoom);
$.seed.moveTo($.startRoom);
$.thrower.moveTo($.startRoom);
$.assistant.moveTo($.startRoom);

0 comments on commit 11d884a

Please sign in to comment.