Skip to main content

cranium_core/
actionset.rs

1/* 
2This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. 
3If a copy of the MPL was not distributed with this file, 
4You can obtain one at https://mozilla.org/MPL/2.0/. 
5*/
6
7//! ActionSets - bundles of Actions, typically all the affordances of a SmartObject or an NPC.
8
9use bevy::prelude::*;
10use crate::actions::{ActionTemplate};
11
12#[cfg(feature = "actionset_loader")]
13use serde::{Serialize, Deserialize};
14
15#[derive(Debug, Clone, Reflect)]
16#[cfg_attr(any(feature = "actionset_loader"), derive(Serialize, Deserialize, Asset))]
17pub struct ActionSet {
18    pub name: String,
19    pub actions: crate::types::CraniumList<ActionTemplate>,
20}
21
22impl ActionSet {
23    pub fn new<IS: Into<String>>(name: IS, actions: crate::types::CraniumList<ActionTemplate>) -> Self {
24        Self {
25            name: name.into(),
26            actions: actions,
27        }
28    }
29}