feat: add plasma gun weapon implementation and new pause menu system with loadout management
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
extends BaseHitscanWeapon
|
||||
class_name M4
|
||||
|
||||
func _init() -> void:
|
||||
weapon_name = "M4"
|
||||
fire_rate = 0.08 # ~750 RPM
|
||||
max_ammo = 40
|
||||
reload_time = 1.6
|
||||
base_damage = 22.0
|
||||
min_damage = 12.0
|
||||
falloff_start = 15.0
|
||||
max_range = 100.0
|
||||
automatic = true
|
||||
spread_angle = 0.01
|
||||
|
||||
func _build_model() -> void:
|
||||
position = Vector3(0.3, -0.3, -0.6)
|
||||
|
||||
var grey_mat = StandardMaterial3D.new()
|
||||
grey_mat.albedo_color = Color(0.25, 0.25, 0.25)
|
||||
var dark_mat = StandardMaterial3D.new()
|
||||
dark_mat.albedo_color = Color(0.1, 0.1, 0.1)
|
||||
|
||||
# Receiver
|
||||
var receiver = MeshInstance3D.new()
|
||||
var rec_mesh = BoxMesh.new()
|
||||
rec_mesh.size = Vector3(0.05, 0.14, 0.25)
|
||||
rec_mesh.material = grey_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.012
|
||||
b_mesh.bottom_radius = 0.012
|
||||
b_mesh.height = 0.4
|
||||
b_mesh.material = dark_mat
|
||||
barrel.mesh = b_mesh
|
||||
barrel.rotation.x = deg_to_rad(90)
|
||||
barrel.position = Vector3(0, 0.04, -0.2)
|
||||
model_root.add_child(barrel)
|
||||
|
||||
# Handguard
|
||||
var guard = MeshInstance3D.new()
|
||||
var g_mesh = BoxMesh.new()
|
||||
g_mesh.size = Vector3(0.06, 0.07, 0.22)
|
||||
g_mesh.material = dark_mat
|
||||
guard.mesh = g_mesh
|
||||
guard.position = Vector3(0, 0.04, -0.1)
|
||||
model_root.add_child(guard)
|
||||
|
||||
# Muzzle Flash
|
||||
muzzle_flash = OmniLight3D.new()
|
||||
muzzle_flash.light_color = Color(1.0, 0.8, 0.4)
|
||||
muzzle_flash.light_energy = 0.0
|
||||
muzzle_flash.omni_range = 4.0
|
||||
muzzle_flash.position = Vector3(0, 0.04, -0.4)
|
||||
model_root.add_child(muzzle_flash)
|
||||
|
||||
# Audio
|
||||
fire_sound = AudioStreamPlayer3D.new()
|
||||
fire_sound.stream = load("res://assets/sounds/m4_fire.wav")
|
||||
fire_sound.position = muzzle_flash.position
|
||||
fire_sound.volume_db = -8.0
|
||||
model_root.add_child(fire_sound)
|
||||
|
||||
reload_sound = AudioStreamPlayer3D.new()
|
||||
reload_sound.stream = load("res://assets/sounds/shotgun_reload.wav")
|
||||
model_root.add_child(reload_sound)
|
||||
Reference in New Issue
Block a user