Fix camp placement and enforce camp access flow

This commit is contained in:
WorldBosse committed 2026-11-02 00:15:52 +04:00
1 parent b920fe9bf5
commit 3189092af2
9 files changed
+538 -15

No files matched your search

@@ -472,8 +472,8 @@ module LonaCraft
# nil when +kind+ can stand on (x, y), else the popup key saying why.
# Floor pieces, every footprint tile: inside the map, inside an owned
# area (tile_allowed?) and not an owned wall tile, not Lona's tile, no
# event (rugs without :occupy do not count), not water or bush,
# passable from all four sides. Wall pieces (1x1): inside the map, an
# event (rugs without :occupy do not count), not water. Wilderness camp
# grass is allowed if the tile has a walkable approach. Wall pieces (1x1): inside the map, an
# owned back-wall tile (wall_tile_allowed?), no event; no passability
# check, the wall is meant to be impassable.
# +ignore+: the ghost, which stands on the anchor tile.
@@ -492,8 +492,15 @@ module LonaCraft
return text_key("Place/not_home") if wall_tile_allowed?(map, tx, ty)
return blocked if $game_player.x == tx && $game_player.y == ty
return blocked if map.events_xy(tx, ty).any?{|ev| !placement_ignores?(ev, ignore) }
return "QuickMsg:Lona/WrongPlace#{rand(2)}" if map.water_floor?(tx, ty) || map.bush?(tx, ty)
return blocked unless [2, 4, 6, 8].all?{|d| map.passable?(tx, ty, d) }
camp_field = base_map?(map) && !LonaCraft::Bases.named_map?(map)
return "QuickMsg:Lona/WrongPlace#{rand(2)}" if map.water_floor?(tx, ty) || (map.bush?(tx, ty) && !camp_field)
directions = [2, 4, 6, 8]
walkable = if camp_field
directions.any?{|d| map.passable?(tx, ty, d) }
else
directions.all?{|d| map.passable?(tx, ty, d) }
end
return blocked unless walkable
}
nil
end