Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

feat: Allow renaming of Plants and Gotchi #18

Open
wants to merge 12 commits into
base: staging
Choose a base branch
from

Conversation

Muirrum
Copy link
Member

@Muirrum Muirrum commented Aug 16, 2020

#16

@Muirrum Muirrum requested a review from cedric-h August 16, 2020 18:23
@@ -11,6 +12,9 @@ use spawn::spawn;
mod hatch;
use hatch::hatch;

mod rename_gotchi;
use rename_gotchi::rename;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would complain because all of them are named i.e. "hatch" and not "hatch_item", but because gotchi aren't items I can see why you named it "rename_gotchi". okay.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the name of the Ask to NicknameGotchi, this should probably be nickname_gotchi but it really doesn't matter


impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "couldn't spawn items: ")?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we were renaming gotchi, not spawning items?


#[derive(Debug)]
pub enum Error {
NoSuchItemConf(ConfigError),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this error could occur outside of the context of spawning items ...

let mut bobstead = Hackstead::register().await?;

// we'll need to keep track of how many items we have to see if spawning works.
fn count_relevant_items(hackstead: &Hackstead) -> usize {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure this actually tests renaming things, like it claims to

@@ -10,6 +10,9 @@ use summon::summon;
mod rub;
use rub::rub;

mod nickname;
use nickname::nickname;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other one is named rename_gotchi, but this one is named "nickname". I know this is a bit of a nitpick, but could we be consistent here for maintenance's sake?

let not_seed_item = not_seed_arch.spawn().await?;
let open_tile = bobstead.free_tile().expect("fresh hackstead no open land?");

struct NewPlantAssumptions {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to go out on a limb here and say this test doesn't test renaming plants, it tests spawning them ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest probably going off of i.e. rub_effects tests here, since those just panic if planting a plant goes wrong, whereas these go across every case, sometimes expecting errors, etc.

@Muirrum Muirrum changed the base branch from master to staging August 26, 2020 16:03
@Muirrum Muirrum requested a review from cedric-h August 26, 2020 16:12
@Muirrum
Copy link
Member Author

Muirrum commented Aug 28, 2020

There's an issue where the builds can fail or pass. It seems like an issue with bincode being too large to pass updates down the wormhole

https://builds.sr.ht/~muirrum/job/289485#task-stable-1271 it also seems that the server is closing too early.

@@ -1,5 +1,6 @@
use super::{strerr, HandledAskKind, SessSend};
use crate::wormhole::server;
use hcor::id::ItemId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would merge this with the imports below it, but ok

@@ -11,6 +12,9 @@ use spawn::spawn;
mod hatch;
use hatch::hatch;

mod rename_gotchi;
use rename_gotchi::rename;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the name of the Ask to NicknameGotchi, this should probably be nickname_gotchi but it really doesn't matter

mod test {
#[actix_rt::test]
/// NOTE: requires that at least one item exists in the config!
async fn spawn() -> hcor::ClientResult<()> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this probably shouldn't be named spawn

}
}

pub fn rename(ss: &mut SessSend, item_id: ItemId, new_name: String) -> Result<String, Error> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, nickname would be better here just to match up with GotchiNickname (which I changed so it would be the same as PlantNickname)

mod test {
#[actix_rt::test]
/// NOTE: relies on item/spawn!
async fn summon() -> hcor::ClientResult<()> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't seem to test nicknaming anywhere?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and has a lot of summoning going on

let seed_item = seed_arch.spawn().await?;
let open_tile = bobstead.free_tile().expect("New hackstead no open land?");

let plant = open_tile.plant_seed(seed_item).await?;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hold on what are seeds doing in my gotchi test

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants