enshwick 1.0.0-alpha.11

The Enshwick Loader's modding API for Enshrouded: the one crate mods are written against
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
//! Effects in the server's world: game events a mod raises, teleports and
//! spawns.
//!
//! An event goes where the game's own events go: the loader puts it into
//! the stream the engine moves at the start of the next step, and the
//! systems that read its type act on it as on one the game raised. Only
//! types the server's own systems raise are allowed, each with a typed call
//! here; the loader refuses any other. A teleport is the game's admin
//! teleport: the entity moves after the next step, and clients see it jump.
//! A spawn is the game's admin spawn: the new entity's id comes back at
//! once, and the entity is in the world after the next step.
//!
//! Every call belongs on the server's game thread, from a game event, a
//! [`Scheduler`](crate::schedule::Scheduler) task or an action; on a client,
//! while it hosts a game.
//!
//! Teleports and pings need the `unstable` feature and may change in any
//! release: whether a client keeps a teleported player where the server put
//! it, and whether it shows a ping the server raised, are not yet seen in
//! the running game.
//!
//! # Examples
//!
//! ```
//! use enshwick::Entity;
//! use enshwick::effects::Effects;
//!
//! fn alarm(effects: &Effects, sender: Entity, signal: u32) -> Result<(), enshwick::WorldError> {
//!     effects.set_toggle(sender, signal, true)
//! }
//!
//! fn init(load: &mut enshwick::Load<'_>) -> Result<Effects, enshwick::Off> {
//!     Ok(load.effects())
//! }
//! ```

use crate::Entity;
use crate::WorldError;
#[cfg(feature = "unstable")]
use crate::abi::TeleportRequest;
use crate::abi::{Header, SpawnRequest};
use crate::engine_ids as ids;
use crate::game_events::{EventType, Field, Scalar};
use crate::{Host, Load, Off};

/// How an entity arrives, for [`Effects::teleport`].
///
/// Unstable: needs the `unstable` feature and may change in any release.
///
/// # Examples
///
/// See [`Effects::teleport`].
#[cfg(feature = "unstable")]
#[derive(Clone, Copy, Debug, Default, PartialEq)]
#[non_exhaustive]
pub struct Teleport {
    /// Let the game look for a free spot near the target to stand on, as it
    /// does for respawns.
    pub search_best_spawn_position: bool,
    /// The orientation to arrive in, a quaternion `x, y, z, w`; `None`
    /// keeps the entity's own. The name is enshwick's: the game takes a
    /// whole arrival transform.
    pub facing: Option<[f32; 4]>,
}

#[cfg(feature = "unstable")]
impl Teleport {
    /// Straight to the target, keeping the entity's orientation.
    ///
    /// # Examples
    ///
    /// See [`Effects::teleport`].
    #[must_use]
    pub const fn new() -> Self {
        Self {
            search_best_spawn_position: false,
            facing: None,
        }
    }

    /// Let the game find a free spot near the target.
    ///
    /// # Examples
    ///
    /// See [`Effects::teleport`].
    #[must_use]
    pub const fn search_best_spawn_position(mut self) -> Self {
        self.search_best_spawn_position = true;
        self
    }

    /// Arrive facing `yaw` radians about the vertical axis.
    ///
    /// # Examples
    ///
    /// ```
    /// use enshwick::effects::Teleport;
    ///
    /// let north = Teleport::new().facing_yaw(0.0);
    /// assert_eq!(north.facing, Some([0.0, 0.0, 0.0, 1.0]));
    /// ```
    #[must_use]
    pub fn facing_yaw(mut self, yaw: f32) -> Self {
        let half = yaw / 2.0;
        self.facing = Some([0.0, half.sin(), 0.0, half.cos()]);
        self
    }
}

/// How an entity starts, for [`Effects::spawn`].
///
/// # Examples
///
/// ```
/// use core::time::Duration;
/// use enshwick::effects::Spawn;
///
/// let brief = Spawn::new().level(10).despawn_after(Duration::from_secs(60));
/// assert_eq!(brief.level, Some(10));
/// ```
#[derive(Clone, Copy, Debug, Default, PartialEq)]
#[non_exhaustive]
pub struct Spawn {
    /// The level the game scales the entity to, as for enemies; `None` for
    /// the template's own.
    pub level: Option<u32>,
    /// Game time after which the game removes the entity; `None` keeps it.
    /// The name is enshwick's, not the game's.
    pub despawn_after: Option<core::time::Duration>,
    /// The orientation, a quaternion `x, y, z, w`; `None` for none turned.
    pub orientation: Option<[f32; 4]>,
}

impl Spawn {
    /// The template as it is.
    ///
    /// # Examples
    ///
    /// See [`Spawn`].
    #[must_use]
    pub const fn new() -> Self {
        Self {
            level: None,
            despawn_after: None,
            orientation: None,
        }
    }

    /// Spawn at `level`.
    ///
    /// # Examples
    ///
    /// See [`Spawn`].
    #[must_use]
    pub const fn level(mut self, level: u32) -> Self {
        self.level = Some(level);
        self
    }

    /// Let the game remove the entity after `time` of game time.
    ///
    /// # Examples
    ///
    /// See [`Spawn`].
    #[must_use]
    pub const fn despawn_after(mut self, time: core::time::Duration) -> Self {
        self.despawn_after = Some(time);
        self
    }

    /// Turn the entity `yaw` radians about the vertical axis.
    ///
    /// # Examples
    ///
    /// ```
    /// use enshwick::effects::Spawn;
    ///
    /// assert!(Spawn::new().orientation_yaw(1.0).orientation.is_some());
    /// ```
    #[must_use]
    pub fn orientation_yaw(mut self, yaw: f32) -> Self {
        let half = yaw / 2.0;
        self.orientation = Some([0.0, half.sin(), 0.0, half.cos()]);
        self
    }
}

/// The fields of a world transform inside an event.
#[derive(Clone, Copy, Debug)]
struct TransformAt {
    position: u64,
    orientation: u64,
    scale: u64,
}

/// `NpcCommandEvent`: a survivor walks somewhere or resets.
#[derive(Clone, Copy, Debug)]
struct NpcCommand {
    ty: EventType,
    kind: Field<u8>,
    npc: Field<u32>,
    target: TransformAt,
}

/// `SetToggleStateEvent`: a signal switches logic on or off.
#[derive(Clone, Copy, Debug)]
struct SetToggle {
    ty: EventType,
    sender: Field<Entity>,
    signal: Field<u32>,
    state: Field<bool>,
}

/// `AddThreatTargetEvent`: an enemy takes notice of a target.
#[derive(Clone, Copy, Debug)]
struct AddThreat {
    ty: EventType,
    attacker: Field<Entity>,
    target: Field<Entity>,
    threat: Field<f32>,
}

/// `UiPingEvent`: a ping on the map and in the world.
#[cfg(feature = "unstable")]
#[derive(Clone, Copy, Debug)]
struct Ping {
    ty: EventType,
    sender: Field<Entity>,
    position: u64,
}

/// What a survivor does on [`Effects::npc_command`].
///
/// # Examples
///
/// ```
/// use enshwick::effects::NpcCommandType;
///
/// let order = NpcCommandType::GoToPosition([10.0, 50.0, -3.0]);
/// assert_ne!(order, NpcCommandType::Reset);
/// ```
#[derive(Clone, Copy, Debug, PartialEq)]
#[non_exhaustive]
pub enum NpcCommandType {
    /// Walk to a point, in metres.
    GoToPosition([f64; 3]),
    /// Drop what it was told and go back to its routine.
    Reset,
}

/// The effects a mod has on the server's world; get them from
/// [`Load::effects`].
///
/// # Examples
///
/// See the [module](self).
#[derive(Clone, Copy, Debug)]
pub struct Effects {
    host: Host,
    npc: Option<NpcCommand>,
    toggle: Option<SetToggle>,
    threat: Option<AddThreat>,
    #[cfg(feature = "unstable")]
    ping: Option<Ping>,
}

impl Effects {
    pub(crate) fn resolve(load: &Load<'_>) -> Self {
        let host = load.host();
        let transform = |base: u64| -> Result<TransformAt, Off> {
            Ok(TransformAt {
                position: base + load.constant(ids::WORLD_TRANSFORM_POSITION)?,
                orientation: base + load.constant(ids::WORLD_TRANSFORM_ORIENTATION)?,
                scale: base + load.constant(ids::WORLD_TRANSFORM_SCALE)?,
            })
        };
        let npc = (|| {
            let ty = load.game_event_type(ids::NPC_COMMAND_EVENT)?;
            Ok::<_, Off>(NpcCommand {
                ty,
                kind: ty.field_by_id(load, ids::NPC_COMMAND_EVENT_TYPE)?,
                npc: ty.field_by_id(load, ids::NPC_COMMAND_EVENT_NPC_ID)?,
                target: transform(load.constant(ids::NPC_COMMAND_EVENT_TARGET_TRANSFORM)?)?,
            })
        })();
        let toggle = (|| {
            let ty = load.game_event_type(ids::SET_TOGGLE_STATE_EVENT)?;
            Ok::<_, Off>(SetToggle {
                ty,
                sender: ty.field_by_id(load, ids::SET_TOGGLE_STATE_EVENT_SENDER_ID)?,
                signal: ty.field_by_id(load, ids::SET_TOGGLE_STATE_EVENT_SIGNAL_ID)?,
                state: ty.field_by_id(load, ids::SET_TOGGLE_STATE_EVENT_NEW_STATE)?,
            })
        })();
        let threat = (|| {
            let ty = load.game_event_type(ids::ADD_THREAT_TARGET_EVENT)?;
            Ok::<_, Off>(AddThreat {
                ty,
                attacker: ty.field_by_id(load, ids::ADD_THREAT_TARGET_EVENT_ATTACKER_ID)?,
                target: ty.field_by_id(load, ids::ADD_THREAT_TARGET_EVENT_TARGET_ID)?,
                threat: ty.field_by_id(load, ids::ADD_THREAT_TARGET_EVENT_THREAT_VALUE)?,
            })
        })();
        #[cfg(feature = "unstable")]
        let ping = (|| {
            let ty = load.game_event_type(ids::UI_PING_EVENT)?;
            Ok::<_, Off>(Ping {
                ty,
                sender: ty.field_by_id(load, ids::UI_PING_EVENT_SENDER_ENTITY_ID)?,
                position: load.constant(ids::UI_PING_POSITION)?,
            })
        })();
        Self {
            host,
            npc: keep("survivor orders", npc),
            toggle: keep("toggles", toggle),
            threat: keep("threat", threat),
            #[cfg(feature = "unstable")]
            ping: keep("pings", ping),
        }
    }

    /// Orders survivor `npc`, by its survivor id, as the game does when a
    /// player sends it somewhere; the survivor's own behaviour carries the
    /// order out.
    ///
    /// # Errors
    ///
    /// [`WorldError::Missing`] on a build without the event,
    /// [`WorldError::WrongThread`] off the game thread and
    /// [`WorldError::Refused`] when the step holds no room for more events.
    ///
    /// # Examples
    ///
    /// ```
    /// use enshwick::effects::{Effects, NpcCommandType};
    ///
    /// fn gather(effects: &Effects, survivor: u32, at: [f64; 3]) {
    ///     if let Err(why) = effects.npc_command(survivor, NpcCommandType::GoToPosition(at)) {
    ///         enshwick::debug!("survivor {survivor} stays: {why}");
    ///     }
    /// }
    /// ```
    pub fn npc_command(&self, npc: u32, order: NpcCommandType) -> Result<(), WorldError> {
        let event = self.npc.ok_or(WorldError::Missing)?;
        let mut bytes = blank(event.ty)?;
        let (kind, at) = match order {
            NpcCommandType::Reset => (0, None),
            NpcCommandType::GoToPosition(at) => (1, Some(at)),
        };
        put(&mut bytes, event.kind, kind)?;
        put(&mut bytes, event.npc, npc)?;
        put_quaternion(&mut bytes, event.target.orientation, [0.0, 0.0, 0.0, 1.0])?;
        put_floats(&mut bytes, event.target.scale, [1.0; 3])?;
        if let Some(at) = at {
            put_position(&mut bytes, event.target.position, at)?;
        }
        self.emit_raw(event.ty, &bytes)
    }

    /// Switches the logic signal `signal` on or off as `sender` would, the
    /// way levers and pressure plates drive doors and lights.
    ///
    /// # Errors
    ///
    /// As for [`Effects::npc_command`].
    ///
    /// # Examples
    ///
    /// ```
    /// fn open(effects: &enshwick::effects::Effects, lever: enshwick::Entity, signal: u32) {
    ///     let _sent = effects.set_toggle(lever, signal, true);
    /// }
    /// ```
    pub fn set_toggle(&self, sender: Entity, signal: u32, on: bool) -> Result<(), WorldError> {
        let event = self.toggle.ok_or(WorldError::Missing)?;
        let mut bytes = blank(event.ty)?;
        put(&mut bytes, event.sender, sender)?;
        put(&mut bytes, event.signal, signal)?;
        put(&mut bytes, event.state, on)?;
        self.emit_raw(event.ty, &bytes)
    }

    /// Makes the enemy `attacker` take notice of `target` with `threat`, as
    /// a hit or a call for help does.
    ///
    /// # Errors
    ///
    /// As for [`Effects::npc_command`].
    ///
    /// # Examples
    ///
    /// ```
    /// use enshwick::Entity;
    ///
    /// fn taunt(effects: &enshwick::effects::Effects, enemy: Entity, player: Entity) {
    ///     let _noticed = effects.add_threat(enemy, player, 100.0);
    /// }
    /// ```
    pub fn add_threat(
        &self,
        attacker: Entity,
        target: Entity,
        threat: f32,
    ) -> Result<(), WorldError> {
        let event = self.threat.ok_or(WorldError::Missing)?;
        let mut bytes = blank(event.ty)?;
        put(&mut bytes, event.attacker, attacker)?;
        put(&mut bytes, event.target, target)?;
        put(&mut bytes, event.threat, threat)?;
        self.emit_raw(event.ty, &bytes)
    }

    /// Pings `position`, in metres, on the map as `sender` would; the
    /// players see it as a ping from them.
    ///
    /// Unstable: needs the `unstable` feature and may change in any release.
    ///
    /// # Errors
    ///
    /// As for [`Effects::npc_command`].
    ///
    /// # Examples
    ///
    /// ```
    /// fn mark(effects: &enshwick::effects::Effects, player: enshwick::Entity, at: [f64; 3]) {
    ///     let _pinged = effects.ping(player, at);
    /// }
    /// ```
    #[cfg(feature = "unstable")]
    pub fn ping(&self, sender: Entity, position: [f64; 3]) -> Result<(), WorldError> {
        let event = self.ping.ok_or(WorldError::Missing)?;
        let mut bytes = blank(event.ty)?;
        put(&mut bytes, event.sender, sender)?;
        put_position(&mut bytes, event.position, position)?;
        self.emit_raw(event.ty, &bytes)
    }

    /// Raises an event of type `ty` from its whole reflected layout, `bytes`
    /// of [`EventType::size`]; the loader stamps the time. The loader allows
    /// the types the typed calls raise and refuses any other.
    ///
    /// # Errors
    ///
    /// [`WorldError::Refused`] for a type the loader does not allow, a size
    /// that is not the type's, or a full step; [`WorldError::WrongThread`]
    /// off the game thread.
    ///
    /// # Examples
    ///
    /// ```
    /// fn init(load: &mut enshwick::Load<'_>) -> Result<(), enshwick::Off> {
    ///     let effects = load.effects();
    ///     let ping = load.game_event_type("keen::ecs::UiPingEvent")?;
    ///     load.on::<enshwick::events::WorldLoaded>(move |()| {
    ///         let bytes = vec![0u8; ping.size() as usize];
    ///         if let Err(why) = effects.emit_raw(ping, &bytes) {
    ///             enshwick::warn!("no ping: {why}");
    ///         }
    ///     })
    /// }
    /// ```
    pub fn emit_raw(&self, ty: EventType, bytes: &[u8]) -> Result<(), WorldError> {
        let size = u32::try_from(bytes.len()).map_err(|_| WorldError::Refused)?;
        let status = (self.host.api().emit)(self.host.handle(), ty.hash(), bytes.as_ptr(), size);
        WorldError::from_status(status)
    }

    /// Asks the server to move `entity` to `position`, in metres, after the
    /// next step, as its admin teleport does: the entity jumps there and
    /// clients see it arrive.
    ///
    /// Unstable: needs the `unstable` feature and may change in any release.
    ///
    /// # Errors
    ///
    /// [`WorldError::Gone`] for an entity not in the world or without a
    /// place, [`WorldError::Refused`] for one the game's teleport does not
    /// move, such as a prop (it moves actors and characters),
    /// [`WorldError::WrongThread`] off the game thread and
    /// [`WorldError::Missing`] on a build without teleports.
    ///
    /// # Examples
    ///
    /// ```
    /// use enshwick::effects::{Effects, Teleport};
    ///
    /// fn home(effects: &Effects, me: enshwick::Entity) -> Result<(), enshwick::WorldError> {
    ///     effects.teleport(me, [0.0, 100.0, 0.0], Teleport::new().search_best_spawn_position())
    /// }
    /// ```
    #[cfg(feature = "unstable")]
    pub fn teleport(
        &self,
        entity: Entity,
        position: [f64; 3],
        how: Teleport,
    ) -> Result<(), WorldError> {
        let mut flags = 0;
        if how.search_best_spawn_position {
            flags |= TeleportRequest::BEST_SPAWN;
        }
        if how.facing.is_some() {
            flags |= TeleportRequest::ORIENTED;
        }
        let request = TeleportRequest {
            header: Header::of::<TeleportRequest>(),
            entity,
            flags,
            position: crate::ecs::fixed(position),
            orientation: how.facing.unwrap_or([0.0, 0.0, 0.0, 1.0]),
        };
        WorldError::check(
            (self.host.api().teleport)(self.host.handle(), &raw const request),
            WorldError::Gone,
        )
    }
}

impl Effects {
    /// Asks the server to spawn an entity of `template`, its GUID as
    /// `World::template` gives it, at
    /// `position` in metres, as its admin spawn does: an enemy, an animal,
    /// a survivor or a prop. The new entity's id comes back at once; the
    /// entity is in the world after the next step, and a template the game
    /// does not know spawns nothing.
    ///
    /// # Errors
    ///
    /// [`WorldError::Refused`] for a zero template or a request the world
    /// turns away and [`WorldError::WrongThread`] off the game thread.
    ///
    /// # Examples
    ///
    /// ```
    /// use enshwick::effects::{Effects, Spawn};
    ///
    /// fn beside(effects: &Effects, template: [u8; 16], [x, y, z]: [f64; 3]) -> Result<enshwick::Entity, enshwick::WorldError> {
    ///     effects.spawn(template, [x + 2.0, y, z], Spawn::new())
    /// }
    /// ```
    pub fn spawn(
        &self,
        template: [u8; 16],
        position: [f64; 3],
        how: Spawn,
    ) -> Result<Entity, WorldError> {
        let api = self.host.api();
        let lifetime = how.despawn_after.map_or(0, |time| {
            u64::try_from(time.as_nanos()).unwrap_or(u64::MAX).max(1)
        });
        let request = SpawnRequest {
            header: Header::of::<SpawnRequest>(),
            template,
            position: crate::ecs::fixed(position),
            orientation: how.orientation.unwrap_or([0.0, 0.0, 0.0, 1.0]),
            level: how.level.unwrap_or(0),
            reserved: 0,
            lifetime_ns: lifetime,
        };
        let mut entity = Entity::NONE;
        WorldError::from_status((api.spawn)(
            self.host.handle(),
            &raw const request,
            &raw mut entity,
        ))?;
        Ok(entity)
    }
}

/// `found`, or `None` with a debug line saying why.
fn keep<T>(what: &str, found: Result<T, Off>) -> Option<T> {
    found
        .inspect_err(|off| crate::debug!("{what} off: {off}"))
        .ok()
}

/// The result of a world call that returned `status`.
/// An all-zero event of type `ty`.
fn blank(ty: EventType) -> Result<Vec<u8>, WorldError> {
    usize::try_from(ty.size())
        .map(|size| vec![0u8; size])
        .map_err(|_| WorldError::Missing)
}

fn put<T: Scalar>(bytes: &mut [u8], field: Field<T>, value: T) -> Result<(), WorldError> {
    put_at(bytes, u64::from(field.offset()), value)
}

fn put_at<T: Scalar>(bytes: &mut [u8], at: u64, value: T) -> Result<(), WorldError> {
    let written = usize::try_from(at)
        .ok()
        .and_then(|at| bytes.get_mut(at..))
        .is_some_and(|out| value.to_bytes(out));
    written.then_some(()).ok_or(WorldError::Missing)
}

fn put_position(bytes: &mut [u8], at: u64, position: [f64; 3]) -> Result<(), WorldError> {
    for (i, axis) in crate::ecs::fixed(position).into_iter().enumerate() {
        put_at(bytes, at + 8 * i as u64, axis)?;
    }
    Ok(())
}

fn put_floats<const N: usize>(
    bytes: &mut [u8],
    at: u64,
    values: [f32; N],
) -> Result<(), WorldError> {
    for (i, value) in values.into_iter().enumerate() {
        put_at(bytes, at + 4 * i as u64, value)?;
    }
    Ok(())
}

fn put_quaternion(bytes: &mut [u8], at: u64, value: [f32; 4]) -> Result<(), WorldError> {
    put_floats(bytes, at, value)
}

impl Load<'_> {
    /// The mod's [`Effects`] in the server's world: game events it raises
    /// and spawns; on a client, the built-in server's while it hosts a
    /// game. An action whose event this build lacks answers
    /// [`WorldError::Missing`].
    ///
    /// # Examples
    ///
    /// See the [module](self).
    #[must_use]
    pub fn effects(&mut self) -> Effects {
        Effects::resolve(self)
    }
}