pyscreeps-arena 0.3.3a0__py3-none-any.whl → 0.3.6__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.
- pyscreeps_arena/compiler.py +44 -7
- pyscreeps_arena/core/config.py +1 -0
- pyscreeps_arena/core/const.py +1 -1
- pyscreeps_arena/project.7z +0 -0
- {pyscreeps_arena-0.3.3a0.dist-info → pyscreeps_arena-0.3.6.dist-info}/METADATA +1 -1
- pyscreeps_arena-0.3.6.dist-info/RECORD +17 -0
- pyscreeps_arena-0.3.3a0.dist-info/RECORD +0 -17
- {pyscreeps_arena-0.3.3a0.dist-info → pyscreeps_arena-0.3.6.dist-info}/WHEEL +0 -0
- {pyscreeps_arena-0.3.3a0.dist-info → pyscreeps_arena-0.3.6.dist-info}/entry_points.txt +0 -0
- {pyscreeps_arena-0.3.3a0.dist-info → pyscreeps_arena-0.3.6.dist-info}/top_level.txt +0 -0
pyscreeps_arena/compiler.py
CHANGED
|
@@ -48,7 +48,7 @@ import { ATTACK, ATTACK_POWER, BODYPART_COST, BODYPART_HITS, BOTTOM, BOTTOM_LEFT
|
|
|
48
48
|
|
|
49
49
|
import {arenaInfo} from "game";
|
|
50
50
|
import {Visual} from "game/visual"
|
|
51
|
-
import {searchPath} from "game/path-finder"
|
|
51
|
+
import {searchPath, CostMatrix} from "game/path-finder"
|
|
52
52
|
"""
|
|
53
53
|
|
|
54
54
|
TOTAL_INSERT_BEFORE_MAIN = """
|
|
@@ -56,16 +56,24 @@ import {searchPath} from "game/path-finder"
|
|
|
56
56
|
|
|
57
57
|
TOTAL_APPEND_ATEND = """
|
|
58
58
|
export var sch = Scheduler();
|
|
59
|
-
var monitor =
|
|
59
|
+
var monitor = Monitor(2);
|
|
60
60
|
know.now = 0;
|
|
61
|
+
|
|
62
|
+
_SchedulerMeta.__types__ = []; // 清空js首次构造时引入的数据
|
|
63
|
+
_StageMachineMeta.__recursive__ = []; // 清空js首次构造时引入的数据
|
|
64
|
+
__init_my_exists_creep_before_k__();
|
|
61
65
|
export var loop = function () {
|
|
62
66
|
know.now = get.ticks ();
|
|
67
|
+
know.handle();
|
|
63
68
|
if (know.now === 1) {
|
|
69
|
+
std.show_welcome();
|
|
64
70
|
init (know);
|
|
65
71
|
}
|
|
66
72
|
|
|
67
|
-
know.update_(know);
|
|
68
73
|
monitor.handle();
|
|
74
|
+
for (const creep of know._creeps){
|
|
75
|
+
creep.motion.handle();
|
|
76
|
+
}
|
|
69
77
|
step (know);
|
|
70
78
|
sch.handle();
|
|
71
79
|
std.show_usage ();
|
|
@@ -91,7 +99,7 @@ export var loop = function () {
|
|
|
91
99
|
|
|
92
100
|
JS_VM = "org.transcrypt.__runtime__.js"
|
|
93
101
|
|
|
94
|
-
BUILTIN_TRANS = ["engine.js"]
|
|
102
|
+
BUILTIN_TRANS = ["engine.js", "stage.js"] # 记录buildin中会被transcrypt的文件
|
|
95
103
|
OTHER_IGNORE_WITH = "./builtin"
|
|
96
104
|
|
|
97
105
|
JS_IMPORT_PAT = re.compile(r'from\s+[\'\"]([^\']+)[\'\"]')
|
|
@@ -106,7 +114,10 @@ export var loop = function () {
|
|
|
106
114
|
|
|
107
115
|
ARENA_IMPORTS_GETTER = {
|
|
108
116
|
const.ARENA_GREEN: lambda: f"""
|
|
109
|
-
|
|
117
|
+
class BodyPart{{
|
|
118
|
+
constructor(){{
|
|
119
|
+
}}
|
|
120
|
+
}};
|
|
110
121
|
const ScoreCollector = StructureSpawn;
|
|
111
122
|
""",
|
|
112
123
|
const.ARENA_BLUE: lambda: f"""
|
|
@@ -114,7 +125,10 @@ const ScoreCollector = StructureSpawn;
|
|
|
114
125
|
import {{ Flag, BodyPart}} from 'arena/season_{config.season}/capture_the_flag/basic';
|
|
115
126
|
""",
|
|
116
127
|
const.ARENA_RED: lambda: f"""
|
|
117
|
-
|
|
128
|
+
class BodyPart{{
|
|
129
|
+
constructor(){{
|
|
130
|
+
}}
|
|
131
|
+
}};
|
|
118
132
|
import {{ RESOURCE_SCORE, ScoreCollector, AreaEffect, EFFECT_DAMAGE, EFFECT_FREEZE }} from 'arena/season_{config.season}/collect_and_control/basic';
|
|
119
133
|
|
|
120
134
|
import ("arena/season_{config.season}/collect_and_control/basic")
|
|
@@ -122,7 +136,10 @@ import ("arena/season_{config.season}/collect_and_control/basic")
|
|
|
122
136
|
.catch((error) => {{ }});
|
|
123
137
|
""",
|
|
124
138
|
const.ARENA_GRAY: lambda: f"""
|
|
125
|
-
|
|
139
|
+
class BodyPart{{
|
|
140
|
+
constructor(){{
|
|
141
|
+
}}
|
|
142
|
+
}};
|
|
126
143
|
const ScoreCollector = StructureSpawn;
|
|
127
144
|
import("game/prototypes")
|
|
128
145
|
.then((module) => {{ const Flag = module.Flag; }})
|
|
@@ -340,6 +357,18 @@ class Compiler_Utils(Compiler_Const):
|
|
|
340
357
|
jsimps.append('./' + '.'.join(rel_path_nodes) + '.js')
|
|
341
358
|
return jsimps
|
|
342
359
|
|
|
360
|
+
# ---------- 自定义函数 ---------- #
|
|
361
|
+
@staticmethod
|
|
362
|
+
def stage_recursive_replace(content:str) -> str:
|
|
363
|
+
"""
|
|
364
|
+
替换'@recursive'为'@recursive(<fname>)', 其中<fname>为被装饰器标记的函数名 |
|
|
365
|
+
Replace '@recursive' with '@recursive(<fname>)', where <fname> is the name of the decorated function.
|
|
366
|
+
|
|
367
|
+
@\s*recursive\s+def\s+([^\s\(]+)
|
|
368
|
+
"""
|
|
369
|
+
return re.sub(r'@\s*recursive(\s+def\s+)([^\s\(]+)', r'@recursive("\2")\1\2', content)
|
|
370
|
+
|
|
371
|
+
|
|
343
372
|
|
|
344
373
|
class CompilerBase(Compiler_Utils):
|
|
345
374
|
|
|
@@ -550,6 +579,14 @@ class Compiler(CompilerBase):
|
|
|
550
579
|
with open(fpath, 'w', encoding='utf-8') as f:
|
|
551
580
|
f.write(new_content)
|
|
552
581
|
|
|
582
|
+
# ------------------------------------ 自定义 ------------------------------------ #
|
|
583
|
+
# 调用stage_recursive_replace
|
|
584
|
+
for fpath in py_fpath:
|
|
585
|
+
content = self.auto_read(fpath)
|
|
586
|
+
content = self.stage_recursive_replace(content)
|
|
587
|
+
with open(fpath, 'w', encoding='utf-8') as f:
|
|
588
|
+
f.write(content)
|
|
589
|
+
|
|
553
590
|
core.lprint(GREEN.format('[2/6]'), LOC_DONE, " ", LOC_PREPROCESSING_FINISH, sep="", head="\r", ln=config.language)
|
|
554
591
|
return _imports, _js_imports, _pre_sort_, _pre_define_, _js_replace_
|
|
555
592
|
|
pyscreeps_arena/core/config.py
CHANGED
pyscreeps_arena/core/const.py
CHANGED
pyscreeps_arena/project.7z
CHANGED
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
pyscreeps_arena/__init__.py,sha256=3O7Oa_IofW8YQYsnrU88SGYNxn-CMR-PpmV8P2hhEhc,800
|
|
2
|
+
pyscreeps_arena/build.py,sha256=DQeGLnID2FjpsWTbnqwt2cOp28olWK68U67bfbFJSOU,177
|
|
3
|
+
pyscreeps_arena/compiler.py,sha256=4rmFo4ah6GZl12wB3RrKqac_pmn_IYcX37rEpOzwYac,43203
|
|
4
|
+
pyscreeps_arena/localization.py,sha256=gBbrNybIJAHlkzeD6maF-ie6RKSwPBbnCNzg_1ge8-c,5656
|
|
5
|
+
pyscreeps_arena/project.7z,sha256=WgobRTq_uG0C-k9kn5kji0ug5sXmLyY6RWr8gMbCMdY,86873
|
|
6
|
+
pyscreeps_arena/core/__init__.py,sha256=qoP_rx1TpbDLJoTm5via4XPwEPaV1FXr1SYvoVoHGms,41
|
|
7
|
+
pyscreeps_arena/core/basic.py,sha256=DFvyDTsTXf2bQtnS9s254TrkshvRwajaHcvTyVvJyqw,2790
|
|
8
|
+
pyscreeps_arena/core/config.py,sha256=U38Z-GiIXPSiAsPKKmOw52AS35Q_tP018H1VUSX6APU,535
|
|
9
|
+
pyscreeps_arena/core/const.py,sha256=vGLNcjVX8ydpK_-RPdTAhtyzOsBErd_idzfORQfh6rU,552
|
|
10
|
+
pyscreeps_arena/core/core.py,sha256=3Nty8eLKPNgwnYk_sVNBPrWuKxBXI2od8nfEezsEAZQ,5157
|
|
11
|
+
pyscreeps_arena/core/main.py,sha256=-FNSOEjksNlDfCbUqsjtPSUW8vT3qxEdfzXqT5Tdsik,170
|
|
12
|
+
pyscreeps_arena/core/utils.py,sha256=N9OOkORvrqnJakayaFp9qyS0apWhB9lBK4xyyYkhFdo,215
|
|
13
|
+
pyscreeps_arena-0.3.6.dist-info/METADATA,sha256=5Ja6mnFYo-VlmhkVf6JWH_yVDXWg-592FbkpykfmaL8,2079
|
|
14
|
+
pyscreeps_arena-0.3.6.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
15
|
+
pyscreeps_arena-0.3.6.dist-info/entry_points.txt,sha256=dqhZN327jfcNypYjEaEJ2t-ABUZ0sVhtDDrD7GiJBfo,67
|
|
16
|
+
pyscreeps_arena-0.3.6.dist-info/top_level.txt,sha256=l4uLyMR2NOy41ngBMh795jOHTFk3tgYKy64-9cgjVng,16
|
|
17
|
+
pyscreeps_arena-0.3.6.dist-info/RECORD,,
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
pyscreeps_arena/__init__.py,sha256=3O7Oa_IofW8YQYsnrU88SGYNxn-CMR-PpmV8P2hhEhc,800
|
|
2
|
-
pyscreeps_arena/build.py,sha256=DQeGLnID2FjpsWTbnqwt2cOp28olWK68U67bfbFJSOU,177
|
|
3
|
-
pyscreeps_arena/compiler.py,sha256=9bWvE1Vjmhb_TU1GBPsY5ByYQLXp9iDYJURHrhfGKpM,41907
|
|
4
|
-
pyscreeps_arena/localization.py,sha256=gBbrNybIJAHlkzeD6maF-ie6RKSwPBbnCNzg_1ge8-c,5656
|
|
5
|
-
pyscreeps_arena/project.7z,sha256=4J3_zoiDu7GUqunY66IZCj4M854RV2SbOBZ9BxN0028,72346
|
|
6
|
-
pyscreeps_arena/core/__init__.py,sha256=qoP_rx1TpbDLJoTm5via4XPwEPaV1FXr1SYvoVoHGms,41
|
|
7
|
-
pyscreeps_arena/core/basic.py,sha256=DFvyDTsTXf2bQtnS9s254TrkshvRwajaHcvTyVvJyqw,2790
|
|
8
|
-
pyscreeps_arena/core/config.py,sha256=7GXJ82BgXwaZK6H5RHNqovAS5q4HQvl4hL_7-cBWOio,518
|
|
9
|
-
pyscreeps_arena/core/const.py,sha256=gWEirCplAKHbFSDC6nyTZee2zpnKk2Q7Ym1PW3DYY0c,554
|
|
10
|
-
pyscreeps_arena/core/core.py,sha256=3Nty8eLKPNgwnYk_sVNBPrWuKxBXI2od8nfEezsEAZQ,5157
|
|
11
|
-
pyscreeps_arena/core/main.py,sha256=-FNSOEjksNlDfCbUqsjtPSUW8vT3qxEdfzXqT5Tdsik,170
|
|
12
|
-
pyscreeps_arena/core/utils.py,sha256=N9OOkORvrqnJakayaFp9qyS0apWhB9lBK4xyyYkhFdo,215
|
|
13
|
-
pyscreeps_arena-0.3.3a0.dist-info/METADATA,sha256=Xrm_q9c1yu1sRmV4ij9O7xMtU2oNjr3i_HVjaBXIjaU,2081
|
|
14
|
-
pyscreeps_arena-0.3.3a0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
15
|
-
pyscreeps_arena-0.3.3a0.dist-info/entry_points.txt,sha256=dqhZN327jfcNypYjEaEJ2t-ABUZ0sVhtDDrD7GiJBfo,67
|
|
16
|
-
pyscreeps_arena-0.3.3a0.dist-info/top_level.txt,sha256=l4uLyMR2NOy41ngBMh795jOHTFk3tgYKy64-9cgjVng,16
|
|
17
|
-
pyscreeps_arena-0.3.3a0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|