feat: Add EnhancedGridMap for dynamic grid generation, pathfinding, and network synchronization, and introduce core game scripts for Tekton entities and managers.
This commit is contained in:
@@ -77,6 +77,27 @@ func simple_move_to(grid_position: Vector2i) -> bool:
|
||||
if (cell_item == -1 or cell_item in enhanced_gridmap.non_walkable_items) and not is_wall_passable:
|
||||
return false
|
||||
|
||||
# PHYSICS CHECK: Ensure no static obstacles (like Stands) are blocking the path
|
||||
# GridMap logic handles cells, but Objects/Bodies might be placed on top (like StaticTektonStand)
|
||||
var space_state = player.get_world_3d().direct_space_state
|
||||
# RAYCAST HEIGHT: 0.3 (Center of the 0.6m tall stand)
|
||||
# Check from CENTER using +0.5
|
||||
var from = Vector3(player.current_position.x + 0.5, 0.3, player.current_position.y + 0.5)
|
||||
var to = Vector3(grid_position.x + 0.5, 0.3, grid_position.y + 0.5)
|
||||
|
||||
# Check center of target tile
|
||||
var query = PhysicsRayQueryParameters3D.create(from, to)
|
||||
query.collide_with_areas = false
|
||||
query.collide_with_bodies = true
|
||||
# query.collision_mask = 1 # Default mask usually covers static bodies
|
||||
|
||||
var result = space_state.intersect_ray(query)
|
||||
if result:
|
||||
# If we hit something static that isn't ourselves
|
||||
if result.collider != player:
|
||||
print("Movement Blocked by Physics Body: ", result.collider.name)
|
||||
return false
|
||||
|
||||
if player.is_position_occupied(grid_position):
|
||||
var push_dir = grid_position - player.current_position
|
||||
if not try_push(grid_position, push_dir):
|
||||
|
||||
Reference in New Issue
Block a user