CaptainPStar / co10_Escape

Official Github repository of A3 mission co10_Escape.
61 stars 47 forks source link

Add per-server classes support #177

Closed Dystopian closed 8 months ago

Dystopian commented 9 months ago

This PR allows server administrator to add own classes to mission arrays without mission recompiling. E.g. he wants to add TGA-200F civilian scooters for mission with any mod, add Tigr and T-90M from [DEV] CUP to CUP Woodland USMC vs RU and NAPA missions, and add KA-137 UAV to CUP Woodland RU vs BAF and ION PMC missions. This configuration can be like this:

profileNamespace setVariable ["A3E_Classes", [
    ["CUP Woodland USMC vs RU and NAPA", [
        ["a3e_arr_Escape_MilitaryTraffic_EnemyVehicleClasses", [
            "CUP_O_Tigr_233011_GREEN_RU",
            "CUP_O_Tigr_233014_PK_RU",
            "CUP_O_Tigr_M_233114_RU"
        ]],
        ["a3e_arr_Escape_RoadBlock_MannedVehicleTypes", [
            "CUP_O_Tigr_233014_GREEN_PK_RU",
            "CUP_O_Tigr_M_233114_KORD_RU",
            "CUP_O_Tigr_M_233114_PK_RU"
        ]],
        ["a3e_arr_ComCenDefence_heavyArmorClasses", ["CUP_O_T90M_RU","CUP_O_T90M_RU"]],
    []]],
    ["CUP Woodland RU vs BAF and ION PMC", [
        ["a3e_arr_searchdrone", ["JK_B_ION_KA137_PK_UAV_F"]],
    []]],
    ["global", [
        ["a3e_arr_Escape_MilitaryTraffic_CivilianVehicleClasses", ["xs_muravei","xs_muravei"]],
        ["a3e_arr_Escape_MilitaryTraffic_CivilianVehicleClasses", ["xs_muravei2","xs_muravei2"]],
    []]]
]];

saveProfileNamespace;

This commands should run once on server. It saves A3E_Classes variable to server profile. It's loaded at mission start and all local classes are added to mission classes. The variable is persistent across server restarts.

Note global section which adds classes to any-mod Escape missions and per-mod sections which add classes only to suitable mod.

Empty class arrays are supported to preserve trailing comma for all arrays (note [] at the end of each section). Also arrays with one name can be used to improve formatting (note a3e_arr_Escape_MilitaryTraffic_CivilianVehicleClasses arrays in the example).