built single-resource based script for weapons, most are broken right now

This commit is contained in:
derek
2025-03-03 15:33:59 -06:00
parent 3e6ad2a56d
commit 15f32eff61
16 changed files with 1566 additions and 191 deletions

View File

@@ -347,7 +347,6 @@ func _physics_process(delta):
ads = true
if !gamespeed_controlled:
Engine.time_scale = lerp(Engine.time_scale, level_control.gamemode.time_slowed_speed, (delta * 50) / Engine.time_scale)
#gun.random_spread_amt = 0
AudioServer.set_bus_effect_enabled(0,0,true)
clock_sound.play()
if sensitivity_shift == true:
@@ -358,7 +357,6 @@ func _physics_process(delta):
ads = false
if !gamespeed_controlled:
Engine.time_scale = lerp(Engine.time_scale, 1.0, (delta * 50)/Engine.time_scale)
#gun.random_spread_amt = gun.random_spread_start
clock_sound.stop()
AudioServer.set_bus_effect_enabled(0,0,false)
SENSITIVITY = start_sensitivity
@@ -596,13 +594,13 @@ func flashlight_toggle():
func aim_down_sights(delta):
if gun != null:
if ads:
if gun.ads == true:
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.fov_zoom_amt),(delta * 5)/Engine.time_scale)
if gun.weapon_info.ads == true:
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.weapon_info.fov_zoom_amt),(delta * 5)/Engine.time_scale)
gun.position = lerp(gun.position,ADS_POS,delta * 10 / Engine.time_scale)
else:
weapon_holder.rotation = lerp(weapon_holder.rotation,Vector3(0,0,0),(delta * 10)/Engine.time_scale)
gun.position = lerp(gun.position, weapon_start_pos,(delta * 4)/Engine.time_scale)
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.fov_zoom_amt),(delta * 5)/Engine.time_scale)
camera.fov = lerp(camera.fov,BASE_FOV - float(gun.weapon_info.fov_zoom_amt),(delta * 5)/Engine.time_scale)
else:
gun.position = lerp(gun.position, weapon_start_pos,(delta * 100)/Engine.time_scale)
@@ -750,12 +748,12 @@ func weapon_sway(delta):
weapon_holder.rotation.y = lerp(weapon_holder.rotation.y, (mouse_input.x + joy_input.x) * weapon_sway_amount, 5 * delta)
else:
if gun != null:
if gun.ads == true:
if gun.weapon_info.ads == true:
weapon_holder.rotation = Vector3.ZERO
func weapon_bob(vel : float, delta):
if weapon_holder:
if gun != null and !ads and !gun.ads:
if gun != null and !ads and !gun.weapon_info.ads:
weapon_holder.global_position.y += -clamp(velocity.y * .15,-1,1) * delta
if vel > 2 and is_on_floor():
var speed_adjust = speed/level_control.gamemode.walk_speed