faction table, applying factions to mobs, and querying reactions
This commit is contained in:
parent
0375c31acf
commit
76d835021b
11 changed files with 108 additions and 13 deletions
|
|
@ -11,6 +11,8 @@ mod spawn_table_structs;
|
|||
use spawn_table_structs::*;
|
||||
mod loot_table_structs;
|
||||
use loot_table_structs::*;
|
||||
mod faction_structs;
|
||||
use faction_structs::{FactionData, Reaction};
|
||||
use std::sync::Mutex;
|
||||
|
||||
lazy_static! {
|
||||
|
|
@ -24,6 +26,7 @@ pub struct Raws {
|
|||
pub props: Vec<Prop>,
|
||||
pub spawn_tables: Vec<SpawnTable>,
|
||||
pub loot_tables: Vec<LootTable>,
|
||||
pub factions: Vec<FactionData>,
|
||||
}
|
||||
|
||||
rltk::embedded_resource!(RAW_ITEMS, "../../raws/items.json");
|
||||
|
|
@ -31,6 +34,7 @@ rltk::embedded_resource!(RAW_MOBS, "../../raws/mobs.json");
|
|||
rltk::embedded_resource!(RAW_PROPS, "../../raws/props.json");
|
||||
rltk::embedded_resource!(RAW_SPAWN_TABLES, "../../raws/spawn_tables.json");
|
||||
rltk::embedded_resource!(RAW_LOOT_TABLES, "../../raws/loot_tables.json");
|
||||
rltk::embedded_resource!(RAW_FACTIONS, "../../raws/factions.json");
|
||||
|
||||
pub fn load_raws() {
|
||||
rltk::link_resource!(RAW_ITEMS, "../../raws/items.json");
|
||||
|
|
@ -38,6 +42,7 @@ pub fn load_raws() {
|
|||
rltk::link_resource!(RAW_PROPS, "../../raws/props.json");
|
||||
rltk::link_resource!(RAW_SPAWN_TABLES, "../../raws/spawn_tables.json");
|
||||
rltk::link_resource!(RAW_LOOT_TABLES, "../../raws/loot_tables.json");
|
||||
rltk::link_resource!(RAW_FACTIONS, "../../raws/factions.json");
|
||||
|
||||
let decoded_raws = get_decoded_raws();
|
||||
RAWS.lock().unwrap().load(decoded_raws);
|
||||
|
|
@ -49,8 +54,9 @@ pub fn get_decoded_raws() -> Raws {
|
|||
let props: Vec<Prop> = ParseJson::parse_raws_into_vector("../../raws/props.json".to_string());
|
||||
let spawn_tables: Vec<SpawnTable> = ParseJson::parse_raws_into_vector("../../raws/spawn_tables.json".to_string());
|
||||
let loot_tables: Vec<LootTable> = ParseJson::parse_raws_into_vector("../../raws/loot_tables.json".to_string());
|
||||
let factions: Vec<FactionData> = ParseJson::parse_raws_into_vector("../../raws/factions.json".to_string());
|
||||
|
||||
return Raws { items, mobs, props, spawn_tables, loot_tables };
|
||||
return Raws { items, mobs, props, spawn_tables, loot_tables, factions };
|
||||
}
|
||||
|
||||
trait ParseJson {
|
||||
|
|
@ -67,4 +73,4 @@ macro_rules! impl_ParseJson {
|
|||
})*
|
||||
}
|
||||
}
|
||||
impl_ParseJson!(for Vec<Item>, Vec<Mob>, Vec<Prop>, Vec<SpawnTable>, Vec<LootTable>);
|
||||
impl_ParseJson!(for Vec<Item>, Vec<Mob>, Vec<Prop>, Vec<SpawnTable>, Vec<LootTable>, Vec<FactionData>);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue