attempt to make stop n go gamemode
This commit is contained in:
@@ -54,6 +54,14 @@ func simple_move_to(grid_position: Vector2i) -> bool:
|
||||
if player.get("is_frozen"):
|
||||
return false
|
||||
|
||||
# Stop n Go Mode Violation Check
|
||||
var main = player.get_tree().root.get_node_or_null("Main")
|
||||
if main:
|
||||
var manager = main.get_node_or_null("StopNGoManager")
|
||||
if manager and manager.has_method("check_movement_violation"):
|
||||
if manager.check_movement_violation(player.name.to_int(), player.current_position, grid_position):
|
||||
return false
|
||||
|
||||
var distance: int
|
||||
if use_diagonal_movement:
|
||||
distance = max(abs(grid_position.x - player.current_position.x), abs(grid_position.y - player.current_position.y))
|
||||
@@ -100,15 +108,17 @@ func simple_move_to(grid_position: Vector2i) -> bool:
|
||||
|
||||
rotate_towards_target(grid_position)
|
||||
|
||||
if player.is_multiplayer_authority() and player.has_method("sync_walk_animation"):
|
||||
player.rpc("sync_walk_animation")
|
||||
if player.is_multiplayer_authority() and multiplayer.has_multiplayer_peer() and multiplayer.multiplayer_peer.get_connection_status() == MultiplayerPeer.CONNECTION_CONNECTED:
|
||||
if player.has_method("sync_walk_animation"):
|
||||
player.rpc("sync_walk_animation")
|
||||
|
||||
var path = [Vector2(player.current_position.x, player.current_position.y), Vector2(grid_position.x, grid_position.y)]
|
||||
path.pop_front()
|
||||
|
||||
current_move_direction = grid_position - player.current_position
|
||||
|
||||
player.rpc("start_movement_along_path", path, not (player.is_bot or player.is_in_group("Bots")))
|
||||
if multiplayer.has_multiplayer_peer() and multiplayer.multiplayer_peer.get_connection_status() == MultiplayerPeer.CONNECTION_CONNECTED:
|
||||
player.rpc("start_movement_along_path", path, not (player.is_bot or player.is_in_group("Bots")))
|
||||
|
||||
return true
|
||||
|
||||
@@ -419,8 +429,8 @@ func _is_position_blocked_by_physics(target_pos: Vector2i) -> bool:
|
||||
var space_state = player.get_world_3d().direct_space_state
|
||||
var center_x = target_pos.x + 0.5
|
||||
var center_z = target_pos.y + 0.5
|
||||
var from = Vector3(center_x, 1.0, center_z)
|
||||
var to = Vector3(center_x, 0.1, center_z)
|
||||
var from = Vector3(center_x, 1.0, center_z)
|
||||
var to = Vector3(center_x, 0.1, center_z)
|
||||
|
||||
var query = PhysicsRayQueryParameters3D.create(from, to)
|
||||
query.collide_with_areas = false
|
||||
|
||||
Reference in New Issue
Block a user