From b3c64a8e17fd635bdd9b5eb2c6490e65e2d5803f Mon Sep 17 00:00:00 2001 From: Devin Bidwell Date: Sun, 23 Nov 2025 00:24:15 -0700 Subject: [PATCH] Added loadBatch and loadBatchNamed to the parser --- libs/parser/src/lib.rs | 30 ++++++++++++++++++++++++++++++ libs/parser/src/sys_call.rs | 8 ++++++++ 2 files changed, 38 insertions(+) diff --git a/libs/parser/src/lib.rs b/libs/parser/src/lib.rs index 63b5b32..06fbecd 100644 --- a/libs/parser/src/lib.rs +++ b/libs/parser/src/lib.rs @@ -758,6 +758,36 @@ impl Parser { LiteralOrVariable::Variable(variable.clone()), ))) } + "loadBatch" => { + check_length(self, &invocation.arguments, 3)?; + let mut args = invocation.arguments.iter(); + + let device_hash = literal_or_variable!(args.next()); + let logic_type = get_arg!(Literal, literal_or_variable!(args.next())); + let batch_mode = get_arg!(Literal, literal_or_variable!(args.next())); + + Ok(SysCall::System(sys_call::System::LoadBatch( + device_hash, + logic_type, + batch_mode, + ))) + } + "loadBatchNamed" => { + check_length(self, &invocation.arguments, 4)?; + let mut args = invocation.arguments.iter(); + + let device_hash = literal_or_variable!(args.next()); + let name_hash = get_arg!(Literal, literal_or_variable!(args.next())); + let logic_type = get_arg!(Literal, literal_or_variable!(args.next())); + let batch_mode = get_arg!(Literal, literal_or_variable!(args.next())); + + Ok(SysCall::System(sys_call::System::LoadBatchNamed( + device_hash, + name_hash, + logic_type, + batch_mode, + ))) + } "setOnDevice" => { check_length(self, &invocation.arguments, 3)?; let mut args = invocation.arguments.iter(); diff --git a/libs/parser/src/sys_call.rs b/libs/parser/src/sys_call.rs index 38a40ae..cb306ca 100644 --- a/libs/parser/src/sys_call.rs +++ b/libs/parser/src/sys_call.rs @@ -121,6 +121,13 @@ pub enum System { /// ## Examples /// lbn r0 HASH("StructureWallLight") HASH("wallLight") On Minimum LoadBatchNamed(LiteralOrVariable, Literal, Literal, Literal), + /// Loads a LogicType from all connected network devices, aggregating them via a + /// batchMode + /// ## In Game + /// lb r? deviceHash loggicType batchMode + /// ## Examples + /// lb r0 HASH("StructureWallLight") On Minimum + LoadBatch(LiteralOrVariable, Literal, Literal), /// Represents a function which stores a setting into a specific device. /// ## In Game /// `s d? logicType r?` @@ -136,6 +143,7 @@ impl std::fmt::Display for System { System::Sleep(a) => write!(f, "sleep({})", a), System::Hash(a) => write!(f, "HASH({})", a), System::LoadFromDevice(a, b) => write!(f, "loadFromDevice({}, {})", a, b), + System::LoadBatch(a, b, c) => write!(f, "loadBatch({}, {}, {})", a, b, c), System::LoadBatchNamed(a, b, c, d) => { write!(f, "loadBatchNamed({}, {}, {}, {})", a, b, c, d) }