aboutsummaryrefslogtreecommitdiff
path: root/codegen/lib
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2023-02-21 21:46:30 -0600
committermat <github@matdoes.dev>2023-02-21 21:46:41 -0600
commit66094921c88e80187a712dca39e421a648d69198 (patch)
tree8119fb9c5617545cb67f84603327e3a06cfc04cb /codegen/lib
parent6942e3547b85c9c6a63d72ce8bf5fbf33af01d4e (diff)
downloadazalea-drasl-66094921c88e80187a712dca39e421a648d69198.tar.xz
make metadata components clonable
Diffstat (limited to 'codegen/lib')
-rw-r--r--codegen/lib/code/entity.py4
-rwxr-xr-xcodegen/lib/extract.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/codegen/lib/code/entity.py b/codegen/lib/code/entity.py
index 750b7ca3..250b7e70 100644
--- a/codegen/lib/code/entity.py
+++ b/codegen/lib/code/entity.py
@@ -162,14 +162,14 @@ impl From<EntityDataValue> for UpdateMetadataError {
metadata_type_data = metadata_types[type_id]
rust_type = metadata_type_data['type']
- code.append(f'#[derive(Component, Deref, DerefMut)]')
+ code.append(f'#[derive(Component, Deref, DerefMut, Clone)]')
code.append(f'pub struct {struct_name}(pub {rust_type});')
else:
# if it's a bitfield just make a struct for each bit
for mask, name in name_or_bitfield.items():
name = maybe_rename_field(name, index)
struct_name = upper_first_letter(to_camel_case(name))
- code.append(f'#[derive(Component, Deref, DerefMut)]')
+ code.append(f'#[derive(Component, Deref, DerefMut, Clone, Copy)]')
code.append(f'pub struct {struct_name}(pub bool);')
# add the entity struct and Bundle struct
diff --git a/codegen/lib/extract.py b/codegen/lib/extract.py
index 09035e86..6bf2d57f 100755
--- a/codegen/lib/extract.py
+++ b/codegen/lib/extract.py
@@ -54,7 +54,7 @@ def determine_python_command():
def try_python_command(version):
return os.system(f'{version} --version') == 0
- for version in ('python3.9', 'python3.8', 'python3', 'python'):
+ for version in (sys.executable, 'python3.9', 'python3.8', 'python3', 'python'):
if try_python_command(version):
python_command = version
return version