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

[RDY]Automatic fire refuelling #24077

Merged
merged 2 commits into from Jul 8, 2018

Conversation

@Coolthulhu
Copy link
Contributor

commented Jun 24, 2018

Long requested feature that got more urgent ~recently, because I implemented a mechanic that makes dying fires more annoying.

Use case goes like this:

  • Player has a small fire adjacent
  • Player has a pile of burnable items - wood pile - adjacent on ONE spot (went for simplicity, the PR grew big fast)
  • Player marks the wood pile using construction menu. Kinda ugly, but I had no better idea that wouldn't get huge fast. It will be easy to change that in the future, though.
  • Player starts a long action that requires light (manually marked in json) - reading or crafting
  • The fire ages to 10 minutes or so
  • The character automatically moves enough items from wood pile to fire pile to keep the fire going. Items on top of the wood pile are picked first, liquids are skipped, unburnable items are skipped.
  • Time passes
  • The fire gets too big because of low granularity of fuel items
  • The character moves first flammable, non-liquid item from fire pile to wood pile, to slow down the rate of burning

I successfully tested it in the following cases:

  • Reading adjacent to a free-standing fire. The fire didn't explode and didn't go out.
  • Reading adjacent to fireplace. The fireplace wasn't over-fueled and it went out shortly after.
  • Reading adjacent to over-fueled free-standing fire. The fire was quickly un-fueled and didn't go super-critical (ie. stayed at intensity 1).

Additionally:

  • Made fire burning more deterministically. It got too chaotic and the player can't easily see if the fire is about to turn into a fireball or go out. May break compatibility with some mods that used burn_data::chance_in_volume.
  • Made fire code use units::volume instead of legacy cups

[CR] because my C++ may be a bit rusty, and because of that weird designation thing.

@RadHazard

This comment has been minimized.

Copy link
Contributor

commented Jun 24, 2018

Does this work with crafting that requires fire (e.g. cooking)? I know that it currently doesn't interrupt crafting if the fire goes out halfway through, but if this system works then it seems like it would be reasonable to change it so that it does.

@Coolthulhu

This comment has been minimized.

Copy link
Contributor Author

commented Jun 25, 2018

Does this work with crafting that requires fire (e.g. cooking)?

Currently all crafting triggers it, even if you don't need the light because you have other sources.

@OzoneH3

This comment has been minimized.

Copy link
Member

commented Jun 26, 2018

Works great. Maybe up the fire/stockpile range from adjacent to crafting range?

@Coolthulhu

This comment has been minimized.

Copy link
Contributor Author

commented Jun 26, 2018

Maybe up the fire/stockpile range from adjacent to crafting range?

Yeah, would be better than hardcoded 1 range limit.

@kevingranade any objections? The closest analogy I recall would be the vehicle crane thing, which is limited to 1 tile.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jun 27, 2018

If the player is free to move during the activity, then using crafting range is reasonable. I also don't anticipate perf issues for scanning since it only happens intermittently during crafting.

@Coolthulhu Coolthulhu changed the title [CR]Automatic fire refuelling [RDY]Automatic fire refuelling Jun 28, 2018

@Coolthulhu

This comment has been minimized.

Copy link
Contributor Author

commented Jun 29, 2018

Does "Jenkins, rebuild" re-trigger Travis too?

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jun 29, 2018

@Coolthulhu

This comment has been minimized.

Copy link
Contributor Author

commented Jun 29, 2018

Nope. Requires developer privs

@Night-Pryanik

This comment has been minimized.

Copy link
Member

commented Jun 29, 2018

I was able to restart this travis build.

@ZhilkinSerg ZhilkinSerg self-assigned this Jun 30, 2018

@@ -96,6 +96,11 @@ std::string player_activity::get_str_value( size_t index, std::string def ) cons

void player_activity::do_turn( player &p )
{
// Should happen before activity or it may fail du to 0 moves

This comment has been minimized.

Copy link
@ZhilkinSerg

ZhilkinSerg Jun 30, 2018

Contributor

du -> due

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor

commented Jun 30, 2018

I cannot do thorough testing right now, but works fine at first glance.

@kevingranade
Copy link
Member

left a comment

I've merged this and tested it locally, but I seem to have forgotten the push it, so feel free to just resolve the conflict in item.h and push it.

best_fire = pt;
best_fire_age = fire_age;
}
// If a contained fire exists, ignore any other fires

This comment has been minimized.

Copy link
@kevingranade

kevingranade Jul 7, 2018

Member

This should find the best contained fire, instead it finds the first contained fire, I'm fine to leave it as a bugfix.

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jul 7, 2018

Author Contributor

I forgot to change it after the range increase, though it's next to trivial.
I'll leave it as is for now since it's tested already. It's pretty unlikely that a player will have two contained fires anyway.

@Coolthulhu Coolthulhu force-pushed the Coolthulhu:fire-refuel branch to 3bcce39 Jul 7, 2018

@Coolthulhu

This comment has been minimized.

Copy link
Contributor Author

commented Jul 7, 2018

I'm not authorized because I'm not a part of CleverRaven at the moment.
If you add me, I'll push the fix.

@ZhilkinSerg ZhilkinSerg merged commit 47a80bc into CleverRaven:master Jul 8, 2018

4 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.3%) to 23.596%
Details
gorgon-ghprb Build finished.
Details

@ZhilkinSerg ZhilkinSerg removed their assignment Jul 8, 2018

@Brambor

This comment has been minimized.

Copy link
Contributor

commented Aug 18, 2018

Does not work with charcoal. Maybe it has something to do with that charcoal stacks in form charcoal (50) whereas two-by-four and more flamable items stack in two-by-four 50x.

I would expect charcoal to be valid item for keeping the fire going.

@Brambor

This comment has been minimized.

Copy link
Contributor

commented Aug 18, 2018

Oh and it is not clear how to stop refueling the fire as if you read by the window and the PC keeps throwing more and more wood into the fire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.