Add new components for dynamically created particle effects

This commit is contained in:
Timothy Warren 2022-01-20 16:31:03 -05:00
parent e001488aa8
commit 1cbb70f294
4 changed files with 38 additions and 21 deletions

View File

@ -3,7 +3,7 @@ mod tags;
use std::collections::HashMap; use std::collections::HashMap;
use ::rltk::{Point, RGB}; use ::rltk::{FontCharType, Point, RGB};
use ::serde::{Deserialize, Serialize}; use ::serde::{Deserialize, Serialize};
use ::specs::error::NoError; use ::specs::error::NoError;
use ::specs::prelude::*; use ::specs::prelude::*;
@ -366,6 +366,20 @@ pub struct IdentifiedItem {
pub name: String, 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 // Serialization helper code. We need to implement ConvertSaveLoad for each type that contains an
// Entity. // Entity.

View File

@ -103,7 +103,8 @@ fn init_state() -> State {
SimpleMarker<SerializeMe>, SimpleMarker<SerializeMe>,
SingleActivation, SingleActivation,
Skills, Skills,
SufferDamage, SpawnParticleBurst,
SpawnParticleLine,
TeleportTo, TeleportTo,
TownPortal, TownPortal,
Vendor, Vendor,

View File

@ -416,6 +416,7 @@ impl TownBuilder {
// Place items // Place items
let mut to_place: Vec<&str> = vec![ let mut to_place: Vec<&str> = vec![
"Priest", "Priest",
"Altar",
"Parishioner", "Parishioner",
"Parishioner", "Parishioner",
"Chair", "Chair",

View File

@ -1,5 +1,4 @@
use std::fs; use std::fs::{self, File};
use std::fs::File;
use std::path::Path; use std::path::Path;
use ::rltk::Point; use ::rltk::Point;
@ -108,7 +107,8 @@ pub fn save_game(ecs: &mut World) {
SerializationHelper, SerializationHelper,
SingleActivation, SingleActivation,
Skills, Skills,
SufferDamage, SpawnParticleBurst,
SpawnParticleLine,
TeleportTo, TeleportTo,
TownPortal, TownPortal,
Vendor, Vendor,
@ -224,7 +224,8 @@ pub fn load_game(ecs: &mut World) {
SerializationHelper, SerializationHelper,
SingleActivation, SingleActivation,
Skills, Skills,
SufferDamage, SpawnParticleBurst,
SpawnParticleLine,
TeleportTo, TeleportTo,
TownPortal, TownPortal,
Vendor, Vendor,