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:
@@ -48,8 +48,33 @@ func move_to(target_pos: Vector2i):
|
||||
if is_moving or is_carried or is_thrown: return
|
||||
|
||||
# Validate
|
||||
# Validate Grid
|
||||
if not enhanced_gridmap.is_position_valid(target_pos):
|
||||
return
|
||||
|
||||
# Validate Physics (Block on Stands)
|
||||
var space_state = get_world_3d().direct_space_state
|
||||
# Tekton is slightly offset, so query center of its current and target tiles
|
||||
# Just checking TARGET center is usually enough to stop entering a blocked tile
|
||||
# RAY HEIGHT: 0.3 to hit the 0.6m tall stand
|
||||
var from = Vector3(target_pos.x + 0.5, 0.3, target_pos.y + 0.5) + Vector3.UP * 5.0
|
||||
var to = Vector3(target_pos.x + 0.5, 0.3, target_pos.y + 0.5) + Vector3.DOWN * 5.0
|
||||
|
||||
# Raycast VERTICALLY at target to see if it's occupied by a Stand
|
||||
# Actually, vertical ray from high up is fine IF it goes low enough.
|
||||
# But let's check intersection at body height to be sure.
|
||||
from = Vector3(target_pos.x + 0.5, 5.0, target_pos.y + 0.5)
|
||||
to = Vector3(target_pos.x + 0.5, 0.1, target_pos.y + 0.5) # Go almost to floor
|
||||
var query = PhysicsRayQueryParameters3D.create(from, to)
|
||||
query.collide_with_areas = false
|
||||
query.collide_with_bodies = true
|
||||
|
||||
var result = space_state.intersect_ray(query)
|
||||
if result:
|
||||
# If we hit a StaticTektonStand (or any other static blocking body)
|
||||
if result.collider != self:
|
||||
# print("Tekton movement blocked by: ", result.collider.name)
|
||||
return
|
||||
|
||||
is_moving = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user