summaryrefslogtreecommitdiff
path: root/src/componentwrapper.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-02-23 01:18:17 +0100
committertroido <troido@protonmail.com>2020-02-23 01:18:17 +0100
commit7262cfc53b4af978d6db1b91e3143200f906587f (patch)
treef6aa651a3040a1389a9c4e82796f1c04b3c5198c /src/componentwrapper.rs
parent522aad7889cd62e96af7c420789507ccbf5b7aaa (diff)
rooms have named locations to be used by portals
Diffstat (limited to 'src/componentwrapper.rs')
-rw-r--r--src/componentwrapper.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/componentwrapper.rs b/src/componentwrapper.rs
index fb2a80a..27e0783 100644
--- a/src/componentwrapper.rs
+++ b/src/componentwrapper.rs
@@ -2,7 +2,7 @@
use std::collections::HashMap;
use specs::Builder;
-use crate::{PlayerId, RoomId, Sprite};
+use crate::{PlayerId, RoomId, Sprite, playerstate::RoomPos};
use crate::components::{Visible, Blocking, Player, Floor, Item, Inventory, Health, Serialise, RoomExit};
use crate::parameter::{Parameter, ParameterType};
@@ -98,7 +98,16 @@ components!(
Inventory (capacity: Int) {Inventory{items: Vec::new(), capacity: capacity as usize}};
Health (health: Int, maxhealth: Int) {Health{health, maxhealth}};
Serialise (template: Template) {Serialise{template}};
- RoomExit (destination: String) {RoomExit{destination: RoomId::from_str(&destination)}};
+ RoomExit (destination: String, dest_pos: String) {
+ RoomExit {
+ destination: RoomId::from_str(&destination),
+ dest_pos: if dest_pos.is_empty() {
+ RoomPos::Unknown
+ } else {
+ RoomPos::Name(dest_pos)
+ }
+ }
+ };
);