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

[added] Chicken/Fishy/Steak turn into food after getting hit by fire arrow + [fixed] fireplace ingredient bug #1848

Closed
wants to merge 10 commits into from

Conversation

mugg91
Copy link
Contributor

@mugg91 mugg91 commented Jan 15, 2024

Status

  • READY: this PR is (to the best of your knowledge) ready to be incorporated into the game.

Description

[added] turn chicken into food with name "Fried Chicken" by fire arrow hit
[added] turn chicken into food by being in fire for 50 ticks
[added] turn fishy into food by fire arrow hit
[added] turn fishy into food by having it be in fire for every 5th tick 10 times
[added] turn steak into food by fire arrow hit
[fixed] Many fireplaces overlapping each other making many foods from one ingredient
[fixed] Spawned ingredient could be cooked and heal you at the same time
[fixed] Fireplace would not remember that it has been extinguished when rejoining the server

Fixes #1399
Fixes #1909
Fixes #1929
Fixes #2031

This PR makes it so that chicken turns into a food item with a chicken wing sprite and the name "Fried Chicken" if it is hit by a firearrow or after it has been in fire for 50 ticks.

This gives another use to chicken, is humorous and seems more realistic. I always found it odd that chicken can just get away with being in fire without taking damage. Also adds strategy, if players want to trade one fire arrow for one food.

This PR does not implement all the suggestions from the above linked issue, nor does it add IsFlammable script to chicken. This is just a start to see if this is something worth adding to the game.

I had trouble compressing Food.png, so if this PR gets accepted someone should compress it more.
I replaced the png file, now it is 277 bytes smaller compared to the live build (-37%).

There is a bug with many fireplaces (that overlap each other) producing many foods from just one ingredient both in offline and online. This PR fixes that.

Tested offline and online, works as intended.

Steps to Test or Reproduce

Spawn chicken, shoot it with a fire arrow.
Notice it will turn into a chicken wing.

Build some buildings or wood backtiles and have chicken be closed inside.
Burn it up.
Notice the chicken may turn into a chicken wing if it touches the fire long enough.

@mugg91
Copy link
Contributor Author

mugg91 commented Jan 30, 2024

I added a commit that makes the following changes:

  • Fishy can now also be fire arrowed to cook it. Fishy will be cooked if it is inside fire for 50 ticks like chicken (by checking every 5th tick 10 times).
  • #include "ProductionCommon.as" removed from Fireplace.as and added to MakeFood.as instead
  • #include "Requirements.as" removed from Fireplace.as. It didn't serve any purpose?
  • u16 fire_duration = this.get_u16("fire duration"); changed to
    u16 fire_duration = this.exists("fire duration") ? this.get_u16("fire duration") : 0;

Grain and steak still omitted for now.

@mugg91 mugg91 changed the title [added] Chicken becomes a food item after getting hit by fire arrow or after being in fire long enough [added] Chicken + Fishy turn into food after getting hit by fire arrow or after being in fire long enough Jan 30, 2024
@mugg91 mugg91 changed the title [added] Chicken + Fishy turn into food after getting hit by fire arrow or after being in fire long enough [added] Chicken/Fishy/Steak turn into food after getting hit by fire arrow Jan 30, 2024
@mugg91
Copy link
Contributor Author

mugg91 commented Jan 30, 2024

I added another commit that does the following changes:

  • cooked name and cooked sprite index is now set in onInit(CBlob@ this) for blobs that can be cooked instead of fetching name and hard-coding it in MakeFood.as.
  • Reduced repetitive code.
  • Steak can be fire-arrowed to receive cooked steak.

For now, steak will not become cooked steak by being in fire.
Grain will not become cooked by fire arrow or by being in fire.

No more changes planned.

@mugg91 mugg91 changed the title [added] Chicken/Fishy/Steak turn into food after getting hit by fire arrow [added] Chicken/Fishy/Steak turn into food after getting hit by fire arrow + [fixed] fireplace ingredient bug Feb 14, 2024
@mugg91
Copy link
Contributor Author

mugg91 commented Mar 2, 2024

I made a commit that fixes a bug where the ingredient can be eaten and cooked at the same time.

I added checks in Eatable.as and EatCommon.as to see if blob has tag "cooked"
and in MakeFood.as to see if blob has tag "healed". So only one or the other can happen.

Before

Stand in fireplace at low health, spawn a grain.
Grain heals you and a bread appears.

After

Stand in fireplace at low health, spawn a grain.
Grain becomes bread and the bread heals you.

@mugg91
Copy link
Contributor Author

mugg91 commented Apr 22, 2024

Added a commit that fixes #2031

Extinguish() has been placed from Fireplace.as to FireplaceCommon.as.

A new function SetFire(CBlob@ this, bool fire_on) has been added to FireplaceCommon.as, which is called in onInit(CBlob@ this) to set fireplace on or off depending if it has tag "extinguished".
Now, Ignite() and Extinguish() - instead of checking animation "fire" or "nofire" - will check if the tag "fire source" is present or absent and call SetFire() with boolean true or false accordingly.

In onInit(CSprite@ this), the fire animation is set visible depending if the fireplace blob has tag "extinguished", similar to above.

There was no need to add onReceiveCreateData() hook.

Tested offline and online, no problems observed.

@mugg91
Copy link
Contributor Author

mugg91 commented Apr 22, 2024

Added yet another commit that improves the smoke particle when fireplace is extinguished.
A new function makeBigSmokeParticle() was added to FireParticle.as which makes use of the unused LargeSmoke.png file.
I set the frame duration from 5 to 4 because I felt it was appropriate. 5 seems too slow.

@mugg91
Copy link
Contributor Author

mugg91 commented Dec 10, 2024

Since this PR has aged and there are too many merge conflicts, I will close this, but with the intention of making a new PR based off this one someday.

@mugg91 mugg91 closed this Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant