xt/html; charset=UTF-8 Last-Modified: Sun, 06 Dec 2026 12:29:15 GMT Expires: Wed, 03 Dec 2036 12:29:15 GMT Remove zip release files, move mod to root, exclude assets from Makefile (#92) - advtrains.git - Advtrains mod for minetest.
aboutsummaryrefslogtreecommitdiff
path: root/atc_command.txt
diff options
context:
space:
mode:
authorrubenwardy <rubenwardy@gmail.com>2017-09-20 17:05:04 +0100
committerorwell96 <mono96.mml@gmail.com>2017-09-20 18:05:04 +0200
commitd65c4916ceaeed6eec5fe3f344d4e71b3c96a80b (patch)
treeae2a4a1ca5bdbcb0a2a867287d4556f92478405a /atc_command.txt
parentb75c83ea43bb9f6e3bee2b4db955e2a9e7be885e (diff)
Remove zip release files, move mod to root, exclude assets from Makefile (#92)
Diffstat (limited to 'atc_command.txt')
-rw-r--r--atc_command.txt83
1 files changed, 83 insertions, 0 deletions
diff --git a/atc_command.txt b/atc_command.txt
new file mode 100644
index 0000000..3df60c8
--- /dev/null
+++ b/atc_command.txt
@@ -0,0 +1,83 @@
+ATC Command Syntax
+
+A train runs the current ATC command once it receives it, including delayed instructions. If the train receives a new command, the current command is discarded.
+Spaces can be inserted into commands as needed and are ignored.
+
+# simple commands:
+
+S<[0-9]+ speed or 'M'>
+Set target speed of train to <speed>. Accelerates if slower, rolls if faster. 'M' means maximum speed.
+Execution of command continues immediately.
+
+B<[0-9]+ speed>
+Brake until speed is reached. If faster, apply brakes, if slower, do nothing.
+Execution of command continues immediately.
+
+Examples:
+SM : accelerate to maximum speed
+S0 : roll to stand
+B0 : brake to stand
+S0B3 or B3S0: brake to 3, then roll to stand.
+
+W
+Wait until S and/or B commands reached the desired speed before continuing execution.
+
+D<[0-9]+ time>
+Delay: Wait for time seconds before continuing execution.
+
+R
+Reverse: change movement direction of train. ONLY WORKS WHEN TRAIN STANDS, else no-op.
+Use B0WR to definitely change direction.
+
< self.pointer = (self.pointer or 1) + 1 return l end end function mock_file:close() return nil end function mock_file:write(text) self.content = self.content..text end function mock_file:create(lines) local f = {} setmetatable(f, mock_file) f.lines = lines or {} f.write = self.write f.close = self.close f.read = self.read f.content = "" return f end local testtable = { key = "value", [1] = "eins", [true] = { a = "b", c = false, }, ["es:cape1"] = "foo:bar", ["es&ca\npe2"] = "baz&bam\nbim", ["es&&ca&\npe3"] = "baz&&bam&\nbim", ["es&:cape4"] = "foo\n:bar" } local testser = [[LUA_SER v=2 B1:T Sa:Sb Sc:B0 E Skey:Svalue Ses&&&&ca&&&npe3:Sbaz&&&&bam&&&nbim N1:Seins Ses&&&:cape4:Sfoo&n&:bar Ses&&ca&npe2:Sbaz&&bam&nbim Ses&:cape1:Sfoo&:bar E END_SER ]] local function check_write(tb, conf) f = mock_file:create() ser.write_to_fd(tb, f, conf or {}) return f.content end function string:split() local fields = {} self:gsub("[^\n]+", function(c) fields[#fields+1] = c end) return fields end local function check_read(text) f = mock_file:create(text:split()) return ser.read_from_fd(f) end local noskip = [[LUA_SER v=2 N1:T E E END_SER ]] local skip = [[LUA_SER v=2 E END_SER ]] describe("write_to_fd", function() it("does not skip empty tables", function() assert.equals(check_write({{}}),noskip) end) it("skips empty tables when needed", function() assert.equals(check_write({{}},{skip_empty_tables=true}),skip) end) end) describe("read_from_fd", function () it("reads a table correctly", function() assert.same(check_read(testser),testtable) end) it("handles some edge cases correctly", function() assert.same(check_read(noskip), {{}}) assert.same(check_read(skip), {}) end) it("Read back table", function() local tb = {} for k=1,262 do tb[k] = { "Foo", "bar", k} end assert.same(check_read(check_write(tb)), tb) end) end)