Cleanup most of the less_explicit mode support
This commit is contained in:
parent
58c815f8b4
commit
68fc094c15
@ -386,6 +386,7 @@ impl DBTrans {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub async fn save_session_model<'a>(
|
||||
self: &'a Self,
|
||||
session: &'a ListenerSession,
|
||||
@ -455,9 +456,7 @@ impl DBTrans {
|
||||
// be reset on restart.
|
||||
for to_copy in [
|
||||
"display",
|
||||
"display_less_explicit",
|
||||
"details",
|
||||
"details_less_explicit",
|
||||
"total_xp",
|
||||
"total_stats",
|
||||
"total_skills",
|
||||
@ -1022,8 +1021,7 @@ impl DBTrans {
|
||||
&format!(
|
||||
"WITH {} SELECT details FROM relevant_items \
|
||||
WHERE \
|
||||
((lower(details->>'display') LIKE $1) \
|
||||
OR (lower(details ->>'display_less_explicit') LIKE $1) \
|
||||
(lower(details->>'display') LIKE $1) \
|
||||
OR EXISTS (SELECT 1 FROM jsonb_array_elements(aliases) AS al(alias) WHERE \
|
||||
LOWER(alias#>>'{{}}') LIKE $1)) {} \
|
||||
ORDER BY {} ABS(length(details->>'display')-$3) ASC \
|
||||
|
@ -60,10 +60,6 @@ impl UserVerb for Verb {
|
||||
.display
|
||||
.to_lowercase()
|
||||
.starts_with(&match_item)
|
||||
|| possession_type
|
||||
.display_less_explicit
|
||||
.map(|d| d.to_lowercase().starts_with(&match_item))
|
||||
.unwrap_or(false)
|
||||
|| possession_type
|
||||
.aliases
|
||||
.iter()
|
||||
|
@ -25,11 +25,6 @@ impl UserVerb for Verb {
|
||||
.into_iter()
|
||||
.filter(|it| {
|
||||
it.display.to_lowercase().starts_with(&npc_name)
|
||||
|| it
|
||||
.display_less_explicit
|
||||
.as_ref()
|
||||
.map(|v| v.to_lowercase().starts_with(&npc_name))
|
||||
.unwrap_or(false)
|
||||
|| it
|
||||
.aliases
|
||||
.iter()
|
||||
@ -54,7 +49,7 @@ impl UserVerb for Verb {
|
||||
&ctx.session,
|
||||
Some(&format!(
|
||||
"A hushed silence falls over the room as you fire {}.\n",
|
||||
npc.display_for_session(&ctx.session_dat),
|
||||
npc.display_for_sentence(1, false),
|
||||
)),
|
||||
)
|
||||
.await?;
|
||||
|
@ -123,7 +123,7 @@ pub async fn stop_following(trans: &DBTrans, follower: &mut Item) -> UResult<()>
|
||||
.await?
|
||||
{
|
||||
if follower.item_type == "player" {
|
||||
if let Some((session, session_dat)) =
|
||||
if let Some((session, _session_dat)) =
|
||||
trans.find_session_for_player(&follower.item_code).await?
|
||||
{
|
||||
trans
|
||||
@ -131,7 +131,7 @@ pub async fn stop_following(trans: &DBTrans, follower: &mut Item) -> UResult<()>
|
||||
&session,
|
||||
Some(&format!(
|
||||
"You are no longer following {}.\n",
|
||||
old_item.display_for_session(&session_dat)
|
||||
old_item.display_for_sentence(1, false)
|
||||
)),
|
||||
)
|
||||
.await?;
|
||||
@ -243,7 +243,7 @@ impl UserVerb for Verb {
|
||||
&ctx.session,
|
||||
Some(&format!(
|
||||
"You are now following {}.\n",
|
||||
&follow_whom.display_for_session(&ctx.session_dat)
|
||||
&follow_whom.display_for_sentence(1, false)
|
||||
)),
|
||||
)
|
||||
.await?;
|
||||
|
@ -70,13 +70,13 @@ impl TaskHandler for ChargeWagesTaskHandler {
|
||||
let sess_and_dat = ctx.trans.find_session_for_player(&hired_by).await?;
|
||||
|
||||
if hire_dat.price > bill_user.credits {
|
||||
if let Some((sess, sess_dat)) = sess_and_dat {
|
||||
if let Some((sess, _sess_dat)) = sess_and_dat {
|
||||
ctx.trans
|
||||
.queue_for_session(
|
||||
&sess,
|
||||
Some(&format!(
|
||||
"<yellow>{} says: <reset><bold>\"{}\"<reset>\n",
|
||||
&npc.display_for_session(&sess_dat),
|
||||
&npc.display_for_sentence(1, false),
|
||||
RESIGNATION_NOTICE
|
||||
)),
|
||||
)
|
||||
@ -96,10 +96,10 @@ impl TaskHandler for ChargeWagesTaskHandler {
|
||||
ctx.trans.save_user_model(&bill_user).await?;
|
||||
match sess_and_dat.as_ref() {
|
||||
None => {},
|
||||
Some((sess, sess_dat)) => ctx.trans.queue_for_session(
|
||||
Some((sess, _sess_dat)) => ctx.trans.queue_for_session(
|
||||
sess, Some(&format!(
|
||||
ansi!("<yellow>Your wristpad beeps for a deduction of ${} for wages for {}.<reset>\n"),
|
||||
&hire_dat.price, &npc.display_for_session(&sess_dat)
|
||||
&hire_dat.price, &npc.display_for_sentence(1, false)
|
||||
))
|
||||
).await?
|
||||
}
|
||||
@ -139,7 +139,7 @@ impl UserVerb for Verb {
|
||||
{
|
||||
msg.push_str(&format!(
|
||||
"* {} @ ${} / {}\n",
|
||||
emp.display_for_session(&ctx.session_dat),
|
||||
emp.display_for_sentence(1, false),
|
||||
hire_dat.price,
|
||||
humantime::format_duration(std::time::Duration::from_secs(
|
||||
hire_dat.frequency_secs,
|
||||
@ -185,7 +185,7 @@ impl UserVerb for Verb {
|
||||
ansi!(
|
||||
"<yellow>{} says: <reset><bold>\"You wouldn't be able to afford me.\"<reset>"
|
||||
),
|
||||
npc.display_for_session(&ctx.session_dat)
|
||||
npc.display_for_sentence(1, false)
|
||||
))?;
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ impl UserVerb for Verb {
|
||||
&ctx.session,
|
||||
Some(&format!(
|
||||
"You hire {}, and your wristpad beeps for a deduction of ${}.\n",
|
||||
npc.display_for_session(&ctx.session_dat),
|
||||
npc.display_for_sentence(1, false),
|
||||
hire_dat.price
|
||||
)),
|
||||
)
|
||||
|
@ -436,7 +436,7 @@ impl UserVerb for Verb {
|
||||
if item.item_type != "possession" {
|
||||
user_error(format!(
|
||||
"You can't improvise with {}!",
|
||||
&item.display_for_session(&ctx.session_dat)
|
||||
&item.display_for_sentence(1, false)
|
||||
))?
|
||||
}
|
||||
input_ids.insert(item.item_code.to_owned());
|
||||
|
@ -6,14 +6,10 @@ pub struct Verb;
|
||||
impl UserVerb for Verb {
|
||||
async fn handle(
|
||||
self: &Self,
|
||||
ctx: &mut VerbContext,
|
||||
_ctx: &mut VerbContext,
|
||||
_verb: &str,
|
||||
_remaining: &str,
|
||||
) -> UResult<()> {
|
||||
(*ctx.session_dat).less_explicit_mode = true;
|
||||
ctx.trans
|
||||
.save_session_model(ctx.session, ctx.session_dat)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ impl UserVerb for Verb {
|
||||
}) if hired_by == &player_item.item_code => {}
|
||||
_ => user_error(format!(
|
||||
"{} doesn't seem to be letting you do that. Try hiring {} first!",
|
||||
npc.display_for_session(&ctx.session_dat),
|
||||
npc.display_for_sentence(1, false),
|
||||
npc.pronouns.object
|
||||
))?,
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ pub async fn describe_normal_item(
|
||||
.map(|(it, _)| it)
|
||||
{
|
||||
any_part_text = true;
|
||||
let display = top_item.display_for_session(&ctx.session_dat);
|
||||
let display = top_item.display_for_sentence(1, false);
|
||||
if !seen_clothes.contains(&display) {
|
||||
seen_clothes.insert(display.clone());
|
||||
contents_desc.push_str(&format!(
|
||||
@ -333,8 +333,8 @@ pub async fn describe_normal_item(
|
||||
ctx.session,
|
||||
Some(&format!(
|
||||
"{}\n{}\n{}",
|
||||
&item.display_for_session(&ctx.session_dat),
|
||||
item.details_for_session(&ctx.session_dat).unwrap_or(""),
|
||||
&item.display_for_sentence(1, false),
|
||||
&item.details.as_ref().map(|d| d.as_str()).unwrap_or(""),
|
||||
contents_desc,
|
||||
)),
|
||||
)
|
||||
@ -396,9 +396,9 @@ pub async fn describe_room(
|
||||
&word_wrap(
|
||||
&format!(
|
||||
ansi!("<yellow>{}<reset> (<blue>{}<reset>)\n{}{}.{}\n{}\n"),
|
||||
item.display_for_session(&ctx.session_dat),
|
||||
item.display_for_sentence(1, false),
|
||||
zone,
|
||||
item.details_for_session(&ctx.session_dat).unwrap_or(""),
|
||||
&item.details.as_ref().map(|d| d.as_str()).unwrap_or(""),
|
||||
item.details_dyn_suffix
|
||||
.as_ref()
|
||||
.map(|d| d.as_str())
|
||||
@ -432,9 +432,9 @@ pub async fn describe_dynroom(
|
||||
&word_wrap(
|
||||
&format!(
|
||||
ansi!("<yellow>{}<reset> (<blue>{}<reset>)\n{}.{}\n{}\n"),
|
||||
item.display_for_session(&ctx.session_dat),
|
||||
item.display_for_sentence(1, false),
|
||||
dynzone.zonename,
|
||||
item.details_for_session(&ctx.session_dat).unwrap_or(""),
|
||||
&item.details.as_ref().map(|d| d.as_str()).unwrap_or(""),
|
||||
contents,
|
||||
exits_for_dyn(dynroom)
|
||||
),
|
||||
@ -463,7 +463,7 @@ async fn describe_door(
|
||||
.await?
|
||||
.first()
|
||||
{
|
||||
let lock_desc = lock.display_for_session(&ctx.session_dat);
|
||||
let lock_desc = lock.display_for_sentence(1, false);
|
||||
msg.push_str(&format!(" The door is locked with {}", &lock_desc));
|
||||
}
|
||||
msg.push('\n');
|
||||
@ -511,7 +511,7 @@ async fn list_room_contents<'l>(ctx: &'l VerbContext<'_>, item: &'l Item) -> URe
|
||||
if let Some(sit_on) = ctx.trans.find_item_by_type_code(on_type, on_code).await?
|
||||
{
|
||||
buf.push_str("on ");
|
||||
buf.push_str(&sit_on.display_for_session(&ctx.session_dat));
|
||||
buf.push_str(&sit_on.display_for_sentence(1, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -523,7 +523,7 @@ async fn list_room_contents<'l>(ctx: &'l VerbContext<'_>, item: &'l Item) -> URe
|
||||
if let Some(sit_on) = ctx.trans.find_item_by_type_code(on_type, on_code).await?
|
||||
{
|
||||
buf.push_str("on ");
|
||||
buf.push_str(&sit_on.display_for_session(&ctx.session_dat));
|
||||
buf.push_str(&sit_on.display_for_sentence(1, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -557,7 +557,7 @@ async fn list_room_contents<'l>(ctx: &'l VerbContext<'_>, item: &'l Item) -> URe
|
||||
Some((ttype, tcode)) => {
|
||||
match ctx.trans.find_item_by_type_code(ttype, tcode).await? {
|
||||
None => buf.push_str("someone"),
|
||||
Some(it) => buf.push_str(&it.display_for_session(&ctx.session_dat)),
|
||||
Some(it) => buf.push_str(&it.display_for_sentence(1, false)),
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -379,7 +379,7 @@ impl UserVerb for Verb {
|
||||
match (recipe_craft.bench.as_ref(), bench.as_ref()) {
|
||||
(Some(bench_type), None) => user_error(format!(
|
||||
"The {} can only be made on the {}.",
|
||||
&instructions.display_for_session(&ctx.session_dat),
|
||||
&instructions.display_for_sentence(1, false),
|
||||
possession_data()
|
||||
.get(bench_type)
|
||||
.map(|pd| pd.display)
|
||||
@ -390,7 +390,7 @@ impl UserVerb for Verb {
|
||||
{
|
||||
user_error(format!(
|
||||
"The {} can only be made on the {}.",
|
||||
&instructions.display_for_session(&ctx.session_dat),
|
||||
&instructions.display_for_sentence(1, false),
|
||||
possession_data()
|
||||
.get(bench_type)
|
||||
.map(|pd| pd.display)
|
||||
|
@ -594,9 +594,7 @@ async fn attempt_move_immediate(
|
||||
for attacker in &attackers[..] {
|
||||
if let Some((atype, acode)) = attacker.split_once("/") {
|
||||
if let Some(aitem) = ctx.trans.find_item_by_type_code(atype, acode).await? {
|
||||
if let Some((_, session_dat)) = session.as_ref() {
|
||||
attacker_names.push(aitem.display_for_session(session_dat));
|
||||
}
|
||||
attacker_names.push(aitem.display_for_sentence(1, false));
|
||||
// We don't push the actual attacker Item, because another attacker
|
||||
// might re-target this attacker when we escape, causing the structure
|
||||
// to be out of date. Instead, we push the type, code pair and look it
|
||||
|
@ -60,7 +60,7 @@ impl UserVerb for Verb {
|
||||
ctx.session,
|
||||
Some(&format!(
|
||||
ansi!("<blue>You page {} on your wristpad: \"{}\"<reset>\n"),
|
||||
to_whom.display_for_session(&ctx.session_dat),
|
||||
to_whom.display_for_sentence(1, false),
|
||||
say_what
|
||||
)),
|
||||
)
|
||||
@ -90,7 +90,7 @@ impl UserVerb for Verb {
|
||||
&other_session,
|
||||
Some(&format!(
|
||||
ansi!("<blue>Your wristpad beeps with page from {}: \"{}\"<reset>\n"),
|
||||
player_item.display_for_session(&ctx.session_dat),
|
||||
player_item.display_for_sentence(1, false),
|
||||
say_what
|
||||
)),
|
||||
)
|
||||
|
@ -248,8 +248,8 @@ impl UserVerb for Verb {
|
||||
.queue_for_session(&ctx.session,
|
||||
Some(
|
||||
&format!("For ease of later use, you decide to rip the pages out of {} before placing them in {}.\n",
|
||||
&target.display_for_session(&ctx.session_dat),
|
||||
&into_what.display_for_session(&ctx.session_dat)),
|
||||
&target.display_for_sentence(1, false),
|
||||
&into_what.display_for_sentence(1, false)),
|
||||
)
|
||||
).await?;
|
||||
for page in pages {
|
||||
|
@ -267,11 +267,7 @@ impl QueueCommandHandler for QueueHandler {
|
||||
{
|
||||
item_mut.possession_type = Some(new_poss.clone());
|
||||
item_mut.display = new_poss_dat.display.to_owned();
|
||||
item_mut.display_less_explicit =
|
||||
new_poss_dat.display_less_explicit.map(|d| d.to_owned());
|
||||
item_mut.details = Some(new_poss_dat.details.to_owned());
|
||||
item_mut.details_less_explicit =
|
||||
new_poss_dat.details_less_explicit.map(|d| d.to_owned());
|
||||
item_mut.aliases = new_poss_dat
|
||||
.aliases
|
||||
.iter()
|
||||
|
@ -49,8 +49,8 @@ impl UserVerb for Verb {
|
||||
ctx.session,
|
||||
Some(&format!(
|
||||
ansi!("<blue>{} whispers to {}: \"{}\"<reset>\n"),
|
||||
player_item.display_for_session(&ctx.session_dat),
|
||||
to_whom.display_for_session(&ctx.session_dat),
|
||||
player_item.display_for_sentence(1, false),
|
||||
to_whom.display_for_sentence(1, false),
|
||||
say_what
|
||||
)),
|
||||
)
|
||||
@ -85,8 +85,8 @@ impl UserVerb for Verb {
|
||||
&other_session,
|
||||
Some(&format!(
|
||||
ansi!("<blue>{} whispers to {}: \"{}\"<reset>\n"),
|
||||
player_item.display_for_session(&ctx.session_dat),
|
||||
to_whom.display_for_session(&ctx.session_dat),
|
||||
player_item.display_for_sentence(1, false),
|
||||
to_whom.display_for_sentence(1, false),
|
||||
say_what
|
||||
)),
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
use super::{effect::EffectType, session::Session};
|
||||
use super::effect::EffectType;
|
||||
use crate::{
|
||||
language,
|
||||
regular_tasks::queued_command::QueueCommand,
|
||||
@ -672,9 +672,7 @@ pub struct Item {
|
||||
pub death_data: Option<DeathData>,
|
||||
pub details: Option<String>,
|
||||
pub details_dyn_suffix: Option<String>,
|
||||
pub details_less_explicit: Option<String>,
|
||||
pub display: String,
|
||||
pub display_less_explicit: Option<String>,
|
||||
pub door_states: Option<BTreeMap<Direction, DoorState>>,
|
||||
pub dynamic_entrance: Option<DynamicEntrance>,
|
||||
pub flags: Vec<ItemFlag>,
|
||||
@ -732,18 +730,6 @@ impl Item {
|
||||
buf
|
||||
}
|
||||
}
|
||||
pub fn display_for_session<'l>(self: &'l Self, _session: &Session) -> String {
|
||||
self.display_for_sentence(1, false)
|
||||
}
|
||||
|
||||
pub fn details_for_session<'l>(self: &'l Self, session: &Session) -> Option<&'l str> {
|
||||
self.details.as_ref().map(|dets| {
|
||||
session.explicit_if_allowed(
|
||||
dets.as_str(),
|
||||
self.details_less_explicit.as_ref().map(String::as_str),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn refstr(&self) -> String {
|
||||
format!("{}/{}", &self.item_type, &self.item_code)
|
||||
@ -794,9 +780,7 @@ impl Default for Item {
|
||||
death_data: None,
|
||||
details: None,
|
||||
details_dyn_suffix: None,
|
||||
details_less_explicit: None,
|
||||
display: "Item".to_owned(),
|
||||
display_less_explicit: None,
|
||||
door_states: None,
|
||||
dynamic_entrance: None,
|
||||
flags: vec![],
|
||||
|
@ -5,32 +5,16 @@ use serde::{Deserialize, Serialize};
|
||||
#[serde(default)]
|
||||
pub struct Session {
|
||||
pub source: String,
|
||||
pub less_explicit_mode: bool, // DEPRECATED
|
||||
pub last_active: Option<DateTime<Utc>>,
|
||||
// Reminder: Consider backwards compatibility when updating this. New fields should generally
|
||||
// be an Option, or you should ensure the default value is sensible, or things will
|
||||
// crash out for existing sessions.
|
||||
}
|
||||
|
||||
impl Session {
|
||||
pub fn explicit_if_allowed<'l>(
|
||||
self: &Self,
|
||||
explicit: &'l str,
|
||||
non_explicit: Option<&'l str>,
|
||||
) -> &'l str {
|
||||
if self.less_explicit_mode {
|
||||
non_explicit.unwrap_or(explicit)
|
||||
} else {
|
||||
explicit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Session {
|
||||
fn default() -> Self {
|
||||
Session {
|
||||
source: "unknown".to_owned(),
|
||||
less_explicit_mode: false,
|
||||
last_active: None,
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ pub async fn soak_damage<DamageDist: DamageDistribution>(
|
||||
if clothes_damage > 0 {
|
||||
clothing.health -= clothes_damage;
|
||||
if victim.item_type == "player" {
|
||||
if let Some((vic_sess, sess_dat)) =
|
||||
if let Some((vic_sess, _sess_dat)) =
|
||||
trans.find_session_for_player(&victim.item_code).await?
|
||||
{
|
||||
trans
|
||||
@ -94,7 +94,7 @@ pub async fn soak_damage<DamageDist: DamageDistribution>(
|
||||
&vic_sess,
|
||||
Some(&format!(
|
||||
"A few bits and pieces fly off your {}.\n",
|
||||
clothing.display_for_session(&sess_dat)
|
||||
clothing.display_for_sentence(1, false)
|
||||
)),
|
||||
)
|
||||
.await?;
|
||||
@ -112,7 +112,7 @@ pub async fn soak_damage<DamageDist: DamageDistribution>(
|
||||
.delete_item(&clothing.item_type, &clothing.item_code)
|
||||
.await?;
|
||||
if victim.item_type == "player" {
|
||||
if let Some((vic_sess, sess_dat)) =
|
||||
if let Some((vic_sess, _sess_dat)) =
|
||||
trans.find_session_for_player(&victim.item_code).await?
|
||||
{
|
||||
trans
|
||||
@ -120,7 +120,7 @@ pub async fn soak_damage<DamageDist: DamageDistribution>(
|
||||
&vic_sess,
|
||||
Some(&format!(
|
||||
"Your {} is completely destroyed; it crumbles away to nothing.\n",
|
||||
clothing.display_for_session(&sess_dat)
|
||||
clothing.display_for_sentence(1, false)
|
||||
)),
|
||||
)
|
||||
.await?;
|
||||
@ -1114,7 +1114,7 @@ pub async fn switch_to_feint(ctx: &VerbContext<'_>, who: &Arc<Item>) -> UResult<
|
||||
if to_whom.species != SpeciesType::Human && to_whom.species != SpeciesType::Robot {
|
||||
user_error(format!(
|
||||
"You don't think {} will pay any attention to a feint.",
|
||||
to_whom.display_for_session(&ctx.session_dat)
|
||||
to_whom.display_for_sentence(1, false)
|
||||
))?;
|
||||
}
|
||||
|
||||
|
@ -551,7 +551,7 @@ pub async fn start_conversation(
|
||||
if initiator.item_type != "player" {
|
||||
user_error("Only players can initiate conversation with players".to_owned())?;
|
||||
}
|
||||
let (_other_sess, other_sessdat) =
|
||||
let (_other_sess, _other_sessdat) =
|
||||
trans
|
||||
.find_session_for_player(&acceptor.item_code)
|
||||
.await?
|
||||
@ -579,7 +579,7 @@ pub async fn start_conversation(
|
||||
),
|
||||
&acceptor.display_for_sentence(1, false),
|
||||
&acceptor.pronouns.subject,
|
||||
initiator.display_for_session(&other_sessdat)
|
||||
initiator.display_for_sentence(1, false)
|
||||
))
|
||||
})?;
|
||||
} else {
|
||||
|
@ -35,7 +35,6 @@ fn room_to_simpleroom(room: &Room) -> Option<SimpleRoom<()>> {
|
||||
short: room.short.clone(),
|
||||
grid_coords: room.grid_coords.clone(),
|
||||
description: room.description.clone(),
|
||||
description_less_explicit: room.description_less_explicit.clone(),
|
||||
exits: simple_exits,
|
||||
should_caption: room.should_caption.clone(),
|
||||
repel_npc: room.repel_npc.clone(),
|
||||
|
@ -97,7 +97,6 @@ impl Dynzone {
|
||||
item_code: roomcode,
|
||||
display: room.name.to_owned(),
|
||||
details: Some(room.description.to_owned()),
|
||||
details_less_explicit: room.description_less_explicit.map(|s| s.to_owned()),
|
||||
location: format!("dynzone/{}", &code),
|
||||
special_data: Some(ItemSpecialData::DynroomData {
|
||||
dynzone_code: self.zonetype.to_str().to_owned(),
|
||||
@ -179,7 +178,6 @@ pub struct Dynroom {
|
||||
pub name: &'static str,
|
||||
pub short: &'static str,
|
||||
pub description: &'static str,
|
||||
pub description_less_explicit: Option<&'static str>,
|
||||
pub exits: Vec<Exit>,
|
||||
pub should_caption: bool,
|
||||
pub item_flags: Vec<ItemFlag>,
|
||||
@ -194,7 +192,6 @@ impl Default for Dynroom {
|
||||
name: "Undefined",
|
||||
short: "XX",
|
||||
description: "A generic room",
|
||||
description_less_explicit: None,
|
||||
exits: vec![],
|
||||
should_caption: false,
|
||||
item_flags: vec![],
|
||||
|
@ -13,7 +13,6 @@ pub fn zone() -> Dynzone {
|
||||
name: "Door step",
|
||||
short: "DS",
|
||||
description: "A sleek hallway, painted white, and lit by futuristic looking bluish-white strip lights that run along the edges of the ceiling. Soft navy blue carpet covers the floor. A beige painted door seems to lead into a private studio apartment",
|
||||
description_less_explicit: None,
|
||||
exits: vec!(
|
||||
Exit {
|
||||
direction: Direction::WEST,
|
||||
@ -36,7 +35,6 @@ pub fn zone() -> Dynzone {
|
||||
name: "Studio apartment",
|
||||
short: "ST",
|
||||
description: "An oddly comfortable studio apartment, with worn grey carpet covering the floor. A window to the east has spectacular views of Melbs and the bleak and desolate wasteland beyond it",
|
||||
description_less_explicit: None,
|
||||
exits: vec!(
|
||||
Exit {
|
||||
direction: Direction::WEST,
|
||||
|
@ -16,7 +16,6 @@ pub fn zone() -> Dynzone {
|
||||
of the bleak wasteland to the north. The walls are painted white, and a long reception \
|
||||
desk, enamelled to look like dark wood, is built into the room. It is well lit \
|
||||
with cool white LED lights recessed into the ceiling above",
|
||||
description_less_explicit: None,
|
||||
exits: vec!(
|
||||
Exit {
|
||||
direction: Direction::WEST,
|
||||
@ -39,7 +38,6 @@ pub fn zone() -> Dynzone {
|
||||
name: "Common Room",
|
||||
short: "CO",
|
||||
description: "A large central room, carpeted with floor tiles alternating between light and dark grey in a checkerboard pattern. The walls are painted white, and the room is dimly lit from above with warm white LED bulbs",
|
||||
description_less_explicit: None,
|
||||
exits: vec!(
|
||||
Exit {
|
||||
direction: Direction::WEST,
|
||||
@ -79,7 +77,6 @@ pub fn zone() -> Dynzone {
|
||||
name: "North Wing",
|
||||
short: "NW",
|
||||
description: "A spacious office, carpeted with floor tiles alternating between light and dark grey in a checkerboard pattern. The walls are painted white, and the room is dimly lit from above with warm white LED bulbs",
|
||||
description_less_explicit: None,
|
||||
exits: vec!(
|
||||
Exit {
|
||||
direction: Direction::NORTH,
|
||||
@ -104,7 +101,6 @@ pub fn zone() -> Dynzone {
|
||||
name: "North Balcony",
|
||||
short: "NB",
|
||||
description: "A timber balcony cantilevered on to the north side of the building, complete with an auto-irrigated garden, and glass front panels exposing a breath-taking view of the desolate lands to the north",
|
||||
description_less_explicit: None,
|
||||
exits: vec!(
|
||||
Exit {
|
||||
direction: Direction::SOUTH,
|
||||
@ -124,7 +120,6 @@ pub fn zone() -> Dynzone {
|
||||
name: "East Wing",
|
||||
short: "EW",
|
||||
description: "A spacious office, carpeted with floor tiles alternating between light and dark grey in a checkerboard pattern. The walls are painted white, and the room is dimly lit from above with warm white LED bulbs",
|
||||
description_less_explicit: None,
|
||||
exits: vec!(
|
||||
Exit {
|
||||
direction: Direction::EAST,
|
||||
@ -149,7 +144,6 @@ pub fn zone() -> Dynzone {
|
||||
name: "Store room",
|
||||
short: "SR",
|
||||
description: "A strong-room apparently designed to preserve people or things in any emergency. The walls, floor, and ceiling all appear to be made of thick steel",
|
||||
description_less_explicit: None,
|
||||
exits: vec!(
|
||||
Exit {
|
||||
direction: Direction::WEST,
|
||||
@ -169,7 +163,6 @@ pub fn zone() -> Dynzone {
|
||||
name: "Health centre",
|
||||
short: "HC",
|
||||
description: "A room apparently designed as a kind of corporate sick-bay. The floor is tiled, and the walls are painted with white glossy easy-wipe paint",
|
||||
description_less_explicit: None,
|
||||
exits: vec!(
|
||||
Exit {
|
||||
direction: Direction::NORTHEAST,
|
||||
@ -189,7 +182,6 @@ pub fn zone() -> Dynzone {
|
||||
name: "Kitchen",
|
||||
short: "KT",
|
||||
description: "A room apparently designed for food preparation. It is tiled with small light green tiles that cover the walls and floor, and has an abundance of water and drain fittings",
|
||||
description_less_explicit: None,
|
||||
exits: vec!(
|
||||
Exit {
|
||||
direction: Direction::NORTH,
|
||||
|
@ -14,7 +14,6 @@ pub struct FixedItem {
|
||||
pub code: String,
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
pub description_less_explicit: Option<String>,
|
||||
pub location: String,
|
||||
pub proper_noun: bool,
|
||||
pub aliases: Vec<String>,
|
||||
@ -27,7 +26,6 @@ impl Default for FixedItem {
|
||||
code: "default".to_owned(),
|
||||
name: "default".to_owned(),
|
||||
description: "A thingy".to_owned(),
|
||||
description_less_explicit: None,
|
||||
location: "unset".to_owned(),
|
||||
proper_noun: true,
|
||||
aliases: vec![],
|
||||
@ -55,7 +53,6 @@ fn fixed_item_list() -> &'static Vec<FixedItem> {
|
||||
and I have a robot police force to keep you safe from the worst baddies, \
|
||||
but be warned - there still are some dangers near by, and the world \
|
||||
further out, outside my realm, is a dangerous and radioactive place.\"".to_owned(),
|
||||
description_less_explicit: None,
|
||||
location: "room/repro_xv_updates".to_owned(),
|
||||
proper_noun: false,
|
||||
aliases: vec!["poster".to_owned()],
|
||||
@ -71,7 +68,6 @@ fn fixed_item_list() -> &'static Vec<FixedItem> {
|
||||
dogs were friendly companions and not the menace they are today. It smells \
|
||||
faintly of iron. [Try <bold>drink from fountain<reset> or, if you have a suitable \
|
||||
container, <bold>fill<reset> container <bold>from fountain<reset>].").to_owned(),
|
||||
description_less_explicit: None,
|
||||
location: "room/melbs_kingst_40".to_owned(),
|
||||
proper_noun: false,
|
||||
aliases: vec!["fountain".to_owned()],
|
||||
@ -109,7 +105,6 @@ pub fn static_items() -> Box<dyn Iterator<Item = StaticItem>> {
|
||||
item_type: "fixed_item".to_owned(),
|
||||
display: r.name.clone(),
|
||||
details: Some(r.description.clone()),
|
||||
details_less_explicit: r.description_less_explicit.as_ref().map(|d| d.clone()),
|
||||
location: r.location.clone(),
|
||||
is_static: true,
|
||||
aliases: r.aliases.iter().map(|s| (*s).clone()).collect(),
|
||||
|
@ -310,9 +310,7 @@ pub struct SitData {
|
||||
pub struct PossessionData {
|
||||
pub weapon_data: Option<WeaponData>,
|
||||
pub display: &'static str,
|
||||
pub display_less_explicit: Option<&'static str>,
|
||||
pub details: &'static str,
|
||||
pub details_less_explicit: Option<&'static str>,
|
||||
pub aliases: Vec<&'static str>,
|
||||
pub max_health: u64,
|
||||
pub charge_data: Option<ChargeData>,
|
||||
@ -338,9 +336,7 @@ impl Default for PossessionData {
|
||||
Self {
|
||||
weapon_data: None,
|
||||
display: "Thingy",
|
||||
display_less_explicit: None,
|
||||
details: "A generic looking thing",
|
||||
details_less_explicit: None,
|
||||
aliases: vec![],
|
||||
max_health: 10,
|
||||
weight: 250,
|
||||
@ -441,9 +437,7 @@ impl Into<Item> for PossessionType {
|
||||
item_type: "possession".to_owned(),
|
||||
possession_type: Some(self.clone()),
|
||||
display: possession_dat.display.to_owned(),
|
||||
display_less_explicit: possession_dat.display_less_explicit.map(|d| d.to_owned()),
|
||||
details: Some(possession_dat.details.to_owned()),
|
||||
details_less_explicit: possession_dat.details_less_explicit.map(|d| d.to_owned()),
|
||||
aliases: possession_dat
|
||||
.aliases
|
||||
.iter()
|
||||
|
@ -383,7 +383,6 @@ pub struct Room {
|
||||
pub short: String,
|
||||
pub grid_coords: GridCoords,
|
||||
pub description: String,
|
||||
pub description_less_explicit: Option<String>,
|
||||
pub exits: Vec<Exit>,
|
||||
pub should_caption: bool,
|
||||
pub repel_npc: bool,
|
||||
@ -411,7 +410,6 @@ impl Default for Room {
|
||||
short: "DF".to_owned(),
|
||||
grid_coords: GridCoords { x: 0, y: 0, z: 0 },
|
||||
description: "default".to_owned(),
|
||||
description_less_explicit: None,
|
||||
exits: vec![],
|
||||
should_caption: true,
|
||||
repel_npc: false,
|
||||
@ -440,7 +438,6 @@ pub struct SimpleRoom<T> {
|
||||
pub short: String,
|
||||
pub grid_coords: GridCoords,
|
||||
pub description: String,
|
||||
pub description_less_explicit: Option<String>,
|
||||
pub exits: Vec<SimpleExit>,
|
||||
pub should_caption: bool,
|
||||
pub repel_npc: bool,
|
||||
@ -477,7 +474,6 @@ impl<T> Into<Room> for SimpleRoom<T> {
|
||||
short: parse_ansi_markup(&self.short).unwrap(),
|
||||
grid_coords: self.grid_coords,
|
||||
description: parse_ansi_markup(&self.description).unwrap(),
|
||||
description_less_explicit: self.description_less_explicit,
|
||||
exits: self.exits.into_iter().map(|e| e.into()).collect(),
|
||||
should_caption: self.should_caption,
|
||||
repel_npc: self.repel_npc,
|
||||
@ -505,7 +501,6 @@ impl<'a, T: Default> Default for SimpleRoom<T> {
|
||||
short: "DF".to_owned(),
|
||||
grid_coords: GridCoords { x: 0, y: 0, z: 0 },
|
||||
description: "default".to_owned(),
|
||||
description_less_explicit: None,
|
||||
exits: vec![],
|
||||
should_caption: true,
|
||||
repel_npc: false,
|
||||
@ -569,7 +564,6 @@ pub fn room_static_items() -> Box<dyn Iterator<Item = StaticItem>> {
|
||||
item_type: "room".to_owned(),
|
||||
display: r.name.to_owned(),
|
||||
details: Some(r.description.to_owned()),
|
||||
details_less_explicit: r.description_less_explicit.as_ref().map(|d| d.to_owned()),
|
||||
location: format!("zone/{}", r.zone),
|
||||
is_static: true,
|
||||
flags: r.item_flags.clone(),
|
||||
|
@ -22,7 +22,6 @@ pub fn fixed_items() -> Vec<FixedItem> {
|
||||
code: "computer_museum_club_door_lock".to_owned(),
|
||||
name: "basic keyed lock".to_owned(),
|
||||
description: "A basic lock that looks like it needs a key to open".to_owned(),
|
||||
description_less_explicit: None,
|
||||
location: "room/computer_museum_hackers_club".to_owned(),
|
||||
proper_noun: false,
|
||||
aliases: vec!["lock".to_owned()],
|
||||
|
@ -181,7 +181,6 @@ pub fn room_list() -> Vec<Room> {
|
||||
stretchers. It smells strongly of phenolic cleaners. At the front of the room \
|
||||
a triage nurse assures everyone coming in they will be assessed by doctors \
|
||||
a minute after arriving. Doctors pace the floor treating patients").to_owned(),
|
||||
description_less_explicit: None,
|
||||
grid_coords: GridCoords { x: 0, y: 0, z: 0 },
|
||||
exits: vec!(
|
||||
Exit {
|
||||
|
@ -28,7 +28,6 @@ CREATE INDEX item_by_loc ON items ((details->>'location'));
|
||||
CREATE INDEX item_by_static ON items ((cast(details->>'is_static' as boolean)));
|
||||
CREATE INDEX item_by_display ON items (lower(details->>'display'));
|
||||
CREATE INDEX item_by_owner ON items (lower(details->>'owner'));
|
||||
CREATE INDEX item_by_display_less_explicit ON items (lower(details->>'display_less_explicit'));
|
||||
CREATE INDEX item_by_following ON items ((details->'following'->>'follow_whom'));
|
||||
CREATE UNIQUE INDEX item_dynamic_entrance ON items (
|
||||
(details->'dynamic_entrance'->>'source_item'),
|
||||
|
Loading…
Reference in New Issue
Block a user