Grenade bounce and radius
This commit is contained in:
parent
f99108c4f0
commit
11eb875d2e
6 changed files with 28 additions and 16 deletions
|
|
@ -72,12 +72,9 @@ func _exit() -> void:
|
||||||
super()
|
super()
|
||||||
player.weapon_models[visibility_target].hide()
|
player.weapon_models[visibility_target].hide()
|
||||||
|
|
||||||
@rpc("authority","call_local","reliable")
|
|
||||||
func use_begin() -> void:
|
func use_begin() -> void:
|
||||||
if current_state != null:
|
if current_state != null:
|
||||||
current_state.use_begin()
|
current_state.use_begin()
|
||||||
|
|
||||||
@rpc("authority","call_local","reliable")
|
|
||||||
func use_end() -> void:
|
func use_end() -> void:
|
||||||
if current_state != null:
|
if current_state != null:
|
||||||
current_state.use_end()
|
current_state.use_end()
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,8 @@ func check_for_empty() -> void:
|
||||||
return
|
return
|
||||||
for child in get_children():
|
for child in get_children():
|
||||||
if child is WeaponSubStateMachine and child.ammo == 0 and child.remaining_ammo == 0 and child.destroy_when_empty:
|
if child is WeaponSubStateMachine and child.ammo == 0 and child.remaining_ammo == 0 and child.destroy_when_empty:
|
||||||
|
if child == current_state:
|
||||||
|
return_to_previous(false)
|
||||||
child.queue_free()
|
child.queue_free()
|
||||||
|
|
||||||
func on_ammo_updated() -> void:
|
func on_ammo_updated() -> void:
|
||||||
|
|
@ -159,13 +161,17 @@ func _physics_process(delta: float) -> void:
|
||||||
current_state.physics_update(delta)
|
current_state.physics_update(delta)
|
||||||
|
|
||||||
func use_begin() -> void:
|
func use_begin() -> void:
|
||||||
current_state.use_begin.rpc()
|
if current_state != null:
|
||||||
|
current_state.use_begin()
|
||||||
|
|
||||||
func use_end() -> void:
|
func use_end() -> void:
|
||||||
current_state.use_end.rpc()
|
if current_state != null:
|
||||||
|
current_state.use_end()
|
||||||
|
|
||||||
func alternate_state() -> void:
|
func alternate_state() -> void:
|
||||||
current_state.alternate_state()
|
if current_state != null:
|
||||||
|
current_state.alternate_state()
|
||||||
|
|
||||||
func switch_mode() -> void:
|
func switch_mode() -> void:
|
||||||
current_state.switch_mode()
|
if current_state != null:
|
||||||
|
current_state.switch_mode()
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,17 @@ extends CharacterBody3D
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if is_multiplayer_authority() == false:
|
if is_multiplayer_authority() == false:
|
||||||
return
|
return
|
||||||
|
|
||||||
velocity += get_gravity() * delta / 4
|
velocity += get_gravity() * delta / 4
|
||||||
|
|
||||||
if is_on_floor():
|
|
||||||
var fire: Node3D = preload("res://weapons/molikman/molik/molikman_molotov_fire.tscn").instantiate()
|
|
||||||
Session.dynamic_objects_parent.add_child(fire,true)
|
|
||||||
fire.global_position = global_position
|
|
||||||
queue_free()
|
|
||||||
|
|
||||||
move_and_slide()
|
var collision = move_and_collide(velocity * delta)
|
||||||
|
if collision:
|
||||||
|
if collision.get_normal().y > 0:
|
||||||
|
var fire: Node3D = preload("res://weapons/molikman/molik/molikman_molotov_fire.tscn").instantiate()
|
||||||
|
Session.dynamic_objects_parent.add_child(fire,true)
|
||||||
|
fire.global_position = global_position
|
||||||
|
queue_free()
|
||||||
|
else:
|
||||||
|
var normal = collision.get_normal()
|
||||||
|
velocity = velocity.bounce(normal) * 0.5
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,12 @@ properties/1/replication_mode = 1
|
||||||
[node name="MolikmanMolik" type="Node" node_paths=PackedStringArray("enter_state")]
|
[node name="MolikmanMolik" type="Node" node_paths=PackedStringArray("enter_state")]
|
||||||
script = ExtResource("1_e53aq")
|
script = ExtResource("1_e53aq")
|
||||||
animation_prefix = &"baked_sp_"
|
animation_prefix = &"baked_sp_"
|
||||||
|
registry_entry = &"mm_molik"
|
||||||
visibility_target = &"sp"
|
visibility_target = &"sp"
|
||||||
max_ammo = 3
|
max_ammo = 3
|
||||||
ammo_mags = 0
|
ammo_mags = 0
|
||||||
|
can_be_previous = false
|
||||||
|
destroy_when_empty = true
|
||||||
enter_state = NodePath("Intro")
|
enter_state = NodePath("Intro")
|
||||||
metadata/_custom_type_script = "uid://e6lqknfl4ngt"
|
metadata/_custom_type_script = "uid://e6lqknfl4ngt"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_hr7p8"]
|
[sub_resource type="CylinderShape3D" id="CylinderShape3D_hr7p8"]
|
||||||
height = 3.0
|
height = 3.0
|
||||||
radius = 1.5
|
radius = 2.5
|
||||||
|
|
||||||
[sub_resource type="Gradient" id="Gradient_hr7p8"]
|
[sub_resource type="Gradient" id="Gradient_hr7p8"]
|
||||||
colors = PackedColorArray(1, 0.53333336, 0, 1, 0.45, 0.45, 0.45, 1)
|
colors = PackedColorArray(1, 0.53333336, 0, 1, 0.45, 0.45, 0.45, 1)
|
||||||
|
|
@ -46,7 +46,7 @@ dps = 25.0
|
||||||
damage_timer = NodePath("DamageTimer")
|
damage_timer = NodePath("DamageTimer")
|
||||||
|
|
||||||
[node name="Decal" type="Decal" parent="."]
|
[node name="Decal" type="Decal" parent="."]
|
||||||
size = Vector3(3, 3, 3)
|
size = Vector3(5, 3, 5)
|
||||||
texture_albedo = ExtResource("1_hr7p8")
|
texture_albedo = ExtResource("1_hr7p8")
|
||||||
texture_emission = ExtResource("2_qokq0")
|
texture_emission = ExtResource("2_qokq0")
|
||||||
emission_energy = 0.25
|
emission_energy = 0.25
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,10 @@ func _exit() -> void:
|
||||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||||
|
|
||||||
func on_animation_finished(animation):
|
func on_animation_finished(animation):
|
||||||
if animation == machine.animation_prefix + "throw":
|
if animation == machine.animation_prefix + "throw" or animation == machine.animation_prefix + "shoot":
|
||||||
transition.emit("Idle")
|
transition.emit("Idle")
|
||||||
|
|
||||||
|
|
||||||
func fire() -> void:
|
func fire() -> void:
|
||||||
if machine.ammo == 0:
|
if machine.ammo == 0:
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue