SuR = SuR or {}

SuR.Version = "0.6.0"
SuR.Build = "alpha"
SuR.DisableLogic = false

GM.Name = "Surrounded"
GM.Author = "RefoselTeamWork"

AddCSLuaFile('shared/sh_cvars.lua')
include('shared/sh_cvars.lua')

AddCSLuaFile("lang/en.lua")
AddCSLuaFile("lang/ru.lua")

SuR.Language = {}
local function change_language()
    local lang = GetConVar("gmod_language"):GetString()
    if lang == "ru" or lang == "uk" then
        include("lang/ru.lua")
    else
        include("lang/en.lua")
    end
end
change_language()

local def_tracks = {
    ["Exfil"] = {"surrounded/theme/music32.mp3"},
    ["Easy"] = {"surrounded/theme/music11.mp3", "surrounded/theme/music14.mp3", "surrounded/theme/music15.mp3", "surrounded/theme/music25.mp3", "surrounded/theme/music26.mp3", "surrounded/theme/music27.mp3", "surrounded/theme/music28.mp3"},
    ["Medium"] = {"surrounded/theme/music2.mp3", "surrounded/theme/music7.mp3", "surrounded/theme/music1.mp3", "surrounded/theme/music33.mp3", "surrounded/theme/music34.mp3", "surrounded/theme/music35.mp3"},
    ["Hard"] = {"surrounded/theme/music3.mp3", "surrounded/theme/music10.mp3", "surrounded/theme/music12.mp3", "surrounded/theme/music29.mp3", "surrounded/theme/music30.mp3", "surrounded/theme/music31.mp3"},
    ["Chaos"] = {"surrounded/theme/music9.mp3", "surrounded/theme/music5.mp3", "surrounded/theme/music13.mp3", "surrounded/theme/music16.mp3", "surrounded/theme/music17.mp3", "surrounded/theme/music21.mp3", "surrounded/theme/music23.mp3"},
    ["Extreme"] = {"surrounded/theme/music4.mp3", "surrounded/theme/music6.mp3", "surrounded/theme/music8.mp3", "surrounded/theme/music18.mp3", "surrounded/theme/music19.mp3", "surrounded/theme/music20.mp3", "surrounded/theme/music22.mp3", "surrounded/theme/music24.mp3"},
    ["Objective"] = {"surrounded/theme/obj1.mp3", "surrounded/theme/obj2.mp3", "surrounded/theme/obj3.mp3", "surrounded/theme/obj4.mp3", "surrounded/theme/obj5.mp3"},
    ["Countdown"] = {"surrounded/theme/countdown1.mp3", "surrounded/theme/countdown2.mp3", "surrounded/theme/countdown3.mp3"},
    
    ["Deploy"] = {"surrounded/theme/deploy.mp3"},
    ["Start"] = {"surrounded/theme/start.mp3"},
    ["GameOver"] = {"surrounded/theme/game_over.mp3"},
    ["ExfilOver"] = {"surrounded/theme/exfil_over.mp3"},
}

SuR.Config = {
    MusicWave = def_tracks,
    DefaultMusicWave = def_tracks,

    EmptyWeapon = "tfa_nmrih_fists",
    SecondaryWeapons = {
        "tfa_private_p99", 
        "tfa_private_p226", 
        "tfa_private_mp412", 
        "tfa_private_p220", 
        "tfa_private_jericho", 
        "tfa_private_vp70", 
        "tfa_private_usp45", 
        "tfa_private_glock17",
        "tfa_private_44magnum", 
        "tfa_private_glock18c", 
        "tfa_private_deagle",
        "tfa_private_dual_m9_samurai",
        "tfa_private_micro_roni",
        "tfa_private_chinalake",
        "tfa_private_milkor_mgl",
        "tfa_private_m79", 
        "tfa_private_m72",
        "sur_mine",
    },
    OtherWeapons = {
        "sur_artillery_strike",
        "sur_hammer",
        "sur_fuel",
    },

    TierWeapons = {
        ["Other"] = {"sur_hammer"},
        ["Melee"] = {"tfa_nmrih_kknife", "tfa_nmrih_bcd", "tfa_nmrih_bat", "tfa_nmrih_asaw", "tfa_nmrih_chainsaw", "tfa_nmrih_wrench", "tfa_nmrih_spade", "tfa_nmrih_sledge", "tfa_nmrih_pickaxe", "tfa_nmrih_machete", "tfa_nmrih_lpipe", "tfa_nmrih_hatchet", "tfa_nmrih_fubar", "tfa_nmrih_fireaxe", "tfa_nmrih_etool", "tfa_nmrih_crowbar", "tfa_nmrih_cleaver"},
        ["Tier1"] = {"tfa_private_p99", "tfa_private_p226", "tfa_private_mp412", "tfa_private_p220", "tfa_private_jericho", "tfa_private_vp70", "tfa_private_usp45", "tfa_private_glock17"},
        ["Tier2"] = {"tfa_private_ump45", "tfa_private_m1cgarand", "tfa_private_winchester1897", "tfa_private_dual_m9_samurai", "tfa_private_famas", "tfa_private_9a91", "tfa_private_tmp", "tfa_private_aug_para", "tfa_private_pp2000", "tfa_private_kriss_vector", "tfa_private_m45", "tfa_private_uzi_pro", "tfa_private_mp5", "tfa_private_mp7", "tfa_private_44magnum", "tfa_private_glock18c", "tfa_private_deagle"},
        ["Tier3"] = {"tfa_private_m79", "tfa_private_m72", "tfa_private_mp5swordfish", "tfa_private_kriss_carbine", "tfa_private_micro_roni", "tfa_private_sig_mcx", "tfa_private_sg751", "tfa_private_sg552", "tfa_private_ar15", "tfa_private_sa58", "tfa_private_galil_arm", "tfa_private_type89", "tfa_private_type64", "tfa_private_hk433", "tfa_private_hk416c", "tfa_private_hk416mod3", "tfa_private_hk416", "tfa_private_xm8", "tfa_private_g36", "tfa_private_fal_ferret", "tfa_private_fedorov", "tfa_private_k2c", "tfa_private_cz805", "tfa_private_ro933", "tfa_private_edge_rifle", "tfa_private_ak12", "tfa_private_ak105", "tfa_private_sl8", "tfa_private_mk20", "tfa_private_pss10", "tfa_private_m500_magpul", "tfa_private_remington870", "tfa_private_bizon", "tfa_private_p90", "tfa_private_ak74u", "tfa_private_honeybadger"},
        ["Tier4"] = {"tfa_private_ppsh41", "tfa_private_chinalake", "tfa_private_ultimax100", "tfa_private_galil_sar", "tfa_private_dsr", "tfa_private_m200", "tfa_private_ksg12", "tfa_private_harms_cqr"},
        ["Tier5"] = {"tfa_private_milkor_mgl", "tfa_private_m60", "tfa_private_m240g", "tfa_private_mk46", "tfa_private_tac50", "tfa_private_m82", "tfa_private_aa12", "tfa_private_mg34", "tfa_private_mg42"},
    },

    Tier_Colors = {
        [1] = Color(150,150,150),
        [2] = Color(75,150,0),
        [3] = Color(200,200,0),
        [4] = Color(230,150,0),
        [5] = Color(200,40,40),
    },

    Tier2_Price = 25,
    Tier3_Price = 100,
    Tier4_Price = 275,
    Tier5_Price = 500,

    Weapons_Executions_Anims = {
        ["chainsaw"] = {"tfa_nmrih_chainsaw"},
        ["abrasivechainsaw"] = {"tfa_nmrih_asaw"},
        ["axe"] = {"tfa_nmrih_fireaxe"},
        ["hammer"] = {"tfa_nmrih_bcd"},
        ["shovel"] = {"tfa_nmrih_spade"},
        ["etool"] = {"tfa_nmrih_etool"},
        ["wrench"] = {"tfa_nmrih_wrench"},
        ["fubar"] = {"tfa_nmrih_fubar"},
        ["crowbar"] = {"tfa_nmrih_crowbar"},
        ["machete"] = {"tfa_nmrih_machete"},
        ["butcherknife"] = {"tfa_nmrih_cleaver"},
        ["pickaxe"] = {"tfa_nmrih_pickaxe"},
        ["pipe"] = {"tfa_nmrih_lpipe"},
        ["sledge"] = {"tfa_nmrih_sledge"},
        ["bat"] = {"tfa_nmrih_bat"},
        ["knife"] = {"tfa_nmrih_kknife"},
        ["handaxe"] = {"tfa_nmrih_hatchet"},
    },

    Melee_Spawn_Chance = 10,
    Other_Spawn_Chance = 3,

    ClassIcons = {
        ["survivor"] = Material('surrounded/classes/survivor.png', 'noclamp smooth'),
        ["scout"] = Material('surrounded/classes/scout.png', 'noclamp smooth'),
        ["medic"] = Material('surrounded/classes/medic.png', 'noclamp smooth'),
        ["engineer"] = Material('surrounded/classes/engineer.png', 'noclamp smooth'),
        ["demoman"] = Material('surrounded/classes/demoman.png', 'noclamp smooth'),
        ["marksman"] = Material('surrounded/classes/marksman.png', 'noclamp smooth'),
        ["berserker"] = Material('surrounded/classes/berserker.png', 'noclamp smooth'),
    },

    VoicePacks = {
        ["Default [EN]"] = {
            ["pain"] = "surrounded/player/en/pain/",
            ["death"] = "surrounded/player/en/death/",
            ["reload"] = "surrounded/player/en/reload/",
            ["enemyback"] = "surrounded/player/en/enemyback/",
            ["enemydown"] = "surrounded/player/en/enemydown/",
            ["pickup"] = "surrounded/player/en/pickup/",
            ["noammo"] = "surrounded/player/en/noammo/",
            ["downed"] = "surrounded/player/en/downed/",
            ["friendlyfire"] = "surrounded/player/en/friendlyfire/",
            ["frienddied"] = "surrounded/player/en/frienddied/",
            ["lowhp"] = "surrounded/player/en/lowhp/",
            ["infected"] = "surrounded/player/en/infected/",
            ["enemyspotted"] = "surrounded/player/en/enemyspotted/",
            ["thanks"] = "surrounded/player/en/thanks/",
            ["cover"] = "surrounded/player/en/cover/",
        },
        ["Sam"] = {
            ["pain"] = "surrounded/player/sam_en/pain/",
            ["death"] = "surrounded/player/sam_en/death/",
            ["reload"] = "surrounded/player/sam_en/reload/",
            ["enemyback"] = "surrounded/player/sam_en/enemyback/",
            ["enemydown"] = "surrounded/player/sam_en/enemydown/",
            ["pickup"] = "surrounded/player/sam_en/pickup/",
            ["noammo"] = "surrounded/player/sam_en/noammo/",
            ["downed"] = "surrounded/player/sam_en/downed/",
            ["friendlyfire"] = "surrounded/player/sam_en/friendlyfire/",
            ["frienddied"] = "surrounded/player/sam_en/frienddied/",
            ["lowhp"] = "surrounded/player/sam_en/lowhp/",
            ["infected"] = "surrounded/player/sam_en/infected/",
            ["enemyspotted"] = "surrounded/player/sam_en/enemyspotted/",
            ["thanks"] = "surrounded/player/sam_en/thanks/",
            ["cover"] = "surrounded/player/sam_en/cover/",
        },
        ["Default [RU]"] = {
            ["pain"] = "surrounded/player/ru/pain/",
            ["death"] = "surrounded/player/ru/death/",
            ["reload"] = "surrounded/player/ru/reload/",
            ["enemyback"] = "surrounded/player/ru/enemyback/",
            ["enemydown"] = "surrounded/player/ru/enemydown/",
            ["pickup"] = "surrounded/player/ru/pickup/",
            ["noammo"] = "surrounded/player/ru/noammo/",
            ["downed"] = "surrounded/player/ru/downed/",
            ["friendlyfire"] = "surrounded/player/ru/friendlyfire/",
            ["frienddied"] = "surrounded/player/ru/frienddied/",
            ["lowhp"] = "surrounded/player/ru/lowhp/",
            ["infected"] = "surrounded/player/ru/infected/",
            ["enemyspotted"] = "surrounded/player/ru/enemyspotted/",
            ["thanks"] = "surrounded/player/ru/thanks/",
            ["cover"] = "surrounded/player/ru/cover/",
        },
    },

    Blocked_PlayerModels = {
        "models/player/charple.mdl",
        "models/player/corpse1.mdl",
        "models/player/skeleton.mdl",
        "models/player/zombie_classic.mdl",
        "models/player/zombie_fast.mdl",
        "models/player/zombie_soldier.mdl",
        "models/player/soldier_stripped.mdl",
    },
    Allowed_PlayerModels = {},

    Zombies = {
        walker = {
            "npc_vj_lnrhl2_citizenf_wal",
            "npc_vj_lnrhl2_citizenm_wal",
            "npc_vj_lnrhl2_medicf_wal",
            "npc_vj_lnrhl2_medicm_wal",
            "npc_vj_lnrhl2_rebelf_wal",
            "npc_vj_lnrhl2_rebelm_wal",
        },
        runner = {
            "npc_vj_lnrhl2_citizenf_inf",
            "npc_vj_lnrhl2_citizenm_inf",
            "npc_vj_lnrhl2_medicf_inf",
            "npc_vj_lnrhl2_medicm_inf",
            "npc_vj_lnrhl2_rebelm_inf",
            "npc_vj_lnrhl2_rebelf_inf",
        },
        special = {
            {
                class = "npc_vj_lnr_shambler",
                chance = 10,
                wave = 1,
            },
            {
                class = "npc_vj_lnr_healer",
                chance = 20,
                wave = 2,
            },
            {
                class = "npc_vj_lnrhl2_rebel_hvy",
                chance = 30,
                wave = 3,
            },
            {
                class = "npc_vj_lnr_fatso",
                chance = 40,
                wave = 3,
            },
            {
                class = "npc_vj_lnr_punk",
                chance = 20,
                wave = 4,
            },
            {
                class = "npc_vj_lnr_carrier",
                chance = 35,
                wave = 4,
            },
            {
                class = "npc_vj_lnr_hazmat",
                chance = 35,
                wave = 5,
            },
            {
                class = "npc_vj_lnr_spitter",
                chance = 30,
                wave = 6,
            },
            {
                class = "npc_vj_lnr_butcher",
                chance = 15,
                wave = 6,
            },
            {
                class = "npc_vj_lnr_brute",
                chance = 30,
                wave = 6,
            },
            {
                class = "npc_vj_lnr_riot",
                chance = 15,
                wave = 7,
            },
            {
                class = "npc_vj_lnr_evo",
                chance = 20,
                wave = 8,
            },
            {
                class = "npc_vj_lnr_ravager",
                chance = 20,
                wave = 8,
            },
            {
                class = "npc_vj_lnr_sentry",
                chance = 20,
                wave = 9,
            },
            {
                class = "npc_vj_lnr_tesla",
                chance = 20,
                wave = 10,
            },
            {
                class = "npc_vj_lnr_riot_shield",
                chance = 25,
                wave = 10,
            },
            {
                class = "npc_vj_lnr_napalm",
                chance = 25,
                wave = 11,
            },
            {
                class = "npc_vj_lnr_butcher_chainsaw",
                chance = 15,
                wave = 12,
            },
            {
                class = "npc_vj_lnr_bomber",
                chance = 15,
                wave = 13,
            },
            {
                class = "npc_vj_lnr_tyrant",
                chance = 10,
                wave = 14,
            },
            {
                class = "npc_vj_lnr_tank",
                chance = 5,
                wave = 15,
            },
        },
    },
    Zombies_Executions = {
        ["downed_machete"] = {"npc_vj_lnr_butcher", "npc_vj_lnrhl2_rebel_hvy", "npc_vj_lnr_healer"},
        ["downed_electro"] = {"npc_vj_lnr_tesla", "npc_vj_lnr_riot", "npc_vj_lnr_riot_shield", "npc_vj_lnr_bomber"},
        ["downed_guitar"] = {"npc_vj_lnr_punk"},
        ["downed_gas"] = {"npc_vj_lnr_hazmat"},
        ["downed_big"] = {"npc_vj_lnr_tyrant", "npc_vj_lnr_brute"},
        ["downed_acid"] = {"npc_vj_lnr_spitter", "npc_vj_lnr_sentry"},
        ["downed_unarmed"] = {"npc_vj_lnr_shambler", "npc_vj_lnr_carrier"},
        ["chainsaw"] = {"npc_vj_lnr_butcher_chainsaw"},
        ["berserk"] = {"npc_vj_lnr_carrier", "npc_vj_lnr_riot", "npc_vj_lnr_riot_shield", "npc_vj_lnrhl2_rebel_hvy"},
        ["jumper"] = {"npc_vj_lnr_evo", "npc_vj_lnr_ravager"},
    },
    Bosses = {
        [2] = {
            class = "npc_vj_lnr_punk",
            health = 2000,
            name = "boss_punk"
        },
        [5] = {
            class = "npc_vj_lnr_butcher_chainsaw",
            health = 3000,
            name = "boss_butcher"
        },
        [9] = {
            class = "npc_vj_lnr_tyrant",
            health = 3000,
            name = "boss_tyrant"
        },
        [14] = {
            class = "npc_vj_lnr_tank",
            health = 7500,
            name = "boss_tank"
        },
    },
    Zombie_Unlock_Wave = {
        ["Walker"] = 0,
        ["Runner"] = 3, 
        ["Carrier"] = 4, 
        ["Hazmat"] = 5, 
        ["Spitter"] = 6, 
        ["Brute"] = 7,
        ["Evo"] = 8,
        ["Bomber"] = 13,     
    },
    Zombie_PlayerModels = {
        ["Walker"] = {
            "models/vj_lnrhl2/humans/group03/male_01.mdl",
            "models/vj_lnrhl2/humans/group03/male_02.mdl",
            "models/vj_lnrhl2/humans/group03/male_03.mdl",
            "models/vj_lnrhl2/humans/group03/male_04.mdl",
            "models/vj_lnrhl2/humans/group03/male_05.mdl",
            "models/vj_lnrhl2/humans/group03/male_06.mdl",
            "models/vj_lnrhl2/humans/group03/male_07.mdl",
            "models/vj_lnrhl2/humans/group03/male_08.mdl",
            "models/vj_lnrhl2/humans/group01/male_09.mdl",
            "models/vj_lnrhl2/humans/group01/male_01.mdl",
            "models/vj_lnrhl2/humans/group01/male_02.mdl",
            "models/vj_lnrhl2/humans/group01/male_03.mdl",
            "models/vj_lnrhl2/humans/group01/male_04.mdl",
            "models/vj_lnrhl2/humans/group01/male_05.mdl",
            "models/vj_lnrhl2/humans/group01/male_06.mdl",
            "models/vj_lnrhl2/humans/group01/male_07.mdl",
            "models/vj_lnrhl2/humans/group01/male_08.mdl",
            "models/vj_lnrhl2/humans/group01/male_09.mdl",
        },
        ["Runner"] = {
            "models/vj_lnrhl2/humans/group03in/male_01.mdl",
            "models/vj_lnrhl2/humans/group03in/male_02.mdl",
            "models/vj_lnrhl2/humans/group03in/male_03.mdl",
            "models/vj_lnrhl2/humans/group03in/male_04.mdl",
            "models/vj_lnrhl2/humans/group03in/male_05.mdl",
            "models/vj_lnrhl2/humans/group03in/male_06.mdl",
            "models/vj_lnrhl2/humans/group03in/male_07.mdl",
            "models/vj_lnrhl2/humans/group03in/male_08.mdl",
            "models/vj_lnrhl2/humans/group03in/male_09.mdl",
            "models/vj_lnrhl2/humans/group02/male_01.mdl",
            "models/vj_lnrhl2/humans/group02/male_02.mdl",
            "models/vj_lnrhl2/humans/group02/male_03.mdl",
            "models/vj_lnrhl2/humans/group02/male_04.mdl",
            "models/vj_lnrhl2/humans/group02/male_05.mdl",
            "models/vj_lnrhl2/humans/group02/male_06.mdl",
            "models/vj_lnrhl2/humans/group02/male_07.mdl",
            "models/vj_lnrhl2/humans/group02/male_08.mdl",
            "models/vj_lnrhl2/humans/group02/male_09.mdl",
        },
        ["Carrier"] = {
            "models/vj_lnrspecials/carrier.mdl",
        },
        ["Hazmat"] = {
            "models/vj_lnrspecials/hazmat_zombie.mdl",
        },
        ["Spitter"] = {
            "models/vj_lnrspecials/spitter.mdl",
        },
        ["Brute"] = {
            "models/vj_lnrspecials/brute.mdl",
        },
        ["Evo"] = {
            "models/vj_lnrspecials/evo.mdl",
        },
        ["Bomber"] = {
            "models/vj_lnrspecials/bomber.mdl",
        },
    },

    LoadingURL = "https://cdn.discordapp.com/attachments/905471196500471859/1162799475018965074/gm_underpass_2023-10-14_18.12.44.png",

    Delay_Before_Wave = 60,
    Delay_Before_Deploy = 60,

    Zombie_Spawn_Delay = 4,
    Max_Zombies_On_Map = 20,
    Runners_On_Wave = 3,
    Only_Runners_On_Wave = 6,
    Start_Zombie_Count = 6,
    Zombie_Multiplier_Per_Wave = 3,
    Zombie_Multiplier_Per_Player = 1,
    Zombie_Spawn_Radius_Min = 500,
    Zombie_Spawn_Radius_Max = 2500,
    Zombie_Grab_Chance = 15,
    Zombie_Special_Grab_Chance = 20,

    Loot_HeightLimit = 4,
    Loot_Spawn_Delay = 1,
    Loot_Remove_Delay = 180,
    Loot_Max_Per_Player = 15,
    Loot_Tier3SpawnWave = 5,
    Loot_Tier4SpawnWave = 9,
    Loot_Tier5SpawnWave = 11,

    Game_Over_Screen_Delay = 22,
    Deploy_Cutscene = {},

    Loot_SpawnPositions = {},
    Support_SpawnPositions = {},
    Player_SpawnPositions = {},
    Gas_SpawnPositions = {},
    Camera_Position = {
        Vector(0,0,0), 
        Angle(0,0,0),
    },

    Zone_Center_Position = Vector(),
    Zone_Radius = 0,

    Invisible_Walls = {},

    Bleedout_Time = 60,
    Enable_Suicide = false,
    Enable_Out_Of_Bounds_Check = true,
    Enable_Dangerous_Water = false,
    Delete_Map_Items = true,
    Delete_Map_Logic = false,
    Allow_PVS_Info = true,
    Enable_Spawn_In_Building_Zombies = false,
    Open_Func_Doors = false,
    Mutator_Chance = 20,
    Height_Of_Air = 0,

    Exfil_Wave = 6,
    Exfil_Points = {},

    Start_Level_XP = 100,
    Level_Progress_Mult = 50,
    XP_Giving = {
        ["zombie_kill"] = 1,
        ["special_kill"] = 2,
        ["execution"] = 5,
        ["wave_complete"] = 10,
        ["fuel"] = 25,
        ["boss_kill"] = 100,
        ["evac_success"] = 250,
        ["capsule_item"] = 500,
    },

    Versus_Mode = false,
    Objective_Mode = false,
    Objective_Mode_Wave = 6,
    Objective_Mode_Max_Cans = 64,
    Objective_Mode_Positions = {},
}