diff --git a/bin/dump-core b/bin/dump-core index 885a99b6..be8375ac 100755 --- a/bin/dump-core +++ b/bin/dump-core @@ -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 .) diff --git a/core/core_99_startup.js b/core/core_99_startup.js new file mode 100644 index 00000000..b9b3a2c0 --- /dev/null +++ b/core/core_99_startup.js @@ -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);