feat: add plasma gun weapon implementation and new pause menu system with loadout management

This commit is contained in:
DottsGit
2026-06-04 17:06:50 -04:00
parent 67bd5b4302
commit 1ccc66a601
37 changed files with 1070 additions and 0 deletions
+80
View File
@@ -0,0 +1,80 @@
extends BaseHitscanWeapon
class_name AK47
func _init() -> void:
weapon_name = "AK-47"
fire_rate = 0.15 # ~400 RPM
max_ammo = 30
reload_time = 2.0
base_damage = 35.0
min_damage = 25.0
falloff_start = 25.0
max_range = 150.0
automatic = true
spread_angle = 0.015
func _build_model() -> void:
# Position
position = Vector3(0.3, -0.3, -0.6)
# Receiver
var receiver = MeshInstance3D.new()
var rec_mesh = BoxMesh.new()
rec_mesh.size = Vector3(0.06, 0.12, 0.3)
var rec_mat = StandardMaterial3D.new()
rec_mat.albedo_color = Color(0.2, 0.2, 0.2)
rec_mesh.material = rec_mat
receiver.mesh = rec_mesh
receiver.position = Vector3(0, 0, 0.1)
model_root.add_child(receiver)
# Barrel
var barrel = MeshInstance3D.new()
var b_mesh = CylinderMesh.new()
b_mesh.top_radius = 0.015
b_mesh.bottom_radius = 0.015
b_mesh.height = 0.45
b_mesh.material = rec_mat
barrel.mesh = b_mesh
barrel.rotation.x = deg_to_rad(90)
barrel.position = Vector3(0, 0.03, -0.2)
model_root.add_child(barrel)
# Wood Handguard
var guard = MeshInstance3D.new()
var g_mesh = BoxMesh.new()
g_mesh.size = Vector3(0.08, 0.08, 0.2)
var wood_mat = StandardMaterial3D.new()
wood_mat.albedo_color = Color(0.5, 0.25, 0.1)
g_mesh.material = wood_mat
guard.mesh = g_mesh
guard.position = Vector3(0, 0, -0.1)
model_root.add_child(guard)
# Wood Stock
var stock = MeshInstance3D.new()
var s_mesh = BoxMesh.new()
s_mesh.size = Vector3(0.06, 0.1, 0.25)
s_mesh.material = wood_mat
stock.mesh = s_mesh
stock.position = Vector3(0, -0.02, 0.35)
model_root.add_child(stock)
# Muzzle Flash
muzzle_flash = OmniLight3D.new()
muzzle_flash.light_color = Color(1.0, 0.7, 0.2)
muzzle_flash.light_energy = 0.0
muzzle_flash.omni_range = 5.0
muzzle_flash.position = Vector3(0, 0.03, -0.45)
model_root.add_child(muzzle_flash)
# Audio
fire_sound = AudioStreamPlayer3D.new()
fire_sound.stream = load("res://assets/sounds/ak47_fire.wav")
fire_sound.position = muzzle_flash.position
fire_sound.volume_db = -5.0
model_root.add_child(fire_sound)
reload_sound = AudioStreamPlayer3D.new()
reload_sound.stream = load("res://assets/sounds/shotgun_reload.wav") # generic reload
model_root.add_child(reload_sound)