Jetpack. Fixed players not dying and health not resetting on respawn.

remotes/1705377932733043820/tmp_refs/heads/unbroken
unfa 2021-09-11 14:35:07 +02:00
parent cb45568ffc
commit 55fe11328a
5 changed files with 27 additions and 7 deletions

View File

@ -131,6 +131,8 @@ func _input(event) -> void:
if not input_active:
return
assert(is_network_authority() == true, "input_active is true, even though the node is not network_authority")
if Input.is_action_just_pressed("view_zoom"):
# tween.remove_all()
# tween.interpolate_property(self, "view_zoom", view_zoom, 4.0, 0.5, Tween.TRANS_SINE, Tween.EASE_IN_OUT)
@ -158,18 +160,24 @@ func _input(event) -> void:
func _process(delta):
$Jetpack/GPUParticles3D.emitting = jetpack_active
if not input_active:
return
assert(is_network_authority() == true, "input_active is true, even though the node is not network_authority")
if view_zoom_direction and view_zoom < view_zoom_target:
view_zoom = min(view_zoom_target, view_zoom + delta * 4)
elif not view_zoom_direction and view_zoom > view_zoom_target:
view_zoom = max(view_zoom_target, view_zoom - delta * 4)
$Jetpack/GPUParticles3D.emitting = jetpack_active
func damage(hp: int):
var target = main.player_list.players[self.get_network_authority()]
target.health -= hp
#if target.health <= 0: # int(name) is the player instance node name signifying owner's PID
# die()
# if target.health <= 0: # int(name) is the player instance node name signifying owner's PID
# die()
func die(killer_pid: int):
var gibs = gibs_vfx.instantiate()

View File

@ -48,9 +48,9 @@ var impact_player = preload("res://Assets/Effects/ImpactBlood.tscn")
impact_vfx = impact_wall.instantiate()
if impact_vfx:
get_tree().root.add_child(impact_vfx)
impact_vfx.global_transform = impact_vfx.global_transform.looking_at(ray['normal'])
impact_vfx.global_transform.origin = ray['position']
get_tree().root.add_child(impact_vfx)
#print(ray)
@ -87,6 +87,7 @@ var impact_player = preload("res://Assets/Effects/ImpactBlood.tscn")
# TODO correct the ejection angle - right now it shoots straight up relative to the gun
casing_instance.linear_velocity = ejector.global_transform.basis[0] * randf_range(6.2, 8.5)# - ejector.global_transform.basis[2] * randf_range(-1.2, -1.7) + player.linear_velocity
# Called when the node enters the scene tree for the first time.
func _ready():
pass

View File

@ -189,7 +189,7 @@ func push_local_player_info(): #
else:
rpc(&'player_list_update', player_list.get(id).serialize(), 1)
@rpc func destroy_player(pid: int):
@rpc(sync,auth,reliable) func destroy_player(pid: int):
var player_node = $Players.get_node(str(pid))
assert(player_node != null, "Attempting to delete a player node that does not exist")

View File

@ -24,6 +24,10 @@ script/source = "extends Node3D
# $ReflectionProbe.show()
# elif round (time / 1.0) == 0:
# $ReflectionProbe.hide()
func _on_Timer_timeout():
$ReflectionProbe.update_mode = ReflectionProbe.UPDATE_ONCE
"
[sub_resource type="PhysicalSkyMaterial" id="1"]
@ -133,6 +137,12 @@ enable_shadows = true
ambient_color = Color(1, 1, 1, 1)
script = null
[node name="Timer" type="Timer" parent="ReflectionProbe"]
wait_time = 5.0
one_shot = true
autostart = true
script = null
[node name="DM1" parent="." instance=ExtResource( "6" )]
[node name="StaticBody3D" type="StaticBody3D" parent="DM1/Main" index="0"]
@ -183,4 +193,6 @@ transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 30, 2.
[node name="BeerCan3" parent="." instance=ExtResource( "3" )]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 29.3, 2.6, 3.6)
[connection signal="timeout" from="ReflectionProbe/Timer" to="." method="_on_Timer_timeout"]
[editable path="DM1"]

View File

@ -132,11 +132,10 @@ say_cancel={
[rendering]
environment/ssao/quality=0
anti_aliasing/screen_space_roughness_limiter/enabled=false
global_illumination/sdfgi/probe_ray_count=2
global_illumination/sdfgi/frames_to_converge=0
global_illumination/sdfgi/frames_to_update_lights=4
anti_aliasing/quality/msaa=1
anti_aliasing/quality/msaa=2
occlusion_culling/use_occlusion_culling=true
mesh_lod/lod_change/threshold_pixels=3.0
environment/defaults/default_environment="res://default_env.tres"