Implement homeless shelter.
This commit is contained in:
parent
1f3fbd28bf
commit
2efc309d78
@ -285,7 +285,7 @@ impl DBTrans {
|
|||||||
// Only copy more permanent fields, others are supposed to change over time and shouldn't
|
// Only copy more permanent fields, others are supposed to change over time and shouldn't
|
||||||
// be reset on restart.
|
// be reset on restart.
|
||||||
for to_copy in ["display", "display_less_explicit", "details", "details_less_explicit",
|
for to_copy in ["display", "display_less_explicit", "details", "details_less_explicit",
|
||||||
"total_xp", "total_stats", "total_skills", "pronouns"] {
|
"total_xp", "total_stats", "total_skills", "pronouns", "flags"] {
|
||||||
det_ex = format!("jsonb_set({}, '{{{}}}', ${})", det_ex, to_copy, var_id);
|
det_ex = format!("jsonb_set({}, '{{{}}}', ${})", det_ex, to_copy, var_id);
|
||||||
params.push(obj_map.get(to_copy).unwrap_or(&Value::Null));
|
params.push(obj_map.get(to_copy).unwrap_or(&Value::Null));
|
||||||
var_id += 1;
|
var_id += 1;
|
||||||
|
@ -3,7 +3,7 @@ use super::{VerbContext, UserVerb, UserVerbRef, UResult, UserError, user_error,
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use ansi::{ansi, flow_around, word_wrap};
|
use ansi::{ansi, flow_around, word_wrap};
|
||||||
use crate::db::ItemSearchParams;
|
use crate::db::ItemSearchParams;
|
||||||
use crate::models::{item::{Item, LocationActionType, Subattack}};
|
use crate::models::{item::{Item, LocationActionType, Subattack, ItemFlag}};
|
||||||
use crate::static_content::room::{self, Direction};
|
use crate::static_content::room::{self, Direction};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@ -75,6 +75,9 @@ pub async fn describe_room(ctx: &VerbContext<'_>, item: &Item,
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn list_item_contents<'l>(ctx: &'l VerbContext<'_>, item: &'l Item) -> UResult<String> {
|
async fn list_item_contents<'l>(ctx: &'l VerbContext<'_>, item: &'l Item) -> UResult<String> {
|
||||||
|
if item.flags.contains(&ItemFlag::NoSeeContents) {
|
||||||
|
return Ok(" It is too foggy to see who or what else is here.".to_owned());
|
||||||
|
}
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
let mut items = ctx.trans.find_items_by_location(&format!("{}/{}",
|
let mut items = ctx.trans.find_items_by_location(&format!("{}/{}",
|
||||||
item.item_type, item.item_code)).await?;
|
item.item_type, item.item_code)).await?;
|
||||||
|
@ -108,7 +108,8 @@ pub enum Sex {
|
|||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
|
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
|
||||||
pub enum ItemFlag {
|
pub enum ItemFlag {
|
||||||
NoSay
|
NoSay,
|
||||||
|
NoSeeContents
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
|
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
|
||||||
|
@ -181,8 +181,8 @@ mod test {
|
|||||||
|
|
||||||
for type_group in registry.iter() {
|
for type_group in registry.iter() {
|
||||||
let iterator : Box<dyn Iterator<Item = StaticTask>> = (type_group.things)();
|
let iterator : Box<dyn Iterator<Item = StaticTask>> = (type_group.things)();
|
||||||
let duplicates: Vec<&'static str> = iterator
|
let duplicates: Vec<String> = iterator
|
||||||
.group_by(|x| x.task_code)
|
.group_by(|x| x.task_code.clone())
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|(k, v)| if v.count() <= 1 { None } else { Some(k) })
|
.filter_map(|(k, v)| if v.count() <= 1 { None } else { Some(k) })
|
||||||
.collect();
|
.collect();
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user