refactored bullet script, broke shotgun pellets which will need to be fixed
This commit is contained in:
@@ -48,12 +48,14 @@ func _ready():
|
||||
if weapon_info.weapon_type != 1:
|
||||
casings_chamber_last = weapon_info.max_ammo
|
||||
|
||||
if weapon_info.fire_mode == 0:
|
||||
cycle_count_start = 1
|
||||
elif weapon_info.fire_mode == 1:
|
||||
cycle_count_start = 1
|
||||
elif weapon_info.fire_mode == 2:
|
||||
cycle_count_start = 3
|
||||
match weapon_info.fire_mode:
|
||||
0:
|
||||
cycle_count_start = 1
|
||||
1:
|
||||
cycle_count_start = 1
|
||||
2:
|
||||
cycle_count_start = 3
|
||||
|
||||
cycle_count = cycle_count_start
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
@@ -252,22 +254,24 @@ func projectile_initialize():
|
||||
instance_bullet.transform.basis = player.bullet_ray.global_transform.basis
|
||||
else:
|
||||
instance_bullet.transform.basis = barrel_ray.global_transform.basis
|
||||
instance_bullet.bullet_speed = weapon_info.bullet_speed
|
||||
instance_bullet.player_velocity = player.velocity * transform.basis
|
||||
instance_bullet.bullet_damage = weapon_info.bullet_damage
|
||||
instance_bullet.blast_power = weapon_info.blast_power
|
||||
instance_bullet.bullet_force_mod = weapon_info.bullet_force_mod
|
||||
if weapon_info.bullet.bullet_hole != null:
|
||||
instance_bullet.instance_bullethole = weapon_info.bullet.bullet_hole.instantiate()
|
||||
instance_bullet.player_position = player.global_position
|
||||
instance_bullet.linear_velocity += instance_bullet.transform.basis * Vector3(0, 0, -weapon_info.bullet_speed) + player.velocity
|
||||
return instance_bullet
|
||||
|
||||
func bullet_fire():
|
||||
SignalBus.emit_signal("shot_fired",weapon_info.crosshair_jump_amount)
|
||||
audio_fire.play()
|
||||
get_tree().current_scene.add_child(projectile_initialize())
|
||||
var bullet_spawn = projectile_initialize()
|
||||
get_tree().current_scene.add_child(bullet_spawn)
|
||||
|
||||
spawn_casing()
|
||||
vibration()
|
||||
|
||||
if chamber != null:
|
||||
revolver_chamber_rot_amt += weapon_info.chamber_rot_amount
|
||||
if weapon_info.smoke_enabled:
|
||||
|
||||
Reference in New Issue
Block a user