Skip to content

Conversation

lstebner
Copy link
Collaborator

@lstebner lstebner commented Jul 17, 2022

note: this is a work in progress. the art is especially mediocre at this point but it's mostly working haha

What this PR does

add "weeds" and "compost"

  • weeds grow randomly overnight in unoccupied plots. they're worth very little but can be sold
  • weeds can be harvested and turned into compost through crafting
  • compost acts like fertilizer

How this change can be validated

Questions or concerns about this change

Additional information

Screen Shot 2022-07-17 at 9 18 21 PM

Screen Shot 2022-07-17 at 9 20 02 PM

Screen Shot 2022-07-17 at 9 20 16 PM

Screen Shot 2022-07-17 at 9 20 55 PM

Screen Shot 2022-07-17 at 9 23 59 PM

Screen Shot 2022-07-17 at 9 30 25 PM

    - weeds grow randomly overnight in unoccupied plots
    - weeds can be turned into compost through crafting
    - compost acts like fertilizer
@vercel
Copy link

vercel bot commented Jul 17, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
farmhand ✅ Ready (Inspect) Visit Preview Jul 21, 2022 at 2:41PM (UTC)

@jeremyckahn
Copy link
Owner

This is very cool! I love the idea. I know you're still working on this so I won't dig into the code yet. I've got some initial play testing feedback (some of which you probably have in mind already):

  • Weeds shouldn't be considered crops. I think it makes sense for weeds to just be a farmhand.plotContent, and not a farmhand.crop:

    farmhand/src/index.js

    Lines 37 to 44 in a0384fd

    /**
    * This is a minimalist base type to be inherited and expanded on by types like
    * farmhand.crop. This also represents non-crop plot content like scarecrows
    * and sprinklers.
    * @typedef farmhand.plotContent
    * @type {Object}
    * @property {string} itemId
    */
    • As part of this, pulling weeds shouldn't trigger the harvest-crop achievement:
      ((reward = 200) => ({
      id: 'harvest-crop',
      name: 'Harvest a Crop',
      description: 'Harvest a crop that you planted.',
      rewardDescription: dollarString(reward),
      condition: state => sumOfCropsHarvested(state.cropsHarvested) >= 1,
      reward: state => addMoney(state, reward),
      }))(),
  • It might make sense to start new games with some weeds in the field.
  • Crows shouldn't eat weeds.
  • Weeds shouldn't have fluctuating prices. I think they should be sell-able for something like a stable $0.10.
  • Perhaps instead of being directly plantable in the field, perhaps Compost should be an ingredient for a Fertilizer recipe?

    - added purchaseable composter
    - weeds are no longer considered crops
    - lower value on weeds
    - added itemType 'WEEDS'
    - refactored harvestPlot a bit to make it easier to understand for
      weeds vs crops
Copy link
Owner

@jeremyckahn jeremyckahn left a comment

Choose a reason for hiding this comment

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

Awesome work so far! We've already talked about a few things here on Discord, but I wanted to get it all in once place here on the PR. Hopefully none of my suggestions are too onerous to deal with.

The art looks great to me!

src/enums.js Outdated
'NONE',
'STANDARD',
'RAINBOW',
'COMPOST',
Copy link
Owner

Choose a reason for hiding this comment

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

Would it make sense to drop the COMPOST fertilizer type and instead craft STANDARD fertilizer with pulled weeds? I'm thinking that would be simplify the implementation and perhaps be a little more straightforward for players too.

type: WEEDS,
})

export { weeds }
Copy link
Owner

Choose a reason for hiding this comment

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

Totally not a big deal, but if you have to go back in here it might be worth exporting the weeds variable directly from its definition above to keep consistent with other item definitions.

Comment on lines 54 to 56
const weeds = freeze({
id: 'weeds',
name: 'Weeds',
Copy link
Owner

Choose a reason for hiding this comment

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

What do you think about changing these terms to be be singular rather than plural, to be consistent with the other items? So, weed/Weed instead of weeds/Weeds.

src/utils.js Outdated
export const getPlotImage = plotContent => {
if (plotContent) {
if (getPlotContentType(plotContent) === itemType.CROP) {
console.log(getCropLifeStage(plotContent), getCropId(plotContent))
Copy link
Owner

Choose a reason for hiding this comment

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

Reminder to drop this before merging. 🎗️

src/enums.js Outdated
'TOMATO',
'WATERMELON',
'WHEAT',
'WEEDS',
Copy link
Owner

Choose a reason for hiding this comment

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

What do you think about switching from plural "weeds" semantics to singular ("weed") for both the cropType here and the itemType below in order to remain consistent with the other cropType and itemType semantics?

src/enums.js Outdated
'NONE',
'STANDARD',
'RAINBOW',
'COMPOST',
Copy link
Owner

Choose a reason for hiding this comment

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

If we drop the mechanic of using compost as fertilizer directly, I think we can drop this addition.


if (plotContent.fertilizerType === fertilizerType.STANDARD) {
if (
[fertilizerType.STANDARD, fertilizerType.COMPOST].includes(
Copy link
Owner

Choose a reason for hiding this comment

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

If we drop fertilizerType.COMPOST, we can revert this change.

@lstebner lstebner marked this pull request as ready for review July 18, 2022 04:18
…ngredients, and consider weeds ripe so they are highlighted when using scythe
@lstebner
Copy link
Collaborator Author

thank you for the excellent and thorough review @jeremyckahn ! you had a ton of great suggestions and I believe I made them all (except one that I responded to). i also made an additional change to support multiple images for weeds and changed the graphic in general so make sure you give that code a look and let me know if it's ok or there's a better way to do it. after playing a bit i actually kinda like the compost image, but am open to modifying it if you have ideas.

@jeremyckahn
Copy link
Owner

I found a separate issue that may also be related to shoveling:
Screenshot from 2022-07-19 09-38-20

To reproduce this issue, load crashing-farmhand-data.zip, go to the Field, select the Hoe, and click on the field. This may or may not be related to shoveling some days prior, but I haven't been able to debug much yet.

@jeremyckahn
Copy link
Owner

99fdcaa seems to be addressing the weed animation issue! Nice work on that. I'm still able to reproduce the crashing issue, but that seems like the last remaining bug.

@jeremyckahn
Copy link
Owner

I'm still able to reproduce the crashing issue, but that seems like the last remaining bug.

This should be fixed in 760bcb4! Please review and make sure it's working correctly for you.

I noticed some tests are failing due to 99fdcaa, so we'll just need to determine whether these are legitimate breakages or just outdated tests.

@lstebner
Copy link
Collaborator Author

This should be fixed in 760bcb4! Please review and make sure it's working correctly for you.

thank you! i tested with the save you provided and it doesn't crash anymore 🎉

I noticed some tests are failing due to 99fdcaa, so we'll just need to determine whether these are legitimate breakages or just outdated tests.

these should be fixed now!

Copy link
Owner

@jeremyckahn jeremyckahn left a comment

Choose a reason for hiding this comment

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

I found another bug. 😩

Unfortunately the Plot code is a little fragile, as we're seeing now. We are getting close though!

state = modifyFieldPlotAt(state, x, y, () => {
return {
isShoveled: true,
wasJustShoveled: true,
Copy link
Owner

Choose a reason for hiding this comment

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

Good idea!

Comment on lines 93 to 101
useEffect(() => {
if (
!initialIsShoveledState &&
plotContent?.isShoveled &&
plotContent?.oreId
) {
setWasJustShoveled(true)
}
}, [initialIsShoveledState, plotContent])
Copy link
Owner

Choose a reason for hiding this comment

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

I think I know why this was here now. I found a newly-introduced bug wherein the "mined" animation replays when you leave the Field and then come back:

Screencast.from.07-20-2022.09.19.21.PM.webm

We'll have to figure out a solution for this before we can merge. 😕

Copy link
Owner

@jeremyckahn jeremyckahn left a comment

Choose a reason for hiding this comment

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

I think this is ready to go now! I just pushed some cleanup and refactoring work, so please review that and let me know if it looks good to you. If it does, feel free to merge and run a minor release since this change affects the persisted data structure.

Awesome work here! Thanks for sticking with this and knocking out all the bugs. And congrats on implementing a brand new feature! 🎉

@lstebner lstebner merged commit e3965ef into develop Jul 21, 2022
@lstebner lstebner deleted the lstebner/weeds-and-compost branch July 21, 2022 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants