mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-03-21 17:25:10 -05:00
Move server code to server/
Also move mods/ to data/mods/ This makes PS more monorepo-like. The intent is to further separate the sim and the server code, but without fully committing to splitting the repository itself. We now support `./pokemon-showdown start` in addition to `./pokemon-showdown`. I'm not clear which I want to be the default yet.
This commit is contained in:
parent
6ed758381f
commit
f3e45fbb72
|
|
@ -1,4 +1,4 @@
|
|||
tournaments/lib/
|
||||
server/tournaments/lib/
|
||||
logs/
|
||||
dev-tools/globals.js
|
||||
node_modules/
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ Some even older code returns `T | false`. This is a very old PHP convention that
|
|||
|
||||
### `false | null | undefined`
|
||||
|
||||
The simulator (code in `sim/`, `data/`, and `mods/`) will often have functions with return signatures of the form `T | false | null | undefined`, especially in event handlers. These aren't optionals, they're different sentinel values.
|
||||
The simulator (code in `sim/` and `data/`) will often have functions with return signatures of the form `T | false | null | undefined`, especially in event handlers. These aren't optionals, they're different sentinel values.
|
||||
|
||||
Specifically:
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class RandomGen3Teams extends RandomGen4Teams {
|
|||
template = this.getTemplate('unown');
|
||||
|
||||
let err = new Error('Template incompatible with random battles: ' + species);
|
||||
require('../../lib/crashlogger')(err, 'The gen 3 randbat set generator');
|
||||
require('../../../lib/crashlogger')(err, 'The gen 3 randbat set generator');
|
||||
}
|
||||
|
||||
if (template.battleOnly) species = template.baseSpecies;
|
||||
|
|
@ -18,7 +18,7 @@ class RandomGen4Teams extends RandomGen5Teams {
|
|||
template = this.getTemplate('unown');
|
||||
|
||||
let err = new Error('Template incompatible with random battles: ' + species);
|
||||
require('../../lib/crashlogger')(err, 'The gen 4 randbat set generator');
|
||||
require('../../../lib/crashlogger')(err, 'The gen 4 randbat set generator');
|
||||
}
|
||||
|
||||
if (template.battleOnly) species = template.baseSpecies;
|
||||
|
|
@ -19,7 +19,7 @@ class RandomGen5Teams extends RandomGen6Teams {
|
|||
template = this.getTemplate('unown');
|
||||
|
||||
let err = new Error('Template incompatible with random battles: ' + species);
|
||||
require('../../lib/crashlogger')(err, 'The gen 5 randbat set generator');
|
||||
require('../../../lib/crashlogger')(err, 'The gen 5 randbat set generator');
|
||||
}
|
||||
|
||||
if (template.battleOnly) {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const RandomTeams = require('../../data/random-teams');
|
||||
const RandomTeams = require('../../random-teams');
|
||||
|
||||
class RandomGen6Teams extends RandomTeams {
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@ class RandomGen6Teams extends RandomTeams {
|
|||
template = this.getTemplate('unown');
|
||||
|
||||
let err = new Error('Template incompatible with random battles: ' + species);
|
||||
require('../../lib/crashlogger')(err, 'The gen 6 randbat set generator');
|
||||
require('../../../lib/crashlogger')(err, 'The gen 6 randbat set generator');
|
||||
}
|
||||
|
||||
if (template.battleOnly) {
|
||||
|
|
@ -1047,7 +1047,7 @@ class RandomGen6Teams extends RandomTeams {
|
|||
|
||||
let pokemonPool = Object.keys(this.randomFactorySets[chosenTier]);
|
||||
|
||||
/**@type {import('./../../data/random-teams').TeamData} */
|
||||
/**@type {import('../../random-teams').TeamData} */
|
||||
let teamData = {typeCount: {}, typeComboCount: {}, baseFormes: {}, megaCount: 0, has: {}, forceResult: forceResult, weaknesses: {}, resistances: {}};
|
||||
let requiredMoveFamilies = ['hazardSet', 'hazardClear'];
|
||||
/**@type {{[k: string]: string}} */
|
||||
|
|
@ -39,7 +39,7 @@ Recent changes
|
|||
|
||||
A changelog for NEXT is available here:
|
||||
|
||||
https://github.com/Zarel/Pokemon-Showdown/commits/master/mods/gennext
|
||||
https://github.com/Zarel/Pokemon-Showdown/commits/master/data/mods/gennext
|
||||
|
||||
Changes
|
||||
------------------------------------------------------------------------
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const RandomTeams = require('../../data/random-teams');
|
||||
const RandomTeams = require('../../random-teams');
|
||||
|
||||
class RandomLetsGoTeams extends RandomTeams {
|
||||
/**
|
||||
|
|
@ -17,7 +17,7 @@ class RandomLetsGoTeams extends RandomTeams {
|
|||
template = this.getTemplate('bulbasaur');
|
||||
|
||||
let err = new Error('Template incompatible with random battles: ' + species);
|
||||
require('../../lib/crashlogger')(err, 'The Let\'s Go randbat set generator');
|
||||
require('../../../lib/crashlogger')(err, 'The Let\'s Go randbat set generator');
|
||||
}
|
||||
|
||||
if (template.battleOnly) {
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Used for bumbadadabum and Snaquaza's move
|
||||
const RandomStaffBrosTeams = require('./random-teams');
|
||||
const Pokemon = require('../../sim/pokemon');
|
||||
const Pokemon = require('../../../sim/pokemon');
|
||||
|
||||
/** @type {{[k: string]: ModdedMoveData}} */
|
||||
let BattleMovedex = {
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* @property {boolean=} shiny
|
||||
*/
|
||||
|
||||
const RandomTeams = require('../../data/random-teams');
|
||||
const RandomTeams = require('../../random-teams');
|
||||
|
||||
class RandomStaffBrosTeams extends RandomTeams {
|
||||
randomStaffBrosTeam() {
|
||||
19
dev-tools/global.d.ts
vendored
19
dev-tools/global.d.ts
vendored
|
|
@ -1,3 +1,5 @@
|
|||
import child_process = require('child_process');
|
||||
|
||||
import BattleType = require('./../sim/battle');
|
||||
import BattleStreamType = require('./../sim/battle-stream');
|
||||
import DataType = require('./../sim/dex-data');
|
||||
|
|
@ -7,15 +9,16 @@ import PokemonType = require('./../sim/pokemon');
|
|||
import PRNGType = require('./../sim/prng');
|
||||
import SideType = require('./../sim/side');
|
||||
import TeamValidatorType = require('./../sim/team-validator');
|
||||
import RoomsType = require('./../rooms');
|
||||
import RoomlogsType = require('./../roomlogs');
|
||||
import LadderStoreType = require('./../ladders-remote');
|
||||
import LaddersType = require('./../ladders');
|
||||
import UsersType = require('./../users');
|
||||
import PunishmentsType = require('./../punishments');
|
||||
|
||||
import RoomsType = require('./../server/rooms');
|
||||
import RoomlogsType = require('./../server/roomlogs');
|
||||
import LadderStoreType = require('./../server/ladders-remote');
|
||||
import LaddersType = require('./../server/ladders');
|
||||
import UsersType = require('./../server/users');
|
||||
import PunishmentsType = require('./../server/punishments');
|
||||
import ChatType = require('./../server/chat');
|
||||
|
||||
import StreamsType = require('./../lib/streams');
|
||||
import child_process = require('child_process');
|
||||
import ChatType = require('./../chat');
|
||||
|
||||
declare global {
|
||||
// modules
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@ type ModdedDex = typeof import('./../sim/dex')
|
|||
type Pokemon = import('./../sim/pokemon')
|
||||
type Side = import('./../sim/side')
|
||||
type Validator = ReturnType<typeof import('./../sim/team-validator')>
|
||||
type PageTable = import('./../chat').PageTable
|
||||
type ChatCommands = import('./../chat').ChatCommands
|
||||
type ChatFilter = import('./../chat').ChatFilter
|
||||
type NameFilter = import('./../chat').NameFilter
|
||||
|
||||
type PageTable = import('./../server/chat').PageTable
|
||||
type ChatCommands = import('./../server/chat').ChatCommands
|
||||
type ChatFilter = import('./../server/chat').ChatFilter
|
||||
type NameFilter = import('./../server/chat').NameFilter
|
||||
|
||||
interface AnyObject {[k: string]: any}
|
||||
type DexTable<T> = {[key: string]: T}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
"node": ">=7.7.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node pokemon-showdown",
|
||||
"start": "node pokemon-showdown start",
|
||||
"test": "eslint --cache . && tsc && mocha",
|
||||
"tsc": "tsc",
|
||||
"lint": "eslint --cache ."
|
||||
|
|
|
|||
|
|
@ -54,18 +54,14 @@ try {
|
|||
}
|
||||
|
||||
if (!process.argv[2] || /^[0-9]+$/.test(process.argv[2])) {
|
||||
// Start the server. We manually load app.js so it can be configured to run as
|
||||
// the main module, rather than this file being considered the main module.
|
||||
// This ensures any dependencies that were just installed can be found when
|
||||
// running on Windows and avoids any other potential side effects of the main
|
||||
// module not being app.js like it is assumed to be.
|
||||
// Start the server.
|
||||
//
|
||||
// The port the server should host on can be passed using the second argument
|
||||
// when launching with this file the same way app.js normally allows, e.g. to
|
||||
// host on port 9000:
|
||||
// $ ./pokemon-showdown 9000
|
||||
|
||||
require('module')._load('./app', module, true);
|
||||
require('module')._load('./server', module, true);
|
||||
} else switch (process.argv[2]) {
|
||||
case 'help':
|
||||
case 'h':
|
||||
|
|
@ -73,7 +69,7 @@ if (!process.argv[2] || /^[0-9]+$/.test(process.argv[2])) {
|
|||
case '-h':
|
||||
case '--help':
|
||||
case '-?':
|
||||
console.log('pokemon-showdown [PORT]');
|
||||
console.log('pokemon-showdown start [PORT]');
|
||||
console.log('');
|
||||
console.log(' Starts a PS server on the specified port');
|
||||
console.log(' (Defaults to the port setting in config/config.js)');
|
||||
|
|
@ -110,6 +106,12 @@ if (!process.argv[2] || /^[0-9]+$/.test(process.argv[2])) {
|
|||
console.log('');
|
||||
console.log(' Displays this reference');
|
||||
break;
|
||||
case 'start':
|
||||
{
|
||||
process.argv[2] = process.argv[3];
|
||||
require('module')._load('./server', module, true);
|
||||
break;
|
||||
}
|
||||
case 'generate-team':
|
||||
{
|
||||
var Dex = require('./sim/dex');
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
/* eslint no-else-return: "error" */
|
||||
|
||||
const crypto = require('crypto');
|
||||
const FS = require('./lib/fs');
|
||||
const FS = require('../lib/fs');
|
||||
|
||||
const MAX_REASON_LENGTH = 300;
|
||||
const MUTE_LENGTH = 7 * 60 * 1000;
|
||||
|
|
@ -2988,7 +2988,7 @@ const commands = {
|
|||
|
||||
Chat.destroy();
|
||||
|
||||
const processManagers = require('./lib/process-manager').processManagers;
|
||||
const processManagers = require('../lib/process-manager').processManagers;
|
||||
for (let manager of processManagers.slice()) {
|
||||
if (manager.filename.startsWith(FS('chat-plugins').path)) {
|
||||
manager.destroy();
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user