Crouch, walking and scoping support, deleted unnecessary Session rpcs
This commit is contained in:
parent
76647fc2fc
commit
d79db8a8d8
6 changed files with 4513 additions and 4456 deletions
|
|
@ -86,7 +86,7 @@ func _process(_delta: float) -> void:
|
|||
func update_clock(time: float):
|
||||
reference_round_time = time
|
||||
|
||||
@rpc("any_peer","call_remote","reliable")
|
||||
@rpc("authority","call_remote","reliable")
|
||||
func start_session() -> void:
|
||||
if not is_server_request():
|
||||
return
|
||||
|
|
@ -100,7 +100,7 @@ func start_session() -> void:
|
|||
|
||||
start_round()
|
||||
|
||||
@rpc("any_peer","call_remote","reliable")
|
||||
@rpc("authority","call_remote","reliable")
|
||||
func end_session() -> void:
|
||||
if not is_server_request():
|
||||
return
|
||||
|
|
@ -114,7 +114,7 @@ func end_session() -> void:
|
|||
|
||||
session_started = false
|
||||
|
||||
@rpc("any_peer","call_remote","reliable")
|
||||
@rpc("authority","call_remote","reliable")
|
||||
func start_round() -> void:
|
||||
if not is_server_request():
|
||||
return
|
||||
|
|
@ -134,7 +134,7 @@ func start_round() -> void:
|
|||
round_state = ROUND_STATES.BUY
|
||||
round_state_changed.emit.call_deferred(round_state)
|
||||
|
||||
@rpc("any_peer","call_remote","reliable")
|
||||
@rpc("authority","call_remote","reliable")
|
||||
func end_round(win_team: int) -> void:
|
||||
if not is_server_request():
|
||||
return
|
||||
|
|
@ -150,7 +150,7 @@ func end_round(win_team: int) -> void:
|
|||
round_state = ROUND_STATES.AFTER_ROUND
|
||||
round_state_changed.emit(round_state)
|
||||
|
||||
@rpc("any_peer","call_remote","reliable")
|
||||
@rpc("authority","call_remote","reliable")
|
||||
func begin_main_stage() -> void:
|
||||
if not is_server_request():
|
||||
return
|
||||
|
|
@ -161,7 +161,7 @@ func begin_main_stage() -> void:
|
|||
round_state = ROUND_STATES.ROUND
|
||||
round_state_changed.emit(round_state)
|
||||
|
||||
@rpc("any_peer","call_remote","reliable")
|
||||
@rpc("authority","call_remote","reliable")
|
||||
func begin_bomb_stage() -> void:
|
||||
if not is_server_request():
|
||||
return
|
||||
|
|
@ -179,7 +179,6 @@ func defuse_win() -> void:
|
|||
bomb_timer.stop()
|
||||
end_round(TEAMS.DEFENCE)
|
||||
|
||||
@rpc("any_peer","call_local","reliable")
|
||||
func add_dead(team: int):
|
||||
if multiplayer.is_server() == false:
|
||||
return
|
||||
|
|
@ -204,12 +203,7 @@ func is_server_request() -> bool:
|
|||
## ammo, remaining_ammo, slot - data for dropped weapon [br]
|
||||
## for more, see dyn_objects_spawner.gd
|
||||
func spawn(data: Dictionary) -> void:
|
||||
spawn_internal.rpc_id(1,data)
|
||||
|
||||
@rpc("any_peer","call_local","reliable")
|
||||
func spawn_internal(data: Dictionary) -> void:
|
||||
if multiplayer.is_server() == false:
|
||||
printerr(str(multiplayer.get_remote_sender_id())+" tried to spawn internally on "+str(multiplayer.get_unique_id()))
|
||||
return
|
||||
|
||||
var object = dynamic_objects_spawner.spawn(data)
|
||||
|
|
@ -217,25 +211,14 @@ func spawn_internal(data: Dictionary) -> void:
|
|||
if data.has("position"):
|
||||
object.global_position = data.position
|
||||
|
||||
func despawn(path: NodePath):
|
||||
despawn_internal.rpc_id(1,path)
|
||||
|
||||
@rpc("any_peer","call_local","reliable")
|
||||
func despawn_internal(path: NodePath) -> void:
|
||||
func despawn(path: NodePath) -> void:
|
||||
if multiplayer.is_server() == false:
|
||||
printerr(str(multiplayer.get_remote_sender_id())+" tried to despawn internally on "+str(multiplayer.get_unique_id()))
|
||||
return
|
||||
|
||||
get_node(path).queue_free()
|
||||
|
||||
func shoot(damage: int,distance: float = 100) -> void:
|
||||
if multiplayer.get_unique_id() == 1:
|
||||
shoot_internal(1,damage,distance)
|
||||
else:
|
||||
shoot_internal.rpc_id(1,multiplayer.get_unique_id(),damage,distance)
|
||||
|
||||
@rpc("any_peer","call_local","reliable")
|
||||
func shoot_internal(id:int , damage: int, distance: float) -> void:
|
||||
func shoot(id:int , damage: int, distance: float) -> void:
|
||||
if multiplayer.is_server() == false:
|
||||
return
|
||||
|
||||
|
|
@ -260,16 +243,12 @@ func shoot_internal(id:int , damage: int, distance: float) -> void:
|
|||
if collision != {} and collision["collider"] is Player:
|
||||
collision["collider"].take_damage.rpc_id(int(collision["collider"].name),damage)
|
||||
|
||||
func interact() -> void:
|
||||
if multiplayer.get_unique_id() == 1:
|
||||
interact_internal(1)
|
||||
else:
|
||||
interact_internal.rpc_id(1,multiplayer.get_unique_id())
|
||||
|
||||
@rpc("any_peer","call_local","reliable")
|
||||
func interact_internal(id:int) -> void:
|
||||
func interact() -> void:
|
||||
if multiplayer.is_server() == false:
|
||||
return
|
||||
var id = multiplayer.get_remote_sender_id()
|
||||
|
||||
var player: Player = player_nodes[id]
|
||||
var player_camera: Camera3D = player.get_node("Camera3D")
|
||||
|
|
@ -285,16 +264,11 @@ func interact_internal(id:int) -> void:
|
|||
if collision != {} and collision["collider"] is Interactible:
|
||||
collision["collider"].interaction_start(id)
|
||||
|
||||
func stop_interact():
|
||||
if multiplayer.get_unique_id() == 1:
|
||||
stop_interact_internal(1)
|
||||
else:
|
||||
stop_interact_internal.rpc_id(1,multiplayer.get_unique_id())
|
||||
|
||||
@rpc("any_peer","call_local","reliable")
|
||||
func stop_interact_internal(id: int) -> void:
|
||||
func stop_interact() -> void:
|
||||
if multiplayer.is_server() == false:
|
||||
return
|
||||
var id = multiplayer.get_remote_sender_id()
|
||||
player_stopped_interacting.emit(id)
|
||||
|
||||
func is_on_site() -> bool:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue