function p.start_use(gun, primary)
    if( ga_genesis() ) then return end
    --
    ga_set_i("xar.inv_exec.cur_wep", gun)
    ga_set_b("xar.inv_exec.primary", primary)
    ga_set_b("xar.inv_exec.starting_shoot", true)

    if( gun == 0 and primary ) then p.dark_hole_start_use() end
end

function p.end_use()
    if( ga_get_i("xar.inv_exec.cur_wep") == 0 and
        ga_get_b("xar.inv_exec.primary") )
    then
        p.dark_hole_end_use()
    end
    ga_set_i("xar.inv_exec.cur_wep", -1)
end

function p.perform_update()
    --Passive updades.
    p.update_homing_launch()

    local cur_gun = ga_get_i("xar.inv_exec.cur_wep")
    local primary = ga_get_b("xar.inv_exec.primary")

    if cur_gun == -1 then return end

    if( cur_gun == 0 and primary ) then
        p.dark_hole_update()
        return
    end

    local mode = 0
    if primary then
        mode = game_wep_modes.get_primary_mode(cur_gun)
    else
        mode = game_wep_modes.get_secondary_mode(cur_gun)
    end

    local fire_period = game_wep_modes.get_fire_period(cur_gun, mode)

    local starting_shoot = ga_get_b("xar.inv_exec.starting_shoot")
    local last_fire_time = ga_get_f("xar.inv_exec.last_fire_time")
    local game_time = ga_get_sys_f("game.time.total")

    --Saftey.
    if( last_fire_time > game_time + 1.0 ) then
        last_fire_time = game_time
        ga_set_f("xar.inv_exec.last_fire_time", last_fire_time)
    end

    if starting_shoot then
        if game_time - last_fire_time > fire_period then
            local shot = p.try_shoot(cur_gun, starting_shoot)
            if shot then
                ga_set_b("xar.inv_exec.starting_shoot", false)
                ga_set_f("xar.inv_exec.last_fire_time", game_time) --Not perfect.
            end
        end
    else
        -- while game_time - last_fire_time > fire_period do
        while true do
            local delta = game_time - last_fire_time
            if delta <= fire_period then break end
            --Can shoot!
            local shot = p.try_shoot(cur_gun, starting_shoot)
            if shot then
                local new_fire_time = last_fire_time + fire_period
                ga_set_f("xar.inv_exec.last_fire_time", new_fire_time)
                last_fire_time = new_fire_time
            else
                return
            end
        end
    end
end

--THIS CAUSED A CRASH WHEN "LOADING LOCKED" BECAUSE OF ga_get_viewer_chunk_id!!!
--Double check that when loading locked, the Lua
--update code is not called at all.
function p.try_shoot(cur_gun, starting_shoot)
    if( ga_get_b("xar.cheat.inf2.enabled") ) then
        --Infinifrag 2 easter egg.
        game_inf2.try_shoot(cur_gun)
        return
    end

    local cur_gun = ga_get_i("xar.inv_exec.cur_wep")
    local primary = ga_get_b("xar.inv_exec.primary")
    local starting_shoot = ga_get_b("xar.inv_exec.starting_shoot")

    local mode = 0
    if primary then
        mode = game_wep_modes.get_primary_mode(cur_gun)
    else
        mode = game_wep_modes.get_secondary_mode(cur_gun)
    end

    --Required ammo.
    local req_ammo = game_wep_modes.get_ammo_per_fire(cur_gun, mode)

    --Ammo.
    local ammo_var =
        "xar.player.gun" .. tostring(cur_gun) .. ".ammo"
    local ammo = ga_get_i(ammo_var)

    -- Seeing if have enough ammo to shoot.
    if ammo < req_ammo then
        if starting_shoot and
            game_wep_modes.print_not_enough_ammo(cur_gun, mode)
        then
            game_msg.add("You need " .. tostring(req_ammo) .. " ammo to fire this")
            ga_set_b("xar.inv_exec.starting_shoot", false) --So does not keep printing this.
        end
        return false
    end

    --Damage.
    local damage = game_wep_modes.get_curved_damage(cur_gun, mode)

    --Speed.
    local speed = game_wep_modes.get_vel(cur_gun, mode)

    local viewer_chunk_id = ga_get_viewer_chunk_id() --WILL CRASH IF LOADING LOCKED!!!
    local viewer_level = ga_chunk_id_to_level(viewer_chunk_id)
    local viewer_pos = ga_get_viewer_offset()
    local look = ga_get_sys_v("game.player.camera.look")

    if cur_gun == 1 then
        local num = game_wep_modes.get_num_shoot(cur_gun, mode)
        for i = 1,num do
            local ent_type = ""
            if mode == 1 then ent_type = "ment_player_proj_plasma_1" end
            if mode == 2 then ent_type = "ment_player_proj_plasma_2" end
            if mode == 3 then ent_type = "ment_player_proj_plasma_2" end --DEBUGGING!!!
            if mode == 4 then ent_type = "ment_player_proj_plasma_2" end --DEBUGGING!!!
            if mode == 5 then ent_type = "ment_player_proj_plasma_5" end

            local extend_len = 1.0
            local pos = std.vec_add(viewer_pos, std.vec_scale(look,extend_len))
            ga_ment_init_set_v("posv", pos)

            local damage = game_wep_modes.get_curved_shot_damage(cur_gun, mode)

            ga_ment_start(viewer_level, pos, ent_type)

            local spread = game_wep_modes.get_spread(cur_gun, mode)
            local dir = game_random.rand_weapon_spread(look, spread)
            std.normalize(dir)
            local vel = std.vec_scale(dir, speed)
            ga_ment_init_set_v("__vel", vel)

            ga_ment_init_set_i("damage", damage)

            ga_ment_end()

            game_play_wep_sound.play(cur_gun, mode)
        end
    elseif cur_gun == 2 then
        local num = game_wep_modes.get_num_shoot(cur_gun, mode)
        for i = 1,num do
            local ent_type = ""
            if mode == 1 then ent_type = "ment_player_proj_cannon_1" end
            if mode == 2 then ent_type = "ment_player_proj_cannon_2" end
            if mode == 3 then ent_type = "ment_player_proj_cannon_3" end

            local extend_len = 1.0
            if( mode == 2 ) then extend_len = 2 end
            local pos = std.vec_add(viewer_pos, std.vec_scale(look,extend_len))

            local damage = game_wep_modes.get_curved_shot_damage(cur_gun, mode)

            ga_ment_start(viewer_level, pos, ent_type)

            local spread = game_wep_modes.get_spread(cur_gun, mode)
            local dir = game_random.rand_weapon_spread(look, spread)
            std.normalize(dir)
            local vel = std.vec_scale(dir, speed)
            ga_ment_init_set_v("__vel", vel)

            ga_ment_init_set_i("damage", damage)

            ga_ment_end()
        end

        game_play_wep_sound.play(cur_gun, mode)
    elseif cur_gun == 3 then
        if (not primary) and (not starting_shoot) then return false end
        local ent_type = (primary and "ment_player_proj_laser_1" or "ment_player_proj_laser_2")

        local extend_len = 1.0
        local pos = std.vec_add(viewer_pos, std.vec_scale(look,extend_len))

        ga_ment_start(viewer_level, pos, ent_type)

        local dir = look
        std.normalize(dir)
        local vel = std.vec_scale(look, speed)
        ga_ment_init_set_v("__vel", vel)
        
        ga_ment_init_set_i("damage", damage)
        -- ga_ment_init_set_i("damage_no_powerups", damage_no_powerups)

        ga_ment_end()

        if not primary then
            game_top2.damage_player(true, 50) --Raw damage.
        end

        game_play_wep_sound.play(cur_gun, mode)
    elseif cur_gun == 4 then
        local ent_type = ""
        if mode == 1 then ent_type = "ment_player_proj_rocket_1" end
        if mode == 2 then ent_type = "ment_player_proj_rocket_2" end
        if mode == 3 then ent_type = "ment_player_proj_rocket_3" end
        if mode == 4 then ent_type = "ment_player_proj_rocket_4" end
        if mode == 5 then ent_type = "ment_player_proj_rocket_5" end

        local extend_len = 1.0
        local pos = std.vec_add(viewer_pos, std.vec_scale(look,extend_len))

        --Kickback.
        if( primary ) then kf = 0.0
        else kf = 0.05 end
        game_movement.add_impulse(-look.x * kf, -look.y * kf, -look.z * kf)

        ga_ment_start(viewer_level, pos, ent_type)

        local vel = std.vec_scale(look, speed)
        ga_ment_init_set_v("__vel", vel)

        ga_ment_init_set_i("damage", damage)

        ga_ment_end()

        game_play_wep_sound.play(cur_gun, mode)
    elseif cur_gun == 5 then
        if primary then
            local extend_len = 1.0
            local pos = std.vec_add(viewer_pos, std.vec_scale(look,extend_len))

            ga_ment_start(viewer_level, pos, "ment_player_proj_homing_1")
            ga_ment_init_set_f("__homing_speed", speed)
            local vel = std.vec_scale(look, speed)
            ga_ment_init_set_v("__vel", vel)
            ga_ment_init_set_i("damage", damage)
            ga_ment_end()
        else
            --If you are reading this, then I know you can write prettier code than this.
            std.set_bydelta_i("xar.player.gun5.bucket.1", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.2", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.3", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.4", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.5", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.6", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.7", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.8", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.9", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.10", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.11", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.12", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.13", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.14", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.15", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.16", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.17", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.18", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.19", 1)
            std.set_bydelta_i("xar.player.gun5.bucket.20", 1)
        end

        game_play_wep_sound.play(cur_gun, mode)
    elseif cur_gun == 6 then
        local ent_type = (primary and "ment_player_proj_minigun_1" or "ment_player_proj_minigun_2")

        local extend_len = 1.0
        local pos = std.vec_add(viewer_pos, std.vec_scale(look,extend_len))

        ga_ment_start(viewer_level, pos, ent_type)

        local dir = {}
        if primary then
            dir.x = look.x + (ga_randf() - 0.5) * 0.08
            dir.y = look.y + (ga_randf() - 0.5) * 0.08
            dir.z = look.z + (ga_randf() - 0.5) * 0.08
        else
            dir = look
        end
        std.normalize(dir)

        local spread = game_wep_modes.get_spread(cur_gun, mode)
        local dir = game_random.rand_weapon_spread(look, spread)
        std.normalize(dir)
        local vel = std.vec_scale(dir, speed)
        ga_ment_init_set_v("__vel", vel)

        ga_ment_init_set_i("damage", damage)
        
        ga_ment_end()

        game_play_wep_sound.play(cur_gun, mode)
    elseif cur_gun == 7 then
        local ent_type = ""
        if mode == 1 then ent_type = "ment_player_proj_railgun_1" end
        if mode == 2 then ent_type = "ment_player_proj_railgun_2" end
        if mode == 3 then ent_type = "ment_player_proj_railgun_3" end
        if mode == 4 then ent_type = "ment_player_proj_railgun_4" end
        
        --Kickback.
        local kf = 0.0 --Kickback factor.
        if mode == 1 then kf = 0.20 end
        if mode == 2 then kf = 0.0 end
        if mode == 3 then kf = -0.15 end --Kick forward.
        if mode == 4 then kf = -0.15 end --Kick forward.
        game_movement.add_impulse(-look.x * kf, -look.y * kf, -look.z * kf)

        local extend_len = 1.0
        local pos = std.vec_add(viewer_pos, std.vec_scale(look,extend_len))
        
        local spread = game_wep_modes.get_spread(cur_gun, mode)
        local dir = game_random.rand_weapon_spread(look, spread)
        std.normalize(dir)

        ga_ment_start(viewer_level, pos, ent_type)

        local vel = std.vec_scale(dir, speed)
        ga_ment_init_set_v("__vel", vel)
        
        ga_ment_init_set_i("damage", damage)

        ga_ment_end()

        game_play_wep_sound.play(cur_gun, mode)
    elseif cur_gun == 8 then
        local radius = game_wep_modes.get_radius(8,mode)

        --Decoration.
        local lp = viewer_pos
        local viewer_level = ga_chunk_id_to_level(viewer_chunk_id)
        local ls = 1.0
        local col = std.vec(0.0, 0.0, 0.0)
        if( primary ) then col = std.vec(0.0, 1.0, 0.0)
        else col = std.vec(0.0, 1.0, 0.5) end
        --
        local args = {}
        args.level = viewer_level
        args.pos = lp
        args.ttl_min = 10.0*ls
        args.ttl_max = 20.0*ls
        args.size_min = 0.2
        args.size_max = 1.0
        args.color = col
        args.fade_time_min = 10.0
        args.fade_time_max = 10.0
        args.speed_min = 0.5
        args.speed_max = 0.5
        args.tex = "particle_2"
        args.radius_min = 4.0
        args.radius_max = 4.0
        args.num = 200
        args.use_min_dist = false
        ga_particle_explosion(args)
        
        local stun_len = game_wep_modes.get_freeze_length(8,mode)
        
        game_ment_emp.detonate_emp(
            viewer_level, viewer_pos, radius, stun_len, damage)

        local game_time = ga_get_sys_f("game.time.total")

        ga_set_f("xar.emp_end_time", game_time + stun_len)

        if not primary then
            game_top2.damage_player(true, 100) --Raw damage.
        end

        --Sound.
        local last_sound_time = ga_get_f("xar.player.gun8.last_sound_time")
        local sound_period = 5.0
        if( game_time > last_sound_time + sound_period ) then
            ga_set_f("xar.player.gun8.last_sound_time", game_time)
            game_play_wep_sound.play(cur_gun, mode)
        end
    elseif cur_gun == 9 then
        local ent_type = (primary and "ment_player_proj_nuke_1" or "ment_player_proj_nuke_2")

        local ent_type = ""
        if mode == 1 then ent_type = "ment_player_proj_nuke_1" end
        if mode == 2 then ent_type = "ment_player_proj_nuke_2" end
        if mode == 3 then ent_type = "ment_player_proj_nuke_3" end

        --Kickback.
        local kf = 1.5 --Kickback factor.
        if( mode == 3 ) then kf = -2.0 end --Kick forward!!
        game_movement.add_impulse(-look.x * kf, -look.y * kf, -look.z * kf)

        local extend_len = 1.0
        local pos = std.vec_add(viewer_pos, std.vec_scale(look,extend_len))

        ga_ment_start(viewer_level, pos, ent_type)

        local dir = look
        local vel = std.vec_scale(look, speed)
        ga_ment_init_set_v("__vel", vel)

        --Hit damage is 0 (only an explosion does damage,
        --and that code knows how to calculate it).
        ga_ment_init_set_i("damage", 0)

        ga_ment_end()

        game_play_wep_sound.play(cur_gun, mode)
    elseif cur_gun == 0 then
        if primary then
            --Handled elsewhere.
        else
            local ammo_max = game_wep_modes.get_ammo_max(0)
            local can_use = game_can_use.main(0)
            if can_use and ammo < ammo_max then
                game_top2.damage_player(true, 100)
                ga_set_i(ammo_var, ammo+1)
            else
                return false
            end
        end
        game_play_wep_sound.play(cur_gun, mode)
    end

    --Spending ammo.
    std.set_bydelta_i(ammo_var, -req_ammo)

    return true
end

function p.update_homing_launch()
    local game_time = ga_get_sys_f("game.time.total")
    local next_release_time = ga_get_f("xar.player.gun5.bucket.next_release_time")

    --Saftey.
    if( game_time + 1.0 < next_release_time ) then
        next_release_time = game_time
        ga_set_f("xar.player.gun5.bucket.next_release_time", next_release_time)
    end

    if( game_time > next_release_time ) then
        local wait = 0.1
        ga_set_f("xar.player.gun5.bucket.next_release_time", game_time + wait)

        --Releasing them.
        local num_release = ga_get_i("xar.player.gun5.bucket.1")
        local viewer_chunk_id = ga_get_viewer_chunk_id()
        local viewer_level = ga_chunk_id_to_level(viewer_chunk_id)
        local viewer_pos = ga_get_viewer_offset()
        local speed = game_wep_modes.get_vel(5,2)
        local raw_damage = game_wep_modes.get_curved_damage(5,2)
        local damage = game_damage.calc_damage_from_player(raw_damage, true) --Allowing powerups.
        -- damage_no_powerups = game_damage.calc_damage_from_player(raw_damage, false)
        for i = 1,num_release do
            dir = {}
            dir.x = ga_randf() - 0.5
            dir.y = ga_randf() - 0.5
            dir.z = ga_randf() - 0.5
            std.normalize(dir)

            local extend_len = 2.0
            local look = ga_get_sys_v("game.player.camera.look")
            local pos = std.vec_add(viewer_pos, std.vec_scale(look,extend_len))

            ga_ment_start(viewer_level, pos, "ment_player_proj_homing_2")
            -- local vel = std.vec_scale(dir, speed)
            -- ga_ment_init_set_v("__vel", vel) --No longer need to set an initial vel.
            ga_ment_init_set_f("__homing_speed", speed)
            ga_ment_init_set_i("damage", damage)
            -- ga_ment_init_set_i("damage_no_powerups", damage_no_powerups)
    
            ga_ment_end()
        end

        --Bucket brigade.
        --If you are reading this, then I know you can write prettier code than this.
        ga_set_i( "xar.player.gun5.bucket.1", ga_get_i("xar.player.gun5.bucket.2") )
        ga_set_i( "xar.player.gun5.bucket.2", ga_get_i("xar.player.gun5.bucket.3") )
        ga_set_i( "xar.player.gun5.bucket.3", ga_get_i("xar.player.gun5.bucket.4") )
        ga_set_i( "xar.player.gun5.bucket.4", ga_get_i("xar.player.gun5.bucket.5") )
        ga_set_i( "xar.player.gun5.bucket.5", ga_get_i("xar.player.gun5.bucket.6") )
        ga_set_i( "xar.player.gun5.bucket.6", ga_get_i("xar.player.gun5.bucket.7") )
        ga_set_i( "xar.player.gun5.bucket.7", ga_get_i("xar.player.gun5.bucket.8") )
        ga_set_i( "xar.player.gun5.bucket.8", ga_get_i("xar.player.gun5.bucket.9") )
        ga_set_i( "xar.player.gun5.bucket.9", ga_get_i("xar.player.gun5.bucket.10") )
        ga_set_i( "xar.player.gun5.bucket.10", ga_get_i("xar.player.gun5.bucket.11") )
        ga_set_i( "xar.player.gun5.bucket.11", ga_get_i("xar.player.gun5.bucket.12") )
        ga_set_i( "xar.player.gun5.bucket.12", ga_get_i("xar.player.gun5.bucket.13") )
        ga_set_i( "xar.player.gun5.bucket.13", ga_get_i("xar.player.gun5.bucket.14") )
        ga_set_i( "xar.player.gun5.bucket.14", ga_get_i("xar.player.gun5.bucket.15") )
        ga_set_i( "xar.player.gun5.bucket.15", ga_get_i("xar.player.gun5.bucket.16") )
        ga_set_i( "xar.player.gun5.bucket.16", ga_get_i("xar.player.gun5.bucket.17") )
        ga_set_i( "xar.player.gun5.bucket.17", ga_get_i("xar.player.gun5.bucket.18") )
        ga_set_i( "xar.player.gun5.bucket.18", ga_get_i("xar.player.gun5.bucket.19") )
        ga_set_i( "xar.player.gun5.bucket.19", ga_get_i("xar.player.gun5.bucket.20") )
        ga_set_i( "xar.player.gun5.bucket.20", 0 )
    end
end

function p.dark_hole_start_use()
    if( ga_get_i("xar.player.gun0.charge") > 0 ) then return end
    local fire_period = game_wep_modes.get_fire_period(0, 1)
    local last_fire_time = ga_get_f("xar.inv_exec.last_fire_time")
    local game_time = ga_get_sys_f("game.time.total")
    if( game_time - last_fire_time <= fire_period ) then
        ga_set_b("xar.inv_exec.starting_shoot", false)
        ga_set_i("xar.player.gun0.charge", 0)
        return
    end
    --
    local ammo = ga_get_i("xar.player.gun0.ammo")
    if( ammo > 0 ) then
        ammo = ammo - 1
        ga_set_i("xar.player.gun0.ammo", ammo)
        ga_set_f("xar.player.gun0.start_shoot_time", game_time)
        ga_set_f("xar.inv_exec.last_fire_time", game_time)
        ga_set_i("xar.player.gun0.charge", 1)
    end
end

function p.dark_hole_damage_factor(charge)
    local damage_mod = 0
    if( charge >= 1 ) then damage_mod = damage_mod + 1 end
    if( charge >= 2 ) then damage_mod = damage_mod + 2 end
    if( charge >= 3 ) then damage_mod = damage_mod + 5 end
    if( charge >= 4 ) then damage_mod = damage_mod + 10 end
    if( charge >= 5 ) then damage_mod = damage_mod + 15 end
    if( charge >= 6 ) then damage_mod = damage_mod + 20 end
    if( charge >= 7 ) then damage_mod = damage_mod + 25 end
    if( charge >= 8 ) then damage_mod = damage_mod + 30 end
    if( charge >= 9 ) then damage_mod = damage_mod + 35 end
    if( charge >= 10 ) then damage_mod = damage_mod + 40 end
    if( charge >= 11 ) then damage_mod = damage_mod + 45 end
    if( charge >= 12 ) then damage_mod = damage_mod + 50 end
    return damage_mod
end

function p.dark_hole_end_use()
    --Adding this Jan 2022.
    local charge = ga_get_i("xar.player.gun0.charge")
    if( charge == 0 ) then
        return
    end
    ga_set_i("xar.player.gun0.charge", 0)

    --Actually firing.
    local game_time = ga_get_game_time()
    ga_set_f("xar.inv_exec.last_fire_time", game_time)
    ga_print("  setting last fire time to " .. game_time)
    --
    if( charge > 1 ) then
        game_play_wep_sound.play_0_1_loud()
    else
        game_play_wep_sound.play(0, 1)
    end
    --
    local damage_natural = game_wep_modes.get_curved_damage(0,1)
    local damage_mod = p.dark_hole_damage_factor(charge)
    local damage_uncurved = damage_natural * damage_mod
    local damage_curved = game_difficulty_curve.curve_player_damage(damage_uncurved) * 10

    --
    --The projectile.
    local viewer_pos = ga_get_viewer_offset()
    local viewer_level = ga_get_viewer_level()
    local look = ga_get_sys_v("game.player.camera.look")
    local extend_len = 1.0
    local pos = std.vec_add(viewer_pos, std.vec_scale(look,extend_len))
    --Kickback.
    -- kf = -0.10 --Kickback factor.
    local kf = 1.0 * (charge-1) --Kickback factor.
    game_movement.add_impulse(-look.x * kf, -look.y * kf, -look.z * kf)
    --
    local speed = game_wep_modes.get_vel(0,1)
    --
    ga_ment_start(viewer_level, pos, "ment_player_proj_dark_hole")
    local vel = std.vec_scale(look, speed)
    ga_ment_init_set_v("__vel", vel)
    ga_ment_init_set_i("damage", damage_curved)
    ga_ment_end()

    ga_set_i("xar.player.gun0.charge", 0)
end

function p.dark_hole_update()
    if( ga_get_i("xar.player.health.amount") <= 0 ) then return end
    if( ga_get_i("xar.player.gun0.charge") == 0 ) then
        --Trying to get the first charge.
        p.dark_hole_start_use()
        return
    end
    local game_time = ga_get_game_time()
    local start_shoot_time = ga_get_f("xar.player.gun0.start_shoot_time")
    local charge = ga_get_i("xar.player.gun0.charge")
    local ammo = ga_get_i("xar.player.gun0.ammo")
    --
    if( charge >= 13 ) then
        ga_kill_player()
        return
    end
    --
    if( game_time > start_shoot_time + charge and
        ammo > 0 )
    then
        charge = charge + 1
        ammo = ammo -1
        ga_print("  LOSING AN AMMO!!!")
        raw = true
        game_top2.damage_player(raw, charge * 25)
        ga_set_i("xar.player.gun0.charge", charge)
        ga_set_i("xar.player.gun0.ammo", ammo)
        game_play_wep_sound.play_0_charge()
    end
end
