@modastar/godot-skills 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
3
3
  "name": "godot-skills",
4
4
  "displayName": "godot-skills",
5
- "version": "0.1.5",
5
+ "version": "0.2.0",
6
6
  "description": "Make your coding agent write modern Godot 4.7+ best practices — lightweight and token-efficient.",
7
7
  "keywords": ["godot", "gdscript", "gdshader", "agent-skills"]
8
8
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "godot-skills",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "Make your coding agent write modern Godot 4.7+ best practices — lightweight and token-efficient.",
5
5
  "keywords": ["godot", "gdscript", "gdshader", "agent-skills"],
6
6
  "skills": "./skills/",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modastar/godot-skills",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "Make your coding agent write modern Godot 4.7+ best practices — lightweight and token-efficient.",
5
5
  "keywords": [
6
6
  "pi-package",
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "godot-skills",
4
- "version": "0.1.5",
4
+ "version": "0.2.0",
5
5
  "description": "Make your coding agent write modern Godot 4.7+ best practices — lightweight and token-efficient."
6
6
  }
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: godot-tilemap-2d
3
+ description: "Write, edit, or debug Godot 2D tile maps: TileMapLayer, deprecated TileMap, set_cell, tile custom data, terrains, and tile collision."
4
+ ---
5
+
6
+ # TileMap 2D
7
+
8
+ Target Godot 4.7+.
9
+
10
+ ## TileMapLayer, never TileMap
11
+
12
+ - `TileMap` is deprecated since 4.3. Use one `TileMapLayer` per layer; layer index parameters no longer exist. Convert old scenes from the TileMap bottom panel → toolbox icon → *Extract TileMap layers as individual TileMapLayer nodes*.
13
+ - Every layer needs a `tile_set`; sibling layers normally share one `TileSet` resource.
14
+ - Cell coordinates serialize as 16-bit signed ints; X and Y outside `-32768..32767` wrap on save.
15
+
16
+ ## Cells
17
+
18
+ ```gdscript
19
+ @onready var ground: TileMapLayer = $Ground
20
+
21
+ ground.set_cell(Vector2i(3, 5), source_id, Vector2i(0, 0)) # coords first, no layer arg
22
+ ground.erase_cell(Vector2i(3, 5))
23
+ ```
24
+
25
+ - `set_cell(coords, source_id = -1, atlas_coords = Vector2i(-1, -1), alternative_tile = 0)`. Any of `source_id = -1`, `atlas_coords = Vector2i(-1, -1)`, or `alternative_tile = -1` erases the cell and resets all three identifiers.
26
+ - `alternative_tile` defaults to `0` in `set_cell()` but to `-1` in `get_used_cells_by_id()`, where it means "any".
27
+ - With a `TileSetScenesCollectionSource`, `atlas_coords` must be `Vector2i(0, 0)` and `alternative_tile` is the scene id.
28
+ - Flip and rotation are bit flags packed into `alternative_tile`, not properties:
29
+ ```gdscript
30
+ const ROTATE_90 := TileSetAtlasSource.TRANSFORM_TRANSPOSE | TileSetAtlasSource.TRANSFORM_FLIP_H
31
+ ground.set_cell(coords, source_id, atlas_coords, alt | ROTATE_90)
32
+ ```
33
+ Read back with `is_cell_flipped_h()`, `is_cell_flipped_v()`, `is_cell_transposed()` (atlas sources only).
34
+ - Use `get_neighbor_cell(coords, TileSet.CELL_NEIGHBOR_*)` instead of adding `Vector2i(1, 0)`; only it is correct for hex and isometric layouts.
35
+
36
+ ## Coordinates
37
+
38
+ - `local_to_map()` and `map_to_local()` use the layer's **local** space: `local_to_map(to_local(body.global_position))`, or `local_to_map(get_local_mouse_position())`.
39
+ - `map_to_local()` returns the tile center, not its corner.
40
+
41
+ ## Per-tile data
42
+
43
+ ```gdscript
44
+ var data := ground.get_cell_tile_data(ground.local_to_map(ground.get_local_mouse_position()))
45
+ if data:
46
+ var power: Variant = data.get_custom_data("power")
47
+ ```
48
+
49
+ - `get_cell_tile_data()` returns `null` for empty cells and non-atlas sources — always null-check.
50
+ - `TileData` is read-only at runtime except inside `_tile_data_runtime_update()`.
51
+
52
+ ## Terrains
53
+
54
+ `set_cells_terrain_connect(cells, terrain_set, terrain, ignore_empty_terrains = true)` joins matching neighbors and may rewrite adjacent tiles; `set_cells_terrain_path()` follows cell order for roads and rivers. Both are expensive — pass the whole array in one call, never cell by cell.
55
+
56
+ ## Collision and navigation
57
+
58
+ - Shapes come from the `TileSet` physics layers; toggle with `collision_enabled`, inspect with `collision_visibility_mode`. Same pattern for `navigation_enabled` and `occlusion_enabled`.
59
+ - Set `use_kinematic_bodies = true` only for layers that move (moving platforms).
60
+ - `physics_quadrant_size` (default 16) merges similar tiles' shapes per quadrant, so a collider covers many cells. Recover the tile with `get_coords_for_body_rid(rid)`, passing `KinematicCollision2D.get_collider_rid()`.
61
+ - Call `set_navigation_map()` to keep a layer's navigation separate from other layers.
62
+
63
+ ## Updates and ordering
64
+
65
+ - Cell edits are batched to the end of the frame, so scene tiles from a `TileSetScenesCollectionSource` initialize *after* their parent and derived state read right after `set_cell()` can be stale. `update_internals()` forces an update — expensive, never per cell in a loop.
66
+ - The `changed` signal fires very often during batch edits; defer real work with `call_deferred()`.
67
+ - For runtime visual overrides implement `_use_tile_data_runtime_update(coords) -> bool` and `_tile_data_runtime_update(coords, tile_data)`, then call `notify_runtime_tile_data_update()` when the predicate's result changes. Returning `true` broadly is a significant performance cost.
68
+ - Top-down depth: enable `y_sort_enabled` (from `CanvasItem`) and shift the layer with `y_sort_origin`. `x_draw_order_reversed` applies only while Y-sorting.