86 lines
2.9 KiB
Go

package pathfinder
// PathfinderZoneIntegration defines the interface for zone integration
type PathfinderZoneIntegration interface {
// GetZoneName returns the zone name
GetZoneName() string
// IsValidPosition checks if a position is valid for pathfinding
IsValidPosition(position [3]float32) bool
// GetGroundZ returns the ground Z coordinate at the given X,Y position
GetGroundZ(x, y float32) float32
// IsInWater checks if a position is in water
IsInWater(position [3]float32) bool
// IsInLava checks if a position is in lava
IsInLava(position [3]float32) bool
// IsInPvP checks if a position is in a PvP area
IsInPvP(position [3]float32) bool
}
// PathfinderClientIntegration defines the interface for client notifications
type PathfinderClientIntegration interface {
// NotifyPathGenerated notifies clients about generated paths (for debugging)
NotifyPathGenerated(path *Path, clientID int32)
// SendPathUpdate sends path updates to clients
SendPathUpdate(spawnID int32, path *Path)
}
// PathfinderStatistics defines the interface for statistics collection
type PathfinderStatistics interface {
// RecordPathRequest records a pathfinding request
RecordPathRequest(duration float64, success bool, partial bool)
// GetPathfindingStats returns current statistics
GetPathfindingStats() *PathfindingStats
// ResetPathfindingStats resets all statistics
ResetPathfindingStats()
}
// PathfindingAdapter provides integration with the zone system
type PathfindingAdapter struct {
zoneIntegration PathfinderZoneIntegration
clientIntegration PathfinderClientIntegration
statistics PathfinderStatistics
}
// NewPathfindingAdapter creates a new pathfinding adapter
func NewPathfindingAdapter(zone PathfinderZoneIntegration, client PathfinderClientIntegration, stats PathfinderStatistics) *PathfindingAdapter {
return &PathfindingAdapter{
zoneIntegration: zone,
clientIntegration: client,
statistics: stats,
}
}
// GetZoneIntegration returns the zone integration interface
func (pa *PathfindingAdapter) GetZoneIntegration() PathfinderZoneIntegration {
return pa.zoneIntegration
}
// GetClientIntegration returns the client integration interface
func (pa *PathfindingAdapter) GetClientIntegration() PathfinderClientIntegration {
return pa.clientIntegration
}
// GetStatistics returns the statistics interface
func (pa *PathfindingAdapter) GetStatistics() PathfinderStatistics {
return pa.statistics
}
// PathfindingLoader defines the interface for loading pathfinding data
type PathfindingLoader interface {
// LoadPathfindingData loads pathfinding data for a zone
LoadPathfindingData(zoneName string) (PathfindingBackend, error)
// GetSupportedBackends returns a list of supported pathfinding backends
GetSupportedBackends() []string
// CreateBackend creates a pathfinding backend of the specified type
CreateBackend(backendType string, zoneName string) (PathfindingBackend, error)
}