Skip to content

Commit

Permalink
Merge pull request #30731 from ymber/construction_time
Browse files Browse the repository at this point in the history
Document constructions and remove time constant
  • Loading branch information
kevingranade authored May 22, 2019
2 parents dec03b2 + 781de6e commit 6f672ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions doc/JSON_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,17 @@ Mods can modify this via `add:traits` and `remove:traits`.
]
```
### Constructions
```C++
"description": "Spike Pit", // Description string displayed in the construction menu
"category": "DIG", // Construction category
"required_skills": [ [ "survival", 1 ] ], // Skill levels required to undertake construction
"time": 30, // Time in minutes required to complete construction
"components": [ [ [ "spear_wood", 4 ], [ "pointy_stick", 4 ] ] ], // Items used in construction
"pre_terrain": "t_pit", // Required terrain to build on
"post_terrain": "t_pit_spiked" // Terrain type after construction is complete
```

## Skills

```C++
Expand Down
2 changes: 1 addition & 1 deletion src/construction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,7 @@ void load_construction( JsonObject &jo )
con.category = jo.get_string( "category", "OTHER" );
// constructions use different time units in json, this makes it compatible
// with recipes/requirements, TODO: should be changed in json
con.time = jo.get_int( "time" ) * 1000;
con.time = to_moves<int>( time_duration::from_minutes( jo.get_int( "time" ) ) );

if( jo.has_string( "using" ) ) {
con.requirements = requirement_id( jo.get_string( "using" ) );
Expand Down
2 changes: 2 additions & 0 deletions src/construction.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ struct construction {

// Index in construction vector
size_t id;

// Time in moves
int time;

// If true, the requirements are generated during finalization
Expand Down

0 comments on commit 6f672ef

Please sign in to comment.