Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat: add remote interface to add a new locomotive type
- Loading branch information
1 parent
a67c537
commit 3a0f889
Showing
5 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- register a new locomotive type | ||
| -- @param name string of lomotive type name | ||
| local function register_locomotive_type(name) | ||
| local contains = false | ||
| for _, v in pairs(global.locomotive_type_names) do | ||
| if v == name then contains = true end | ||
| end | ||
| if not (contains) then table.insert(global.locomotive_type_names, name) end | ||
| end | ||
|
|
||
| remote.add_interface("BatteryLocomotive", | ||
| {["register_locomotive_type"] = register_locomotive_type}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters