forked from interstellar_development/freeftf
Milestone 7 Beta 1
Redid the entire serverside and clientside, matchmaking is finally out, bugfixes.
This commit is contained in:
parent
9de67986dd
commit
699320353a
16 changed files with 324 additions and 266 deletions
|
|
@ -10,7 +10,7 @@
|
|||
extends CharacterBody3D
|
||||
|
||||
|
||||
var jump_velocity = 6
|
||||
var jump_velocity = 12
|
||||
var speed = 7
|
||||
var zoom = 0
|
||||
var player_no
|
||||
|
|
@ -32,9 +32,9 @@ var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
|
|||
|
||||
func _ready():
|
||||
player_no = Game.players
|
||||
$nametag.text = Server.players[Server.players_numbered[player_no]]
|
||||
$nametag.text = Game.player_list[Game.player_list.keys()[player_no]]
|
||||
Game.players += 1
|
||||
if Server.players_numbered[player_no] == multiplayer.get_unique_id():
|
||||
if Game.player_list.keys()[player_no] == multiplayer.get_unique_id():
|
||||
if Game.settings["fps_counter"] == 1:
|
||||
$fps_counter.show()
|
||||
$health.show()
|
||||
|
|
@ -49,12 +49,7 @@ func _physics_process(delta):
|
|||
|
||||
if not is_on_floor():
|
||||
velocity.y -= gravity * delta
|
||||
|
||||
if Input.is_action_just_pressed("jump") and is_on_floor() and $jump_timeout.is_stopped():
|
||||
if beast:
|
||||
speed -= 5
|
||||
$jump_timeout.start()
|
||||
velocity.y = jump_velocity
|
||||
|
||||
|
||||
if Input.is_action_just_pressed("crouch") and !beast:
|
||||
if $collision.rotation.x == 0:
|
||||
|
|
@ -69,10 +64,12 @@ func _physics_process(delta):
|
|||
|
||||
if Input.is_action_pressed("click") and $hammer.rotation_degrees.x > -90:
|
||||
$hammer.rotation_degrees.x -= 5
|
||||
Server.sync_hammer.rpc(name, $hammer.rotation)
|
||||
for id in Game.player_list:
|
||||
Client.rpc_id(id,"sync_hammer",name, $hammer.rotation)
|
||||
elif $hammer.rotation_degrees.x < 0 and !Input.is_action_pressed("click"):
|
||||
$hammer.rotation_degrees.x += 5
|
||||
Server.sync_hammer.rpc(name, $hammer.rotation)
|
||||
for id in Game.player_list:
|
||||
Client.rpc_id(id,"sync_hammer",name, $hammer.rotation)
|
||||
|
||||
var input_dir = Input.get_vector("left", "right", "forwards", "backwards")
|
||||
var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||
|
|
@ -83,10 +80,20 @@ func _physics_process(delta):
|
|||
velocity.x = move_toward(velocity.x, 0, speed)
|
||||
velocity.z = move_toward(velocity.z, 0, speed)
|
||||
|
||||
if Input.is_action_just_pressed("jump") and is_on_floor() and $jump_timeout.is_stopped():
|
||||
if beast:
|
||||
speed -= 5
|
||||
$jump_timeout.start()
|
||||
if velocity.x == 0 or velocity.y == 0:
|
||||
velocity.y = jump_velocity
|
||||
else:
|
||||
velocity.y = jump_velocity/2
|
||||
|
||||
move_and_slide()
|
||||
|
||||
if !npc:
|
||||
Server.sync_player.rpc(name, position, rotation)
|
||||
for id in Game.player_list:
|
||||
Client.rpc_id(id,"sync_player",name, position, rotation)
|
||||
if mouse_locked and !has_node("./game_menu"):
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
else:
|
||||
|
|
@ -133,7 +140,8 @@ func beast_init():
|
|||
|
||||
func _on_detect_hit_body_entered(body):
|
||||
if enabled and body is CharacterBody3D and !got_person:
|
||||
Server.player_hit.rpc(body.name, name)
|
||||
for id in Game.player_list:
|
||||
Client.rpc_id(id,"player_hit",body.name, name)
|
||||
|
||||
func captured(beast2):
|
||||
if !npc:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue