mouse.isDown uses 1 = left / 2 = right (LÖVE-style, matching docs and voxel-terrain/cardgame examples); button 0 is skipped and always false. examples/building (+ building-3d, building-tilemap) called mousePressed(0) for left-click placement, so placing buildings never fired while ghost preview, palette keys, rotation and right-click removal still worked. Switch the mousePressed helper and left-click call sites to button 1.
Building 放置示例
演示 eve.Building():JSON 建筑定义、地形约束、道路邻接、鬼影预览、旋转与拆除。
make run/<platform>-debug GAME=examples/building
# 或
make building
操作
| 输入 | 作用 |
|---|---|
1–5 |
选择建筑(路 / 木屋 / 摊位 / 码头 / L 形仓) |
| 鼠标移动 | 鬼影跟随并吸附到格子 |
R |
旋转鬼影(90°) |
| 左键 | 确认放置(校验通过且金币足够) |
| 右键 | 拆除指针下建筑 |
Space |
重置地图与金币 |
演示要点
- 木屋:2×2,陆地,花费木材/金币
- 摊位:必须邻接带
road标签的建筑 - 码头:只能建在水域格子上
- L 仓:不规则
footprintMask - 鬼影绿色 = 可放,红色 = 失败(HUD 显示 reason)