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: if not input_active:
return 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"): if Input.is_action_just_pressed("view_zoom"):
# tween.remove_all() # tween.remove_all()
# tween.interpolate_property(self, "view_zoom", view_zoom, 4.0, 0.5, Tween.TRANS_SINE, Tween.EASE_IN_OUT) # 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): 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: if view_zoom_direction and view_zoom < view_zoom_target:
view_zoom = min(view_zoom_target, view_zoom + delta * 4) view_zoom = min(view_zoom_target, view_zoom + delta * 4)
elif not view_zoom_direction and view_zoom > view_zoom_target: elif not view_zoom_direction and view_zoom > view_zoom_target:
view_zoom = max(view_zoom_target, view_zoom - delta * 4) view_zoom = max(view_zoom_target, view_zoom - delta * 4)
$Jetpack/GPUParticles3D.emitting = jetpack_active
func damage(hp: int): func damage(hp: int):
var target = main.player_list.players[self.get_network_authority()] var target = main.player_list.players[self.get_network_authority()]
target.health -= hp target.health -= hp
#if target.health <= 0: # int(name) is the player instance node name signifying owner's PID # if target.health <= 0: # int(name) is the player instance node name signifying owner's PID
# die() # die()
func die(killer_pid: int): func die(killer_pid: int):
var gibs = gibs_vfx.instantiate() 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() impact_vfx = impact_wall.instantiate()
if impact_vfx: 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 = impact_vfx.global_transform.looking_at(ray['normal'])
impact_vfx.global_transform.origin = ray['position'] impact_vfx.global_transform.origin = ray['position']
get_tree().root.add_child(impact_vfx)
#print(ray) #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 # 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 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. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
pass pass

View File

@ -189,7 +189,7 @@ func push_local_player_info(): #
else: else:
rpc(&'player_list_update', player_list.get(id).serialize(), 1) 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)) var player_node = $Players.get_node(str(pid))
assert(player_node != null, "Attempting to delete a player node that does not exist") 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() # $ReflectionProbe.show()
# elif round (time / 1.0) == 0: # elif round (time / 1.0) == 0:
# $ReflectionProbe.hide() # $ReflectionProbe.hide()
func _on_Timer_timeout():
$ReflectionProbe.update_mode = ReflectionProbe.UPDATE_ONCE
" "
[sub_resource type="PhysicalSkyMaterial" id="1"] [sub_resource type="PhysicalSkyMaterial" id="1"]
@ -133,6 +137,12 @@ enable_shadows = true
ambient_color = Color(1, 1, 1, 1) ambient_color = Color(1, 1, 1, 1)
script = null 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="DM1" parent="." instance=ExtResource( "6" )]
[node name="StaticBody3D" type="StaticBody3D" parent="DM1/Main" index="0"] [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" )] [node name="BeerCan3" parent="." instance=ExtResource( "3" )]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 29.3, 2.6, 3.6) 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"] [editable path="DM1"]

View File

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