Showing results for

ecs

on bfnightly.bracketproductions.com
bfnightly.bracketproductions.com › chapter 49.html
Living bystanders - Roguelike Tutorial - In Rust
...let vendors = ecs.read_storage::<Vendor>(); let mut swap_entities : Vec<(Entity, i32, i32)> = Vec::new(); for (entity, _player, pos, viewshed) in (&entities, &players, &mut positions...
bfnightly.bracketproductions.com › chapter 52.html
User Interface - Roguelike Tutorial - In Rust
...i32) -> RunState { use super::{Consumable, InBackpack, WantsToUseItem}; let consumables = gs.ecs.read_storage::<Consumable>(); let backpack = gs.ecs.read_storage::<InBackpack>(); let player_entity = gs.ecs.fetch...
bfnightly.bracketproductions.com › print.html
Roguelike Tutorial - In Rust
...This chapter will introduce the entire of an Entity Component System (ECS), which will form the backbone of the rest of this tutorial. Rust...
bfnightly.bracketproductions.com › chapter 27.html
Cellular Automata Maps - Roguelike Tutorial - In Rust
...#![allow(unused)] fn main() { fn spawn_entities(&mut self, ecs : &mut World) { for area in self.noise_areas.iter() { spawner::spawn_region(ecs, area.1, self...
bfnightly.bracketproductions.com › chapter 23.html
Refactor Map Building - Roguelike Tutorial - In Rust
...i32) -> (Map, Position); fn spawn(map : &Map, ecs : &mut World, new_depth: i32); } }
Simple enough: it requires the ECS (since we're adding entities) and...
bfnightly.bracketproductions.com › chapter 5.html
Field of View - Roguelike Tutorial - In Rust
...i32, ecs: &mut World) { let mut positions = ecs.write_storage::<Position>(); let mut players = ecs.write_storage::<Player>(); let mut viewsheds = ecs.write_storage::<Viewshed>(); let map...
bfnightly.bracketproductions.com › chapter 68.html
Mushrooms - Roguelike Tutorial - In Rust
...Entity, targets : &Targets, ecs: &mut World) { let mut self_destruct = false; if let Some(template) = ecs.read_storage::<SpellTemplate>().get(spell) { let mut pools = ecs.write_storage...
bfnightly.bracketproductions.com › chapter 61.html
Town Portals - Roguelike Tutorial - In Rust
...#![allow(unused)] fn main() { RunState::TownPortal => { // Spawn the portal spawner::spawn_town_portal(&mut self.ecs); // Transition let map_depth = self.ecs.fetch::<Map>().depth; let...
bfnightly.bracketproductions.com › chapter 51.html
Equipment - Roguelike Tutorial - In Rust
...SpawnType) -> Option<Entity> { if raws.item_index.contains_key(key) { return spawn_named_item(raws, ecs, key, pos); } else if raws.mob_index.contains_key(key) { return spawn_named_mob(raws, ecs...
bfnightly.bracketproductions.com › chapter 4.html
A More Interesting Map - Roguelike Tutorial - In Rust
...World::new() }; gs.ecs.register::<Position>(); gs.ecs.register::<Renderable>(); gs.ecs.register::<Player>(); let (rooms, map) = new_map_rooms_and_corridors(); gs.ecs.insert(map); let (player_x...