The `# mcrf:` stamp recorded verified=<version>@<commit>, so every commit rewrote
the hash in all 130 snippet headers -- a guaranteed 130-file diff carrying no signal
git history doesn't already have, and one `--check` ignores anyway. The version alone
is stable within a dev cycle ("0.2.8-dev") and becomes the release marker at a tag
("0.2.9"), which is the whole point of the field: freezing a version into the docs
site's history, not pinning a commit.
verified is now version-only. The stamper is idempotent again: a second run on a
clean tree changes zero files. This commit is the one-time normalization that strips
the @hash suffix from the existing headers.
Found while cleaning up after a make release-docs run left all 130 snippets dirty
with nothing but hash churn.
58 lines
1.7 KiB
Python
58 lines
1.7 KiB
Python
# mcrf: objects=[Caption,Color,ColorLayer,Entity,Grid,Scene] verified=0.2.8-dev status=ok
|
|
# FOV Basic - Field of view computation
|
|
import mcrfpy
|
|
|
|
scene = mcrfpy.Scene("demo")
|
|
mcrfpy.current_scene = scene
|
|
|
|
grid = mcrfpy.Grid(
|
|
grid_size=(16, 12),
|
|
texture=mcrfpy.default_texture,
|
|
pos=(0, 0),
|
|
size=(1024, 768),
|
|
zoom=4.0
|
|
)
|
|
scene.children.append(grid)
|
|
|
|
# Add fog layer for FOV visualization
|
|
fog_layer = mcrfpy.ColorLayer(z_index=1, name="fog")
|
|
grid.add_layer(fog_layer)
|
|
fog_layer.fill(mcrfpy.Color(0, 0, 0, 200)) # Start dark
|
|
|
|
# Create dungeon with walls
|
|
for y in range(12):
|
|
for x in range(16):
|
|
cell = grid.at(x, y)
|
|
# Border walls
|
|
if x == 0 or x == 15 or y == 0 or y == 11:
|
|
cell.tilesprite = 1
|
|
cell.walkable = False
|
|
cell.transparent = False
|
|
# Internal pillars
|
|
elif (x in [4, 8, 12]) and (y in [4, 8]):
|
|
cell.tilesprite = 1
|
|
cell.walkable = False
|
|
cell.transparent = False
|
|
else:
|
|
cell.tilesprite = 48
|
|
cell.walkable = True
|
|
cell.transparent = True
|
|
|
|
# Player position
|
|
player_pos = (8, 6)
|
|
player = mcrfpy.Entity(grid_pos=player_pos, texture=mcrfpy.default_texture, sprite_index=84)
|
|
grid.entities.append(player)
|
|
|
|
# Compute FOV from player position
|
|
grid.compute_fov(player_pos, radius=8)
|
|
|
|
# Clear fog for visible cells
|
|
for y in range(12):
|
|
for x in range(16):
|
|
if grid.is_in_fov((x, y)):
|
|
fog_layer.set((x, y), mcrfpy.Color(0, 0, 0, 0)) # Clear
|
|
|
|
status = mcrfpy.Caption(text="FOV radius=8, dark areas not visible", pos=(340, 700))
|
|
status.outline = 2
|
|
status.outline_color = mcrfpy.Color(0, 0, 0)
|
|
scene.children.append(status)
|