initial files
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
if (!GRLIB_permissions_param) exitWith {};
|
||||
|
||||
waitUntil {!isNil "GRLIB_permissions"};
|
||||
waitUntil {!isNil "save_is_loaded"};
|
||||
waitUntil {save_is_loaded};
|
||||
|
||||
while {true} do {
|
||||
|
||||
private _default_permissions = [];
|
||||
{if ((_x select 0) == "Default") exitWith {_default_permissions = (_x select 2);}} foreach GRLIB_permissions;
|
||||
|
||||
if (count _default_permissions > 0) then {
|
||||
private _all_players_uids = [];
|
||||
{if ((_x select 0) != "Default") then {_all_players_uids pushback (_x select 0)}} foreach GRLIB_permissions;
|
||||
|
||||
private _old_count = count GRLIB_permissions;
|
||||
{
|
||||
if !(((getPlayerUID _x) in _all_players_uids) || ((getPlayerUID _x) isEqualTo "")) then {
|
||||
GRLIB_permissions pushBack [getPlayerUID _x, name _x, _default_permissions];
|
||||
};
|
||||
} foreach (allPlayers - entities "HeadlessClient_F");
|
||||
|
||||
if (_old_count != count GRLIB_permissions) then {
|
||||
publicVariable "GRLIB_permissions"
|
||||
};
|
||||
};
|
||||
|
||||
sleep 10;
|
||||
|
||||
};
|
||||
@@ -0,0 +1,105 @@
|
||||
sleep 5;
|
||||
|
||||
if ([] call KP_liberation_victoryCheck && GRLIB_endgame != 1) then {
|
||||
GRLIB_endgame = 1;
|
||||
publicVariable "GRLIB_endgame";
|
||||
{_x allowDamage false; (vehicle _x) allowDamage false;} forEach allPlayers;
|
||||
|
||||
private _rabbits = round (random 75) + round (random 80);
|
||||
|
||||
publicstats = [];
|
||||
publicstats pushback stats_ammo_produced;
|
||||
publicstats pushback stats_ammo_spent;
|
||||
publicstats pushback stats_blufor_soldiers_killed;
|
||||
publicstats pushback stats_blufor_soldiers_recruited;
|
||||
publicstats pushback stats_blufor_teamkills;
|
||||
publicstats pushback stats_blufor_vehicles_built;
|
||||
publicstats pushback stats_blufor_vehicles_killed;
|
||||
publicstats pushback stats_civilian_buildings_destroyed;
|
||||
publicstats pushback stats_civilian_vehicles_killed;
|
||||
publicstats pushback stats_civilian_vehicles_killed_by_players;
|
||||
publicstats pushback stats_civilian_vehicles_seized;
|
||||
publicstats pushback stats_civilians_healed;
|
||||
publicstats pushback stats_civilians_killed;
|
||||
publicstats pushback stats_civilians_killed_by_players;
|
||||
publicstats pushback stats_fobs_built;
|
||||
publicstats pushback stats_fobs_lost;
|
||||
publicstats pushback stats_fuel_produced;
|
||||
publicstats pushback stats_fuel_spent;
|
||||
publicstats pushback stats_hostile_battlegroups;
|
||||
publicstats pushback stats_ieds_detonated;
|
||||
publicstats pushback stats_opfor_killed_by_players;
|
||||
publicstats pushback stats_opfor_soldiers_killed;
|
||||
publicstats pushback stats_opfor_vehicles_killed;
|
||||
publicstats pushback stats_opfor_vehicles_killed_by_players;
|
||||
publicstats pushback stats_player_deaths;
|
||||
publicstats pushback stats_playtime;
|
||||
publicstats pushback stats_prisoners_captured;
|
||||
publicstats pushback stats_readiness_earned;
|
||||
publicstats pushback stats_reinforcements_called;
|
||||
publicstats pushback stats_resistance_killed;
|
||||
publicstats pushback stats_resistance_teamkills;
|
||||
publicstats pushback stats_resistance_teamkills_by_players;
|
||||
publicstats pushback stats_secondary_objectives;
|
||||
publicstats pushback stats_sectors_liberated;
|
||||
publicstats pushback stats_sectors_lost;
|
||||
publicstats pushback stats_spartan_respawns;
|
||||
publicstats pushback stats_supplies_produced;
|
||||
publicstats pushback stats_supplies_spent;
|
||||
publicstats pushback stats_vehicles_recycled;
|
||||
publicstats pushback _rabbits;
|
||||
|
||||
publicstats remoteExec ["remote_call_endgame"];
|
||||
|
||||
private _playtime_days = floor (stats_playtime / 86400);
|
||||
private _playtime_hours = floor ((stats_playtime % 86400) / 3600);
|
||||
private _playtime_minutes = floor ((stats_playtime % 3600) / 60);
|
||||
private _playtime_seconds = stats_playtime % 60;
|
||||
|
||||
["------------------------------------", "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Playtime: %1 days, %2 hours, %3 minutes, %4 seconds", _playtime_days, _playtime_hours, _playtime_minutes, _playtime_seconds], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["OPFOR infantry killed: %1", stats_opfor_soldiers_killed], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["OPFOR infantry killed by players: %1", stats_opfor_killed_by_players], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["OPFOR vehicles destroyed: %1", stats_opfor_vehicles_killed], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["OPFOR vehicles destroyed by players: %1", stats_opfor_vehicles_killed_by_players], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["BLUFOR infantry recruited: %1", stats_blufor_soldiers_recruited], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["BLUFOR infantry killed: %1", stats_blufor_soldiers_killed], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["BLUFOR vehicles built: %1", stats_blufor_vehicles_built], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["BLUFOR vehicles destroyed: %1", stats_blufor_vehicles_killed], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Player deaths: %1", stats_player_deaths], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["BLUFOR friendly fire incidents: %1", stats_blufor_teamkills], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Resistance fighters killed: %1", stats_resistance_killed], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Resistance fighters (friendly) killed: %1", stats_resistance_teamkills], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Resistance fighters (friendly) killed by players: %1", stats_resistance_teamkills_by_players], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Civilians killed: %1", stats_civilians_killed], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Civilians killed by players: %1", stats_civilians_killed_by_players], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Civilians healed: %1", stats_civilians_healed], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Civilian vehicles destroyed: %1", stats_civilian_vehicles_killed], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Civilian vehicles destroyed by players: %1", stats_civilian_vehicles_killed_by_players], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Civilian vehicles seized: %1", stats_civilian_vehicles_seized], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Civilian buildings destroyed: %1", stats_civilian_buildings_destroyed], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Vehicles recycled: %1", stats_vehicles_recycled], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Ammunition units produced: %1", stats_ammo_produced], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Ammunition units spent: %1", stats_ammo_spent], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Fuel units produced: %1", stats_fuel_produced], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Fuel units spent: %1", stats_fuel_spent], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Supply units produced: %1", stats_supplies_produced], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Supply units spent: %1", stats_supplies_spent], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Sectors liberated: %1", stats_sectors_liberated], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Sectors lost: %1", stats_sectors_lost], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["FOBs built: %1", stats_fobs_built], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["FOBs lost: %1", stats_fobs_lost], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Secondary objectives accomplished: %1", stats_secondary_objectives], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Prisoners captured: %1", stats_prisoners_captured], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Hostile battlegroups called: %1", stats_hostile_battlegroups], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Hostile reinforcements called: %1", stats_reinforcements_called], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Total combat readiness raised: %1", round stats_readiness_earned], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["IEDs detonated: %1", stats_ieds_detonated], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Number of Potato 01 losses: %1", stats_spartan_respawns], "MISSION END"] call KPLIB_fnc_log;
|
||||
[format ["Rabbits killed: %1", _rabbits], "MISSION END"] call KPLIB_fnc_log;
|
||||
["------------------------------------", "MISSION END"] call KPLIB_fnc_log;
|
||||
|
||||
sleep 20;
|
||||
|
||||
{if !(isPlayer _x) then {deleteVehicle _x;}} forEach allUnits;
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
private [ "_nextvehicle", "_nearestfob", "_reset_ticker" ];
|
||||
|
||||
_cleanup_classnames = [];
|
||||
{
|
||||
_cleanup_classnames append _x;
|
||||
} forEach [KPLIB_b_light_classes, KPLIB_b_heavy_classes, KPLIB_b_air_classes];
|
||||
|
||||
while { GRLIB_cleanup_vehicles > 0 } do {
|
||||
|
||||
sleep 600;
|
||||
|
||||
{
|
||||
_reset_ticker = true;
|
||||
_nextvehicle = _x;
|
||||
_nearestfob = [ getpos _nextvehicle ] call KPLIB_fnc_getNearestFob;
|
||||
if ( count _nearestfob == 3 ) then {
|
||||
if ( ( _nextvehicle distance _nearestfob > ( 1.2 * GRLIB_fob_range ) ) && ( _nextvehicle distance startbase > ( 1.2 * GRLIB_fob_range ) ) ) then {
|
||||
if ((toLower (typeof _nextvehicle)) in _cleanup_classnames) then {
|
||||
if ( count ( crew _nextvehicle ) == 0 ) then {
|
||||
_nextvehicle setVariable [ "GRLIB_empty_vehicle_ticker", ( _nextvehicle getVariable [ "GRLIB_empty_vehicle_ticker", 0 ] ) + 1 ];
|
||||
_reset_ticker = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
} ;
|
||||
|
||||
if ( _reset_ticker ) then {
|
||||
_nextvehicle setVariable [ "GRLIB_empty_vehicle_ticker", 0 ];
|
||||
};
|
||||
|
||||
if ( _nextvehicle getVariable [ "GRLIB_empty_vehicle_ticker", 0 ] >= ( 6 * GRLIB_cleanup_vehicles ) ) then {
|
||||
deleteVehicle _nextvehicle;
|
||||
};
|
||||
|
||||
sleep 0.5;
|
||||
} foreach vehicles;
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
while {true} do {
|
||||
5 setFog [0, 0, 0];
|
||||
sleep 30;
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
while {true} do {
|
||||
if (GRLIB_shorter_nights && (daytime > 20 || daytime < 4)) then {
|
||||
setTimeMultiplier (GRLIB_time_factor * 4);
|
||||
} else {
|
||||
setTimeMultiplier GRLIB_time_factor;
|
||||
};
|
||||
sleep 10;
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
private _weathers = [
|
||||
[0.25],
|
||||
[0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55],
|
||||
[0, 0.1, 0.15, 0.2, 0.25, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425, 0.45, 0.475, 0.5, 0.525, 0.55, 0.575, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1]
|
||||
] select (GRLIB_weather_param - 1);
|
||||
|
||||
private _newWeather = selectRandom _weathers;
|
||||
0 setOvercast _newWeather;
|
||||
forceWeatherChange;
|
||||
|
||||
[format ["Set initial weather to: %1 - Param Value: %2 - Time: %3", _newWeather, GRLIB_weather_param, diag_tickTime], "WEATHER"] call KPLIB_fnc_log;
|
||||
|
||||
while {GRLIB_endgame == 0} do {
|
||||
_newWeather = selectRandom _weathers;
|
||||
(3600 * timeMultiplier) setOvercast _newWeather;
|
||||
[format ["Set next weather transition to: %1 - Time: %2", _newWeather, diag_tickTime], "WEATHER"] call KPLIB_fnc_log;
|
||||
sleep 3000; // Slighty less than weather transition time, as sleep duration is depending on FPS
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
waitUntil { !isNil "save_is_loaded" };
|
||||
waitUntil { save_is_loaded };
|
||||
|
||||
while { true } do {
|
||||
sleep 1;
|
||||
stats_playtime = stats_playtime + 1;
|
||||
};
|
||||
575
kp_liberation.brf_sumava/scripts/server/game/save_manager.sqf
Normal file
575
kp_liberation.brf_sumava/scripts/server/game/save_manager.sqf
Normal file
@@ -0,0 +1,575 @@
|
||||
scriptName "KPLIB_saveLoop";
|
||||
|
||||
private _start = diag_tickTime;
|
||||
["----- Loading save data", "SAVE"] call KPLIB_fnc_log;
|
||||
|
||||
// Handle possible enabled "wipe save" mission parameters
|
||||
if (GRLIB_param_wipe_savegame_1 == 1 && GRLIB_param_wipe_savegame_2 == 1) then {
|
||||
profileNamespace setVariable [GRLIB_save_key,nil];
|
||||
saveProfileNamespace;
|
||||
["Save wiped via mission parameters", "SAVE"] call KPLIB_fnc_log;
|
||||
} else {
|
||||
["No save wipe", "SAVE"] call KPLIB_fnc_log;
|
||||
};
|
||||
|
||||
// Auto save when last player exits
|
||||
if (hasInterface) then {
|
||||
[] spawn {
|
||||
waitUntil {!isNull findDisplay 46};
|
||||
(findDisplay 46) displayAddEventHandler ["Unload", {
|
||||
if (!isServer) exitWith {};
|
||||
["Player server exit. Saving mission data.", "SAVE"] call KPLIB_fnc_log;
|
||||
[] call KPLIB_fnc_doSave;
|
||||
}];
|
||||
};
|
||||
} else {
|
||||
addMissionEventHandler ["HandleDisconnect", {
|
||||
if !(allPlayers isEqualTo []) exitWith {false};
|
||||
params ["_unit"];
|
||||
deleteVehicle _unit;
|
||||
["Last player disconnected. Saving mission data.", "SAVE"] call KPLIB_fnc_log;
|
||||
[] call KPLIB_fnc_doSave;
|
||||
}];
|
||||
};
|
||||
|
||||
// All classnames of objects which should be saved
|
||||
KPLIB_classnamesToSave = [toLower FOB_typename, toLower huron_typename];
|
||||
|
||||
/*
|
||||
--- Locals ---
|
||||
Variables which are only used inside the save_manager.sqf
|
||||
*/
|
||||
// All AI squads
|
||||
private _aiGroups = [];
|
||||
// Current campaign date and time
|
||||
private _dateTime = [];
|
||||
// Vehicles which shouldn't be handled in the kill manager
|
||||
private _noKillHandler = [toLower FOB_typename, toLower huron_typename];
|
||||
// All objects which should be loaded/saved
|
||||
private _objectsToSave = [];
|
||||
// All storages which are handled for resource persistence
|
||||
private _resourceStorages = [];
|
||||
// Collection array for the statistic values
|
||||
private _stats = [];
|
||||
// Collection array for the enemy weights
|
||||
private _weights = [];
|
||||
// All mines around FOBs
|
||||
private _allMines = [];
|
||||
// All unclaimed crates from crate spawning sectors
|
||||
private _allCrates = [];
|
||||
|
||||
/*
|
||||
--- Globals ---
|
||||
Initializes global variables which are used at several places in the framework
|
||||
*/
|
||||
|
||||
// Enemy weight for anti air
|
||||
air_weight = 33;
|
||||
// Enemy weight for anti armor
|
||||
armor_weight = 33;
|
||||
// Blufor sectors
|
||||
blufor_sectors = [];
|
||||
// Enemy combat readiness (0-100)
|
||||
combat_readiness = 0;
|
||||
// All FOBs
|
||||
GRLIB_all_fobs = [];
|
||||
// Player permissions data
|
||||
GRLIB_permissions = [];
|
||||
// Vehicle unlock links
|
||||
GRLIB_vehicle_to_military_base_links = [];
|
||||
// Enemy weight for anti infantry
|
||||
infantry_weight = 33;
|
||||
// Civilian reputation value (-100 - +100)
|
||||
KP_liberation_civ_rep = 0;
|
||||
// Clearances
|
||||
KP_liberation_clearances = [];
|
||||
// Strength value of the resistance forces
|
||||
KP_liberation_guerilla_strength = 0;
|
||||
// Logistic handling data
|
||||
KP_liberation_logistics = [];
|
||||
// Production handling data
|
||||
KP_liberation_production = [];
|
||||
// Factory markers to display the current available facilities
|
||||
KP_liberation_production_markers = [];
|
||||
// Radio tower classnames per radio tower sector
|
||||
KPLIB_sectorTowers = [];
|
||||
// Sectors under attack
|
||||
KPLIB_sectorsUnderAttack = [];
|
||||
// Global Intel resource
|
||||
resources_intel = 0;
|
||||
// State if the save is fully loaded
|
||||
save_is_loaded = false;
|
||||
|
||||
// Add all buildings for saving and kill manager ignore
|
||||
_noKillHandler append KPLIB_b_buildings_classes;
|
||||
KPLIB_classnamesToSave append KPLIB_b_buildings_classes;
|
||||
KPLIB_classnamesToSave append KPLIB_b_allVeh_classes;
|
||||
|
||||
// Add opfor and civilian vehicles for saving
|
||||
KPLIB_classnamesToSave append KPLIB_o_allVeh_classes;
|
||||
KPLIB_classnamesToSave append civilian_vehicles;
|
||||
|
||||
// Remove duplicates
|
||||
KPLIB_classnamesToSave = KPLIB_classnamesToSave arrayIntersect KPLIB_classnamesToSave;
|
||||
|
||||
/*
|
||||
--- Statistic Variables ---
|
||||
*/
|
||||
|
||||
stats_ammo_produced = 0;
|
||||
stats_ammo_spent = 0;
|
||||
stats_blufor_soldiers_killed = 0;
|
||||
stats_blufor_soldiers_recruited = 0;
|
||||
stats_blufor_teamkills = 0;
|
||||
stats_blufor_vehicles_built = 0;
|
||||
stats_blufor_vehicles_killed = 0;
|
||||
stats_civilian_buildings_destroyed = 0;
|
||||
stats_civilian_vehicles_killed = 0;
|
||||
stats_civilian_vehicles_killed_by_players = 0;
|
||||
stats_civilian_vehicles_seized = 0;
|
||||
stats_civilians_healed = 0;
|
||||
stats_civilians_killed = 0;
|
||||
stats_civilians_killed_by_players = 0;
|
||||
stats_fobs_built = 0;
|
||||
stats_fobs_lost = 0;
|
||||
stats_fuel_produced = 0;
|
||||
stats_fuel_spent = 0;
|
||||
stats_hostile_battlegroups = 0;
|
||||
stats_ieds_detonated = 0;
|
||||
stats_opfor_killed_by_players = 0;
|
||||
stats_opfor_soldiers_killed = 0;
|
||||
stats_opfor_vehicles_killed = 0;
|
||||
stats_opfor_vehicles_killed_by_players = 0;
|
||||
stats_player_deaths = 0;
|
||||
stats_playtime = 0;
|
||||
stats_prisoners_captured = 0;
|
||||
stats_readiness_earned = 0;
|
||||
stats_reinforcements_called = 0;
|
||||
stats_resistance_killed = 0;
|
||||
stats_resistance_teamkills = 0;
|
||||
stats_resistance_teamkills_by_players = 0;
|
||||
stats_secondary_objectives = 0;
|
||||
stats_sectors_liberated = 0;
|
||||
stats_sectors_lost = 0;
|
||||
stats_spartan_respawns = 0;
|
||||
stats_supplies_produced = 0;
|
||||
stats_supplies_spent = 0;
|
||||
stats_vehicles_recycled = 0;
|
||||
|
||||
// Prevent saving/duplication of objects placed in Eden
|
||||
{
|
||||
_x setVariable ["KP_liberation_edenObject", true];
|
||||
} forEach (allMissionObjects "");
|
||||
|
||||
// Get possible save data
|
||||
private _saveData = profileNamespace getVariable GRLIB_save_key;
|
||||
|
||||
// Load save data, when retrieved
|
||||
if (!isNil "_saveData") then {
|
||||
|
||||
// Convert from string to array
|
||||
if (_saveData isEqualType "") then {
|
||||
_saveData = parseSimpleArray _saveData;
|
||||
};
|
||||
|
||||
if (((_saveData select 0) select 0) isEqualType 0) then {
|
||||
[format ["Save data from version: %1", (_saveData select 0) joinstring "."], "SAVE"] call KPLIB_fnc_log;
|
||||
|
||||
_dateTime = _saveData select 1;
|
||||
_objectsToSave = _saveData select 2;
|
||||
_resourceStorages = _saveData select 3;
|
||||
_stats = _saveData select 4;
|
||||
_weights = _saveData select 5;
|
||||
_aiGroups = _saveData select 6;
|
||||
blufor_sectors = _saveData select 7;
|
||||
combat_readiness = _saveData select 8;
|
||||
GRLIB_all_fobs = _saveData select 9;
|
||||
GRLIB_permissions = _saveData select 10;
|
||||
GRLIB_vehicle_to_military_base_links = _saveData select 11;
|
||||
KP_liberation_civ_rep = _saveData select 12;
|
||||
KP_liberation_clearances = _saveData select 13;
|
||||
KP_liberation_guerilla_strength = _saveData select 14;
|
||||
KP_liberation_logistics = _saveData select 15;
|
||||
KP_liberation_production = _saveData select 16;
|
||||
KP_liberation_production_markers = _saveData select 17;
|
||||
resources_intel = _saveData select 18;
|
||||
_allMines = _saveData param [19, []];
|
||||
_allCrates = _saveData param [20, []];
|
||||
KPLIB_sectorTowers = _saveData param [21, []];
|
||||
|
||||
stats_ammo_produced = _stats select 0;
|
||||
stats_ammo_spent = _stats select 1;
|
||||
stats_blufor_soldiers_killed = _stats select 2;
|
||||
stats_blufor_soldiers_recruited = _stats select 3;
|
||||
stats_blufor_teamkills = _stats select 4;
|
||||
stats_blufor_vehicles_built = _stats select 5;
|
||||
stats_blufor_vehicles_killed = _stats select 6;
|
||||
stats_civilian_buildings_destroyed = _stats select 7;
|
||||
stats_civilian_vehicles_killed = _stats select 8;
|
||||
stats_civilian_vehicles_killed_by_players = _stats select 9;
|
||||
stats_civilian_vehicles_seized = _stats select 10;
|
||||
stats_civilians_healed = _stats select 11;
|
||||
stats_civilians_killed = _stats select 12;
|
||||
stats_civilians_killed_by_players = _stats select 13;
|
||||
stats_fobs_built = _stats select 14;
|
||||
stats_fobs_lost = _stats select 15;
|
||||
stats_fuel_produced = _stats select 16;
|
||||
stats_fuel_spent = _stats select 17;
|
||||
stats_hostile_battlegroups = _stats select 18;
|
||||
stats_ieds_detonated = _stats select 19;
|
||||
stats_opfor_killed_by_players = _stats select 20;
|
||||
stats_opfor_soldiers_killed = _stats select 21;
|
||||
stats_opfor_vehicles_killed = _stats select 22;
|
||||
stats_opfor_vehicles_killed_by_players = _stats select 23;
|
||||
stats_player_deaths = _stats select 24;
|
||||
stats_playtime = _stats select 25;
|
||||
stats_prisoners_captured = _stats select 26;
|
||||
stats_readiness_earned = _stats select 27;
|
||||
stats_reinforcements_called = _stats select 28;
|
||||
stats_resistance_killed = _stats select 29;
|
||||
stats_resistance_teamkills = _stats select 30;
|
||||
stats_resistance_teamkills_by_players = _stats select 31;
|
||||
stats_secondary_objectives = _stats select 32;
|
||||
stats_sectors_liberated = _stats select 33;
|
||||
stats_sectors_lost = _stats select 34;
|
||||
stats_spartan_respawns = _stats select 35;
|
||||
stats_supplies_produced = _stats select 36;
|
||||
stats_supplies_spent = _stats select 37;
|
||||
stats_vehicles_recycled = _stats select 38;
|
||||
} else {
|
||||
// --- Compatibility for older save data ---
|
||||
["Save data from version: pre 0.96.5", "SAVE"] call KPLIB_fnc_log;
|
||||
|
||||
blufor_sectors = _saveData select 0;
|
||||
GRLIB_all_fobs = _saveData select 1;
|
||||
_objectsToSave = _saveData select 2;
|
||||
_dateTime = _saveData select 3;
|
||||
combat_readiness = _saveData select 4;
|
||||
_resourceStorages = _saveData select 5;
|
||||
KP_liberation_production = _saveData select 6;
|
||||
KP_liberation_logistics = _saveData select 7;
|
||||
_stats = _saveData select 8;
|
||||
_weights = _saveData select 9;
|
||||
GRLIB_vehicle_to_military_base_links = _saveData select 10;
|
||||
GRLIB_permissions = _saveData select 11;
|
||||
_aiGroups = _saveData select 12;
|
||||
resources_intel = _saveData select 13;
|
||||
KP_liberation_civ_rep = _saveData select 15;
|
||||
KP_liberation_production_markers = _saveData select 16;
|
||||
KP_liberation_guerilla_strength = _saveData select 17;
|
||||
|
||||
stats_opfor_soldiers_killed = _stats select 0;
|
||||
stats_opfor_killed_by_players = _stats select 1;
|
||||
stats_blufor_soldiers_killed = _stats select 2;
|
||||
stats_player_deaths = _stats select 3;
|
||||
stats_opfor_vehicles_killed = _stats select 4;
|
||||
stats_opfor_vehicles_killed_by_players = _stats select 5;
|
||||
stats_blufor_vehicles_killed = _stats select 6;
|
||||
stats_blufor_soldiers_recruited = _stats select 7;
|
||||
stats_blufor_vehicles_built = _stats select 8;
|
||||
stats_civilians_killed = _stats select 9;
|
||||
stats_civilians_killed_by_players = _stats select 10;
|
||||
stats_sectors_liberated = _stats select 11;
|
||||
stats_playtime = _stats select 12;
|
||||
stats_spartan_respawns = _stats select 13;
|
||||
stats_secondary_objectives = _stats select 14;
|
||||
stats_hostile_battlegroups = _stats select 15;
|
||||
stats_ieds_detonated = _stats select 16;
|
||||
stats_reinforcements_called = _stats select 19;
|
||||
stats_prisoners_captured = _stats select 20;
|
||||
stats_blufor_teamkills = _stats select 21;
|
||||
stats_vehicles_recycled = _stats select 22;
|
||||
stats_ammo_spent = _stats select 23;
|
||||
stats_sectors_lost = _stats select 24;
|
||||
stats_fobs_built = _stats select 25;
|
||||
stats_fobs_lost = _stats select 26;
|
||||
stats_readiness_earned = _stats select 27;
|
||||
};
|
||||
|
||||
// Extract weigths from collection array
|
||||
infantry_weight = _weights select 0;
|
||||
armor_weight = _weights select 1;
|
||||
air_weight = _weights select 2;
|
||||
|
||||
// Set correct resistance standing
|
||||
private _resistanceEnemy = [0, 1] select (KP_liberation_civ_rep < 25);
|
||||
private _resistanceFriendly = [0, 1] select (KP_liberation_civ_rep >= -25);
|
||||
|
||||
GRLIB_side_resistance setFriend [GRLIB_side_enemy, _resistanceEnemy];
|
||||
GRLIB_side_enemy setFriend [GRLIB_side_resistance, _resistanceEnemy];
|
||||
GRLIB_side_resistance setFriend [GRLIB_side_friendly, _resistanceFriendly];
|
||||
GRLIB_side_friendly setFriend [GRLIB_side_resistance, _resistanceFriendly];
|
||||
|
||||
if (KP_liberation_civrep_debug > 0) then {[format ["%1 getFriend %2: %3 - %1 getFriend %4: %5", GRLIB_side_resistance, GRLIB_side_enemy, (GRLIB_side_resistance getFriend GRLIB_side_enemy), GRLIB_side_friendly, (GRLIB_side_resistance getFriend GRLIB_side_friendly)], "CIVREP"] call KPLIB_fnc_log;};
|
||||
|
||||
// Apply current date and time
|
||||
if (_dateTime isEqualType []) then {
|
||||
setDate _dateTime;
|
||||
} else {
|
||||
setDate [2045, 6, 6, _dateTime, 0]; // Compatibility for older save data
|
||||
};
|
||||
|
||||
// Create clearances
|
||||
{
|
||||
[_x select 0, _x select 1] call KPLIB_fnc_createClearance;
|
||||
} forEach KP_liberation_clearances;
|
||||
|
||||
// Collection array for all objects which are loaded
|
||||
private _spawnedObjects = [];
|
||||
|
||||
// Spawn all saved objects
|
||||
private _object = objNull;
|
||||
{
|
||||
// Fetch data of saved object
|
||||
_x params ["_class", "_pos", "_vecDir", "_vecUp", ["_hasCrew", false]];
|
||||
|
||||
// This will be removed if we reach a 0.96.7 due to more released Arma 3 DLCs until we finish 0.97.0
|
||||
if !(((_saveData select 0) select 0) isEqualType 0) then {
|
||||
// Pre 0.96.5 compatibility with repair building, as it was replaced by default with a different classname
|
||||
if ((KP_liberation_recycle_building != "Land_CarService_F") && (_class == "Land_CarService_F")) then {
|
||||
_class = KP_liberation_recycle_building;
|
||||
};
|
||||
|
||||
// Pre 0.96.5 compatibility with air building, as it was replaced by default with a different classname
|
||||
if ((KP_liberation_air_vehicle_building != "Land_Radar_Small_F") && (_class == "Land_Radar_Small_F")) then {
|
||||
_class = KP_liberation_air_vehicle_building;
|
||||
};
|
||||
};
|
||||
|
||||
// Only spawn, if the classname is still in the presets
|
||||
if ((toLower _class) in KPLIB_classnamesToSave) then {
|
||||
|
||||
// Create object without damage handling and simulation
|
||||
_object = createVehicle [_class, _pos, [], 0, "CAN_COLLIDE"];
|
||||
_object allowdamage false;
|
||||
_object enableSimulation false;
|
||||
|
||||
// Add object to spawned objects collection
|
||||
_spawnedObjects pushBack _object;
|
||||
|
||||
// Reposition spawned object
|
||||
_object setPosWorld _pos;
|
||||
_object setVectorDirAndUp [_vecDir, _vecUp];
|
||||
|
||||
// Process KP object init
|
||||
[_object] call KPLIB_fnc_addObjectInit;
|
||||
|
||||
// Apply kill manager handling, if not excluded
|
||||
if !((toLower _class) in _noKillHandler) then {
|
||||
_object addMPEventHandler ["MPKilled", {_this spawn kill_manager}];
|
||||
};
|
||||
|
||||
// Set enemy vehicle as captured
|
||||
if ((toLower _class) in KPLIB_o_allVeh_classes) then {
|
||||
_object setVariable ["KPLIB_captured", true, true];
|
||||
};
|
||||
|
||||
// Set civilian vehicle as seized
|
||||
if (_class in civilian_vehicles) then {
|
||||
_object setVariable ["KPLIB_seized", true, true];
|
||||
};
|
||||
|
||||
// Determine if cargo should be cleared
|
||||
[_object] call KPLIB_fnc_clearCargo;
|
||||
|
||||
// Add blufor crew, if it had crew or is a UAV
|
||||
if ((unitIsUAV _object) || _hascrew) then {
|
||||
[_object] call KPLIB_fnc_forceBluforCrew;
|
||||
};
|
||||
};
|
||||
} forEach _objectsToSave;
|
||||
|
||||
// Re-enable physics on the spawned objects
|
||||
{
|
||||
_x enableSimulation true;
|
||||
_x setdamage 0;
|
||||
_x allowdamage true;
|
||||
} forEach _spawnedObjects;
|
||||
["Saved buildings and vehicles placed", "SAVE"] call KPLIB_fnc_log;
|
||||
|
||||
// Spawn all saved mines
|
||||
private _mine = objNull;
|
||||
{
|
||||
_x params ["_minePos", "_dirAndUp", "_class", "_known"];
|
||||
|
||||
_mine = createVehicle [_class, _minePos, [], 0];
|
||||
_mine setPosWorld _minePos;
|
||||
_mine setVectorDirAndUp _dirAndUp;
|
||||
|
||||
// reveal mine to player side if it was detected
|
||||
if (_known) then {
|
||||
GRLIB_side_friendly revealMine _mine;
|
||||
};
|
||||
|
||||
} forEach _allMines;
|
||||
["Saved mines placed", "SAVE"] call KPLIB_fnc_log;
|
||||
|
||||
// Spawn saved resource storages and their content
|
||||
{
|
||||
_x params ["_class", "_pos", "_vecDir", "_vecUp", "_supply", "_ammo", "_fuel"];
|
||||
|
||||
// Only spawn, if the classname is still in the presets
|
||||
if ((toLower _class) in KPLIB_classnamesToSave) then {
|
||||
|
||||
// Create object without damage handling and simulation
|
||||
_object = createVehicle [_class, _pos, [], 0, "CAN_COLLIDE"];
|
||||
_object allowdamage false;
|
||||
_object enableSimulation false;
|
||||
|
||||
// Reposition spawned object
|
||||
_object setPosWorld _pos;
|
||||
_object setVectorDirAndUp [_vecDir, _vecUp];
|
||||
|
||||
// Re-enable physics on spawned object
|
||||
_object setdamage 0;
|
||||
_object enableSimulation true;
|
||||
_object allowdamage true;
|
||||
|
||||
// Mark it as FOB storage
|
||||
_object setVariable ["KP_liberation_storage_type", 0, true];
|
||||
|
||||
// Fill storage with saved resources
|
||||
[floor _supply, floor _ammo, floor _fuel, _object] call KPLIB_fnc_fillStorage;
|
||||
};
|
||||
} forEach _resourceStorages;
|
||||
["Saved FOB storages placed and filled", "SAVE"] call KPLIB_fnc_log;
|
||||
|
||||
// Spawn saved sector storages and their content
|
||||
private _storage = [];
|
||||
{
|
||||
_storage = _x select 3;
|
||||
|
||||
// Spawn storage, if sector has valid storage
|
||||
if ((count _storage) == 3) then {
|
||||
_storage params ["_pos", "_dir", "_vecUp"];
|
||||
|
||||
// Create object without damage handling and simulation
|
||||
_object = createVehicle [KP_liberation_small_storage_building, _pos, [], 0, "CAN_COLLIDE"];
|
||||
_object enableSimulationGlobal false;
|
||||
_object allowdamage false;
|
||||
|
||||
// Reposition spawned object
|
||||
_object setdir _dir;
|
||||
_object setVectorUp _vecUp;
|
||||
_object setPosATL _pos;
|
||||
|
||||
// Re-enable physics on spawned object
|
||||
_object setdamage 0;
|
||||
_object enableSimulation true;
|
||||
_object allowdamage true;
|
||||
|
||||
// Mark it as sector storage
|
||||
_object setVariable ["KP_liberation_storage_type", 1, true];
|
||||
|
||||
// Fill storage
|
||||
[floor (_x select 9), floor (_x select 10), floor (_x select 11), _object] call KPLIB_fnc_fillStorage;
|
||||
};
|
||||
} forEach KP_liberation_production;
|
||||
["Saved sector storages placed and filled", "SAVE"] call KPLIB_fnc_log;
|
||||
|
||||
// Spawn BLUFOR AI groups
|
||||
// This will be removed if we reach a 0.96.7 due to more released Arma 3 DLCs until we finish 0.97.0
|
||||
private _grp = grpNull;
|
||||
if (((_saveData select 0) select 0) isEqualType 0) then {
|
||||
{
|
||||
_x params ["_spawnPos", "_units"];
|
||||
_grp = createGroup [GRLIB_side_friendly, true];
|
||||
{
|
||||
[_x, [_spawnPos, _grp] select (_forEachIndex > 0), _grp] call KPLIB_fnc_createManagedUnit;
|
||||
} forEach _units;
|
||||
} forEach _aiGroups;
|
||||
} else {
|
||||
// Pre 0.96.5 compatibility
|
||||
private _pos = [];
|
||||
private _dir = 0;
|
||||
private _unit = objNull;
|
||||
{
|
||||
_grp = createGroup [GRLIB_side_friendly, true];
|
||||
{
|
||||
_pos = [(_x select 1) select 0, (_x select 1) select 1, ((_x select 1) select 2) + 0.2];
|
||||
_dir = _x select 2;
|
||||
_unit = [(_x select 0), _pos, _grp] call KPLIB_fnc_createManagedUnit;
|
||||
_unit setDir _dir;
|
||||
_unit setPosATL _pos;
|
||||
} forEach _x;
|
||||
} forEach _aiGroups;
|
||||
};
|
||||
["Saved AI units placed", "SAVE"] call KPLIB_fnc_log;
|
||||
|
||||
// Spawn all saved sector crates
|
||||
{
|
||||
_x call KPLIB_fnc_createCrate;
|
||||
} forEach _allCrates;
|
||||
["Saved crates placed", "SAVE"] call KPLIB_fnc_log;
|
||||
} else {
|
||||
["Save nil", "SAVE"] call KPLIB_fnc_log;
|
||||
};
|
||||
|
||||
publicVariable "stats_civilian_vehicles_seized";
|
||||
publicVariable "stats_ieds_detonated";
|
||||
publicVariable "blufor_sectors";
|
||||
publicVariable "GRLIB_all_fobs";
|
||||
publicVariable "KPLIB_sectorsUnderAttack";
|
||||
publicVariable "KP_liberation_clearances";
|
||||
|
||||
// Check for deleted military sectors or deleted classnames in the locked vehicles array
|
||||
GRLIB_vehicle_to_military_base_links = GRLIB_vehicle_to_military_base_links select {((_x select 0) in elite_vehicles) && ((_x select 1) in sectors_military)};
|
||||
|
||||
// Remove links for vehicles of possibly removed mods
|
||||
GRLIB_vehicle_to_military_base_links = GRLIB_vehicle_to_military_base_links select {[_x select 0] call KPLIB_fnc_checkClass};
|
||||
|
||||
// Check for additions in the locked vehicles array
|
||||
private _lockedVehCount = count GRLIB_vehicle_to_military_base_links;
|
||||
if ((_lockedVehCount < (count sectors_military)) && (_lockedVehCount < (count elite_vehicles))) then {
|
||||
private _assignedVehicles = [];
|
||||
private _assignedBases = [];
|
||||
private _nextVehicle = "";
|
||||
private _nextBase = "";
|
||||
|
||||
{
|
||||
_assignedVehicles pushBack (_x select 0);
|
||||
_assignedBases pushBack (_x select 1);
|
||||
} forEach GRLIB_vehicle_to_military_base_links;
|
||||
|
||||
// Add new entries, when there are elite vehicles and military sectors are not yet assigned
|
||||
while {((count _assignedVehicles) < (count elite_vehicles)) && ((count _assignedBases) < (count sectors_military))} do {
|
||||
_nextVehicle = selectRandom (elite_vehicles - _assignedVehicles);
|
||||
_nextBase = selectRandom (sectors_military - _assignedBases);
|
||||
_assignedVehicles pushBack _nextVehicle;
|
||||
_assignedBases pushBack _nextBase;
|
||||
GRLIB_vehicle_to_military_base_links pushBack [_nextVehicle, _nextBase];
|
||||
};
|
||||
["Additional military sectors or unlockable vehicles detected and assigned", "SAVE"] call KPLIB_fnc_log;
|
||||
};
|
||||
|
||||
publicVariable "GRLIB_vehicle_to_military_base_links";
|
||||
publicVariable "GRLIB_permissions";
|
||||
save_is_loaded = true; publicVariable "save_is_loaded";
|
||||
|
||||
[format ["----- Saved data loaded - Time needed: %1 seconds", diag_tickTime - _start], "SAVE"] call KPLIB_fnc_log;
|
||||
|
||||
// Start the save loop
|
||||
private _saveTime = time + KP_liberation_save_interval;
|
||||
while {true} do {
|
||||
waitUntil {
|
||||
sleep 0.5;
|
||||
(time > _saveTime) || {GRLIB_endgame == 1};
|
||||
};
|
||||
_start = diag_tickTime;
|
||||
|
||||
// Exit the while and wipe save, if campaign ended
|
||||
if (GRLIB_endgame == 1) exitWith {
|
||||
profileNamespace setVariable [GRLIB_save_key, nil];
|
||||
saveProfileNamespace;
|
||||
};
|
||||
|
||||
[] call KPLIB_fnc_doSave;
|
||||
|
||||
if (KP_liberation_savegame_debug > 0) then {[format ["Campaign saved - Time needed: %1 seconds", diag_tickTime - _start], "SAVE"] call KPLIB_fnc_log;};
|
||||
|
||||
_saveTime = time + KP_liberation_save_interval;
|
||||
};
|
||||
|
||||
["Left saving loop", "SAVE"] call KPLIB_fnc_log;
|
||||
|
||||
true
|
||||
@@ -0,0 +1,72 @@
|
||||
if (!isDedicated) exitWith {};
|
||||
|
||||
_serverDuration = (KP_liberation_restart * 60 * 60);
|
||||
|
||||
[format ["Restart Timer Set To %1", _serverDuration], "RESTART"] call KPLIB_fnc_log;
|
||||
|
||||
private _30minspassed = false;
|
||||
private _15minspassed = false;
|
||||
private _5minspassed = false;
|
||||
private _60secondspassed = false;
|
||||
|
||||
private _timeStart = diag_tickTime;
|
||||
|
||||
private ["_timeSinceStart","_timeUntilRestart"];
|
||||
while{true} do
|
||||
{
|
||||
_timeSinceStart = diag_tickTime - _timeStart;
|
||||
_timeUntilRestart = _serverDuration - _timeSinceStart;
|
||||
|
||||
switch true do
|
||||
{
|
||||
case ((_timeUntilRestart < (1 * 60)) && !_60secondspassed) :
|
||||
{
|
||||
["lib_restart_60_s"] remoteExecCall ["BIS_fnc_showNotification"];
|
||||
["60 seconds until server restart.", "RESTART"] call KPLIB_fnc_log;
|
||||
_60secondspassed = true;
|
||||
_5minspassed = true;
|
||||
_15minspassed = true;
|
||||
_30minspassed = true;
|
||||
};
|
||||
case ((_timeUntilRestart < (5 * 60)) && !_5minspassed) :
|
||||
{
|
||||
["lib_restart_5_min"] remoteExecCall ["BIS_fnc_showNotification"];
|
||||
["5 minutes until server restart.", "RESTART"] call KPLIB_fnc_log;
|
||||
_5minspassed = true;
|
||||
_15minspassed = true;
|
||||
_30minspassed = true;
|
||||
};
|
||||
case ((_timeUntilRestart < (15 * 60)) && !_15minspassed) :
|
||||
{
|
||||
["lib_restart_15_min"] remoteExecCall ["BIS_fnc_showNotification"];
|
||||
["15 minutes until server restart.", "RESTART"] call KPLIB_fnc_log;
|
||||
_15minspassed = true;
|
||||
_30minspassed = true;
|
||||
};
|
||||
case ((_timeUntilRestart < (30 * 60)) && !_30minspassed) :
|
||||
{
|
||||
["lib_restart_30_min"] remoteExecCall ["BIS_fnc_showNotification"];
|
||||
["30 minutes until server restart.", "RESTART"] call KPLIB_fnc_log;
|
||||
_30minspassed = true;
|
||||
};
|
||||
};
|
||||
|
||||
if(_timeSinceStart > _serverDuration) then
|
||||
{
|
||||
["Restart timeout elapsed, attempting server shutdown.", "RESTART"] call KPLIB_fnc_log;
|
||||
sleep 5;
|
||||
|
||||
private _myPass = call compile preprocessFileLineNumbers "\userconfig\restart\myPass.hpp";
|
||||
private _shutdownSuccess = _myPass serverCommand (["#restart", "#restartserver"] select ((productVersion select 6) isEqualTo "Windows"));
|
||||
|
||||
if(_shutdownSuccess) then
|
||||
{
|
||||
["Shutting down server!", "RESTART"] call KPLIB_fnc_log;
|
||||
}
|
||||
else
|
||||
{
|
||||
["Shutdown failed!", "RESTART"] call KPLIB_fnc_log;
|
||||
};
|
||||
};
|
||||
sleep 15;
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
uiSleep 3;
|
||||
|
||||
private _sector = "";
|
||||
private _saved = [];
|
||||
private _classname = "";
|
||||
private _tower = objNull;
|
||||
|
||||
{
|
||||
_sector = _x;
|
||||
_saved = KPLIB_sectorTowers select {(_x select 0) isEqualTo _sector};
|
||||
if (_saved isEqualTo []) then {
|
||||
_classname = selectRandom KPLIB_radioTowerClassnames;
|
||||
KPLIB_sectorTowers pushBack [_sector, _classname];
|
||||
} else {
|
||||
_classname = (_saved select 0) select 1;
|
||||
};
|
||||
_tower = _classname createVehicle (markerpos _x);
|
||||
_tower setPos (markerpos _x);
|
||||
_tower setVectorUp [0, 0, 1];
|
||||
_tower addEventHandler ["HandleDamage", {0}];
|
||||
} forEach sectors_tower;
|
||||
@@ -0,0 +1,41 @@
|
||||
sync_eco = []; publicVariable "sync_eco";
|
||||
|
||||
waitUntil{!isNil "save_is_loaded"};
|
||||
waitUntil{!isNil "KP_liberation_production"};
|
||||
waitUntil{!isNil "KP_liberation_logistics"};
|
||||
waitUntil{!isNil "KP_liberation_production_markers"};
|
||||
waitUntil {save_is_loaded};
|
||||
|
||||
if (KP_liberation_production_markers isEqualTo []) then {
|
||||
{
|
||||
private _facility = selectRandom [[true,false,false], [false,true,false], [false,false,true]];
|
||||
KP_liberation_production_markers pushBack [_x, _facility select 0, _facility select 1, _facility select 2, markerText _x];
|
||||
} forEach sectors_factory;
|
||||
};
|
||||
|
||||
private _KP_liberation_production_old = [0];
|
||||
private _KP_liberation_logistics_old = [0];
|
||||
|
||||
while {true} do {
|
||||
|
||||
waitUntil {sleep 0.25;
|
||||
!(_KP_liberation_production_old isEqualTo KP_liberation_production)
|
||||
|| !(_KP_liberation_logistics_old isEqualTo KP_liberation_logistics)
|
||||
};
|
||||
{
|
||||
private _sector = _x;
|
||||
{
|
||||
if ((_sector select 1) == (_x select 0)) exitWith {
|
||||
_x set [1, (_sector select 4)];
|
||||
_x set [2, (_sector select 5)];
|
||||
_x set [3, (_sector select 6)];
|
||||
};
|
||||
} forEach KP_liberation_production_markers;
|
||||
} forEach KP_liberation_production;
|
||||
sleep 0.25;
|
||||
sync_eco = [KP_liberation_production,KP_liberation_logistics,KP_liberation_production_markers];
|
||||
publicVariable "sync_eco";
|
||||
|
||||
_KP_liberation_production_old = +KP_liberation_production;
|
||||
_KP_liberation_logistics_old = +KP_liberation_logistics;
|
||||
};
|
||||
@@ -0,0 +1,103 @@
|
||||
sync_vars = []; publicVariable "sync_vars";
|
||||
|
||||
waitUntil{!isNil "save_is_loaded"};
|
||||
waitUntil{!isNil "KP_liberation_fob_resources"};
|
||||
waitUntil{!isNil "KP_liberation_supplies_global"};
|
||||
waitUntil{!isNil "KP_liberation_ammo_global"};
|
||||
waitUntil{!isNil "KP_liberation_fuel_global"};
|
||||
waitUntil{!isNil "combat_readiness"};
|
||||
waitUntil{!isNil "unitcap"};
|
||||
waitUntil{!isNil "KP_liberation_heli_count"};
|
||||
waitUntil{!isNil "KP_liberation_plane_count"};
|
||||
waitUntil{!isNil "KP_liberation_heli_slots"};
|
||||
waitUntil{!isNil "KP_liberation_plane_slots"};
|
||||
waitUntil{!isNil "resources_intel"};
|
||||
waitUntil{!isNil "infantry_cap"};
|
||||
waitUntil{!isNil "KP_liberation_civ_rep"};
|
||||
waitUntil{!isNil "KP_liberation_guerilla_strength"};
|
||||
waitUntil{!isNil "infantry_weight"};
|
||||
waitUntil{!isNil "armor_weight"};
|
||||
waitUntil{!isNil "air_weight"};
|
||||
waitUntil {save_is_loaded};
|
||||
|
||||
private _KP_liberation_fob_resources_old = [];
|
||||
private _KP_liberation_supplies_global_old = -1;
|
||||
private _KP_liberation_ammo_global_old = -1;
|
||||
private _KP_liberation_fuel_global_old = -1;
|
||||
private _unitcap_old = -1;
|
||||
private _KP_liberation_heli_count_old = -1;
|
||||
private _KP_liberation_plane_count_old = -1;
|
||||
private _KP_liberation_heli_slots_old = -1;
|
||||
private _KP_liberation_plane_slots_old = -1;
|
||||
private _combat_readiness_old = -1;
|
||||
private _resources_intel_old = -999;
|
||||
private _infantry_cap_old = -999;
|
||||
private _KP_liberation_civ_rep_old = -999;
|
||||
private _KP_liberation_guerilla_strength_old = -999;
|
||||
private _infantry_weight_old = -1;
|
||||
private _armor_weight_old = -1;
|
||||
private _air_weight_old = -1;
|
||||
|
||||
while {true} do {
|
||||
waitUntil {sleep 0.25;
|
||||
!(_KP_liberation_fob_resources_old isEqualTo KP_liberation_fob_resources)
|
||||
|| _KP_liberation_supplies_global_old != KP_liberation_supplies_global
|
||||
|| _KP_liberation_ammo_global_old != KP_liberation_ammo_global
|
||||
|| _KP_liberation_fuel_global_old != KP_liberation_fuel_global
|
||||
|| _unitcap_old != unitcap
|
||||
|| _KP_liberation_heli_count_old != KP_liberation_heli_count
|
||||
|| _KP_liberation_plane_count_old != KP_liberation_plane_count
|
||||
|| _KP_liberation_heli_slots_old != KP_liberation_heli_slots
|
||||
|| _KP_liberation_plane_slots_old != KP_liberation_plane_slots
|
||||
|| _combat_readiness_old != combat_readiness
|
||||
|| _resources_intel_old != resources_intel
|
||||
|| _infantry_cap_old != infantry_cap
|
||||
|| _KP_liberation_civ_rep_old != KP_liberation_civ_rep
|
||||
|| _KP_liberation_guerilla_strength_old != KP_liberation_guerilla_strength
|
||||
|| _infantry_weight_old != infantry_weight
|
||||
|| _armor_weight_old != armor_weight
|
||||
|| _air_weight_old != air_weight
|
||||
};
|
||||
|
||||
if (KP_liberation_guerilla_strength < 0) then {KP_liberation_guerilla_strength = 0;};
|
||||
|
||||
sleep 0.25;
|
||||
sync_vars = [
|
||||
KP_liberation_fob_resources,
|
||||
KP_liberation_supplies_global,
|
||||
KP_liberation_ammo_global,
|
||||
KP_liberation_fuel_global,
|
||||
unitcap,
|
||||
KP_liberation_heli_count,
|
||||
KP_liberation_plane_count,
|
||||
KP_liberation_heli_slots,
|
||||
KP_liberation_plane_slots,
|
||||
combat_readiness,
|
||||
resources_intel,
|
||||
infantry_cap,
|
||||
KP_liberation_civ_rep,
|
||||
KP_liberation_guerilla_strength,
|
||||
infantry_weight,
|
||||
armor_weight,
|
||||
air_weight
|
||||
];
|
||||
publicVariable "sync_vars";
|
||||
|
||||
_KP_liberation_fob_resources_old = +KP_liberation_fob_resources;
|
||||
_KP_liberation_supplies_global_old = KP_liberation_supplies_global;
|
||||
_KP_liberation_ammo_global_old = KP_liberation_ammo_global;
|
||||
_KP_liberation_fuel_global_old = KP_liberation_fuel_global;
|
||||
_unitcap_old = unitcap;
|
||||
_KP_liberation_heli_count_old = KP_liberation_heli_count;
|
||||
_KP_liberation_plane_count_old = KP_liberation_plane_count;
|
||||
_KP_liberation_heli_slots_old = KP_liberation_heli_slots;
|
||||
_KP_liberation_plane_slots_old = KP_liberation_plane_slots;
|
||||
_combat_readiness_old = combat_readiness;
|
||||
_resources_intel_old = resources_intel;
|
||||
_infantry_cap_old = infantry_cap;
|
||||
_KP_liberation_civ_rep_old = KP_liberation_civ_rep;
|
||||
_KP_liberation_guerilla_strength_old = KP_liberation_guerilla_strength;
|
||||
_infantry_weight_old = infantry_weight;
|
||||
_armor_weight_old = armor_weight;
|
||||
_air_weight_old = air_weight;
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
waitUntil {!isNil "huron_typename"};
|
||||
|
||||
// Classnames of objects which should be added as editable for Zeus
|
||||
private _vehicleClassnames = [toLower huron_typename];
|
||||
{
|
||||
_vehicleClassnames append _x;
|
||||
} forEach [
|
||||
KPLIB_crates,
|
||||
KPLIB_b_light_classes,
|
||||
KPLIB_b_heavy_classes,
|
||||
KPLIB_b_air_classes,
|
||||
KPLIB_b_static_classes,
|
||||
KPLIB_b_support_classes
|
||||
];
|
||||
if (KP_liberation_enemies_zeus) then {_vehicleClassnames append KPLIB_o_allVeh_classes;};
|
||||
|
||||
private _valids = [];
|
||||
private _toRemove = [];
|
||||
private _toAdd = [];
|
||||
|
||||
while {true} do {
|
||||
waitUntil {sleep 1; !(allCurators isEqualTo [])};
|
||||
|
||||
// Add units
|
||||
_valids = allUnits select {
|
||||
(alive _x) // Alive
|
||||
&& {
|
||||
(KP_liberation_enemies_zeus && {!(side (group _x) isEqualTo GRLIB_side_civilian)}) // Not civilian side, if enemy adding is enabled
|
||||
|| {side (group _x) isEqualTo GRLIB_side_friendly} // Player side if enemy adding is disabled
|
||||
}
|
||||
&& {((str _x) find "BIS_SUPP_HQ_") isEqualTo -1} // Not a HQ entity from support module
|
||||
};
|
||||
|
||||
// Add vehicles
|
||||
_valids append (vehicles select {
|
||||
(alive _x) // Alive
|
||||
&& {
|
||||
((toLower (typeOf _x)) in _vehicleClassnames) // In valid classnames
|
||||
|| (_x getVariable ["KPLIB_captured", false]) // or captured
|
||||
|| (_x getVariable ["KPLIB_seized", false]) // or seized
|
||||
}
|
||||
&& {isNull (attachedTo _x)} // Not attached to something
|
||||
});
|
||||
|
||||
// Add playable units
|
||||
_valids append switchableUnits;
|
||||
_valids append playableUnits;
|
||||
|
||||
{
|
||||
// Remove death or attached units
|
||||
_toRemove = ((curatorEditableObjects _x) select {!(alive _x) || !(isNull (attachedTo _x))});
|
||||
|
||||
// Filter already added units of this curator
|
||||
_toAdd = _valids - (curatorEditableObjects _x);
|
||||
|
||||
// Add and remove units
|
||||
_x addCuratorEditableObjects [_toAdd, true];
|
||||
_x removeCuratorEditableObjects [_toRemove, true];
|
||||
} forEach allCurators;
|
||||
sleep 9;
|
||||
};
|
||||
Reference in New Issue
Block a user