Skip to content

Commit

Permalink
Merge pull request #32333 from ZhilkinSerg/refactor-fields-step-5
Browse files Browse the repository at this point in the history
Refactor fields (step 5)
  • Loading branch information
kevingranade authored Jul 12, 2019
2 parents f253d84 + fd89150 commit d0a24c3
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 161 deletions.
10 changes: 10 additions & 0 deletions data/json/field_type.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"type": "field_type",
"legacy_enum_id": 1,
"intensity_levels": [ { "name": "blood splatter", "color": "red" }, { "name": "blood stain" }, { "name": "puddle of blood" } ],
"underwater_age_speedup": "25 minutes",
"half_life": "2 days",
"phase": "liquid",
"accelerated_decay": true,
Expand All @@ -20,6 +21,7 @@
"type": "field_type",
"legacy_enum_id": 2,
"intensity_levels": [ { "name": "bile splatter", "color": "pink" }, { "name": "bile stain" }, { "name": "puddle of bile" } ],
"underwater_age_speedup": "25 minutes",
"half_life": "1 days",
"phase": "liquid",
"accelerated_decay": true,
Expand All @@ -34,6 +36,7 @@
{ "name": "bloody meat chunks", "color": "light_red" },
{ "name": "heap of gore", "color": "red" }
],
"underwater_age_speedup": "25 minutes",
"half_life": "2 days",
"phase": "solid",
"accelerated_decay": true,
Expand All @@ -48,6 +51,7 @@
{ "name": "shattered branches and leaves" },
{ "name": "broken vegetation tangle", "color": "green" }
],
"underwater_age_speedup": "25 minutes",
"half_life": "2 days",
"phase": "solid",
"accelerated_decay": true,
Expand Down Expand Up @@ -86,6 +90,7 @@
{ "name": "acid streak" },
{ "name": "pool of acid", "color": "green" }
],
"underwater_age_speedup": "2 minutes",
"priority": 2,
"half_life": "2 minutes",
"phase": "liquid",
Expand Down Expand Up @@ -349,6 +354,7 @@
{ "name": "plant sap stain" },
{ "name": "puddle of resin" }
],
"underwater_age_speedup": "25 minutes",
"half_life": "2 days",
"phase": "liquid",
"accelerated_decay": true,
Expand All @@ -359,6 +365,7 @@
"type": "field_type",
"legacy_enum_id": 29,
"intensity_levels": [ { "name": "bug blood splatter", "color": "green" }, { "name": "bug blood stain" }, { "name": "puddle of bug blood" } ],
"underwater_age_speedup": "25 minutes",
"half_life": "2 days",
"phase": "liquid",
"accelerated_decay": true,
Expand All @@ -373,6 +380,7 @@
{ "name": "hemolymph stain" },
{ "name": "puddle of hemolymph" }
],
"underwater_age_speedup": "25 minutes",
"half_life": "2 days",
"phase": "liquid",
"accelerated_decay": true,
Expand All @@ -387,6 +395,7 @@
{ "name": "shattered bug leg", "color": "green" },
{ "name": "torn insect organs", "color": "yellow" }
],
"underwater_age_speedup": "25 minutes",
"half_life": "2 days",
"phase": "solid",
"accelerated_decay": true,
Expand All @@ -401,6 +410,7 @@
{ "name": "icky mess" },
{ "name": "heap of squishy gore", "color": "dark_gray" }
],
"underwater_age_speedup": "25 minutes",
"half_life": "2 days",
"phase": "solid",
"accelerated_decay": true,
Expand Down
4 changes: 4 additions & 0 deletions src/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ class field_entry
return is_alive;
}

time_duration get_underwater_age_speedup() const {
return type.obj().underwater_age_speedup;
}

bool decays_on_actualize() const {
return type.obj().accelerated_decay;
}
Expand Down
1 change: 1 addition & 0 deletions src/field_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ void field_type::load( JsonObject &jo, const std::string & )
fallback_intensity_level.move_cost );
intensity_levels.emplace_back( intensity_level );
}
optional( jo, was_loaded, "underwater_age_speedup", underwater_age_speedup, 0_turns );
optional( jo, was_loaded, "priority", priority, 0 );
optional( jo, was_loaded, "half_life", half_life, 0_turns );
if( jo.has_member( "phase" ) ) {
Expand Down
4 changes: 3 additions & 1 deletion src/field_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ struct field_type {

std::vector<field_intensity_level> intensity_levels;

time_duration underwater_age_speedup = 0_turns;

int priority = 0;
time_duration half_life = 0_days;
time_duration half_life = 0_turns;
phase_id phase = PNULL;
bool accelerated_decay = false;
bool display_items = true;
Expand Down
Loading

0 comments on commit d0a24c3

Please sign in to comment.