Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zone activity - farm plot planting #25181

Merged
merged 16 commits into from Aug 31, 2018
Merged

Conversation

Robik81
Copy link
Contributor

@Robik81 Robik81 commented Aug 27, 2018

Summary

SUMMARY: Features "adds new option for Farm: Plot zone to attach specific seed and new activity to plant in nearby plot zones"

Purpose of change

As outlined in #24826 , this PR aims at reducing tedium of farming. Follow up of #25125 . Planting activity for Farm: Plot zone. Watering, weeding and fertilizing will follow in separate PRs.

Describe the solution

  1. Select seed for existing Farm: Plot zone (via Edit->Edit options in zone manager) or select seed while creating a new one
  2. After Tilling farm plots activity, perform Plant seeds activity (shortcut Shift+O).
  3. Watch your character do all the work automatically.

Update

Watering, weeding and fertilizing will follow if / when the improved crop farming is implemented again.

@Vasyan2006
Copy link
Contributor

I'm still planning to separate >Watering, weeding and fertilizing into new functions, so you will be able to use your tumba-jumba zone magic and apply them over every tile. I suppose it will be faster to commit such changes into your branch rather then opening new PR.

@Robik81
Copy link
Contributor Author

Robik81 commented Aug 27, 2018

I suppose it will be faster to commit such changes into your branch rather then opening new PR.

I think if you'l make tiny PR only with refactoring of a function into two, @ZhilkinSerg can review and merge something like this quite fast?

src/iexamine.cpp Outdated

// if true, it works fine for normal planting, but closes immediately if called
// from parent uimenu when adding new planting zone
smenu.return_invalid = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

What comment says.

Copy link
Contributor

@Qrox Qrox Aug 28, 2018

Choose a reason for hiding this comment

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

I guess it is because there's a timeout set in the input manager (for blinking), so when the timeout is triggered in the submenu, it thinks it is an unbound key, and returns because return_invalid is true.

See here:
https://github.com/CleverRaven/Cataclysm-DDA/blob/c27cf5e2335d55cb13cf97e8b47b485b51b6c5d2/src/game.cpp#L8420

I'll let uimenu handle it properly in my PR. For now you may want to temporarily disable the timeout before calling up the submenu.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Your guess was correct. That was indeed a problem.

Thank you very much for helping me out.

(I see you are going to handle it on the uimenu side, cool.)

@ZhilkinSerg ZhilkinSerg added <Enhancement / Feature> New features, or enhancements on existing [JSON] Changes (can be) made in JSON [C++] Changes (can be) made in C++. Previously named `Code` Controls / Input Keyboard, mouse, keybindings, input UI, etc. labels Aug 28, 2018
@ZhilkinSerg
Copy link
Contributor

#25204 is merged

@Robik81
Copy link
Contributor Author

Robik81 commented Aug 28, 2018

Thank you guys.

On the weeding I go... it will be in separate PR though, this one is big enough as it is.

much easier to add more than one extra option to zones this way
when zone manager is open, zones which support marking show selected mark in its tiles
break the code into multiple functions to allow calling the same code from outside
while I prefer distinct naming convention for interfaces, it looked incredibly odd with naming conventions in this project
gorgon fix CleverRaven#2

gorgon fix
to prevent possible infinite loop
@Robik81
Copy link
Contributor Author

Robik81 commented Aug 29, 2018

Given that PR #24291 was rolled back, I updated this PR to work with the old planting system.

@ZhilkinSerg ZhilkinSerg self-assigned this Aug 29, 2018
src/iexamine.cpp Outdated
g->m.add_item_or_charges( examp, used_seed.front() );
g->m.set( examp, t_dirt, f_plant_seed );
p.moves -= 500;
add_msg( _( "Planted %s" ), item::nname( seed_id ).c_str() );
Copy link
Contributor

Choose a reason for hiding this comment

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

Should probably add period after Planted %s

@ZhilkinSerg
Copy link
Contributor

No feedback for player (in message log or popup) when Plant items action is selected, but plant zone is not defined or plant zone has no seeds selected in its options.

@Robik81
Copy link
Contributor Author

Robik81 commented Aug 29, 2018

No feedback for player (in message log or popup) when Plant items action is selected, but plant zone is not defined or plant zone has no seeds selected in its options.

There is feedback if no compatible zone is nearby:
image

There is no feedback if you have only Unsorted loot zone defined but there is nothing to sort (i'l write it down as sort loot issue). You can't pick any farm related action in this case though.

If you have plant zone, but is not tilled, have no seed attached, or you have no seeds, there is also not any feedback. This one is probably the one you are referring to.

I'll fix the issue.

@Robik81
Copy link
Contributor Author

Robik81 commented Aug 29, 2018

New commits changes

  • extra dot in Planted %s message
  • action menu now checks if you have any seeds at all (planting disabled if not)
  • added message "You planted all seeds you could." after planting action is finished (whether you planted anything or not)

damn you, astyling in Visual Studio
@ZhilkinSerg ZhilkinSerg merged commit 0db5290 into CleverRaven:master Aug 31, 2018
@ZhilkinSerg ZhilkinSerg removed their assignment Aug 31, 2018
@Robik81 Robik81 deleted the farm_plant branch September 2, 2018 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Controls / Input Keyboard, mouse, keybindings, input UI, etc. <Enhancement / Feature> New features, or enhancements on existing [JSON] Changes (can be) made in JSON
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants