dfpyre 0.7.0__py3-none-any.whl → 0.7.2__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.
Potentially problematic release.
This version of dfpyre might be problematic. Click here for more details.
- dfpyre/actiondump.py +6 -1
- dfpyre/items.py +4 -4
- dfpyre/pyre.py +12 -10
- dfpyre/scriptgen.py +1 -3
- {dfpyre-0.7.0.dist-info → dfpyre-0.7.2.dist-info}/METADATA +1 -1
- dfpyre-0.7.2.dist-info/RECORD +12 -0
- dfpyre-0.7.0.dist-info/RECORD +0 -12
- {dfpyre-0.7.0.dist-info → dfpyre-0.7.2.dist-info}/LICENSE +0 -0
- {dfpyre-0.7.0.dist-info → dfpyre-0.7.2.dist-info}/WHEEL +0 -0
dfpyre/actiondump.py
CHANGED
|
@@ -15,7 +15,7 @@ CODEBLOCK_NAME_LOOKUP = {
|
|
|
15
15
|
'IF GAME': 'if_game',
|
|
16
16
|
'IF VARIABLE': 'if_var',
|
|
17
17
|
'REPEAT': 'repeat',
|
|
18
|
-
'SELECT OBJECT': '
|
|
18
|
+
'SELECT OBJECT': 'select_obj',
|
|
19
19
|
'CONTROL': 'control',
|
|
20
20
|
'PLAYER EVENT': 'event',
|
|
21
21
|
'ENTITY EVENT': 'entity_event',
|
|
@@ -59,6 +59,11 @@ def parse_actiondump():
|
|
|
59
59
|
|
|
60
60
|
codeblock_name = CODEBLOCK_NAME_LOOKUP[action_data['codeblockName']]
|
|
61
61
|
codeblock_data[codeblock_name][action_data['name']] = parsed_action_data
|
|
62
|
+
if aliases := action_data['aliases']:
|
|
63
|
+
alias_data = parsed_action_data.copy()
|
|
64
|
+
alias_data['alias'] = action_data['name']
|
|
65
|
+
for alias in aliases:
|
|
66
|
+
codeblock_data[codeblock_name][alias] = alias_data
|
|
62
67
|
|
|
63
68
|
return codeblock_data
|
|
64
69
|
|
dfpyre/items.py
CHANGED
|
@@ -363,10 +363,10 @@ def item_from_dict(item_dict: dict) -> object:
|
|
|
363
363
|
note = _some_or(item_data.get('note'), '')
|
|
364
364
|
param_type = ParameterType(PARAMETER_TYPE_LOOKUP.index(item_data['type']))
|
|
365
365
|
if item_data['optional']:
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
return
|
|
366
|
+
if 'default_value' in item_data:
|
|
367
|
+
return parameter(item_data['name'], param_type, item_data['plural'], True, description, note, item_from_dict(item_data['default_value']))
|
|
368
|
+
return parameter(item_data['name'], param_type, item_data['plural'], True, description, note)
|
|
369
|
+
return parameter(item_data['name'], param_type, item_data['plural'], False, description, note)
|
|
370
370
|
elif item_id in {'bl_tag', 'hint'}:
|
|
371
371
|
return
|
|
372
372
|
else:
|
dfpyre/pyre.py
CHANGED
|
@@ -19,7 +19,7 @@ from dfpyre.actiondump import CODEBLOCK_DATA, get_default_tags
|
|
|
19
19
|
|
|
20
20
|
VARIABLE_TYPES = {'txt', 'comp', 'num', 'item', 'loc', 'var', 'snd', 'part', 'pot', 'g_val', 'vec', 'pn_el'}
|
|
21
21
|
TEMPLATE_STARTERS = {'event', 'entity_event', 'func', 'process'}
|
|
22
|
-
|
|
22
|
+
DYNAMIC_CODEBLOCKS = {'func', 'process', 'call_func', 'start_process'}
|
|
23
23
|
|
|
24
24
|
TARGETS = ['Selection', 'Default', 'Killer', 'Damager', 'Shooter', 'Victim', 'AllPlayers', 'Projectile', 'AllEntities', 'AllMobs', 'LastEntity']
|
|
25
25
|
TARGET_CODEBLOCKS = {'player_action', 'entity_action', 'if_player', 'if_entity'}
|
|
@@ -55,7 +55,7 @@ class CodeBlock:
|
|
|
55
55
|
self.tags = tags
|
|
56
56
|
|
|
57
57
|
def __repr__(self) -> str:
|
|
58
|
-
if self.name in
|
|
58
|
+
if self.name in DYNAMIC_CODEBLOCKS:
|
|
59
59
|
if self.name == 'else':
|
|
60
60
|
return 'CodeBlock(else)'
|
|
61
61
|
return f'CodeBlock({self.name}, {self.data["data"]})'
|
|
@@ -78,7 +78,7 @@ class CodeBlock:
|
|
|
78
78
|
final_args = [arg.format(slot) for slot, arg in enumerate(self.args) if arg.type in VARIABLE_TYPES]
|
|
79
79
|
|
|
80
80
|
# check for unrecognized name, add tags
|
|
81
|
-
if codeblock_type is not None
|
|
81
|
+
if codeblock_type is not None and codeblock_type != 'else':
|
|
82
82
|
if self.name not in CODEBLOCK_DATA[codeblock_type]:
|
|
83
83
|
_warn_unrecognized_name(codeblock_type, self.name)
|
|
84
84
|
elif include_tags:
|
|
@@ -227,16 +227,18 @@ class DFTemplate:
|
|
|
227
227
|
args.append(parsed_item)
|
|
228
228
|
target = Target(TARGETS.index(block_dict['target'])) if 'target' in block_dict else DEFAULT_TARGET
|
|
229
229
|
|
|
230
|
-
|
|
231
|
-
if 'block'
|
|
232
|
-
|
|
230
|
+
codeblock_action = 'bracket'
|
|
231
|
+
if block_dict.get('block') == 'else':
|
|
232
|
+
codeblock_action = 'else'
|
|
233
|
+
elif block_dict.get('block') in DYNAMIC_CODEBLOCKS:
|
|
234
|
+
codeblock_action = 'dynamic'
|
|
233
235
|
elif 'action' in block_dict:
|
|
234
|
-
|
|
236
|
+
codeblock_action = block_dict['action']
|
|
235
237
|
|
|
236
|
-
if
|
|
237
|
-
codeblock = CodeBlock(
|
|
238
|
+
if codeblock_action == 'bracket' or block_dict['block'] == 'else':
|
|
239
|
+
codeblock = CodeBlock(codeblock_action, data=block_dict)
|
|
238
240
|
else:
|
|
239
|
-
codeblock = CodeBlock(
|
|
241
|
+
codeblock = CodeBlock(codeblock_action, args, target, block_dict, tags=block_tags)
|
|
240
242
|
template.codeblocks.append(codeblock)
|
|
241
243
|
|
|
242
244
|
return template
|
dfpyre/scriptgen.py
CHANGED
|
@@ -29,7 +29,6 @@ TEMPLATE_METHOD_LOOKUP = {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
TARGET_CODEBLOCKS = {'player_action', 'entity_action', 'if_player', 'if_entity'}
|
|
32
|
-
SINGLE_NAME_CODEBLOCKS = {'func', 'process', 'call_func', 'start_process'}
|
|
33
32
|
VAR_SCOPES = {'unsaved': 'g', 'saved': 's', 'local': 'l', 'line': 'i'}
|
|
34
33
|
|
|
35
34
|
|
|
@@ -134,7 +133,7 @@ def generate_script(template, flags: GeneratorFlags) -> str:
|
|
|
134
133
|
|
|
135
134
|
method_name = TEMPLATE_METHOD_LOOKUP[codeblock.data['block']]
|
|
136
135
|
method_args = [f'"{codeblock.name}"']
|
|
137
|
-
if codeblock.name
|
|
136
|
+
if codeblock.name == 'dynamic':
|
|
138
137
|
method_args[0] = f'"{codeblock.data["data"]}"'
|
|
139
138
|
|
|
140
139
|
codeblock_args = [argument_item_to_string(flags, i) for i in codeblock.args]
|
|
@@ -143,7 +142,6 @@ def generate_script(template, flags: GeneratorFlags) -> str:
|
|
|
143
142
|
if method_name in TARGET_CODEBLOCKS and codeblock.target.name != 'SELECTION':
|
|
144
143
|
method_args.append(f'target=Target.{codeblock.target.name}')
|
|
145
144
|
if codeblock.tags:
|
|
146
|
-
print(codeblock.tags)
|
|
147
145
|
default_tags = get_default_tags(codeblock.data.get('block'), codeblock.name)
|
|
148
146
|
written_tags = {t: o for t, o in codeblock.tags.items() if default_tags[t] != o}
|
|
149
147
|
if written_tags:
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
dfpyre/__init__.py,sha256=apPsSxJ1Tztfl71MoORoSmDfX7LyKLYlLwOGeLQUitw,25
|
|
2
|
+
dfpyre/actiondump.py,sha256=MVI1kVJBNpab882Tgqo-xtemiBN2W1_2OcopBcRupWQ,2587
|
|
3
|
+
dfpyre/data/actiondump_min.json,sha256=OOSlKqWffFf9dJbY7Kj8uCRz3d6CZPMEWkSpX2-Avqs,1785020
|
|
4
|
+
dfpyre/items.py,sha256=StQnkvGAZj3mb7qG3bMyuuiRaSIttyW1Azs139e5c_4,11374
|
|
5
|
+
dfpyre/pyre.py,sha256=snx65yM0ysuBfV4Qe6zEKK9aw0jNmPsPgv7v8XIsSVw,18216
|
|
6
|
+
dfpyre/scriptgen.py,sha256=fHjf7KVpz6iPr97Co-6BeacVVwcpVRfHd3g_ez3jnNM,5875
|
|
7
|
+
dfpyre/style.py,sha256=mLW1CFvvi8_9fk8JaH10I5S4WI0YBdQIXHtI3G_4sR8,980
|
|
8
|
+
dfpyre/util.py,sha256=gHIPPVD0dcLPAaN1M5EnNgxenarwlxfRKN4xno1YJHM,582
|
|
9
|
+
dfpyre-0.7.2.dist-info/LICENSE,sha256=_vuDskB0ja2c-Fgm7Gt8Q8cO9NsLNpZAVyvmZwX7E6o,1060
|
|
10
|
+
dfpyre-0.7.2.dist-info/METADATA,sha256=mmwlWG_tcoqYC9aWo_rqfT7vO5BIa1_MB5waCL9Z-HE,11754
|
|
11
|
+
dfpyre-0.7.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
12
|
+
dfpyre-0.7.2.dist-info/RECORD,,
|
dfpyre-0.7.0.dist-info/RECORD
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
dfpyre/__init__.py,sha256=apPsSxJ1Tztfl71MoORoSmDfX7LyKLYlLwOGeLQUitw,25
|
|
2
|
-
dfpyre/actiondump.py,sha256=1MrZfH3m9FdwLGjEHZ14h8J6mAbAvFUVt9-UubSt6KY,2338
|
|
3
|
-
dfpyre/data/actiondump_min.json,sha256=OOSlKqWffFf9dJbY7Kj8uCRz3d6CZPMEWkSpX2-Avqs,1785020
|
|
4
|
-
dfpyre/items.py,sha256=94-TM8NY6GyGkx4KeMGy3BUluQUcWXjGcLHKwzDfDWE,11260
|
|
5
|
-
dfpyre/pyre.py,sha256=JHxB4ILWUhyd2U1tdol3MJCR-3H3nsD2nllTD7wgngs,18149
|
|
6
|
-
dfpyre/scriptgen.py,sha256=s2zmBuGFtKGfq8oVKcWMHC9rBh9d5_oa2zwGi2b719E,5997
|
|
7
|
-
dfpyre/style.py,sha256=mLW1CFvvi8_9fk8JaH10I5S4WI0YBdQIXHtI3G_4sR8,980
|
|
8
|
-
dfpyre/util.py,sha256=gHIPPVD0dcLPAaN1M5EnNgxenarwlxfRKN4xno1YJHM,582
|
|
9
|
-
dfpyre-0.7.0.dist-info/LICENSE,sha256=_vuDskB0ja2c-Fgm7Gt8Q8cO9NsLNpZAVyvmZwX7E6o,1060
|
|
10
|
-
dfpyre-0.7.0.dist-info/METADATA,sha256=xB34ssdHq_fLqmWpjr-iZ4UviWUsweOZoLU4dFHG340,11754
|
|
11
|
-
dfpyre-0.7.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
12
|
-
dfpyre-0.7.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|