Add new components for dynamically created particle effects
This commit is contained in:
parent
e001488aa8
commit
1cbb70f294
@ -3,7 +3,7 @@ mod tags;
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use ::rltk::{Point, RGB};
|
||||
use ::rltk::{FontCharType, Point, RGB};
|
||||
use ::serde::{Deserialize, Serialize};
|
||||
use ::specs::error::NoError;
|
||||
use ::specs::prelude::*;
|
||||
@ -366,6 +366,20 @@ pub struct IdentifiedItem {
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Component, Serialize, Deserialize, Clone)]
|
||||
pub struct SpawnParticleLine {
|
||||
pub glyph: FontCharType,
|
||||
pub color: RGB,
|
||||
pub lifetime_ms: f32,
|
||||
}
|
||||
|
||||
#[derive(Component, Serialize, Deserialize, Clone)]
|
||||
pub struct SpawnParticleBurst {
|
||||
pub glyph: FontCharType,
|
||||
pub color: RGB,
|
||||
pub lifetime_ms: f32,
|
||||
}
|
||||
|
||||
// Serialization helper code. We need to implement ConvertSaveLoad for each type that contains an
|
||||
// Entity.
|
||||
|
||||
|
@ -103,7 +103,8 @@ fn init_state() -> State {
|
||||
SimpleMarker<SerializeMe>,
|
||||
SingleActivation,
|
||||
Skills,
|
||||
SufferDamage,
|
||||
SpawnParticleBurst,
|
||||
SpawnParticleLine,
|
||||
TeleportTo,
|
||||
TownPortal,
|
||||
Vendor,
|
||||
|
@ -416,6 +416,7 @@ impl TownBuilder {
|
||||
// Place items
|
||||
let mut to_place: Vec<&str> = vec![
|
||||
"Priest",
|
||||
"Altar",
|
||||
"Parishioner",
|
||||
"Parishioner",
|
||||
"Chair",
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::fs;
|
||||
use std::fs::File;
|
||||
use std::fs::{self, File};
|
||||
use std::path::Path;
|
||||
|
||||
use ::rltk::Point;
|
||||
@ -16,13 +15,13 @@ use crate::spatial;
|
||||
macro_rules! serialize_individually {
|
||||
($ecs:expr, $ser:expr, $data:expr, $( $type:ty),*,) => {
|
||||
$(
|
||||
SerializeComponents::<NoError, SimpleMarker<SerializeMe>>::serialize(
|
||||
&( $ecs.read_storage::<$type>(), ),
|
||||
&$data.0,
|
||||
&$data.1,
|
||||
&mut $ser,
|
||||
)
|
||||
.unwrap();
|
||||
SerializeComponents::<NoError, SimpleMarker<SerializeMe>>::serialize(
|
||||
&( $ecs.read_storage::<$type>(), ),
|
||||
&$data.0,
|
||||
&$data.1,
|
||||
&mut $ser,
|
||||
)
|
||||
.unwrap();
|
||||
)*
|
||||
};
|
||||
}
|
||||
@ -108,7 +107,8 @@ pub fn save_game(ecs: &mut World) {
|
||||
SerializationHelper,
|
||||
SingleActivation,
|
||||
Skills,
|
||||
SufferDamage,
|
||||
SpawnParticleBurst,
|
||||
SpawnParticleLine,
|
||||
TeleportTo,
|
||||
TownPortal,
|
||||
Vendor,
|
||||
@ -138,14 +138,14 @@ pub fn does_save_exist() -> bool {
|
||||
macro_rules! deserialize_individually {
|
||||
($ecs:expr, $de:expr, $data:expr, $( $type:ty),*,) => {
|
||||
$(
|
||||
DeserializeComponents::<NoError, _>::deserialize(
|
||||
&mut ( &mut $ecs.write_storage::<$type>(), ),
|
||||
&$data.0, // entities
|
||||
&mut $data.1, // marker
|
||||
&mut $data.2, // allocater
|
||||
&mut $de,
|
||||
)
|
||||
.unwrap();
|
||||
DeserializeComponents::<NoError, _>::deserialize(
|
||||
&mut ( &mut $ecs.write_storage::<$type>(), ),
|
||||
&$data.0, // entities
|
||||
&mut $data.1, // marker
|
||||
&mut $data.2, // allocater
|
||||
&mut $de,
|
||||
)
|
||||
.unwrap();
|
||||
)*
|
||||
};
|
||||
}
|
||||
@ -224,7 +224,8 @@ pub fn load_game(ecs: &mut World) {
|
||||
SerializationHelper,
|
||||
SingleActivation,
|
||||
Skills,
|
||||
SufferDamage,
|
||||
SpawnParticleBurst,
|
||||
SpawnParticleLine,
|
||||
TeleportTo,
|
||||
TownPortal,
|
||||
Vendor,
|
||||
|
Loading…
Reference in New Issue
Block a user