mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-16 00:44:50 +00:00
🍻 Shoot straight and clean up mode management
This commit is contained in:
parent
8a15bdbd43
commit
81bcd95d42
12 changed files with 262 additions and 327 deletions
Binary file not shown.
|
|
@ -32,18 +32,25 @@ func can_fire() -> bool:
|
|||
return weapon_state == WeaponState.WEAPON_READY
|
||||
|
||||
func fire_primary() -> void:
|
||||
# check permission
|
||||
if not can_fire():
|
||||
return
|
||||
|
||||
# init projectile
|
||||
var projectile : Node = PROJECTILE.instantiate()
|
||||
# configure projectile
|
||||
projectile.shooter = holder
|
||||
projectile.transform = nozzle.global_transform
|
||||
projectile.velocity = nozzle.global_basis.z.normalized() * projectile.speed
|
||||
projectile.shooter = holder
|
||||
var inheritance_factor : float = clamp(inheritance, 0., 1.)
|
||||
projectile.velocity += (inventory.owner.linear_velocity * inheritance_factor)
|
||||
# play the fire animation
|
||||
$Mesh/AnimationPlayer.play("fire")
|
||||
# add projectile as sibling of the owner
|
||||
inventory.owner.add_sibling(projectile)
|
||||
# ensure projectile does not collide with owner
|
||||
var collider : ShapeCast3D = projectile.shape_cast
|
||||
collider.add_exception(inventory.owner)
|
||||
# update states
|
||||
weapon_state = WeaponState.WEAPON_RELOADING
|
||||
await get_tree().create_timer(reload_time).timeout
|
||||
weapon_state = WeaponState.WEAPON_READY
|
||||
|
|
|
|||
|
|
@ -8,7 +8,27 @@
|
|||
script = ExtResource("1_6sm4s")
|
||||
PROJECTILE = ExtResource("2_wvneg")
|
||||
|
||||
[node name="disclauncher" parent="." instance=ExtResource("3_5k2xm")]
|
||||
[node name="Mesh" parent="." instance=ExtResource("3_5k2xm")]
|
||||
|
||||
[node name="Skeleton3D" parent="Mesh/Armature" index="0"]
|
||||
bones/0/scale = Vector3(1, 1, 1)
|
||||
bones/1/rotation = Quaternion(-0.707107, 5.33851e-08, 5.33851e-08, 0.707107)
|
||||
bones/1/scale = Vector3(1, 1, 1)
|
||||
bones/2/rotation = Quaternion(-0.707107, 5.33851e-08, 5.33851e-08, 0.707107)
|
||||
bones/2/scale = Vector3(1, 1, 1)
|
||||
bones/3/rotation = Quaternion(-0.707107, 5.33851e-08, 5.33851e-08, 0.707107)
|
||||
bones/3/scale = Vector3(1, 1, 1)
|
||||
|
||||
[node name="grip" parent="Mesh/Armature/Skeleton3D" index="0"]
|
||||
transform = Transform3D(1, -4.26326e-14, -2.13163e-14, 2.84217e-14, 1, -3.57628e-07, 3.2684e-14, 3.57628e-07, 1, -1.42109e-14, -2.98023e-07, 2.38419e-07)
|
||||
|
||||
[node name="main" parent="Mesh/Armature/Skeleton3D" index="1"]
|
||||
transform = Transform3D(1, -4.26326e-14, -2.13163e-14, 2.84217e-14, 1, -3.57628e-07, 3.2684e-14, 3.57628e-07, 1, -1.42109e-14, -2.98023e-07, 2.38419e-07)
|
||||
|
||||
[node name="sides" parent="Mesh/Armature/Skeleton3D" index="2"]
|
||||
transform = Transform3D(1, -4.26326e-14, -2.13163e-14, 2.84217e-14, 1, -3.57628e-07, 3.2684e-14, 3.57628e-07, 1, -1.42109e-14, -2.98023e-07, 2.38419e-07)
|
||||
|
||||
[node name="Nozzle" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.111355, 0.540839)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.27)
|
||||
|
||||
[editable path="Mesh"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue