From 07a899ad61e292260bd8aff4ca73217662a323d6 Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Wed, 13 Oct 2021 08:12:38 +0200 Subject: :lipstick: Add Trigger variable, fix small UI bug --- NeoRuntime/Runtime/luxcena_neo/neo_behaviour.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'NeoRuntime') diff --git a/NeoRuntime/Runtime/luxcena_neo/neo_behaviour.py b/NeoRuntime/Runtime/luxcena_neo/neo_behaviour.py index 4da3093..6ae58fe 100644 --- a/NeoRuntime/Runtime/luxcena_neo/neo_behaviour.py +++ b/NeoRuntime/Runtime/luxcena_neo/neo_behaviour.py @@ -56,6 +56,7 @@ class VariableType(Enum): FLOAT = 3 COLOR = 4 BOOL = 5 + TRIGGER = 6 class Variables: @@ -264,3 +265,17 @@ class BooleanVariable(Variable): super(BooleanVariable, type(self)).value.fset(self, value) except: print("Attempted to set {} to \"{}\", which is not a valid bool...".format(self.name, value)) + +class Trigger(self): + + def __init__(self, name: str, **kwargs): + super().__init__(name, False, VariableType.TRIGGER, **kwargs) + + @Variable.value.setter + def value(self, value): + try: + value = bool(value) + if value: value = False + super(BooleanVariable, type(self)).value.fset(self, value) + except: + print("Attempted to set {} to \"{}\", which is not a valid bool...".format(self.name, value)) \ No newline at end of file -- cgit v1.2.3