feat: implement main game scene and player logic with modular manager architecture
This commit is contained in:
@@ -62,7 +62,6 @@ grab_item={
|
|||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
move_north={
|
move_north={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":87,"physical_keycode":0,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":87,"physical_keycode":0,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||||
|
|||||||
+8
-1
@@ -832,6 +832,12 @@ func _assign_random_spawn_positions():
|
|||||||
var mid_x = enhanced_gridmap.columns / 2
|
var mid_x = enhanced_gridmap.columns / 2
|
||||||
var mid_z = enhanced_gridmap.rows / 2
|
var mid_z = enhanced_gridmap.rows / 2
|
||||||
|
|
||||||
|
# If static positions were not calculated yet, do it now to avoid players spawning in them
|
||||||
|
if reserved_static_positions.is_empty() and LobbyManager.game_mode != "Stop n Go":
|
||||||
|
if not static_tekton_manager:
|
||||||
|
static_tekton_manager = preload("res://scripts/managers/static_tekton_manager.gd").new()
|
||||||
|
reserved_static_positions = static_tekton_manager.calculate_spawn_points(3, enhanced_gridmap)
|
||||||
|
|
||||||
for x in range(enhanced_gridmap.columns):
|
for x in range(enhanced_gridmap.columns):
|
||||||
for z in range(enhanced_gridmap.rows):
|
for z in range(enhanced_gridmap.rows):
|
||||||
var ground = enhanced_gridmap.get_cell_item(Vector3i(x, 0, z))
|
var ground = enhanced_gridmap.get_cell_item(Vector3i(x, 0, z))
|
||||||
@@ -839,7 +845,8 @@ func _assign_random_spawn_positions():
|
|||||||
var pos = Vector2i(x, z)
|
var pos = Vector2i(x, z)
|
||||||
|
|
||||||
# SAFETY CHECK: Is this reserved for a Static Tekton Stand?
|
# SAFETY CHECK: Is this reserved for a Static Tekton Stand?
|
||||||
# Stand clears 3x3, but we use a radius of 2 (5x5) for safety
|
# Stand clears 3x3, we use a strictly >= 1 check (so abs <= 1 is EXACTLY the 3x3 stand)
|
||||||
|
# Let's use a 3x3 check (1 radius) to avoid strictly the stand itself, plus 1 buffer = radius 2.
|
||||||
var is_safe = true
|
var is_safe = true
|
||||||
for reserved in reserved_static_positions:
|
for reserved in reserved_static_positions:
|
||||||
if abs(x - reserved.x) <= 2 and abs(z - reserved.y) <= 2:
|
if abs(x - reserved.x) <= 2 and abs(z - reserved.y) <= 2:
|
||||||
|
|||||||
+3
-3
@@ -1317,18 +1317,18 @@ func is_position_occupied(pos: Vector2i) -> bool:
|
|||||||
if p.is_player_moving and p.target_position == pos:
|
if p.is_player_moving and p.target_position == pos:
|
||||||
return true
|
return true
|
||||||
|
|
||||||
# Prevent overlap with Static Tekton Stands (3x3 area) using active nodes
|
# Prevent overlap with Static Tekton Stands (3x3 area, with 1-tile buffer = 5x5 checked)
|
||||||
if enhanced_gridmap:
|
if enhanced_gridmap:
|
||||||
for stand in get_tree().get_nodes_in_group("StaticTektonStands"):
|
for stand in get_tree().get_nodes_in_group("StaticTektonStands"):
|
||||||
var local_pos = enhanced_gridmap.to_local(stand.global_position)
|
var local_pos = enhanced_gridmap.to_local(stand.global_position)
|
||||||
var stand_map_pos = enhanced_gridmap.local_to_map(local_pos)
|
var stand_map_pos = enhanced_gridmap.local_to_map(local_pos)
|
||||||
if abs(pos.x - stand_map_pos.x) <= 1 and abs(pos.y - stand_map_pos.z) <= 1:
|
if abs(pos.x - stand_map_pos.x) <= 2 and abs(pos.y - stand_map_pos.z) <= 2:
|
||||||
return true
|
return true
|
||||||
|
|
||||||
var main_node = get_tree().get_root().get_node_or_null("Main")
|
var main_node = get_tree().get_root().get_node_or_null("Main")
|
||||||
if main_node and "reserved_static_positions" in main_node:
|
if main_node and "reserved_static_positions" in main_node:
|
||||||
for reserved in main_node.reserved_static_positions:
|
for reserved in main_node.reserved_static_positions:
|
||||||
if abs(pos.x - reserved.x) <= 1 and abs(pos.y - reserved.y) <= 1:
|
if abs(pos.x - reserved.x) <= 2 and abs(pos.y - reserved.y) <= 2:
|
||||||
return true
|
return true
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user