Skip to content

Commit 30d6fcf

Browse files
committed
add a bit of docs
1 parent c5bd576 commit 30d6fcf

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

addons/wfc/nodes/generator_2d.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func _create_precondition(problem_settings: WFC2DProblem.WFC2DProblemSettings, m
9393

9494
parameters.target_node = map
9595
parameters.problem_settings = problem_settings
96-
parameters.base_node = self
96+
parameters.generator_node = self
9797

9898
return settings.create_precondition(parameters)
9999

addons/wfc/problems/2d/mappers/mapper_2d.gd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func get_used_rect(_map: Node) -> Rect2i:
1414
func read_cell(_map: Node, _coords: Vector2i) -> int:
1515
"""
1616
Read cell from map and return a mapped code.
17-
17+
1818
Returns a negative value if cell is empty or mapping for the cell is missing.
1919
"""
2020
@warning_ignore("assert_always_false")
@@ -24,7 +24,7 @@ func read_cell(_map: Node, _coords: Vector2i) -> int:
2424
func read_tile_meta(_tile: int, _meta_name: String) -> Array:
2525
"""
2626
Read metadata attribute values associated with given cell type.
27-
27+
2828
May return array of multiple values if cell type consists of multiple objects having metadata.
2929
E.g. combinations of different tiles in multi-layer tilemap.
3030
"""
@@ -35,7 +35,7 @@ func read_tile_meta(_tile: int, _meta_name: String) -> Array:
3535
func write_cell(_map: Node, _coords: Vector2i, _code: int):
3636
"""
3737
Write a cell to map.
38-
38+
3939
code should be inside acceptable range for mapped codes.
4040
"""
4141
@warning_ignore("assert_always_false")

addons/wfc/problems/2d/preconditions/precondition_2d_base.gd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
class_name WFC2DPrecondition
22
extends RefCounted
33

4+
"""
5+
Sets initial conditions (by deciding what tiles can be placed in what cells) for 2D WFC generation.
6+
7+
Instances should be created by WFC2DPrecondition2DNullSettings subclasses.
8+
"""
9+
410
func prepare():
511
"""
612
May calculate data necessary for this precondition.
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
11
extends Resource
22
class_name WFC2DPrecondition2DNullSettings
33

4+
"""
5+
Contains serializable settings for creation of a WFC2DPrecondition.
6+
7+
This base class creates an empty precondition that does not limit acontent of any cells.
8+
For custom precondition classes a corresponding WFC2DPrecondition2DNullSettings subclasses should exist.
9+
10+
This class is named WFC2DPrecondition2DNullSettings, not WFC2DPrecondition2DSettings to make it clearer to
11+
node inspector users that it will create a "null" (empty, default) precondition.
12+
If GdScript supported interfaces or abstract classes then there would be an interface/abstract class
13+
IWFC2DPrecondition2DSettings and WFC2DPrecondition2DNullSettings extending/implementing it along with
14+
other concreate classes.
15+
But with GdScript all other precondition settings classes should extend WFC2DPrecondition2DNullSettings.
16+
"""
17+
418
class CreationParameters:
519
var problem_settings: WFC2DProblem.WFC2DProblemSettings
620
var target_node: Node
7-
var base_node: Node
21+
var generator_node: WFC2DGenerator
822

923
func create_precondition(parameters: CreationParameters) -> WFC2DPrecondition:
24+
"""
25+
Instantiates a precondition using settings from this object.
26+
"""
1027
return WFC2DPrecondition.new()

0 commit comments

Comments
 (0)