diff --git a/raws/props.json b/raws/props.json index d2519da..0c48291 100644 --- a/raws/props.json +++ b/raws/props.json @@ -9,7 +9,8 @@ "id": "prop_altar", "name": "altar", "renderable": { "glyph": "_", "fg": "#FFFFFF", "bg": "#000000", "order": 2 }, - "flags": [] + "flags": ["ENTRY_TRIGGER"], + "effects": { "heal": "8d8" } }, { "id": "prop_keg", diff --git a/src/ai/visible_ai_system.rs b/src/ai/visible_ai_system.rs index 09c0972..3a15b25 100644 --- a/src/ai/visible_ai_system.rs +++ b/src/ai/visible_ai_system.rs @@ -2,6 +2,7 @@ use crate::{ raws::Reaction, Chasing, Faction, HasAncestry, Map, Mind, Position, TakingTurn, Telepath, Viewshed, WantsToApproach, WantsToFlee, }; +use rltk::prelude::*; use specs::prelude::*; use std::collections::HashSet; diff --git a/src/effects/hunger.rs b/src/effects/hunger.rs index f0c6b16..db1e191 100644 --- a/src/effects/hunger.rs +++ b/src/effects/hunger.rs @@ -2,8 +2,8 @@ use super::{EffectSpawner, EffectType}; use crate::{HungerClock, BUC}; use specs::prelude::*; -pub fn restore_food(ecs: &mut World, effect: &EffectSpawner, target: Entity) { - if let EffectType::RestoreNutrition { amount } = &effect.effect_type { +pub fn modify_nutrition(ecs: &mut World, effect: &EffectSpawner, target: Entity) { + if let EffectType::ModifyNutrition { amount } = &effect.effect_type { if let Some(hc) = ecs.write_storage::().get_mut(target) { hc.duration += amount; } diff --git a/src/effects/mod.rs b/src/effects/mod.rs index 154047f..a1b5bc9 100644 --- a/src/effects/mod.rs +++ b/src/effects/mod.rs @@ -29,7 +29,7 @@ pub enum EffectType { Particle { glyph: FontCharType, fg: RGB, bg: RGB, lifespan: f32, delay: f32 }, EntityDeath, ItemUse { item: Entity }, - RestoreNutrition { amount: i32 }, + ModifyNutrition { amount: i32 }, TriggerFire { trigger: Entity }, } @@ -116,7 +116,7 @@ fn tile_effect_hits_entities(effect: &EffectType) -> bool { match effect { EffectType::Damage { .. } => true, EffectType::Healing { .. } => true, - EffectType::RestoreNutrition { .. } => true, + EffectType::ModifyNutrition { .. } => true, EffectType::Confusion { .. } => true, _ => false, } @@ -139,7 +139,7 @@ fn affect_entity(ecs: &mut World, effect: &EffectSpawner, target: Entity) { } } EffectType::EntityDeath => damage::entity_death(ecs, effect, target), - EffectType::RestoreNutrition { .. } => hunger::restore_food(ecs, effect, target), + EffectType::ModifyNutrition { .. } => hunger::modify_nutrition(ecs, effect, target), _ => {} } } diff --git a/src/effects/triggers.rs b/src/effects/triggers.rs index d39ed57..434de78 100644 --- a/src/effects/triggers.rs +++ b/src/effects/triggers.rs @@ -87,7 +87,7 @@ fn handle_restore_nutrition( BUC::Uncursed => 400, BUC::Cursed => 200, }; - add_effect(event.source, EffectType::RestoreNutrition { amount }, event.target.clone()); + add_effect(event.source, EffectType::ModifyNutrition { amount }, event.target.clone()); logger = logger .append("You eat the") .colour(item_colour_ecs(ecs, event.entity)) diff --git a/src/player.rs b/src/player.rs index 8b01868..21da5d7 100644 --- a/src/player.rs +++ b/src/player.rs @@ -309,9 +309,12 @@ pub fn try_move_player(delta_x: i32, delta_y: i32, ecs: &mut World) -> RunState result = crate::spatial::for_each_tile_content_with_runstate(destination_idx, |potential_target| { let mut hostile = true; if pools.get(potential_target).is_some() { + // We get the reaction of the target to this entity -- + // i.e. in reverse to usual. We want to know if the target + // is hostile to us. If it isn't, we can swap places. let result = crate::raws::get_reactions( - entity, potential_target, + entity, &factions, &ancestries, &crate::raws::RAWS.lock().unwrap(), diff --git a/src/raws/rawmaster.rs b/src/raws/rawmaster.rs index f14171c..a2ac921 100644 --- a/src/raws/rawmaster.rs +++ b/src/raws/rawmaster.rs @@ -45,7 +45,11 @@ macro_rules! apply_flags { "BLOCKS_VISIBILITY" => $eb = $eb.with(BlocksVisibility {}), "ENTRY_TRIGGER" => $eb = $eb.with(EntryTrigger {}), "SINGLE_ACTIVATION" => $eb = $eb.with(SingleActivation {}), - "DOOR" => $eb = $eb.with(Door { open: false }), + "DOOR" => { + $eb = $eb.with(Door { open: false }); + $eb = $eb.with(BlocksVisibility {}); + $eb = $eb.with(BlocksTile {}); + } // RESTORES NUTRITION "FOOD" => $eb = $eb.with(ProvidesNutrition {}), // IS DELETED ON USE