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

Refactors eating and drinking #3733

Closed
wants to merge 2 commits into from
Closed

Refactors eating and drinking #3733

wants to merge 2 commits into from

Conversation

VampyrBytes
Copy link
Contributor

No more need for 4(!) lots of code dealing with eating and drinking, carbon mobs now have eat proc that handles it and takes a reagent_container/food object and the user
Pills are now a child of food.
Kitchen utensils now create a food item identical to the original with enough reagents taken from it for one mouthful.
The only gameplay changes are related to messages and add consistency (eg you now get the message related to how hungry you are when eating off kitchen utensils)
Fixed some relative pathing

If I've missed anywhere that deals with eating let me know and I'll factor it in

@tigercat2000
Copy link
Contributor

@VampyrBytes Travis is working fine, you didn't update metastation with the new paths.

@VampyrBytes
Copy link
Contributor Author

Ah right, thanks @tigercat2000

@Tastyfish
Copy link
Contributor

Check the awaystation maps that we use (listeningoutpost, moonoutpost19, undergroundoutpost45) as well.

@Fox-McCloud Fox-McCloud added the Refactor This PR will clean up the code but have the same ingame outcome label Feb 28, 2016
@Iamgoofball
Copy link
Contributor

Pills are now a child of food.

uhhh

this means patches use food code

@VampyrBytes
Copy link
Contributor Author

Yeah, I know... I thought the same, then I looked at what they were doing, which was using the pill eating code anyway.

Sounds wrong but works well

@Fox-McCloud
Copy link
Member

@VampyrBytes

Before I review this, what thing(s) are changed, exactly? (from a mechanics standpoint).

@VampyrBytes
Copy link
Contributor Author

There's only 2 new mechanics.
When you picked up food with a kitchen utensil before it just transferred a bite's amount of the reagents from the target food to the fork which were then transferred to the mob when the utensil was used to eat off. Now it creates a new instance of that type of food, removes all the reagents from it and then puts a bite's amount of the reagents from the old one into the new one. The new one is what is passed into the eat proc when the utensil is used.

The other new one is food items having a consume_sound var with the sound to play when it's consumed (if !null), rather than them being hard coded into the procs, which was done for the eating and drinking sounds, and has the side effect of allowing for a specific food to have a specific sound played if someone wanted that (explosion sound on drinking a syndicate bomb anyone? 😉)

Where before there was stuff done in if(human) clauses, it's now done through overriding. All the other mechanics were taken from one or more of the existing methods and just made to work together. Other than that it was just cleaning up stuff.... breaking the big procs up so each proc is focussed on one thing, which can then be overridden, or use another one based on an if, changing colour macros into spans, using visible_message rather than for loops and removing relative paths

Think that pretty much covers everything I did 😃

@VampyrBytes
Copy link
Contributor Author

@Fox-McCloud
Anything else you need to know before review?

if(toEat.reagents.total_volume)
toEat.reagents.reaction(src, toEat.apply_type)
spawn(0)
Copy link
Member

Choose a reason for hiding this comment

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

What is the purpose of this spawn?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Crazylemon64
That's a good question. It was in the originals, and I wasn't 100% about taking it out. I'll be glad if I can take it out though, as I had to put in spawns to counteract it when the items were finished, otherwise they got deleted before the reagents were transferred

@Fox-McCloud
Copy link
Member

Anything else you need to know before review?

Can't think of anything, at the moment.

@Fox-McCloud
Copy link
Member

just waiting for: #2903 to be merged in.

@VampyrBytes
Copy link
Contributor Author

No worries, I don't want to cause @Aurorablade any more merge conflicts either.

@Fox-McCloud Fox-McCloud added the Merge Conflict This PR is merge conflicted label Mar 5, 2016
@Fox-McCloud
Copy link
Member

Merge conflicts

@VampyrBytes
Copy link
Contributor Author

Messed up resolving them (which turned out to be a good thing), so putting up a new PR

@VampyrBytes VampyrBytes closed this Mar 5, 2016
Fox-McCloud added a commit that referenced this pull request Mar 8, 2016
@VampyrBytes VampyrBytes deleted the EatDrinkRefactor branch March 12, 2016 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merge Conflict This PR is merge conflicted Refactor This PR will clean up the code but have the same ingame outcome
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants