Skip to content

Commit

Permalink
Merge pull request #71319 from RedMisao/patch-14
Browse files Browse the repository at this point in the history
Update TER_FURN_TRANSFORM.md
  • Loading branch information
Maleclypse authored Jan 29, 2024
2 parents dc071d3 + fea725f commit 69bcaea
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions doc/TER_FURN_TRANSFORM.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Terrain and Furniture Transforms

A ter_furn_transform is a type of json object that allows you to specify a transformation of a tile from one terrain to another terrain, and from one furniture to another furniture and one field to another field and one trap to another trap.
A `ter_furn_transform` is a type of json object that allows you to specify a transformation of a "tile" from one type to another. Tile in this context can refer to field, furniture, terrain or trap.

```json
[
Expand All @@ -19,7 +19,8 @@ A ter_furn_transform is a type of json object that allows you to specify a trans
]
```

The example above turns "sand" into "dirt". It does so by comparing the direct terrain ids.
The example above turns `terrain` "sand" into "dirt". It does so by comparing the direct terrain IDs.

If, however, we wanted to turn sand into "dirt or grass" we can do:

```json
Expand All @@ -29,11 +30,10 @@ If, however, we wanted to turn sand into "dirt or grass" we can do:
"valid_terrain": [ "t_sand" ],
"message": "sandy!"
}
],
]
```

message_good is optional and defaults to true.
This example chooses either dirt or grass at a 1:1 ratio. But, if you want a 4:1 ratio:
`message_good` is optional and defaults to true. The example chooses either dirt or grass at a 1:1 ratio, which can be modified to a 4:1 ratio:

```json
"terrain": [
Expand All @@ -45,16 +45,19 @@ This example chooses either dirt or grass at a 1:1 ratio. But, if you want a 4:1
]
```

As you can see, you can mix and match arrays with weights with single strings. Each single string has a weight of 1.
As you can see, you can mix and match arrays with weights with single strings. Each single string has a weight of 1.

All of the above applies to furniture, fields and traps as well.
All of the above applies to `fields`, `furniture`, and `traps` as well.

```json
"field": [
{ "result": "fd_null", "valid_field": [ "fd_fire" ], "message": "The fires suddenly vanishes!", "message_good": true }
],
"furniture": [
{
"result": [ [ "f_null", 4 ], "f_chair" ],
"valid_furniture": [ "f_hay", "f_woodchips" ],
"message": "I need a chair"
"message": "I need a chair"
}
]
```
Expand All @@ -71,4 +74,9 @@ You can also use flags instead of specific IDs for furniture, terrain and traps.
]
```

A ter_furn_transform can have terrain, furniture, field, and trap fields. It treats them separately, so no "if dirt, add chair."
A `ter_furn_transform` can have field, furniture, terrain, and trap fields. It treats them separately, so no "if dirt, add chair".


## How to use

`ter_furn_transform` can be declared by [effect on conditions](EFFECT_ON_CONDITION.md#u_transform_radiusnpc_transform_radius), [mapgen](MAPGEN.md#apply-mapgen-transformation-with-ter_furn_transforms), and spells (see the spell effects at [MAGIC.md](MAGIC.md#spell-effects).)

0 comments on commit 69bcaea

Please sign in to comment.