Skip to content

Commit 534fb6c

Browse files
authored
Merge pull request #11 from mc-cc-scripts/Remove-Submodules
Remove submodules
2 parents 6c41199 + 6881d68 commit 534fb6c

File tree

16 files changed

+131
-66
lines changed

16 files changed

+131
-66
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
name: Busted
22

3-
43
on: [push, pull_request]
54

6-
75
jobs:
86
test:
97
runs-on: ubuntu-latest
108

119
steps:
1210
- name: checkout
1311
uses: actions/checkout@v2
14-
with:
15-
submodules: true
1612

1713
- name: get lua
1814
uses: leafo/gh-actions-lua@v10
@@ -30,11 +26,11 @@ jobs:
3026
luarocks install luasocket
3127
luarocks install luasec
3228
33-
- name: Git Submodule Update
29+
- name: fetch dependencies
3430
run: |
35-
git pull --recurse-submodules
36-
git submodule update --init --remote --recursive
31+
chmod +x ./fetch-deps.sh
32+
./fetch-deps.sh
3733
3834
- name: test
3935
run: |
40-
busted tests
36+
busted .

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/config
22
/.vscode
33
/computer
4-
/suits
4+
/libs

.gitmodules

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,45 @@
11
# turtleEmulator-lib
22

3-
This Libary is meant to Emulate the functions and behaviour of turtles in Minecraft.
4-
This is exclusively useful for testing with f.e. Busted
3+
This Emulator is exclusively ment to enable testing CC turtle-code with a testingframework (namely busted), outside MC and CraftOS.
54

6-
### [Documentation](https://github.com/mc-cc-scripts/turtleEmulator-lib/wiki)
5+
### WIP
6+
7+
Should increase in scope incrementally.
8+
9+
> For now it only supports all functions listed in the Progress.md
10+
11+
### HOW TO USE
12+
13+
```lua
14+
local turtleEmulator = require("<path>/turtleEmulator")
15+
16+
-- create turtles
17+
local turtleOne = turtleEmulator:createTurtle()
18+
local turtleTwo = turtleEmulator:createTurtle()
19+
20+
-- add items to turtles for testing
21+
turtleOne.addItemToInventory({
22+
name = "minecraft:coal",
23+
count = 64,
24+
maxcount = 64,
25+
fuelgain = 8
26+
})
27+
turtleOne.refuel(64)
28+
29+
assert(true == turtleOne.forward(), "I have fuel and should work")
30+
assert(false == turtleTwo.forward(), "I have no fuel and should not work")
31+
32+
-- add block to World
33+
turtleEmulator:createBlock({
34+
item = {
35+
name = "minecraft:dirt"
36+
},
37+
position = { x = 0, y = -1, z = 0 }
38+
})
39+
40+
```
41+
---
42+
### Restrictions
43+
44+
To allow the creation of multiple turtles within the same Emulator, the turtle returned by createTurtle is only a proxy, meaning that the metatable should not be modified!
45+
However, should the need ever arise, you can modify it by getmetatable(turtle).\_\_metatable = nil. But please be aware that overriding the \_\_index and \_\_newIndex will break the functionality of the turtle.

TestSuite-lib

Lines changed: 0 additions & 1 deletion
This file was deleted.

cc/pretty.lua

Lines changed: 0 additions & 8 deletions
This file was deleted.

ccPackage.lua

Lines changed: 0 additions & 11 deletions
This file was deleted.

defaultBehaviour/defaultcheckActionValid.lua

Lines changed: 0 additions & 14 deletions
This file was deleted.

defaultBehaviour/defaultInteraction.lua renamed to defaultInteraction.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ local function defaultInteration(turtle, block, action)
2323
end
2424
end
2525

26-
return defaultInteration
26+
return defaultInteration

fetch-deps.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
# ---- Whats happening ---- #
4+
5+
# This fetches the dependencies listed in the "libs" variable and saves them in the targetFolder
6+
7+
8+
9+
set -e
10+
11+
libs=(
12+
"helperFunctions-lib"
13+
"eventCallStack-lib"
14+
"ccClass-lib"
15+
"testSuite-lib"
16+
)
17+
18+
# Basic setup variables
19+
repo="mc-cc-scripts"
20+
branch="master"
21+
targetFolderName=libs
22+
23+
24+
# fetch files.txt and save each file into the targetFolder
25+
fetch() {
26+
27+
files_txt=$(curl -fsSL "https://raw.githubusercontent.com/$repo/$1/$branch/files.txt")
28+
if [ -z "$files_txt" ]; then
29+
echo "Could not load files.txt for $1"
30+
exit 1
31+
fi
32+
while IFS= read -r FILE; do
33+
rm -f $targetFolderName/$1.lua # rm existing file
34+
curl -s "https://raw.githubusercontent.com/$repo/$1/$branch/$FILE" -o "$targetFolderName/$FILE"
35+
done < <(echo "$files_txt")
36+
}
37+
38+
mkdir -p $targetFolderName
39+
40+
for i in "${libs[@]}"; do
41+
fetch "$i"
42+
done

0 commit comments

Comments
 (0)