Skip to content

Commit 5d3977b

Browse files
committed
help
1 parent 1ff7fb4 commit 5d3977b

27 files changed

+236
-41
lines changed

lang/constructs/block_states/BlockState.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ import (
88
)
99

1010
func init() {
11+
traversal.RegisterHelp[*grammar.BlockStateContext](
12+
func(state traversal.Construct, symbol traversal.Symbol, location traversal.TextLocation) *string {
13+
out := "Defines a Minecraft [block state](https://minecraft.wiki/w/Block_states).<br/>Currently *only has support for block name*.<br/>Example: `Block(minecraft:stone)`"
14+
return &out
15+
},
16+
)
17+
1118
traversal.Register(
1219
func(state *grammar.BlockStateContext, currentNamespace string, scope *traversal.Scope) traversal.Construct {
1320
nameCtx := state.ResourceReference()

lang/constructs/primitives/VerticalAnchor.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ import (
1111
)
1212

1313
func init() {
14+
traversal.RegisterHelp[*grammar.VerticalAnchorContext](
15+
func(construct traversal.Construct, symbol traversal.Symbol, location traversal.TextLocation) *string {
16+
out := "Defines a vertical anchor, which can be absolute, above the bottom, or below the top.<br/>Absolute: `100`<br/>Above bottom: `~-100`<br/>Below top: `~100`"
17+
return &out
18+
})
1419
traversal.Register(
1520
func(anchor *grammar.VerticalAnchorContext, _ string, _ *traversal.Scope) traversal.Construct {
1621
if anchor.Identifier() != nil {

lang/constructs/worldgen/density_functions/ClampFn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
func init() {
1515
traversal.RegisterHelp[*grammar.DensityFn_ClampContext](
1616
func(construct traversal.Construct, s traversal.Symbol, location traversal.TextLocation) *string {
17-
help := `Clamps the input density function to the specified range`
17+
help := "Clamps the input density function to the specified range.<br/> `.Min(float)` and `.Max(float)` are required.<br/>Example: `Clamp(_densityFn_).Min(0).Max(1))`"
1818
return &help
1919
},
2020
)

lang/constructs/worldgen/density_functions/DualInput.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ const (
1717
)
1818

1919
func init() {
20+
traversal.RegisterHelp[*grammar.DensityFn_DualInputContext](
21+
func(construct traversal.Construct, symbol traversal.Symbol, location traversal.TextLocation) *string {
22+
var out string
23+
switch construct.(DualInputDensityFn).Kind {
24+
case DensityFn_Min:
25+
out = "Takes the minimum of 2 density functions.<br/>Functions must be separated by `,`.<br/>Example: `Min(1, 2)`"
26+
case DensityFn_Max:
27+
out = "Takes the maximum of 2 density functions.<br/>Functions must be separated by `,`.<br/>Example: `Max(1, 2)`"
28+
}
29+
return &out
30+
},
31+
)
2032
traversal.Register(
2133
func(densityFn *grammar.DensityFn_DualInputContext, currentNamespace string, scope *traversal.Scope) traversal.Construct {
2234
out := &DualInputDensityFn{}

lang/constructs/worldgen/density_functions/OldNoiseFn.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import (
1111
)
1212

1313
func init() {
14+
traversal.RegisterHelp[*grammar.DensityFn_OldBlendedNoiseContext](
15+
func(construct traversal.Construct, symbol traversal.Symbol, location traversal.TextLocation) *string {
16+
out := "References a defined noise function.<br/>Uses .XzScale( float ), .YScale( float ), .XzFactor( float ), .YFactor( float ) and .Smear( float ) to scale the noise function."
17+
return &out
18+
},
19+
)
1420
traversal.Register(
1521
func(densityFn *grammar.DensityFn_OldBlendedNoiseContext, currentNamespace string, scope *traversal.Scope) traversal.Construct {
1622
noiseFnBuilder := builder_chain.NewBuilderChain(

lang/constructs/worldgen/density_functions/RangeChoiceFn.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ import (
1212
)
1313

1414
func init() {
15+
traversal.RegisterHelp[*grammar.DensityFn_RangeChoiceContext](
16+
func(construct traversal.Construct, symbol traversal.Symbol, location traversal.TextLocation) *string {
17+
help := "Defines a range choice density function that returns different values based on whether the input is within a specified range.<br/>Required: `.Min(float)`, `.Max(float)`, `.InRange(densityFn)`, `.OutRange(densityFn)`.<br/>Example: `RangeChoice(densityFn).Min(-1).Max(1).InRange(densityFn).OutRange(densityFn)`"
18+
return &help
19+
},
20+
)
21+
1522
traversal.Register(
1623
func(densityFn *grammar.DensityFn_RangeChoiceContext, currentNamespace string, scope *traversal.Scope) traversal.Construct {
1724
rangeChoiceBuilder := builder_chain.NewBuilderChain[RangeChoiceDensityFn](

lang/constructs/worldgen/density_functions/ShiftedNoiseFn.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ import (
1111
)
1212

1313
func init() {
14+
traversal.RegisterHelp[*grammar.DensityFn_ShiftedNoiseContext](
15+
func(construct traversal.Construct, symbol traversal.Symbol, location traversal.TextLocation) *string {
16+
help := "Shifts noise using .ShiftX( densityFn ), .ShiftY( densityFn ) and .ShiftZ( densityFn ).<br/>Uses .XZScale( float ) and .YScale( float ) to scale the noise function."
17+
return &help
18+
},
19+
)
20+
1421
traversal.Register(
1522
func(densityFn *grammar.DensityFn_ShiftedNoiseContext, currentNamespace string, scope *traversal.Scope) traversal.Construct {
1623
shiftedNoiseBuilder := builder_chain.NewBuilderChain[ShiftedNoiseDensityFn](

lang/constructs/worldgen/density_functions/SingleInput.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,38 @@ const (
2626
)
2727

2828
func init() {
29+
traversal.RegisterHelp[*grammar.DensityFn_SingleInputContext](
30+
func(construct traversal.Construct, symbol traversal.Symbol, location traversal.TextLocation) *string {
31+
c := construct.(*SingleInputDensityFn)
32+
var out string
33+
switch c.Kind {
34+
case DensityFn_Interpolated:
35+
out = "Interpolates at each block in one cell based on the input density function value of some cells around. The size of each cell is size_horizontal * 4 and size_vertical * 4. Used often in combination with flat_cache."
36+
case DensityFn_FlatCache:
37+
out = "Calculate the value per 4×4 column (Value at each block in one column is the same). And it is calculated only once per column, at Y=0. Used often in combination with interpolated."
38+
case DensityFn_Abs:
39+
out = "Modifies input function by taking the absolute value.<br/>Example: `Abs(1)`"
40+
case DensityFn_Cube:
41+
out = "Modifies input function by taking the cube of the value. (x^3)<br/>Example: `Cube(1)`"
42+
case DensityFn_Square:
43+
out = "Modifies input function by taking the square of the value. (x^2)<br/>Example: `Square(1)`"
44+
case DensityFn_HalfNeg:
45+
out = "If the input is negative, returns half of the input. Otherwise returns the input. (x < 0 ? x/2 : x)"
46+
case DensityFn_QuarterNeg:
47+
out = "If the input is negative, returns a quarter of the input. Otherwise returns the input. (x < 0 ? x/4 : x)"
48+
case DensityFn_Squeeze:
49+
out = "First clamps the input between −1 and 1, then transforms it using x/2 - x*x*x/24."
50+
case DensityFn_Shift:
51+
out = "Samples a noise at (x/4, y/4, z/4), then multiplies it by 4."
52+
case DensityFn_ShiftA:
53+
out = "Samples a noise at (x/4, 0, z/4), then multiplies it by 4."
54+
case DensityFn_ShiftB:
55+
out = "Samples a noise at (z/4, x/4, 0), then multiplies it by 4."
56+
}
57+
58+
return &out
59+
},
60+
)
2961
traversal.Register(
3062
func(densityFn *grammar.DensityFn_SingleInputContext, currentNamespace string, scope *traversal.Scope) traversal.Construct {
3163
out := &SingleInputDensityFn{}

lang/constructs/worldgen/density_functions/SplineFn.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ func buildSplinePoint(point *grammar.DensityFn_SplinePointContext, currentNamesp
6161
}
6262

6363
func init() {
64+
traversal.RegisterHelp[*grammar.DensityFn_SplineFnContext](
65+
func(construct traversal.Construct, symbol traversal.Symbol, location traversal.TextLocation) *string {
66+
out := "Defines a cubic spline"
67+
return &out
68+
},
69+
)
6470
traversal.Register(
6571
func(densityFn *grammar.DensityFn_SplineFnContext, currentNamespace string, scope *traversal.Scope) traversal.Construct {
6672
splineDef := densityFn.DensityFn_Spline()

lang/constructs/worldgen/density_functions/WeirdScaledSamplerFn.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@ import (
1010
)
1111

1212
func init() {
13+
traversal.RegisterHelp[*grammar.DensityFn_WierdScaledSamplerContext](
14+
func(construct traversal.Construct, symbol traversal.Symbol, location traversal.TextLocation) *string {
15+
out := "According to the input value, scales and enhances (or weakens) some regions of the specified noise, and then returns the absolute value.\n\n"
16+
return &out
17+
},
18+
)
1319
traversal.Register(
14-
1520
func(densityFn *grammar.DensityFn_WierdScaledSamplerContext, currentNamespace string, scope *traversal.Scope) traversal.Construct {
1621
out := &WeirdScaledSamplerFn{}
1722

0 commit comments

Comments
 (0)