Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign up[RDY] Initial craft entity implementation #28937
Conversation
This comment has been minimized.
This comment has been minimized.
|
Related suggestion to lessen spoilage of ingredients (especially for large batches): #28930 |
This comment has been minimized.
This comment has been minimized.
|
Like I said, I'm not aiming to change mechanics too much in this pr. General discussion of the crafting overhaul belongs in #29210 |
ifreund
marked this pull request as ready for review
Apr 1, 2019
This comment has been minimized.
This comment has been minimized.
|
Whoops, wasn't quite ready to mark this as ready yet, still want to do a bit of code cleanup and it looks like I need to rebase as well. |
ifreund
force-pushed the
ifreund:craft-entity
branch
2 times, most recently
from
c5336f6
to
e5d845f
Apr 1, 2019
This comment has been minimized.
This comment has been minimized.
|
Ok this is ready for review. I had initially planned to try and make in progress crafts look like their products, but that can wait for one of the many planned follow up prs addressing #28775 |
ifreund
added this to Confirmed
in 0.E Release
via automation
Apr 1, 2019
ifreund
added this to In progress
in Tailoring Overhaul
via automation
Apr 1, 2019
This comment has been minimized.
This comment has been minimized.
|
I don't see spoilage being handled anywhere in you code. There's a possible exploit related to it:
My point is, a craft made of perishable items should also be perishable, and it shouldn't last longer than its first to go off ingredient. |
This comment has been minimized.
This comment has been minimized.
|
Yeah, that's part of my todo list in #29210. I thought that the poor handling would be ok for now, but you're right that it is a little too exploitable to be merged in it's current state. Will look into a proper fix. |
This comment has been minimized.
This comment has been minimized.
|
Ok, components now rot while in an in progress craft. The relative rot of the most rotten component at completion is transferred to the product. This may be a little unrealistic in some preservation recipes, but that's a subject for a different pr, this one is large enough. |
codemime
reviewed
Apr 2, 2019
src/activity_handlers.cpp Outdated
codemime
reviewed
Apr 2, 2019
src/activity_handlers.cpp Outdated
codemime
reviewed
Apr 2, 2019
src/activity_handlers.cpp Outdated
codemime
reviewed
Apr 2, 2019
src/crafting.cpp Outdated
codemime
reviewed
Apr 2, 2019
src/crafting.cpp Outdated
codemime
reviewed
Apr 2, 2019
src/item.cpp Outdated
codemime
reviewed
Apr 2, 2019
codemime
reviewed
Apr 2, 2019
|
|
||
| for( const item &it : components ) { | ||
| if( it.has_flag( "HIDDEN_POISON" ) ) { | ||
| set_flag( "HIDDEN_POISON" ); |
This comment has been minimized.
This comment has been minimized.
codemime
Apr 2, 2019
Member
This approach isn't particularly robust: imagine adding new flags or removing them. Essentially this snipped is code duplication with all its drawbacks. I'd tweak item::has_flag instead.
This comment has been minimized.
This comment has been minimized.
ifreund
Apr 2, 2019
Author
Contributor
The reason I did it this way is that I wasn't sure if it made sense for all flags to be transferred and didn't want to cause any potential strange behavior. Will take another look at this.
codemime
reviewed
Apr 2, 2019
src/item.cpp Outdated
codemime
reviewed
Apr 2, 2019
src/item.cpp Outdated
codemime
reviewed
Apr 2, 2019
src/item.cpp Outdated
This comment has been minimized.
This comment has been minimized.
|
Ok, proposed solution for rot that actually better captures what the old code was trying to calculate and I think makes sense.
|
ifreund
changed the title
Initial craft entity implementation
[WIP] Initial craft entity implementation
Apr 3, 2019
This comment has been minimized.
This comment has been minimized.
|
That makes sense to me, and has a number of great qualities. Only weird edge case, what if an output is permafood? |
This comment has been minimized.
This comment has been minimized.
|
Ok, I implemented basically what I outlined, for the permafood edge case I've decided to maintain the status quo of crafting permafood with old/rotting components being an exploit. Will look at fixing that in a future pr.
|
ifreund
changed the title
[WIP] Initial craft entity implementation
Initial craft entity implementation
Apr 3, 2019
ifreund
changed the title
Initial craft entity implementation
[WIP] Initial craft entity implementation
Apr 3, 2019
This comment has been minimized.
This comment has been minimized.
|
Ok, now we should really be good to go. |
ifreund
changed the title
[WIP] Initial craft entity implementation
Initial craft entity implementation
Apr 3, 2019
kevingranade
requested changes
Apr 4, 2019
This comment has been minimized.
This comment has been minimized.
|
Gotta love it when the tests catch all the stupid things I did. Should be good to go now. |
ifreund
force-pushed the
ifreund:craft-entity
branch
from
8a60fa1
to
00e9a6a
Apr 5, 2019
This was referenced Apr 5, 2019
codemime
reviewed
Apr 5, 2019
| } | ||
| if( !p->has_item( *craft ) ) { | ||
| p->add_msg_if_player( "%s no longer has the target '%s.' Aborting ACT_CRAFT.", | ||
| p->disp_name(), craft->tname() ); |
This comment has been minimized.
This comment has been minimized.
codemime
Apr 5, 2019
Member
This can appear during normal play, so it shouldn't look like a debug message.
This comment has been minimized.
This comment has been minimized.
ifreund
Apr 6, 2019
Author
Contributor
Pretty sure I intended for that to be a debug message but called the wrong function. I guess it could pop up rarely in normal play however and wouldn't cause any problems, so I'll take your advice and fix it.
Thanks for all your time reviewing this pr by the way!
This comment has been minimized.
This comment has been minimized.
codemime
Apr 6, 2019
Member
Thanks in return for your efforts working on it: the list of presumably resolved issues is quite impressive.
ifreund
changed the title
Initial craft entity implementation
[RDY] Initial craft entity implementation
Apr 7, 2019
ifreund
added some commits
Mar 23, 2019
ifreund
force-pushed the
ifreund:craft-entity
branch
from
1c21032
to
fbb59eb
Apr 8, 2019
kevingranade
merged commit 7225789
into
CleverRaven:master
Apr 9, 2019
0.E Release
automation
moved this from Confirmed
to Done
Apr 9, 2019
Tailoring Overhaul
automation
moved this from In progress
to Done
Apr 9, 2019
This comment has been minimized.
This comment has been minimized.
|
This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there: |
ifreund commentedMar 23, 2019
•
edited
Summary
SUMMARY: Features "Represent in progress crafts as an item."Purpose of change
First step in #29210
Closes #28775
Closes #25188
Fixes #28718
Fixes #28930
Closes #28698
Closes #28592
Fixes #26264
Closes #23971
Closes #21850
Fixes #18191
Describe the solution
craftstart_craft()to generate the itemitem::type_name()(probably put "in progress craft" in the json and move the substitution string to the c++ code)Additional context
The main goal of this PR is to implement a fully functional craft item while keeping crafting mechanics mostly unchanged. It may prove easier to modify some checks to be incremental, but I really just want to get a solid foundation established that I can build on in subsequent pull requests.