mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-20 20:35:43 +01:00
feat: implement some
This commit is contained in:
1 parent
15172e8b33
commit
be4af0bf84
5 files changed
+254
-16
No files matched your search
@@ -22,18 +22,24 @@ export function computeCharacteristics(
|
||||
throw new Error(`${name} not computed yet`);
|
||||
}
|
||||
|
||||
function attribute(name: TankAttributeChange_AttributeName) {
|
||||
function attributeSafe(name: TankAttributeChange_AttributeName) {
|
||||
const attribute = parameters.attributes.find(
|
||||
(attribute) => attribute.attribute_name === name
|
||||
);
|
||||
|
||||
if (!attribute) {
|
||||
return attribute ? attribute.value : null;
|
||||
}
|
||||
|
||||
function attribute(name: TankAttributeChange_AttributeName) {
|
||||
const attribute = attributeSafe(name);
|
||||
|
||||
if (attribute === null) {
|
||||
throw new Error(
|
||||
`Attribute ${TankAttributeChange_AttributeName[name]} (${name}) not found`
|
||||
);
|
||||
}
|
||||
|
||||
return attribute.value;
|
||||
return attribute;
|
||||
}
|
||||
|
||||
function shellSafe(name: ShellUpgrageSingleChange_AttributeName) {
|
||||
@@ -71,6 +77,7 @@ export function computeCharacteristics(
|
||||
const value = characteristics[name]({
|
||||
characteristic,
|
||||
attribute,
|
||||
attributeSafe,
|
||||
shell,
|
||||
shellSafe,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user