dashcode 1.2.6__tar.gz → 1.2.8__tar.gz
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.
- {dashcode-1.2.6 → dashcode-1.2.8}/PKG-INFO +1 -1
- {dashcode-1.2.6 → dashcode-1.2.8}/dashcode/core.py +37 -3
- {dashcode-1.2.6 → dashcode-1.2.8}/dashcode.egg-info/PKG-INFO +1 -1
- {dashcode-1.2.6 → dashcode-1.2.8}/setup.py +1 -1
- {dashcode-1.2.6 → dashcode-1.2.8}/README.md +0 -0
- {dashcode-1.2.6 → dashcode-1.2.8}/dashcode/__init__.py +0 -0
- {dashcode-1.2.6 → dashcode-1.2.8}/dashcode.egg-info/SOURCES.txt +0 -0
- {dashcode-1.2.6 → dashcode-1.2.8}/dashcode.egg-info/dependency_links.txt +0 -0
- {dashcode-1.2.6 → dashcode-1.2.8}/dashcode.egg-info/top_level.txt +0 -0
- {dashcode-1.2.6 → dashcode-1.2.8}/setup.cfg +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import base64
|
|
2
2
|
import gzip
|
|
3
|
+
from operator import index
|
|
4
|
+
|
|
3
5
|
obj_string = ""
|
|
4
6
|
lvlname = ""
|
|
5
7
|
|
|
@@ -36,7 +38,9 @@ class Dashcode:
|
|
|
36
38
|
"TargetColor":23,
|
|
37
39
|
"Delay": 63,
|
|
38
40
|
"SpawnTrigger":62,
|
|
39
|
-
"MultiTrigger":87
|
|
41
|
+
"MultiTrigger":87,
|
|
42
|
+
"X":2,
|
|
43
|
+
"Y":3,
|
|
40
44
|
}
|
|
41
45
|
self.objectids = {
|
|
42
46
|
"block": 1, "spike": 8, "yorb": 36, "coin": 1329,
|
|
@@ -108,6 +112,7 @@ class Dashcode:
|
|
|
108
112
|
pos_y = params.get('Y', 0) * 30 + 15
|
|
109
113
|
full_obj_string = f"1,{oid},2,{pos_x},3,{pos_y}{extraparams}"
|
|
110
114
|
self.objects.append(full_obj_string)
|
|
115
|
+
return full_obj_string
|
|
111
116
|
def parse_object_string(self,objstr):
|
|
112
117
|
data = objstr.split(',')
|
|
113
118
|
obj_dict = {}
|
|
@@ -116,7 +121,33 @@ class Dashcode:
|
|
|
116
121
|
value = data[i + 1]
|
|
117
122
|
obj_dict[key] = value
|
|
118
123
|
return obj_dict
|
|
119
|
-
|
|
124
|
+
def removeobject(self, obj:str):
|
|
125
|
+
self.objects.remove(obj)
|
|
126
|
+
def editobject(self, obj:str, params:dict):
|
|
127
|
+
parsed = self.parse_object_string(obj)
|
|
128
|
+
#print(parsed)
|
|
129
|
+
newparams = {}
|
|
130
|
+
for i,v in parsed.items():
|
|
131
|
+
if not newparams.get(i):
|
|
132
|
+
newparams[i] = v
|
|
133
|
+
for i,v in params.items():
|
|
134
|
+
#print(i,v)
|
|
135
|
+
if self.params.get(i) and not i in ["X","Y"]:
|
|
136
|
+
if not parsed.get(self.params.get(i)) and self.params.get(i):
|
|
137
|
+
newparams[str(self.params.get(i))] = str(v)
|
|
138
|
+
elif i in ["X","Y"]:
|
|
139
|
+
#print(i,v)
|
|
140
|
+
newparams[str(self.params.get(i))] = str(v*30)
|
|
141
|
+
else:
|
|
142
|
+
newparams[str(i)] = str(v)
|
|
143
|
+
new_obj = ""
|
|
144
|
+
for i,v in newparams.items():
|
|
145
|
+
new_obj += f"{i},{v},"
|
|
146
|
+
#print(newparams)
|
|
147
|
+
#print(new_obj)
|
|
148
|
+
self.removeobject(obj)
|
|
149
|
+
self.objects.append(new_obj)
|
|
150
|
+
return new_obj
|
|
120
151
|
def addprefab(self, obj: str, params: dict, prefab: str):
|
|
121
152
|
fab = self.prefabs.get(prefab)
|
|
122
153
|
if not fab:
|
|
@@ -125,11 +156,13 @@ class Dashcode:
|
|
|
125
156
|
ey = params.get('EY', 0)
|
|
126
157
|
base_x = params.get('X', 0)
|
|
127
158
|
base_y = params.get('Y', 0)
|
|
159
|
+
placed = []
|
|
128
160
|
def place(x_val, y_val):
|
|
129
161
|
current_params = dict(params)
|
|
130
162
|
current_params["X"] = x_val
|
|
131
163
|
current_params["Y"] = y_val
|
|
132
|
-
self.addobject(obj, current_params)
|
|
164
|
+
preobj_str = self.addobject(obj, current_params)
|
|
165
|
+
placed.append(preobj_str)
|
|
133
166
|
if fab.get("X") == 0:
|
|
134
167
|
for i in range(ex):
|
|
135
168
|
place(base_x + i, base_y)
|
|
@@ -148,6 +181,7 @@ class Dashcode:
|
|
|
148
181
|
for i in range(ey):
|
|
149
182
|
place(base_x, base_y + i)
|
|
150
183
|
place(base_x + ex, base_y + i)
|
|
184
|
+
return placed
|
|
151
185
|
def build_timeline(self, timeline:list):
|
|
152
186
|
cdelay = 0
|
|
153
187
|
for tlobj in timeline:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|