sm-blueprint-lib 0.0.7__py3-none-any.whl → 0.0.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sm_blueprint_lib-0.0.8.dist-info/METADATA +99 -0
- {sm_blueprint_lib-0.0.7.dist-info → sm_blueprint_lib-0.0.8.dist-info}/RECORD +4 -4
- sm_blueprint_lib-0.0.7.dist-info/METADATA +0 -17
- {sm_blueprint_lib-0.0.7.dist-info → sm_blueprint_lib-0.0.8.dist-info}/WHEEL +0 -0
- {sm_blueprint_lib-0.0.7.dist-info → sm_blueprint_lib-0.0.8.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,99 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: sm_blueprint_lib
|
3
|
+
Version: 0.0.8
|
4
|
+
Summary: Scrap Mechanic Library for Blueprint manipulation.
|
5
|
+
Project-URL: Homepage, https://github.com/MauriceTZ/sm_blueprint_lib
|
6
|
+
Project-URL: Issues, https://github.com/MauriceTZ/sm_blueprint_lib/issues
|
7
|
+
Author-email: Maurice <mauriciotorrez00@gmail.com>
|
8
|
+
License-Expression: MIT
|
9
|
+
License-File: LICENSE
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
12
|
+
Requires-Python: >=3.8
|
13
|
+
Requires-Dist: numpy
|
14
|
+
Description-Content-Type: text/markdown
|
15
|
+
|
16
|
+
# sm_blueprint_lib
|
17
|
+
Scrap Mechanic Library for Blueprint manipulation.
|
18
|
+
|
19
|
+
## Instalation
|
20
|
+
```sh
|
21
|
+
pip install sm_blueprint_lib
|
22
|
+
```
|
23
|
+
## Usage
|
24
|
+
```python
|
25
|
+
import numpy as np
|
26
|
+
|
27
|
+
import sm_blueprint_lib as sm
|
28
|
+
|
29
|
+
# Create a Blueprint object to store your parts
|
30
|
+
bp = sm.Blueprint()
|
31
|
+
|
32
|
+
# Define your stuff as you like, ID's are generated automatically or u can create them manually
|
33
|
+
# The controller argument is converted to the needed LogicGateController class
|
34
|
+
# 0: and, 1: or, 2: xor, 3: nand, 4: nor, 5: xnor
|
35
|
+
single_and = sm.LogicGate(pos=(0, 0, 0), color="1122ff", controller=0)
|
36
|
+
single_or = sm.LogicGate(sm.Pos(0, 2, 0), "3322ff", 1)
|
37
|
+
single_self_wired_xor = sm.LogicGate(
|
38
|
+
pos=sm.Pos(0, 4, 0),
|
39
|
+
color="5522ff",
|
40
|
+
# Or define it explicitly
|
41
|
+
controller=sm.LogicGateController(mode=2, id=9999999, controllers=[sm.ID(9999999)])
|
42
|
+
)
|
43
|
+
|
44
|
+
# Create multiple gates at the same time
|
45
|
+
row_0 = [sm.LogicGate((x, 6, 0), "ffffff", 0) for x in range(10)]
|
46
|
+
row_1 = [sm.LogicGate((-1, 6, z + 1), "ffffff", 0) for z in range(10)]
|
47
|
+
# Define matrices using numpy
|
48
|
+
matrix = np.ndarray((10, 10), dtype=sm.LogicGate)
|
49
|
+
for x in range(10):
|
50
|
+
for z in range(10):
|
51
|
+
# Define custom rotation (xaxis, zaxis)
|
52
|
+
matrix[x, z] = sm.LogicGate(
|
53
|
+
(x, 8, z + 1), "000000", 5, xaxis=1, zaxis=2)
|
54
|
+
|
55
|
+
single_nor = sm.LogicGate(sm.Pos(0, 11, 0), "ee22ff", 4)
|
56
|
+
|
57
|
+
row_2 = [sm.LogicGate((x, 13, 0), "ffffff", 0) for x in range(10)]
|
58
|
+
row_3 = [sm.LogicGate((-1, 13, z + 1), "ffffff", 0) for z in range(10)]
|
59
|
+
|
60
|
+
# Simple Timer loop
|
61
|
+
loop = [sm.LogicGate((4, 0, 0), "987654"),
|
62
|
+
# TimerController can be passed as (seconds, ticks)
|
63
|
+
sm.Timer((5, 0, 0), "3210ff", (1, 0)),
|
64
|
+
sm.LogicGate((6, 0, 0), "eeddcc", 3)]
|
65
|
+
|
66
|
+
# Connect stuff
|
67
|
+
# 1 to 1
|
68
|
+
sm.connect(single_and, single_or)
|
69
|
+
sm.connect(single_or, single_self_wired_xor)
|
70
|
+
sm.connect(row_0, row_1) # With parallel=True (ie row to row)
|
71
|
+
# 1 to many
|
72
|
+
sm.connect(single_self_wired_xor, row_0)
|
73
|
+
sm.connect(row_0, matrix)
|
74
|
+
# Many to 1
|
75
|
+
sm.connect(matrix, single_nor)
|
76
|
+
# Many to many
|
77
|
+
# With parallel=False (ie everything connects to everything)
|
78
|
+
sm.connect(row_2, row_3, parallel=False)
|
79
|
+
# You can also chain single gate connections
|
80
|
+
loop[0].connect(loop[1]).connect(loop[2]).connect(loop[0])
|
81
|
+
|
82
|
+
# Put all parts into the blueprint
|
83
|
+
# Note that it doesn't care if it's a single gate or arrays
|
84
|
+
bp.add(single_and, single_or, single_self_wired_xor,
|
85
|
+
row_0, row_1, matrix, single_nor, row_2, row_3, loop)
|
86
|
+
|
87
|
+
# Finally, save the blueprint into a file or dump it as a string
|
88
|
+
print(sm.dump_string_from_blueprint(bp))
|
89
|
+
path = "path/to/your/blueprint/folder/blueprint.json"
|
90
|
+
sm.save_blueprint(bp, path)
|
91
|
+
```
|
92
|
+
|
93
|
+
### Results
|
94
|
+
#### 1 to 1 and loop
|
95
|
+

|
96
|
+
#### Row to row and 1 to many
|
97
|
+

|
98
|
+
#### Many to 1 and many to many
|
99
|
+

|
@@ -34,7 +34,7 @@ sm_blueprint_lib/prebuilds/register.py,sha256=MAiplmiA2L_VJaxCX2E8QuancnoqvyLY-v
|
|
34
34
|
sm_blueprint_lib/prebuilds/rom.py,sha256=4dxAaNxRX60kDW17NKew-TJkPB7EMfHuK_zVIm6N-jo,3700
|
35
35
|
sm_blueprint_lib/prebuilds/timer_ram_cached.py,sha256=PG53hDKYS00fur5vazh7iOs2Gm4G_URJLX7d9xWJOe4,19057
|
36
36
|
sm_blueprint_lib/prebuilds/timer_ram_multiclient.py,sha256=NlQeJB6ilEGJDrIOfkFmPWd7afDR_0CUZH7RQpjyA4s,4200
|
37
|
-
sm_blueprint_lib-0.0.
|
38
|
-
sm_blueprint_lib-0.0.
|
39
|
-
sm_blueprint_lib-0.0.
|
40
|
-
sm_blueprint_lib-0.0.
|
37
|
+
sm_blueprint_lib-0.0.8.dist-info/METADATA,sha256=a8b9VUFkqtRqzOTuWkomOeOb6y6r7VerAgp7ZNuOGs0,3378
|
38
|
+
sm_blueprint_lib-0.0.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
39
|
+
sm_blueprint_lib-0.0.8.dist-info/licenses/LICENSE,sha256=DWhaodryTSEv07KdWbanCMaEujOXYxnj-IEhmgTkOq0,1084
|
40
|
+
sm_blueprint_lib-0.0.8.dist-info/RECORD,,
|
@@ -1,17 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: sm_blueprint_lib
|
3
|
-
Version: 0.0.7
|
4
|
-
Summary: Scrap Mechanic Library for Blueprint manipulation.
|
5
|
-
Project-URL: Homepage, https://github.com/MauriceTZ/sm_blueprint_lib
|
6
|
-
Project-URL: Issues, https://github.com/MauriceTZ/sm_blueprint_lib/issues
|
7
|
-
Author-email: Maurice <mauriciotorrez00@gmail.com>
|
8
|
-
License-Expression: MIT
|
9
|
-
License-File: LICENSE
|
10
|
-
Classifier: Operating System :: OS Independent
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
12
|
-
Requires-Python: >=3.8
|
13
|
-
Requires-Dist: numpy
|
14
|
-
Description-Content-Type: text/markdown
|
15
|
-
|
16
|
-
# sm_blueprint_lib
|
17
|
-
Scrap Mechanic Library for Blueprint manipulation.
|
File without changes
|
File without changes
|