Skip to content

Line of sight: don't pass through floors and stairs - #1631

Open
DavideRei wants to merge 1 commit into
Sphereserver:devfrom
DavideRei:fix/los-through-floors
Open

DavideRei wants to merge 1 commit into
Sphereserver:devfrom
DavideRei:fix/los-through-floors

Conversation

@DavideRei

@DavideRei DavideRei commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Description

CanSeeLOS walks towards the target following the height a char would stand at on every tile, so it can climb stairs and reach a different floor of a building: archers and casters could target chars on the floor above or below. On every tile of the walk, check also the straight line between the two (at half the player height): if a floor or a stair (a non-terrain tile with CAN_I_PLATFORM or CAN_I_CLIMB) is above the line where we stand on it, or below the line over our heads, the sight is blocked.


Type of Change

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation update
  • Build / CI change
  • Other (please describe): behaviour change

Related Issues

None.


Testing

  • Compiled with MSVC 2022 (Windows x64, Release) on top of the current dev.
  • The same change has been running on our shard (a private fork kept aligned with dev); the code in this PR was adapted to the current dev and was not tested in game in this form.
  • If Fights between ships and the sea: line of sight and reach #1632 (ship line of sight) is merged too, the floor check should skip the pieces of the ship (fShipPiece).

Checklist

  • Code compiles successfully
  • Changes follow the project's coding style
  • No unrelated code was modified
  • Documentation updated where necessary (Changelog.txt)
  • This PR does not introduce breaking changes (or they are documented)

Additional Notes

If #1632 (ship line of sight) is merged too, the floor check should skip the pieces of the ship (fShipPiece).

🤖 Generated with Claude Code

CanSeeLOS walks towards the target following the height a char would stand at on every tile, so it can climb
stairs and reach a different floor of a building: archers and casters could target chars on the floor above or below.
On every tile of the walk, check also the straight line between the two (at half the player height): if a floor or a
stair (a non-terrain tile with CAN_I_PLATFORM or CAN_I_CLIMB) is above the line where we stand on it, or below the line
over our heads, the sight is blocked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant