pyscreeps-arena 0.3.5__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 +27 -2
- pyscreeps_arena/core/const.py +1 -1
- {pyscreeps_arena-0.3.5.dist-info → pyscreeps_arena-0.3.6.dist-info}/METADATA +1 -1
- {pyscreeps_arena-0.3.5.dist-info → pyscreeps_arena-0.3.6.dist-info}/RECORD +7 -7
- {pyscreeps_arena-0.3.5.dist-info → pyscreeps_arena-0.3.6.dist-info}/WHEEL +0 -0
- {pyscreeps_arena-0.3.5.dist-info → pyscreeps_arena-0.3.6.dist-info}/entry_points.txt +0 -0
- {pyscreeps_arena-0.3.5.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 = """
|
|
@@ -59,16 +59,21 @@ export var sch = Scheduler();
|
|
|
59
59
|
var monitor = Monitor(2);
|
|
60
60
|
know.now = 0;
|
|
61
61
|
|
|
62
|
+
_SchedulerMeta.__types__ = []; // 清空js首次构造时引入的数据
|
|
63
|
+
_StageMachineMeta.__recursive__ = []; // 清空js首次构造时引入的数据
|
|
62
64
|
__init_my_exists_creep_before_k__();
|
|
63
65
|
export var loop = function () {
|
|
64
66
|
know.now = get.ticks ();
|
|
65
|
-
know.
|
|
67
|
+
know.handle();
|
|
66
68
|
if (know.now === 1) {
|
|
67
69
|
std.show_welcome();
|
|
68
70
|
init (know);
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
monitor.handle();
|
|
74
|
+
for (const creep of know._creeps){
|
|
75
|
+
creep.motion.handle();
|
|
76
|
+
}
|
|
72
77
|
step (know);
|
|
73
78
|
sch.handle();
|
|
74
79
|
std.show_usage ();
|
|
@@ -352,6 +357,18 @@ class Compiler_Utils(Compiler_Const):
|
|
|
352
357
|
jsimps.append('./' + '.'.join(rel_path_nodes) + '.js')
|
|
353
358
|
return jsimps
|
|
354
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
|
+
|
|
355
372
|
|
|
356
373
|
class CompilerBase(Compiler_Utils):
|
|
357
374
|
|
|
@@ -562,6 +579,14 @@ class Compiler(CompilerBase):
|
|
|
562
579
|
with open(fpath, 'w', encoding='utf-8') as f:
|
|
563
580
|
f.write(new_content)
|
|
564
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
|
+
|
|
565
590
|
core.lprint(GREEN.format('[2/6]'), LOC_DONE, " ", LOC_PREPROCESSING_FINISH, sep="", head="\r", ln=config.language)
|
|
566
591
|
return _imports, _js_imports, _pre_sort_, _pre_define_, _js_replace_
|
|
567
592
|
|
pyscreeps_arena/core/const.py
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
pyscreeps_arena/__init__.py,sha256=3O7Oa_IofW8YQYsnrU88SGYNxn-CMR-PpmV8P2hhEhc,800
|
|
2
2
|
pyscreeps_arena/build.py,sha256=DQeGLnID2FjpsWTbnqwt2cOp28olWK68U67bfbFJSOU,177
|
|
3
|
-
pyscreeps_arena/compiler.py,sha256=
|
|
3
|
+
pyscreeps_arena/compiler.py,sha256=4rmFo4ah6GZl12wB3RrKqac_pmn_IYcX37rEpOzwYac,43203
|
|
4
4
|
pyscreeps_arena/localization.py,sha256=gBbrNybIJAHlkzeD6maF-ie6RKSwPBbnCNzg_1ge8-c,5656
|
|
5
5
|
pyscreeps_arena/project.7z,sha256=WgobRTq_uG0C-k9kn5kji0ug5sXmLyY6RWr8gMbCMdY,86873
|
|
6
6
|
pyscreeps_arena/core/__init__.py,sha256=qoP_rx1TpbDLJoTm5via4XPwEPaV1FXr1SYvoVoHGms,41
|
|
7
7
|
pyscreeps_arena/core/basic.py,sha256=DFvyDTsTXf2bQtnS9s254TrkshvRwajaHcvTyVvJyqw,2790
|
|
8
8
|
pyscreeps_arena/core/config.py,sha256=U38Z-GiIXPSiAsPKKmOw52AS35Q_tP018H1VUSX6APU,535
|
|
9
|
-
pyscreeps_arena/core/const.py,sha256=
|
|
9
|
+
pyscreeps_arena/core/const.py,sha256=vGLNcjVX8ydpK_-RPdTAhtyzOsBErd_idzfORQfh6rU,552
|
|
10
10
|
pyscreeps_arena/core/core.py,sha256=3Nty8eLKPNgwnYk_sVNBPrWuKxBXI2od8nfEezsEAZQ,5157
|
|
11
11
|
pyscreeps_arena/core/main.py,sha256=-FNSOEjksNlDfCbUqsjtPSUW8vT3qxEdfzXqT5Tdsik,170
|
|
12
12
|
pyscreeps_arena/core/utils.py,sha256=N9OOkORvrqnJakayaFp9qyS0apWhB9lBK4xyyYkhFdo,215
|
|
13
|
-
pyscreeps_arena-0.3.
|
|
14
|
-
pyscreeps_arena-0.3.
|
|
15
|
-
pyscreeps_arena-0.3.
|
|
16
|
-
pyscreeps_arena-0.3.
|
|
17
|
-
pyscreeps_arena-0.3.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|