Add hunger: Reformat
This commit is contained in:
parent
74c05f97af
commit
fdeabefd75
@ -127,7 +127,6 @@ impl Heals {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Component, Debug, Clone, ConvertSaveload)]
|
#[derive(Component, Debug, Clone, ConvertSaveload)]
|
||||||
pub struct Ranged {
|
pub struct Ranged {
|
||||||
pub range: i32,
|
pub range: i32,
|
||||||
@ -212,6 +211,5 @@ pub struct HungerClock {
|
|||||||
pub duration: i32,
|
pub duration: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Component, Debug, Serialize, Deserialize, Clone)]
|
#[derive(Component, Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct ProvidesFood {}
|
pub struct ProvidesFood {}
|
||||||
|
35
src/gui.rs
35
src/gui.rs
@ -1,14 +1,14 @@
|
|||||||
use rltk::{Point, VirtualKeyCode};
|
|
||||||
use rltk::RGB;
|
|
||||||
use rltk::Rltk;
|
use rltk::Rltk;
|
||||||
|
use rltk::RGB;
|
||||||
|
use rltk::{Point, VirtualKeyCode};
|
||||||
use specs::prelude::*;
|
use specs::prelude::*;
|
||||||
|
|
||||||
use crate::{HungerClock, HungerState, HungerSystem, Name};
|
|
||||||
use crate::{CombatStats, InBackpack, RunState, State, Viewshed};
|
|
||||||
use crate::{Equipped, Map};
|
|
||||||
use crate::gamelog::GameLog;
|
use crate::gamelog::GameLog;
|
||||||
use crate::Player;
|
use crate::Player;
|
||||||
use crate::Position;
|
use crate::Position;
|
||||||
|
use crate::{CombatStats, InBackpack, RunState, State, Viewshed};
|
||||||
|
use crate::{Equipped, Map};
|
||||||
|
use crate::{HungerClock, HungerState, HungerSystem, Name};
|
||||||
|
|
||||||
pub fn draw_ui(ecs: &World, ctx: &mut Rltk) {
|
pub fn draw_ui(ecs: &World, ctx: &mut Rltk) {
|
||||||
ctx.draw_box(
|
ctx.draw_box(
|
||||||
@ -46,14 +46,31 @@ pub fn draw_ui(ecs: &World, ctx: &mut Rltk) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
match hc.state {
|
match hc.state {
|
||||||
HungerState::WellFed => ctx.print_color(71, 42, RGB::named(rltk::GREEN), RGB::named(rltk::BLACK), "Well Fed"),
|
HungerState::WellFed => ctx.print_color(
|
||||||
|
71,
|
||||||
|
42,
|
||||||
|
RGB::named(rltk::GREEN),
|
||||||
|
RGB::named(rltk::BLACK),
|
||||||
|
"Well Fed",
|
||||||
|
),
|
||||||
HungerState::Normal => {}
|
HungerState::Normal => {}
|
||||||
HungerState::Hungry => ctx.print_color(71, 42, RGB::named(rltk::ORANGE), RGB::named(rltk::BLACK), "Hungry"),
|
HungerState::Hungry => ctx.print_color(
|
||||||
HungerState::Starving => ctx.print_color(71, 42, RGB::named(rltk::RED), RGB::named(rltk::BLACK), "Starving"),
|
71,
|
||||||
|
42,
|
||||||
|
RGB::named(rltk::ORANGE),
|
||||||
|
RGB::named(rltk::BLACK),
|
||||||
|
"Hungry",
|
||||||
|
),
|
||||||
|
HungerState::Starving => ctx.print_color(
|
||||||
|
71,
|
||||||
|
42,
|
||||||
|
RGB::named(rltk::RED),
|
||||||
|
RGB::named(rltk::BLACK),
|
||||||
|
"Starving",
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let mut y = 44;
|
let mut y = 44;
|
||||||
for s in log.entries.iter().rev() {
|
for s in log.entries.iter().rev() {
|
||||||
if y < 49 {
|
if y < 49 {
|
||||||
|
@ -5,10 +5,7 @@ use crate::{CombatStats, GameLog, Heals};
|
|||||||
pub struct HealingSystem {}
|
pub struct HealingSystem {}
|
||||||
|
|
||||||
impl<'a> System<'a> for HealingSystem {
|
impl<'a> System<'a> for HealingSystem {
|
||||||
type SystemData = (
|
type SystemData = (WriteStorage<'a, Heals>, WriteStorage<'a, CombatStats>);
|
||||||
WriteStorage<'a, Heals>,
|
|
||||||
WriteStorage<'a, CombatStats>,
|
|
||||||
);
|
|
||||||
|
|
||||||
fn run(&mut self, data: Self::SystemData) {
|
fn run(&mut self, data: Self::SystemData) {
|
||||||
let (mut heals, mut stats) = data;
|
let (mut heals, mut stats) = data;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use specs::prelude::*;
|
use specs::prelude::*;
|
||||||
|
|
||||||
use crate::{GameLog, Heals, HungerClock, HungerState, ProvidesHealing, RunState, SufferDamage};
|
|
||||||
use crate::spawner::player;
|
use crate::spawner::player;
|
||||||
|
use crate::{GameLog, Heals, HungerClock, HungerState, ProvidesHealing, RunState, SufferDamage};
|
||||||
|
|
||||||
pub struct HungerSystem {}
|
pub struct HungerSystem {}
|
||||||
|
|
||||||
@ -13,19 +13,36 @@ impl<'a> System<'a> for HungerSystem {
|
|||||||
ReadExpect<'a, RunState>,
|
ReadExpect<'a, RunState>,
|
||||||
WriteStorage<'a, SufferDamage>,
|
WriteStorage<'a, SufferDamage>,
|
||||||
WriteExpect<'a, GameLog>,
|
WriteExpect<'a, GameLog>,
|
||||||
WriteStorage<'a, Heals>
|
WriteStorage<'a, Heals>,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn run(&mut self, data: Self::SystemData) {
|
fn run(&mut self, data: Self::SystemData) {
|
||||||
let (entities, mut hunger_clock, player_entity, run_state, mut suffer_damage, mut game_log, mut heals) = data;
|
let (
|
||||||
|
entities,
|
||||||
|
mut hunger_clock,
|
||||||
|
player_entity,
|
||||||
|
run_state,
|
||||||
|
mut suffer_damage,
|
||||||
|
mut game_log,
|
||||||
|
mut heals,
|
||||||
|
) = data;
|
||||||
for (entity, mut clock) in (&entities, &mut hunger_clock).join() {
|
for (entity, mut clock) in (&entities, &mut hunger_clock).join() {
|
||||||
let mut proceed = false;
|
let mut proceed = false;
|
||||||
|
|
||||||
match *run_state {
|
match *run_state {
|
||||||
RunState::PlayerTurn => {
|
RunState::PlayerTurn => {
|
||||||
if entity == *player_entity { proceed = true; } }
|
if entity == *player_entity {
|
||||||
RunState::MonsterTurn => { if entity != *player_entity { proceed = true; } }
|
proceed = true;
|
||||||
_ => { proceed = false; }
|
}
|
||||||
|
}
|
||||||
|
RunState::MonsterTurn => {
|
||||||
|
if entity != *player_entity {
|
||||||
|
proceed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
proceed = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !proceed {
|
if !proceed {
|
||||||
@ -42,7 +59,9 @@ impl<'a> System<'a> for HungerSystem {
|
|||||||
clock.state = HungerState::Normal;
|
clock.state = HungerState::Normal;
|
||||||
clock.duration = 200;
|
clock.duration = 200;
|
||||||
if entity == *player_entity {
|
if entity == *player_entity {
|
||||||
game_log.entries.push("You are no longer well-feed".to_string())
|
game_log
|
||||||
|
.entries
|
||||||
|
.push("You are no longer well-feed".to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HungerState::Normal => {
|
HungerState::Normal => {
|
||||||
@ -61,7 +80,9 @@ impl<'a> System<'a> for HungerSystem {
|
|||||||
}
|
}
|
||||||
HungerState::Starving => {
|
HungerState::Starving => {
|
||||||
if entity == *player_entity {
|
if entity == *player_entity {
|
||||||
game_log.entries.push("Your hunger pangs are getting painful".to_string())
|
game_log
|
||||||
|
.entries
|
||||||
|
.push("Your hunger pangs are getting painful".to_string())
|
||||||
}
|
}
|
||||||
SufferDamage::new_damage(&mut suffer_damage, entity, 1);
|
SufferDamage::new_damage(&mut suffer_damage, entity, 1);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
use specs::prelude::*;
|
use specs::prelude::*;
|
||||||
|
|
||||||
use crate::{AreaOfEffect, CombatStats, Confusion, Consumable, Equippable, Equipped, HungerClock, HungerState, InBackpack, InflictsDamage, Map, Name, Position, ProvidesFood, ProvidesHealing, Ranged, SufferDamage, WantsToDropItem, WantsToPickupItem, WantsToRemoveItem, WantsToUseItem};
|
|
||||||
use crate::gamelog::GameLog;
|
use crate::gamelog::GameLog;
|
||||||
use crate::particle_system::ParticleBuilder;
|
use crate::particle_system::ParticleBuilder;
|
||||||
|
use crate::{
|
||||||
|
AreaOfEffect, CombatStats, Confusion, Consumable, Equippable, Equipped, HungerClock,
|
||||||
|
HungerState, InBackpack, InflictsDamage, Map, Name, Position, ProvidesFood, ProvidesHealing,
|
||||||
|
Ranged, SufferDamage, WantsToDropItem, WantsToPickupItem, WantsToRemoveItem, WantsToUseItem,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct ItemCollectionSystem {}
|
pub struct ItemCollectionSystem {}
|
||||||
|
|
||||||
@ -94,7 +98,7 @@ impl<'a> System<'a> for ItemUseSystem {
|
|||||||
mut particle_builder,
|
mut particle_builder,
|
||||||
positions,
|
positions,
|
||||||
provides_food,
|
provides_food,
|
||||||
mut hunger_clocks
|
mut hunger_clocks,
|
||||||
) = data;
|
) = data;
|
||||||
|
|
||||||
for (entity, use_item) in (&entities, &wants_use).join() {
|
for (entity, use_item) in (&entities, &wants_use).join() {
|
||||||
@ -144,7 +148,10 @@ impl<'a> System<'a> for ItemUseSystem {
|
|||||||
if let Some(hc) = hunger_clocks.get_mut(target) {
|
if let Some(hc) = hunger_clocks.get_mut(target) {
|
||||||
hc.state = HungerState::WellFed;
|
hc.state = HungerState::WellFed;
|
||||||
hc.duration = 20;
|
hc.duration = 20;
|
||||||
game_log.entries.push(format!("You eat the {}.", names.get(use_item.item).unwrap().name));
|
game_log.entries.push(format!(
|
||||||
|
"You eat the {}.",
|
||||||
|
names.get(use_item.item).unwrap().name
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ mod components;
|
|||||||
mod damage_system;
|
mod damage_system;
|
||||||
mod gamelog;
|
mod gamelog;
|
||||||
mod gui;
|
mod gui;
|
||||||
|
mod healing_system;
|
||||||
|
mod hunger_system;
|
||||||
mod inventory_system;
|
mod inventory_system;
|
||||||
mod map;
|
mod map;
|
||||||
mod map_indexing_system;
|
mod map_indexing_system;
|
||||||
@ -37,8 +39,6 @@ mod rect;
|
|||||||
mod save_load_system;
|
mod save_load_system;
|
||||||
mod spawner;
|
mod spawner;
|
||||||
mod visibility_system;
|
mod visibility_system;
|
||||||
mod hunger_system;
|
|
||||||
mod healing_system;
|
|
||||||
|
|
||||||
#[derive(PartialEq, Copy, Clone)]
|
#[derive(PartialEq, Copy, Clone)]
|
||||||
pub enum RunState {
|
pub enum RunState {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use specs::prelude::*;
|
use specs::prelude::*;
|
||||||
|
|
||||||
use crate::{DefenseBonus, Equipped, HungerClock, HungerState, MeleePowerBonus, Position};
|
|
||||||
use crate::components::{CombatStats, Name, SufferDamage, WantsToMelee};
|
use crate::components::{CombatStats, Name, SufferDamage, WantsToMelee};
|
||||||
use crate::gamelog::GameLog;
|
use crate::gamelog::GameLog;
|
||||||
use crate::particle_system::ParticleBuilder;
|
use crate::particle_system::ParticleBuilder;
|
||||||
|
use crate::{DefenseBonus, Equipped, HungerClock, HungerState, MeleePowerBonus, Position};
|
||||||
|
|
||||||
pub struct MeleeCombatSystem {}
|
pub struct MeleeCombatSystem {}
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ impl<'a> System<'a> for MeleeCombatSystem {
|
|||||||
ReadStorage<'a, Equipped>,
|
ReadStorage<'a, Equipped>,
|
||||||
WriteExpect<'a, ParticleBuilder>,
|
WriteExpect<'a, ParticleBuilder>,
|
||||||
ReadStorage<'a, Position>,
|
ReadStorage<'a, Position>,
|
||||||
ReadStorage<'a, HungerClock>
|
ReadStorage<'a, HungerClock>,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn run(&mut self, data: Self::SystemData) {
|
fn run(&mut self, data: Self::SystemData) {
|
||||||
@ -37,11 +37,11 @@ impl<'a> System<'a> for MeleeCombatSystem {
|
|||||||
equipped,
|
equipped,
|
||||||
mut particle_builder,
|
mut particle_builder,
|
||||||
positions,
|
positions,
|
||||||
hunger_clock
|
hunger_clock,
|
||||||
) = data;
|
) = data;
|
||||||
|
|
||||||
for (entity, wants_melee, name, stats) in
|
for (entity, wants_melee, name, stats) in
|
||||||
(&entities, &wants_melee, &names, &combat_stats).join()
|
(&entities, &wants_melee, &names, &combat_stats).join()
|
||||||
{
|
{
|
||||||
if stats.hp <= 0 {
|
if stats.hp <= 0 {
|
||||||
continue;
|
continue;
|
||||||
@ -49,7 +49,7 @@ impl<'a> System<'a> for MeleeCombatSystem {
|
|||||||
|
|
||||||
let mut offensive_bonus = 0;
|
let mut offensive_bonus = 0;
|
||||||
for (_item_entity, power_bonus, equipped_by) in
|
for (_item_entity, power_bonus, equipped_by) in
|
||||||
(&entities, &melee_bonus, &equipped).join()
|
(&entities, &melee_bonus, &equipped).join()
|
||||||
{
|
{
|
||||||
if equipped_by.owner == entity {
|
if equipped_by.owner == entity {
|
||||||
offensive_bonus += power_bonus.power;
|
offensive_bonus += power_bonus.power;
|
||||||
@ -68,7 +68,7 @@ impl<'a> System<'a> for MeleeCombatSystem {
|
|||||||
|
|
||||||
let mut defensive_bonus = 0;
|
let mut defensive_bonus = 0;
|
||||||
for (_item_entity, defense_bonus, equipped_by) in
|
for (_item_entity, defense_bonus, equipped_by) in
|
||||||
(&entities, &defense_bonus, &equipped).join()
|
(&entities, &defense_bonus, &equipped).join()
|
||||||
{
|
{
|
||||||
if equipped_by.owner == wants_melee.target {
|
if equipped_by.owner == wants_melee.target {
|
||||||
defensive_bonus += defense_bonus.defense;
|
defensive_bonus += defense_bonus.defense;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
use rltk::Point;
|
use rltk::Point;
|
||||||
use specs::prelude::*;
|
use specs::prelude::*;
|
||||||
|
|
||||||
|
use crate::particle_system::ParticleBuilder;
|
||||||
use crate::{
|
use crate::{
|
||||||
components::{Monster, Position, Viewshed, WantsToMelee},
|
components::{Monster, Position, Viewshed, WantsToMelee},
|
||||||
Confusion,
|
map::Map,
|
||||||
map::Map, RunState,
|
Confusion, RunState,
|
||||||
};
|
};
|
||||||
use crate::particle_system::ParticleBuilder;
|
|
||||||
|
|
||||||
pub struct MonsterAI {}
|
pub struct MonsterAI {}
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ impl<'a> System<'a> for MonsterAI {
|
|||||||
WriteStorage<'a, Position>,
|
WriteStorage<'a, Position>,
|
||||||
WriteStorage<'a, WantsToMelee>,
|
WriteStorage<'a, WantsToMelee>,
|
||||||
WriteStorage<'a, Confusion>,
|
WriteStorage<'a, Confusion>,
|
||||||
WriteExpect<'a, ParticleBuilder>
|
WriteExpect<'a, ParticleBuilder>,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn run(&mut self, data: Self::SystemData) {
|
fn run(&mut self, data: Self::SystemData) {
|
||||||
@ -38,7 +38,7 @@ impl<'a> System<'a> for MonsterAI {
|
|||||||
mut position,
|
mut position,
|
||||||
mut wants_to_melee,
|
mut wants_to_melee,
|
||||||
mut confused,
|
mut confused,
|
||||||
mut particle_builder
|
mut particle_builder,
|
||||||
) = data;
|
) = data;
|
||||||
|
|
||||||
if *runstate != RunState::MonsterTurn {
|
if *runstate != RunState::MonsterTurn {
|
||||||
@ -46,7 +46,7 @@ impl<'a> System<'a> for MonsterAI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (entity, mut viewshed, _monster, mut pos) in
|
for (entity, mut viewshed, _monster, mut pos) in
|
||||||
(&entities, &mut viewshed, &monster, &mut position).join()
|
(&entities, &mut viewshed, &monster, &mut position).join()
|
||||||
{
|
{
|
||||||
let mut can_act = true;
|
let mut can_act = true;
|
||||||
|
|
||||||
@ -57,7 +57,14 @@ impl<'a> System<'a> for MonsterAI {
|
|||||||
}
|
}
|
||||||
can_act = false;
|
can_act = false;
|
||||||
|
|
||||||
particle_builder.request(pos.x, pos.y, rltk::RGB::named(rltk::MAGENTA), rltk::RGB::named(rltk::BLACK), rltk::to_cp437('?'), 200.);
|
particle_builder.request(
|
||||||
|
pos.x,
|
||||||
|
pos.y,
|
||||||
|
rltk::RGB::named(rltk::MAGENTA),
|
||||||
|
rltk::RGB::named(rltk::BLACK),
|
||||||
|
rltk::to_cp437('?'),
|
||||||
|
200.,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !can_act {
|
if !can_act {
|
||||||
|
@ -3,9 +3,13 @@ use std::cmp::{max, min};
|
|||||||
use rltk::{Point, Rltk, VirtualKeyCode};
|
use rltk::{Point, Rltk, VirtualKeyCode};
|
||||||
use specs::prelude::*;
|
use specs::prelude::*;
|
||||||
|
|
||||||
use crate::{components::{CombatStats, Player, Position, Viewshed, WantsToMelee}, HungerClock, HungerState, Item, map::Map, Monster, RunState, State, TileType, WantsToPickupItem};
|
|
||||||
use crate::gamelog::GameLog;
|
use crate::gamelog::GameLog;
|
||||||
use crate::spawner::player;
|
use crate::spawner::player;
|
||||||
|
use crate::{
|
||||||
|
components::{CombatStats, Player, Position, Viewshed, WantsToMelee},
|
||||||
|
map::Map,
|
||||||
|
HungerClock, HungerState, Item, Monster, RunState, State, TileType, WantsToPickupItem,
|
||||||
|
};
|
||||||
|
|
||||||
pub fn try_move_player(delta_x: i32, delta_y: i32, ecs: &mut World) {
|
pub fn try_move_player(delta_x: i32, delta_y: i32, ecs: &mut World) {
|
||||||
let mut positions = ecs.write_storage::<Position>();
|
let mut positions = ecs.write_storage::<Position>();
|
||||||
@ -17,7 +21,7 @@ pub fn try_move_player(delta_x: i32, delta_y: i32, ecs: &mut World) {
|
|||||||
let map = ecs.fetch::<Map>();
|
let map = ecs.fetch::<Map>();
|
||||||
|
|
||||||
for (entity, _player, pos, viewshed) in
|
for (entity, _player, pos, viewshed) in
|
||||||
(&entities, &mut players, &mut positions, &mut viewsheds).join()
|
(&entities, &mut players, &mut positions, &mut viewsheds).join()
|
||||||
{
|
{
|
||||||
if pos.x + delta_x < 1
|
if pos.x + delta_x < 1
|
||||||
|| pos.x + delta_x > map.width - 1
|
|| pos.x + delta_x > map.width - 1
|
||||||
@ -139,8 +143,12 @@ fn skip_turn(ecs: &mut World) -> RunState {
|
|||||||
let mut heal_bonus = 0;
|
let mut heal_bonus = 0;
|
||||||
if let Some(hc) = hunger_clock.get(*player_entity) {
|
if let Some(hc) = hunger_clock.get(*player_entity) {
|
||||||
match hc.state {
|
match hc.state {
|
||||||
HungerState::Hungry | HungerState::Starving => {can_heal = false;}
|
HungerState::Hungry | HungerState::Starving => {
|
||||||
HungerState::WellFed => {heal_bonus = 1;}
|
can_heal = false;
|
||||||
|
}
|
||||||
|
HungerState::WellFed => {
|
||||||
|
heal_bonus = 1;
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,14 @@ use rltk::{FontCharType, RandomNumberGenerator, RGB};
|
|||||||
use specs::prelude::*;
|
use specs::prelude::*;
|
||||||
use specs::saveload::{MarkedBuilder, SimpleMarker};
|
use specs::saveload::{MarkedBuilder, SimpleMarker};
|
||||||
|
|
||||||
use crate::{AreaOfEffect, BlocksTile, CombatStats, Confusion, Consumable, DefenseBonus, EquipmentSlot, Equippable, HungerClock, HungerState, InflictsDamage, Item, MAP_WIDTH, MAX_MONSTER, MeleePowerBonus, Monster, Name, Player, Position, ProvidesFood, ProvidesHealing, Ranged, Renderable, SerializeMe, Viewshed};
|
|
||||||
use crate::random_table::RandomTable;
|
use crate::random_table::RandomTable;
|
||||||
use crate::rect::Rect;
|
use crate::rect::Rect;
|
||||||
|
use crate::{
|
||||||
|
AreaOfEffect, BlocksTile, CombatStats, Confusion, Consumable, DefenseBonus, EquipmentSlot,
|
||||||
|
Equippable, HungerClock, HungerState, InflictsDamage, Item, MeleePowerBonus, Monster, Name,
|
||||||
|
Player, Position, ProvidesFood, ProvidesHealing, Ranged, Renderable, SerializeMe, Viewshed,
|
||||||
|
MAP_WIDTH, MAX_MONSTER,
|
||||||
|
};
|
||||||
|
|
||||||
pub fn player(ecs: &mut World, player_x: i32, player_y: i32) -> Entity {
|
pub fn player(ecs: &mut World, player_x: i32, player_y: i32) -> Entity {
|
||||||
ecs.create_entity()
|
ecs.create_entity()
|
||||||
@ -400,7 +405,6 @@ fn sabatons(ecs: &mut World, x: i32, y: i32) {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn rations(ecs: &mut World, x: i32, y: i32) {
|
fn rations(ecs: &mut World, x: i32, y: i32) {
|
||||||
ecs.create_entity()
|
ecs.create_entity()
|
||||||
.with(Position { x, y })
|
.with(Position { x, y })
|
||||||
@ -414,8 +418,8 @@ fn rations(ecs: &mut World, x: i32, y: i32) {
|
|||||||
.with(Name {
|
.with(Name {
|
||||||
name: "Rations".to_string(),
|
name: "Rations".to_string(),
|
||||||
})
|
})
|
||||||
.with(Consumable{})
|
.with(Consumable {})
|
||||||
.with(ProvidesFood{})
|
.with(ProvidesFood {})
|
||||||
.marked::<SimpleMarker<SerializeMe>>()
|
.marked::<SimpleMarker<SerializeMe>>()
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user