foundryvtt / foundryvtt

Public issue tracking and documentation for Foundry Virtual Tabletop - software connecting RPG gamers in a shared multiplayer environment with an intuitive interface and powerful API.
https://foundryvtt.com/
234 stars 9 forks source link

Add data to wall Edges if they are a door and add a way for ClockwiseSweepPolygon to count doors as closed #11469

Open mclemente opened 1 month ago

mclemente commented 1 month ago

User Experience

Request

  1. Add a door object property to wall-type foundry.canvas.edges.Edge, which should have its current state (open, locked, closed) and how its closed/locked state's senses behave.
  2. Add a new config to check if the closed state's values should be used instead of the opened state's.

Reason

I'm currently drawing a ClockwiseSweepPolygon to target a "room", which is any space enclosed by walls, but it fails to detect a room with open doors, because their senses' data when opened is 0.

I've tried to subclass ClockwiseSweepPolygon#_testEdgeInclusion, but the issues lies within Edge not having any data related to the Wall being a door or not, so, even if I were to subclass it, I'd need to hack Edge (or check the wall data through the ID myself).

aaclayton commented 1 month ago

A request we can consider for the future, but each Edge has a reference to the PlaceableObject which spawned it, so you can consult edge.object.isDoor to easily test whether the edge is a door.