feat: implement player movement controller and initial weapon framework including double barrel shotgun and explosive projectiles

This commit is contained in:
DottsGit
2026-06-06 21:09:40 -04:00
parent 54dfd342c2
commit 30dbf7a4cd
3 changed files with 37 additions and 15 deletions
+9 -6
View File
@@ -191,16 +191,19 @@ func _explode(pos: Vector3) -> void:
# Add a tiny bit of upward bias to knockback so it lifts them
dir = (dir + Vector3(0, 0.5, 0)).normalized()
# Apply knockback if it has apply_impulse
if col.has_method("apply_impulse"):
col.apply_impulse(dir * final_knockback)
# Apply knockback if it has server_apply_impulse (for rocket jumping)
if col.has_method("server_apply_impulse") and col == owner_player:
if multiplayer.has_multiplayer_peer() and multiplayer.multiplayer_peer is not OfflineMultiplayerPeer:
col.server_apply_impulse.rpc_id(1, dir * final_knockback)
else:
col.apply_impulse(dir * final_knockback)
# Apply damage
# Apply damage (and knockback for other players via take_damage)
if col.has_method("take_damage"):
if col == owner_player and not can_self_damage:
# Skip self damage, but we still applied the knockback!
# Skip self damage (we already applied knockback above)
pass
elif owner_player and owner_player.multiplayer.is_server():
elif owner_player:
col.take_damage(final_damage, target_pos, owner_player, dir * final_knockback)
# Broadcast Visual Explosion Effect to other peers