Skip to main content

scratch_test_model/blocks/
comparisons.rs

1use scratch_test_model_proc::Block;
2
3use crate::attrs::{
4    ArgumentReporterName, Color, DirectDropdownOf, Expression, ExpressionRef, List, RefBlock,
5    RoundDropdownMenuOf,
6    dropdowns::{SensingKeyoptions, SensingTouchingobject},
7};
8
9#[derive(Debug, PartialEq, Block, Clone)]
10#[block(default_location = inputs)]
11pub enum CmpBlockKind {
12    ArgumentReporterBoolean {
13        #[block(location = fields)]
14        value: ArgumentReporterName,
15    },
16
17    OperatorAnd {
18        operand1: Option<RefBlock<CmpBlockKind>>,
19        operand2: Option<RefBlock<CmpBlockKind>>,
20    },
21    OperatorOr {
22        operand1: Option<RefBlock<CmpBlockKind>>,
23        operand2: Option<RefBlock<CmpBlockKind>>,
24    },
25    OperatorNot {
26        /// reference to boolean expression that should be negated
27        operand: Option<RefBlock<CmpBlockKind>>,
28    },
29    OperatorGt {
30        operand1: Expression,
31        operand2: Expression,
32    },
33    OperatorLt {
34        operand1: Expression,
35        operand2: Expression,
36    },
37    OperatorEquals {
38        operand1: Expression,
39        operand2: Expression,
40    },
41    OperatorContains {
42        string1: Expression,
43        string2: Expression,
44    },
45
46    DataListcontainsitem {
47        #[block(location = fields)]
48        list: List,
49        item: Expression,
50    },
51
52    SensingColoristouchingcolor {
53        color: either::Either<Color, ExpressionRef>,
54        color2: either::Either<Color, ExpressionRef>,
55    },
56    SensingKeyoptions {
57        #[block(location = fields)]
58        key_option: DirectDropdownOf<svalue::ARc<str>>,
59    },
60    SensingKeypressed {
61        key_option: RoundDropdownMenuOf<SensingKeyoptions>,
62    },
63    SensingMousedown,
64    SensingTouchingobject {
65        #[block(json_name = "TOUCHINGOBJECTMENU")]
66        object: RoundDropdownMenuOf<SensingTouchingobject>,
67    },
68    SensingTouchingcolor {
69        color: either::Either<Color, ExpressionRef>,
70    },
71}