aboutsummaryrefslogtreecommitdiff
path: root/NeoRuntime/Runtime/luxcena_neo/neo_behaviour.py
diff options
context:
space:
mode:
authorJakob Stendahl <jakobste@uio.no>2021-10-03 20:01:31 +0200
committerJakob Stendahl <jakobste@uio.no>2021-10-03 20:01:31 +0200
commit4850c11d87df287beacf5a5bd9012f7b54f13566 (patch)
tree549f08a23a4fe87a07ec17885016696e829ca50b /NeoRuntime/Runtime/luxcena_neo/neo_behaviour.py
parent950d093ca54366ce49164370325062afd061cf9d (diff)
downloadLuxcena-Neo-4850c11d87df287beacf5a5bd9012f7b54f13566.tar.gz
Luxcena-Neo-4850c11d87df287beacf5a5bd9012f7b54f13566.zip
:sprakles: Add BooleanVariable
Diffstat (limited to 'NeoRuntime/Runtime/luxcena_neo/neo_behaviour.py')
-rw-r--r--NeoRuntime/Runtime/luxcena_neo/neo_behaviour.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/NeoRuntime/Runtime/luxcena_neo/neo_behaviour.py b/NeoRuntime/Runtime/luxcena_neo/neo_behaviour.py
index 66678c4..dc4609c 100644
--- a/NeoRuntime/Runtime/luxcena_neo/neo_behaviour.py
+++ b/NeoRuntime/Runtime/luxcena_neo/neo_behaviour.py
@@ -55,6 +55,7 @@ class VariableType(Enum):
INT = 2
FLOAT = 3
COLOR = 4
+ BOOL = 5
class Variables:
@@ -248,3 +249,17 @@ class FloatVariable(Variable):
def to_dict(self):
return {"name": self.name, "value": self.value, "type": self.var_type, "min": self.__min, "max": self.__max}
+
+
+
+class BooleanVariable(Variable):
+
+ def __init__(self, name: str, default: bool, **kwargs):
+ super().__init__(name, default, VariableType.BOOL)
+
+ @Variable.value.setter
+ def value(self, value):
+ try:
+ value = bool(value)
+ except:
+ print(f"Attempted to set {self.name} to \"{value}\", which is not a valid bool...")