From 65914a73250ee6dbaddb94a3b5d2a5df81b2a4a3 Mon Sep 17 00:00:00 2001 From: Sean O'Donohue Date: Tue, 3 Nov 2015 10:56:26 -0500 Subject: [PATCH 1/8] Add docs on this fork --- README.mkd | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.mkd b/README.mkd index b1a7ac0b1..000492f02 100644 --- a/README.mkd +++ b/README.mkd @@ -1,6 +1,13 @@ # RanvierMUD NodeJS based MUD engine with full localization support +## Contributing to this fork +This fork aims to eventually turn the lightweight MUD engine Ranvier, developed by shawncplus, into a full-fledged game. The setting is, currently, a post-apocalyptic steampunk port town. That is probably a cliche, but I don't care. Right now, the master branch is working and has a fair amount of new content and features. However, I have a better understanding of the codebase now so it is in flux. + +There is also a development branch where I am working on rewriting some of the features to submit to the upstream project. At some point, the dev branch will be updated to include a lot more content. For the time being, it's bare since I am rewriting some features I'd already added. + +Please submit any PRs that are related to making this into a game to this project, preferably the master branch. Please submit any features based on enhancing the MUD engine itself to the shawncplus project. + ## Features * Full localization for any strings displayed to the player after they log in. This isn't a common feature in MUDs so I'll explain it. Player A and Player B log in, play the same game and see a different language. Same items, npcs, rooms, etc, different language. * Scripting support: It's in Javascript! No need for a shitty DSL. The codebase is javascript, the scripting is javascript. @@ -24,6 +31,8 @@ NodeJS based MUD engine with full localization support cd ranviermud npm install sudo ./ranvier -v --save=10 --respawn=10 + +Connect to the server using `telnet 23` ## Documentation From 36c6fcfca763313ad87819360c3117917ae467e4 Mon Sep 17 00:00:00 2001 From: Sean O'Donohue Date: Tue, 3 Nov 2015 20:44:06 -0500 Subject: [PATCH 2/8] Remove note about this fork from dev branch. --- README.mkd | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.mkd b/README.mkd index 000492f02..70bcfa40e 100644 --- a/README.mkd +++ b/README.mkd @@ -1,13 +1,6 @@ # RanvierMUD NodeJS based MUD engine with full localization support -## Contributing to this fork -This fork aims to eventually turn the lightweight MUD engine Ranvier, developed by shawncplus, into a full-fledged game. The setting is, currently, a post-apocalyptic steampunk port town. That is probably a cliche, but I don't care. Right now, the master branch is working and has a fair amount of new content and features. However, I have a better understanding of the codebase now so it is in flux. - -There is also a development branch where I am working on rewriting some of the features to submit to the upstream project. At some point, the dev branch will be updated to include a lot more content. For the time being, it's bare since I am rewriting some features I'd already added. - -Please submit any PRs that are related to making this into a game to this project, preferably the master branch. Please submit any features based on enhancing the MUD engine itself to the shawncplus project. - ## Features * Full localization for any strings displayed to the player after they log in. This isn't a common feature in MUDs so I'll explain it. Player A and Player B log in, play the same game and see a different language. Same items, npcs, rooms, etc, different language. * Scripting support: It's in Javascript! No need for a shitty DSL. The codebase is javascript, the scripting is javascript. From 28569875501b156c7dbad7eb8b15b003b53fe4f7 Mon Sep 17 00:00:00 2001 From: Sean O'Donohue Date: Mon, 9 Nov 2015 16:18:33 -0500 Subject: [PATCH 3/8] Add file for say command logic --- commands/say.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 commands/say.js diff --git a/commands/say.js b/commands/say.js new file mode 100644 index 000000000..bdfd23670 --- /dev/null +++ b/commands/say.js @@ -0,0 +1,10 @@ +var l10n_file = __dirname + '/../l10n/commands/save.yml'; +var l10n = require('../src/l10n')(l10n_file); +var CommandUtil = require('../src/command_util').CommandUtil; +exports.command = function (rooms, items, players, npcs, Commands) +{ + return function (args, player) + { + // code goes here + } +}; \ No newline at end of file From afcdadc35f4262f929d87fdb889f535d94f87108 Mon Sep 17 00:00:00 2001 From: Sean O'Donohue Date: Mon, 9 Nov 2015 16:20:45 -0500 Subject: [PATCH 4/8] Add file for l10n --- l10n/commands/say.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 l10n/commands/say.yml diff --git a/l10n/commands/say.yml b/l10n/commands/say.yml new file mode 100644 index 000000000..746b59a8c --- /dev/null +++ b/l10n/commands/say.yml @@ -0,0 +1 @@ +say.yml \ No newline at end of file From 6df7600a646b58b041105b6b474f1b032ed8158f Mon Sep 17 00:00:00 2001 From: Sean O'Donohue Date: Mon, 9 Nov 2015 16:29:13 -0500 Subject: [PATCH 5/8] Add l10n strings and logic for say command. --- commands/say.js | 28 ++++++++++++++++++++++------ l10n/commands/say.yml | 7 ++++++- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/commands/say.js b/commands/say.js index bdfd23670..5f9665dea 100644 --- a/commands/say.js +++ b/commands/say.js @@ -1,10 +1,26 @@ var l10n_file = __dirname + '/../l10n/commands/save.yml'; var l10n = require('../src/l10n')(l10n_file); var CommandUtil = require('../src/command_util').CommandUtil; -exports.command = function (rooms, items, players, npcs, Commands) -{ - return function (args, player) - { - // code goes here - } +exports.command = function(rooms, items, players, npcs, Commands) { + return function(args, player) { + if (args) { + player.sayL10n(l10n, 'YOU_SAY', args); + players.eachIf(function(p) { + otherPlayersInRoom(p); + }, function(p) { + p.sayL10n(l10n, 'THEY_SAY', player.getName(), args); + }); + return; + } + + player.sayL10n(l10n, 'NOTHING_SAID'); + return; + } + + function otherPlayersInRoom(p) { + if (p) + return (p.getName() !== player.getName() && p.getLocation() === player.getLocation()); + }; + + }; \ No newline at end of file diff --git a/l10n/commands/say.yml b/l10n/commands/say.yml index 746b59a8c..8102c9e66 100644 --- a/l10n/commands/say.yml +++ b/l10n/commands/say.yml @@ -1 +1,6 @@ -say.yml \ No newline at end of file +NOTHING_SAID: + en: 'You say nothing. Type "say (message)" to be heard!' +YOU_SAY: + en: 'You say, "$[1]"' +THEY_SAY: + en: '$[1] says, "$[2]"' \ No newline at end of file From 15258b551a5d5fb964ade6cd00be6562438eb351 Mon Sep 17 00:00:00 2001 From: Sean O'Donohue Date: Mon, 9 Nov 2015 16:30:11 -0500 Subject: [PATCH 6/8] Fix path for l10n --- commands/say.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/say.js b/commands/say.js index 5f9665dea..671cb7ae7 100644 --- a/commands/say.js +++ b/commands/say.js @@ -1,4 +1,4 @@ -var l10n_file = __dirname + '/../l10n/commands/save.yml'; +var l10n_file = __dirname + '/../l10n/commands/say.yml'; var l10n = require('../src/l10n')(l10n_file); var CommandUtil = require('../src/command_util').CommandUtil; exports.command = function(rooms, items, players, npcs, Commands) { From 056bec5276f48e0defcecd9b96778a89d57d0c8d Mon Sep 17 00:00:00 2001 From: Sean O'Donohue Date: Mon, 9 Nov 2015 16:55:52 -0500 Subject: [PATCH 7/8] Add conditional to avoid duplicate messages, fix EachIf block. --- commands/say.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/say.js b/commands/say.js index 671cb7ae7..637739b51 100644 --- a/commands/say.js +++ b/commands/say.js @@ -6,9 +6,10 @@ exports.command = function(rooms, items, players, npcs, Commands) { if (args) { player.sayL10n(l10n, 'YOU_SAY', args); players.eachIf(function(p) { - otherPlayersInRoom(p); + return otherPlayersInRoom(p); }, function(p) { - p.sayL10n(l10n, 'THEY_SAY', player.getName(), args); + if (p.getName() != player.getName()) + p.sayL10n(l10n, 'THEY_SAY', player.getName(), args); }); return; } From cf2a91d48c900fff03c42daa1c849b65e3e28f67 Mon Sep 17 00:00:00 2001 From: Sean O'Donohue Date: Tue, 10 Nov 2015 13:32:06 -0500 Subject: [PATCH 8/8] Remove unneeded conditional. --- commands/say.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/commands/say.js b/commands/say.js index 637739b51..cf979ed8e 100644 --- a/commands/say.js +++ b/commands/say.js @@ -8,8 +8,7 @@ exports.command = function(rooms, items, players, npcs, Commands) { players.eachIf(function(p) { return otherPlayersInRoom(p); }, function(p) { - if (p.getName() != player.getName()) - p.sayL10n(l10n, 'THEY_SAY', player.getName(), args); + p.sayL10n(l10n, 'THEY_SAY', player.getName(), args); }); return; }