initial files

This commit is contained in:
Samuele Lorefice
2025-05-24 16:17:33 +02:00
commit 9e023649ac
477 changed files with 118566 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
class client_tutorial {
file = "scripts\client\tutorial";
class handleCrateStorageTask {};
class handleHealCivTask {};
class handleTakePowTask {};
class tutorial {ext = ".fsm";};
};

View File

@@ -0,0 +1,103 @@
// TODO Split this in an added action to the vehicles and add the dorecycle == 1 part in a button action
params ["_vehToRecycle"];
if (_vehToRecycle getVariable ["KP_liberation_preplaced", false]) exitWith {hint localize "STR_PREPLACED_ERROR";};
dorecycle = 0;
private _type = typeOf _vehToRecycle;
private _cfg = configFile >> "cfgVehicles";
private _suppMulti = 0.5;
private _ammoMulti = 0.5;
private _fuelMulti = 0.5;
if !(
((toLower _type) in KPLIB_b_buildings_classes) ||
((toLower _type) in KPLIB_storageBuildings) ||
((toLower _type) in KPLIB_upgradeBuildings) ||
(_type in KP_liberation_ace_crates) ||
(_type == "B_Slingload_01_Repair_F") ||
(_type == "B_Slingload_01_Fuel_F") ||
(_type == "B_Slingload_01_Ammo_F")
) then {
private _currentAmmo = 0;
private _allAmmo = 0;
if (count (magazinesAmmo _vehToRecycle) > 0) then {
{
_currentAmmo = _currentAmmo + (_x select 1);
_allAmmo = _allAmmo + (getNumber(configFile >> "CfgMagazines" >> (_x select 0) >> "count"));
} forEach (magazinesAmmo _vehToRecycle);
} else {
_allAmmo = 1;
};
_suppMulti = (((_vehToRecycle getHitPointDamage "HitEngine") - 1) * -1) * (((_vehToRecycle getHitPointDamage "HitHull") - 1) * -1);
_ammoMulti = _currentAmmo/_allAmmo;
_fuelMulti = fuel _vehToRecycle;
if (_type in boats_names) then {
_suppMulti = (((_vehToRecycle getHitPointDamage "HitEngine") - 1) * -1);
};
};
private _price_s = 0;
private _price_a = 0;
private _price_f = 0;
if ((toLower _type) in KPLIB_o_allVeh_classes) then {
if (_vehToRecycle isKindOf "Car") then {
_price_s = round (60 * _suppMulti);
_price_a = round (25 * _ammoMulti);
_price_f = round (40 * _fuelMulti);
};
if (_vehToRecycle isKindOf "Tank") then {
_price_s = round (150 * _suppMulti);
_price_a = round (120 * _ammoMulti);
_price_f = round (100 * _fuelMulti);
};
if (_vehToRecycle isKindOf "Air") then {
_price_s = round (250 * _suppMulti);
_price_a = round (200 * _ammoMulti);
_price_f = round (150 * _fuelMulti);
};
} else {
private _objectinfo = ((light_vehicles + heavy_vehicles + air_vehicles + static_vehicles + support_vehicles + buildings) select {_type == (_x select 0)}) select 0;
_price_s = round ((_objectinfo select 1) * GRLIB_recycling_percentage * _suppMulti);
_price_a = round ((_objectinfo select 2) * GRLIB_recycling_percentage * _ammoMulti);
_price_f = round ((_objectinfo select 3) * GRLIB_recycling_percentage * _fuelMulti);
};
createDialog "liberation_recycle";
waitUntil {sleep 0.1; dialog};
ctrlSetText [134, format [localize "STR_RECYCLING_YIELD", getText (_cfg >> _type >> "displayName")]];
ctrlSetText [131, format ["%1", _price_s]];
ctrlSetText [132, format ["%1", _price_a]];
ctrlSetText [133, format ["%1", _price_f]];
waitUntil {sleep 0.1; !dialog || !alive player || dorecycle != 0};
if (dialog) then {closeDialog 0};
if (dorecycle == 1 && !(isnull _vehToRecycle) && alive _vehToRecycle) then {
if (!(KP_liberation_recycle_building_near) && ((_price_s + _price_a + _price_f) > 0)) exitWith {hint localize "STR_NORECBUILDING_ERROR";};
private _storage_areas = (([] call KPLIB_fnc_getNearestFob) nearobjects (GRLIB_fob_range * 1.2)) select {(_x getVariable ["KP_liberation_storage_type",-1]) == 0};
private _crateSum = (ceil (_price_s / 100)) + (ceil (_price_a / 100)) + (ceil (_price_f / 100));
private _spaceSum = 0;
{
if (typeOf _x == KP_liberation_large_storage_building) then {
_spaceSum = _spaceSum + (count KP_liberation_large_storage_positions) - (count (attachedObjects _x));
};
if (typeOf _x == KP_liberation_small_storage_building) then {
_spaceSum = _spaceSum + (count KP_liberation_small_storage_positions) - (count (attachedObjects _x));
};
} forEach _storage_areas;
if (_spaceSum < _crateSum) then {
hint localize "STR_CANCEL_ERROR";
} else {
[_vehToRecycle, _price_s, _price_a, _price_f, _storage_areas] remoteExec ["recycle_remote_call",2];
};
};

View File

@@ -0,0 +1,40 @@
dorepackage = 0;
createDialog "liberation_repackage_fob";
waitUntil {sleep 0.1; dialog};
waitUntil {sleep 0.1; !dialog || !alive player || dorepackage != 0};
if (dorepackage > 0) then {
closeDialog 0;
waitUntil {sleep 0.1; !dialog};
private _fob = [] call KPLIB_fnc_getNearestFob;
if !(_fob isEqualTo []) then {
GRLIB_all_fobs = GRLIB_all_fobs - [_fob];
KP_liberation_clearances deleteAt (KP_liberation_clearances findIf {(_x select 0) isEqualTo _fob});
publicVariable "GRLIB_all_fobs";
publicVariable "KP_liberation_clearances";
};
{deleteVehicle _x} forEach (((getPos player) nearobjects [FOB_typename, 250]) select {getObjectType _x >= 8});
sleep 0.5;
private _spawnpos = zeropos;
while {_spawnpos distance2d zeropos < 1000} do {
_spawnpos = (getPos player) findEmptyPosition [10, 250, 'B_Heli_Transport_01_F'];
if (_spawnpos isEqualTo []) then {_spawnpos = zeropos;};
};
if (dorepackage == 1) then {
private _fobbox = FOB_box_typename createVehicle _spawnpos;
[_fobbox] call KPLIB_fnc_addObjectInit;
};
if (dorepackage == 2) then {
private _fobTruck = FOB_truck_typename createVehicle _spawnpos;
[_fobTruck] call KPLIB_fnc_addObjectInit;
};
hint localize "STR_FOB_REPACKAGE_HINT";
};

View File

@@ -0,0 +1,6 @@
params [ "_veh" ];
if ( !isNull _veh ) then {
_veh setpos [(getpos _veh) select 0,(getpos _veh) select 1, 0.5];
_veh setVectorUp surfaceNormal position _veh;
};

View File

@@ -0,0 +1,53 @@
// TODO Remove this loop by adding the actions to the units/intel objects on spawn
waitUntil {!isNil "GRLIB_permissions"};
waitUntil {!(GRLIB_permissions isEqualTo []) || !GRLIB_permissions_param};
private _near_people = [];
private _near_intel = [];
private _actionned_captive_units = [];
private _actionned_intel_items = [];
while {true} do {
if ([5] call KPLIB_fnc_hasPermission) then {
_near_people = (getPosATL player) nearEntities [["Man"], 5];
_near_intel = (getPosATL player) nearEntities [KPLIB_intelObjectClasses, 5];
{
if ((captive _x) && !(_x in _actionned_captive_units) && !((side group _x) == GRLIB_side_friendly) && !(_x getVariable ["ACE_isUnconscious", false])) then {
_x addAction ["<t color='#FFFF00'>" + localize "STR_SECONDARY_CAPTURE" + "</t>",{[_this select 0] join (group player);},"",-850,true,true,"","(vehicle player == player) && (side group _target != GRLIB_side_friendly) && (captive _target)"];
_actionned_captive_units pushback _x;
};
} forEach _near_people;
{
if (!(alive _x) || ((player distance _x) > 5) || ((side group _x) == GRLIB_side_friendly)) then {
removeAllActions _x;
_actionned_captive_units = _actionned_captive_units - [_x];
};
} forEach _actionned_captive_units;
{
if !(_x in _actionned_intel_items) then {
_x addAction ["<t color='#FFFF00'>" + localize "STR_INTEL" + "</t>",{[_this select 0] remoteExecCall ["intel_remote_call", 2];},"",-849,true,true,"","(vehicle player == player)"];
_actionned_intel_items pushback _x;
};
} forEach _near_intel;
{
if ((player distance _x) > 5) then {
removeAllActions _x;
_actionned_intel_items = _actionned_intel_items - [_x];
};
} forEach _actionned_intel_items;
} else {
{
removeAllActions _x;
_actionned_captive_units = _actionned_captive_units - [_x];
} forEach _actionned_captive_units;
{
removeAllActions _x;
_actionned_intel_items = _actionned_intel_items - [_x];
} forEach _actionned_intel_items;
};
sleep 3;
};

View File

@@ -0,0 +1,138 @@
if (KPLIB_directArsenal) exitWith {
if (KP_liberation_ace && KP_liberation_arsenal_type) then {
[player, player, false] call ace_arsenal_fnc_openBox;
} else {
["Open", false] spawn BIS_fnc_arsenal;
};
};
load_loadout = 0;
edit_loadout = 0;
respawn_loadout = 0;
load_from_player = -1;
exit_on_load = 0;
createDialog "liberation_arsenal";
private _backpack = backpack player;
private ["_loadouts_data"];
// Get loadouts either from ACE or BI arsenals
if (KP_liberation_ace && KP_liberation_arsenal_type) then {
_loadouts_data = +(profileNamespace getVariable ["ace_arsenal_saved_loadouts", []]);
} else {
private _saved_loadouts = +(profileNamespace getVariable "bis_fnc_saveInventory_data");
_loadouts_data = [];
private _counter = 0;
if (!isNil "_saved_loadouts") then {
{
if (_counter % 2 == 0) then {
_loadouts_data pushback _x;
};
_counter = _counter + 1;
} forEach _saved_loadouts;
};
};
waitUntil { dialog };
if ( count _loadouts_data > 0 ) then {
{ lbAdd [201, _x param [0]]} foreach _loadouts_data;
if ( lbSize 201 > 0 ) then {
ctrlEnable [ 202, true ];
lbSetCurSel [ 201, 0 ];
} else {
ctrlEnable [ 202, false ];
};
} else {
ctrlEnable [ 202, false ];
};
private _loadplayers = [];
{
if ( !(name _x in [ "HC1", "HC2", "HC3" ]) ) then {
_loadplayers pushback [ name _x, _x ];
};
} foreach ( allPlayers - [ player ] );
if ( count _loadplayers > 0 ) then {
{
private _nextplayer = _x select 1;
private _namestr = "";
if(count (squadParams _nextplayer) != 0) then {
_namestr = "[" + ((squadParams _nextplayer select 0) select 0) + "] ";
};
_namestr = _namestr + name _nextplayer;
lbAdd [ 203, _namestr ];
lbSetCurSel [ 203, 0 ];
} foreach _loadplayers;
} else {
ctrlEnable [ 203, false ];
ctrlEnable [ 204, false ];
};
((findDisplay 5251) displayCtrl 201) ctrlAddEventHandler [ "mouseButtonDblClick" , { exit_on_load = 1; load_loadout = 1; } ];
while { dialog && (alive player) && edit_loadout == 0 } do {
if ( load_loadout > 0 ) then {
private _loaded_loadout = _loadouts_data select (lbCurSel 201);
if (KP_liberation_ace && KP_liberation_arsenal_type) then {
player setUnitLoadout (_loaded_loadout select 1);
} else {
[player, [profileNamespace, _loaded_loadout]] call BIS_fnc_loadInventory;
};
if (KP_liberation_arsenalUsePreset) then {
if ([_backpack] call KPLIB_fnc_checkGear) then {
hint format [ localize "STR_HINT_LOADOUT_LOADED", _loaded_loadout param [0]];
};
} else {
hint format [ localize "STR_HINT_LOADOUT_LOADED", _loaded_loadout param [0]];
};
if ( exit_on_load == 1 ) then {
closeDialog 0;
};
load_loadout = 0;
};
if ( respawn_loadout > 0 ) then {
GRLIB_respawn_loadout = [ player, ["repetitive"] ] call KPLIB_fnc_getLoadout;
hint localize "STR_MAKE_RESPAWN_LOADOUT_HINT";
respawn_loadout = 0;
};
if ( load_from_player >= 0 ) then {
private _playerselected = ( _loadplayers select load_from_player ) select 1;
if ( alive _playerselected ) then {
[player, [_playerselected, ["repetitive"]] call KPLIB_fnc_getLoadout] call KPLIB_fnc_setLoadout;
hint format [ localize "STR_LOAD_PLAYER_LOADOUT_HINT", name _playerselected ];
};
load_from_player = -1;
};
sleep 0.1;
};
if ( edit_loadout > 0 ) then {
closeDialog 0;
waitUntil { !dialog };
if (KP_liberation_ace && KP_liberation_arsenal_type) then {
[player, player, false] call ace_arsenal_fnc_openBox;
} else {
[ "Open", false ] spawn BIS_fnc_arsenal;
};
if (KP_liberation_arsenalUsePreset) then {
uiSleep 5;
private _arsenalDisplay = ["RSCDisplayArsenal", "ace_arsenal_display"] select (KP_liberation_ace && KP_liberation_arsenal_type);
waitUntil {sleep 1; isNull (uinamespace getvariable [_arsenalDisplay, displayNull])};
[_backpack] call KPLIB_fnc_checkGear;
};
};

View File

@@ -0,0 +1,72 @@
private _recycleable_vehicles = [];
private _recycleable_classnames = [];
veh_action_detect_distance = 20;
veh_action_distance = 10;
{
_recycleable_classnames append _x;
} forEach [
KPLIB_b_light_classes,
KPLIB_b_heavy_classes,
KPLIB_b_air_classes,
KPLIB_b_static_classes,
KPLIB_b_support_classes,
KPLIB_o_allVeh_classes
];
while {true} do {
waitUntil {sleep 2; player getVariable ['KPLIB_fobDist', 99999] < GRLIB_fob_range};
if ([4] call KPLIB_fnc_hasPermission) then {
private _detected_vehicles = (getPos player) nearObjects veh_action_detect_distance select {
(((toLower (typeof _x)) in _recycleable_classnames && (({alive _x} count (crew _x)) == 0 || unitIsUAV _x) && (locked _x == 0 || locked _x == 1)) ||
(toLower (typeOf _x)) in KPLIB_b_buildings_classes ||
(((toLower (typeOf _x)) in KPLIB_storageBuildings) && ((_x getVariable ["KP_liberation_storage_type",-1]) == 0)) ||
(toLower (typeOf _x)) in KPLIB_upgradeBuildings ||
(typeOf _x) in KP_liberation_ace_crates) &&
alive _x &&
(
// ignore null objects left by Advanced Towing
// see https://github.com/sethduda/AdvancedTowing/pull/46
(((attachedObjects _x) select {!isNull _X}) isEqualTo [])
|| ((typeOf _x) == "rhsusf_mkvsoc")
) &&
_x distance2d startbase > 1000 &&
(_x distance2d ([] call KPLIB_fnc_getNearestFob)) < GRLIB_fob_range &&
(getObjectType _x) >= 8
};
{
private _next_vehicle = _x;
private _next_vehicle_already_in_list = false;
{
if ((_x select 0) == _next_vehicle) exitWith {_next_vehicle_already_in_list = true;};
} forEach _recycleable_vehicles;
if (!_next_vehicle_already_in_list) then {
private _idact_next = _next_vehicle addAction ["<t color='#FFFF00'>" + localize "STR_RECYCLE" + "</t> <img size='2' image='res\ui_recycle.paa'/>", "scripts\client\actions\do_recycle.sqf", "", -900, true, true, "", "build_confirmed == 0 && ((_this distance2D _target) < veh_action_distance) && (vehicle player == player)"];
_recycleable_vehicles pushback [_next_vehicle, _idact_next] ;
};
} forEach _detected_vehicles;
{
private _next_vehicle = _x;
private _next_vehicle_already_in_list = false;
{
if (_x == (_next_vehicle select 0)) exitWith {_next_vehicle_already_in_list = true;};
} forEach _detected_vehicles;
if (!_next_vehicle_already_in_list) then {
(_next_vehicle select 0) removeAction (_next_vehicle select 1);
_recycleable_vehicles = _recycleable_vehicles - [_next_vehicle];
};
} forEach _recycleable_vehicles;
} else {
{
(_x select 0) removeAction (_x select 1);
_recycleable_vehicles = _recycleable_vehicles - [_x];
} forEach _recycleable_vehicles;
};
sleep 3;
};

View File

@@ -0,0 +1,58 @@
waitUntil {!isNil "GRLIB_permissions"};
waitUntil {!(GRLIB_permissions isEqualTo []) || !GRLIB_permissions_param};
private [ "_unflippable_vehicles", "_detected_vehicles", "_next_vehicle", "_next_vehicle_already_in_list", "_idact_next" ];
_unflippable_vehicles = [];
veh_action_distance = 10;
while { true } do {
if ([5] call KPLIB_fnc_hasPermission) then {
_detected_vehicles = ((getpos player) nearEntities [["Tank","APC","IFV","Car"], veh_action_distance]) select {
(count crew _x) == 0 &&
((locked _x == 0 || locked _x == 1)) &&
(_x distance startbase > 1000)
};
{
_next_vehicle = _x;
_next_vehicle_already_in_list = false;
{
if ( (_x select 0) == _next_vehicle ) then {
_next_vehicle_already_in_list = true;
};
} foreach _unflippable_vehicles;
if ( !_next_vehicle_already_in_list ) then {
_idact_next = _next_vehicle addAction [ "<t color='#FFFF00'>" + localize "STR_UNFLIP" + "</t> <img size='2' image='res\ui_flipveh.paa'/>", "scripts\client\actions\do_unflip.sqf", "", -950, true, true, "", "build_confirmed == 0 && (_this distance _target < veh_action_distance) && (vehicle player == player)"];
_unflippable_vehicles pushback [ _next_vehicle, _idact_next ] ;
};
} foreach _detected_vehicles;
{
_next_vehicle = _x;
_next_vehicle_already_in_list = false;
{
if ( _x == (_next_vehicle select 0) ) then {
_next_vehicle_already_in_list = true;
};
} foreach _detected_vehicles;
if ( !_next_vehicle_already_in_list ) then {
(_next_vehicle select 0) removeAction (_next_vehicle select 1);
_unflippable_vehicles = _unflippable_vehicles - [ _next_vehicle ];
};
} foreach _unflippable_vehicles;
} else {
{
(_x select 0) removeAction (_x select 1);
_unflippable_vehicles = _unflippable_vehicles - [ _x ];
} foreach _unflippable_vehicles;
};
sleep 3;
};

View File

@@ -0,0 +1,127 @@
waitUntil {!isNil "build_confirmed"};
waitUntil {!isNil "one_synchro_done"};
waitUntil {!isNil "one_eco_done"};
waitUntil {one_synchro_done};
waitUntil {one_eco_done};
private ["_managed_trucks", "_managed_boxes", "_managed_areas", "_next_truck", "_next_box", "_truck_load", "_checked_trucks", "_checked_boxes", "_action_id","_action_id2","_action_id3","_action_id4","_b_action_id1","_b_action_id2","_b_action_id3","_b_action_id4"];
_managed_trucks = [];
_managed_boxes = [];
_managed_areas = [];
while {true} do {
if ([5] call KPLIB_fnc_hasPermission) then {
_nearammoboxes = ((getpos player) nearEntities [KPLIB_crates, 10]);
_neartransporttrucks = ((getpos player) nearEntities [KPLIB_transport_classes, 10]);
_nearstorageareas = nearestObjects [player, KPLIB_storageBuildings, 10];
_checked_trucks = [];
{
_next_truck = _x;
_truck_load = _next_truck getVariable ["GRLIB_ammo_truck_load", 0];
if (!(_next_truck in _managed_trucks) && (_truck_load > 0)) then {
_action_id = _next_truck addAction ["<t color='#FFFF00'>" + localize "STR_ACTION_UNLOAD_BOX" + "</t>","scripts\client\ammoboxes\do_unload_truck.sqf","",-500,true,true,"","build_confirmed == 0 && (_this distance _target < 8) && (vehicle player == player)"];
_next_truck setVariable [ "GRLIB_ammo_truck_action", _action_id, false ];
_managed_trucks pushback _next_truck;
};
if ((_next_truck in _managed_trucks) && _truck_load == 0) then {
_next_truck removeAction (_next_truck getVariable ["GRLIB_ammo_truck_action", -1]);
_managed_trucks = _managed_trucks - [_next_truck];
};
_checked_trucks pushback _next_truck;
} foreach _neartransporttrucks;
{
_next_truck = _x;
if (!(_next_truck in _checked_trucks)) then {
_managed_trucks = _managed_trucks - [_next_truck];
_next_truck removeAction ( _next_truck getVariable ["GRLIB_ammo_truck_action", -1]);
}
} foreach _managed_trucks;
_checked_boxes = [];
{
_next_box = _x;
if (!(_next_box in _managed_boxes) && ( isNull attachedTo _next_box )) then {
_b_action_id1 = _next_box addAction ["<t color='#FFFF00'>" + localize "STR_ACTION_LOAD_BOX" + "</t>",{[_this select 0] call do_load_box;},"",-501,true,true,"","build_confirmed == 0 && (_this distance _target < 5) && (vehicle player == player)"];
_b_action_id2 = _next_box addAction ["<t color='#FFFF00'>" + localize "STR_ACTION_STORE_CRATE" + "</t>",{[(_this select 0), (nearestObjects [player,KPLIB_storageBuildings,20]) select 0,true] call KPLIB_fnc_crateToStorage;},"",-502,true,true,"","build_confirmed == 0 && (_this distance _target < 5) && (vehicle player == player)"];
_b_action_id3 = _next_box addAction ["<t color='#FFFF00'>" + localize "STR_ACTION_CRATE_VALUE" + "</t>",{[_this select 0] call KPLIB_fnc_checkCrateValue;uiSleep 3; hint "";},"",-503,true,true,"","build_confirmed == 0 && (_this distance _target < 5) && (vehicle player == player)"];
_b_action_id4 = _next_box addAction ["<t color='#FFFF00'>" + localize "STR_ACTION_CRATE_PUSH" + "</t>",{(_this select 0) setPos ((_this select 0) getPos [1, (player getDir (_this select 0))]);},"",-504,true,false,"","build_confirmed == 0 && (_this distance _target < 5) && (vehicle player == player)"];
_next_box setVariable ["GRLIB_ammo_box_action", _b_action_id1, false];
_next_box setVariable ["KP_crate_store_action", _b_action_id2, false];
_next_box setVariable ["KP_crate_value_action", _b_action_id3, false];
_next_box setVariable ["KP_crate_push_action", _b_action_id4, false];
_managed_boxes pushback _next_box;
};
_checked_boxes pushback _next_box;
} foreach _nearammoboxes;
{
_next_box = _x;
if (!(_next_box in _managed_boxes) || !( isNull attachedTo _next_box )) then {
_managed_boxes = _managed_boxes - [_next_box];
_next_box removeAction (_next_box getVariable ["GRLIB_ammo_box_action", -1]);
_next_box removeAction (_next_box getVariable ["KP_crate_store_action", -1]);
_next_box removeAction (_next_box getVariable ["KP_crate_value_action", -1]);
_next_box removeAction (_next_box getVariable ["KP_crate_push_action", -1]);
}
} foreach _managed_boxes;
_checked_areas = [];
{
_next_area = _x;
_area_load = count (attachedObjects _x);
if (!(_next_area in _managed_areas) && (_area_load > 0)) then {
_action_id = _next_area addAction ["<t color='#FFFF00'>" + localize "STR_ACTION_UNSTORE_SUPPLY" + "</t>",{[KP_liberation_supply_crate, (_this select 0), true] call KPLIB_fnc_crateFromStorage;},"",-504,true,true,"","build_confirmed == 0 && (_this distance _target < 12) && (vehicle player == player)"];
_next_area setVariable ["KP_supply_unstore_action", _action_id, false];
_action_id2 = _next_area addAction ["<t color='#FFFF00'>" + localize "STR_ACTION_UNSTORE_AMMO" + "</t>",{[KP_liberation_ammo_crate, (_this select 0), true] call KPLIB_fnc_crateFromStorage;},"",-505,true,true,"","build_confirmed == 0 && (_this distance _target < 12) && (vehicle player == player)"];
_next_area setVariable ["KP_ammo_unstore_action", _action_id2, false];
_action_id3 = _next_area addAction ["<t color='#FFFF00'>" + localize "STR_ACTION_UNSTORE_FUEL" + "</t>",{[KP_liberation_fuel_crate, (_this select 0), true] call KPLIB_fnc_crateFromStorage;},"",-506,true,true,"","build_confirmed == 0 && (_this distance _target < 12) && (vehicle player == player)"];
_next_area setVariable ["KP_fuel_unstore_action", _action_id3, false];
_action_id4 = _next_area addAction ["<t color='#FFFF00'>" + localize "STR_ACTION_SORT_STORAGE" + "</t>",{[(_this select 0)] call KPLIB_fnc_sortStorage;},"",-507,true,true,"","build_confirmed == 0 && (_this distance _target < 12) && (vehicle player == player)"];
_next_area setVariable ["KP_storage_sort_action", _action_id4, false];
_managed_areas pushback _next_area;
};
if ((_next_area in _managed_areas) && _area_load == 0) then {
_next_area removeAction (_next_area getVariable ["KP_supply_unstore_action", -1]);
_next_area removeAction (_next_area getVariable ["KP_ammo_unstore_action", -1]);
_next_area removeAction (_next_area getVariable ["KP_fuel_unstore_action", -1]);
_next_area removeAction (_next_area getVariable ["KP_storage_sort_action", -1]);
_managed_areas = _managed_areas - [_next_area];
};
_checked_areas pushback _next_area;
} foreach _nearstorageareas;
{
_next_area = _x;
if (!(_next_area in _checked_areas)) then {
_managed_areas = _managed_areas - [_next_area];
_next_area removeAction (_next_area getVariable ["KP_supply_unstore_action", -1]);
_next_area removeAction (_next_area getVariable ["KP_ammo_unstore_action", -1]);
_next_area removeAction (_next_area getVariable ["KP_fuel_unstore_action", -1]);
_next_area removeAction (_next_area getVariable ["KP_storage_sort_action", -1]);
}
} foreach _managed_areas;
};
sleep 3;
};

View File

@@ -0,0 +1,38 @@
params [ "_ammobox", ["_max_transport_distance", 15] ];
private [ "_neartransporttrucks", "_truck_to_load", "_truck_load", "_next_truck", "_maxload", "_i" ];
_maxload = 3;
_neartransporttrucks = ((getpos _ammobox) nearEntities [KPLIB_transport_classes, _max_transport_distance]) select {alive _x && speed _x < 5 && ((getpos _x) select 2) < 5};
_truck_to_load = objNull;
{
_next_truck = _x;
_maxload = 0;
_offsets = [];
{
if ( _x select 0 == typeof _next_truck ) then {
_maxload = (count _x) - 2;
for [ {_i=2}, {_i < (count _x) }, {_i=_i+1} ] do { _offsets pushback (_x select _i); };
};
} foreach KPLIB_transportConfigs;
if ( isNull _truck_to_load ) then {
_truck_load = _next_truck getVariable ["GRLIB_ammo_truck_load", 0];
if ( _truck_load < _maxload ) then {
_truck_to_load = _next_truck;
_ammobox attachTo [ _truck_to_load, _offsets select _truck_load ];
[_ammobox, false] remoteExec ["enableRopeAttach"];
_truck_to_load setVariable ["GRLIB_ammo_truck_load", _truck_load + 1, true];
if ( !isDedicated ) then {
hint localize "STR_BOX_LOADED";
};
}
};
} foreach _neartransporttrucks;
if ( isNull _truck_to_load && !isDedicated ) then {
hint localize "STR_BOX_CANTLOAD";
uiSleep 2;
hint "";
};

View File

@@ -0,0 +1,36 @@
params [ "_truck_to_unload"];
private [ "_next_box", "_next_pos", "_offset" ];
_offset = 0;
{
if ( _x select 0 == typeof _truck_to_unload ) then { _offset = _x select 1; };
} foreach KPLIB_transportConfigs;
if ( _truck_to_unload getVariable ["GRLIB_ammo_truck_load", 0] > 0 ) then {
_truck_to_unload setVariable ["GRLIB_ammo_truck_load", 0, true];
[_truck_to_unload, false] remoteExec ["KPLIB_fnc_protectObject"];
{
_next_box = _x;
[_next_box, false] remoteExec ["KPLIB_fnc_protectObject"];
sleep 0.5;
detach _next_box;
_next_box setpos (_truck_to_unload getpos [_offset, getdir _truck_to_unload]);
_next_box setdir (getdir _truck_to_unload);
_next_box setVelocity [0,0,0];
_next_box setDamage 0;
_offset = _offset - 2.2;
sleep 0.5;
[_next_box] remoteExec ["KPLIB_fnc_protectObject"];
[_next_box, true] remoteExec ["enableRopeAttach"];
} foreach ( attachedObjects _truck_to_unload);
sleep 0.5;
[_truck_to_unload] remoteExec ["KPLIB_fnc_protectObject"];
hint localize "STR_BOX_UNLOADED";
uiSleep 2;
hint "";
};

View File

@@ -0,0 +1,24 @@
if (isDedicated) exitWith {};
params ["_notif_id", ["_pos", getpos player]];
if (KP_liberation_asymmetric_debug > 0) then {[format ["asymm_notifications called on: %1 - Parameters: [%2, %3] ", debug_source, _notif_id, _pos], "ASYMMETRIC"] remoteExecCall ["KPLIB_fnc_log", 2];};
switch (_notif_id) do {
case 0: {
["lib_asymm_convoy_ambush", [markertext ([10000, _pos] call KPLIB_fnc_getNearestSector)]] call BIS_fnc_showNotification;
private _ambush_marker = createMarkerLocal ["asymm_ambushmarker", _pos];
_ambush_marker setMarkerDirLocal (random 360);
_ambush_marker setMarkerColorLocal "ColorIndependent";
_ambush_marker setMarkerTypeLocal "hd_ambush";
};
case 1: {
["lib_asymm_convoy_ambush_success"] call BIS_fnc_showNotification;
deleteMarkerLocal "asymm_ambushmarker";
};
case 2: {
["lib_asymm_convoy_ambush_fail"] call BIS_fnc_showNotification;
deleteMarkerLocal "asymm_ambushmarker";
};
default {[format ["asymm_notifications.sqf -> no valid value for _notif_id: %1", _notif_id], "ERROR"] remoteExecCall ["KPLIB_fnc_log", 2];};
};

View File

@@ -0,0 +1,18 @@
GRLIB_conflicting_objects = [];
GRLIB_buildoverlay_icon = "\A3\ui_f\data\map\markers\handdrawn\objective_CA.paa";
GRLIB_buildoverlay_color = [ 1, 0, 0, 1 ];
GRLIB_buildoverlay_cfg = configFile >> "cfgVehicles";
["build_overlay", "onEachFrame", {
if ( build_confirmed == 1 ) then {
if ( count GRLIB_conflicting_objects > 0 ) then {
{
if ( alive _x ) then {
drawIcon3D [ GRLIB_buildoverlay_icon, GRLIB_buildoverlay_color, [ (getpos _x) select 0, (getpos _x) select 1, 1.5],
1, 1, 0, format [ "%1", getText (GRLIB_buildoverlay_cfg >> typeof _x >> "displayName") ], 2, 0.04, "puristaMedium"];
};
} foreach GRLIB_conflicting_objects;
};
};
}] call BIS_fnc_addStackedEventHandler;

View File

@@ -0,0 +1,373 @@
// TODO This needs absolutely a code refactoring, flamethrower or nuke
private [ "_maxdist", "_truepos", "_built_object_remote", "_pos", "_grp", "_classname", "_idx", "_unitrank", "_posfob", "_ghost_spot", "_vehicle", "_dist", "_actualdir", "_near_objects", "_near_objects_25", "_debug_colisions" ];
build_confirmed = 0;
_maxdist = GRLIB_fob_range;
_truepos = [];
_debug_colisions = false;
KP_vector = true;
private _object_spheres = [];
private _fob_spheres = [];
for "_i" from 1 to 36 do {
_object_spheres pushBack ("Sign_Sphere100cm_F" createVehicleLocal [0, 0, 0]);
_fob_spheres pushBack ("Sign_Sphere100cm_F" createVehicleLocal [0, 0, 0]);
};
{ _x setObjectTexture [0, "#(rgb,8,8,3)color(0,1,0,1)"]; } foreach _object_spheres;
if (isNil "manned") then { manned = false };
if (isNil "gridmode" ) then { gridmode = 0 };
if (isNil "repeatbuild" ) then { repeatbuild = false };
if (isNil "build_rotation" ) then { build_rotation = 0 };
if (isNil "build_elevation" ) then { build_elevation = 0 };
waitUntil { sleep 0.2; !isNil "dobuild" };
while { true } do {
waitUntil { sleep 0.2; dobuild != 0 };
build_confirmed = 1;
build_invalid = 0;
_classname = "";
if ( buildtype == 99 ) then {
_classname = FOB_typename;
} else {
_classname = ((KPLIB_buildList select buildtype) select buildindex) select 0;
_price_s = ((KPLIB_buildList select buildtype) select buildindex) select 1;
_price_a = ((KPLIB_buildList select buildtype) select buildindex) select 2;
_price_f = ((KPLIB_buildList select buildtype) select buildindex) select 3;
_nearfob = [] call KPLIB_fnc_getNearestFob;
_storage_areas = (_nearfob nearobjects (GRLIB_fob_range * 2)) select {(_x getVariable ["KP_liberation_storage_type",-1]) == 0};
[_price_s, _price_a, _price_f, _classname, buildtype, _storage_areas] remoteExec ["build_remote_call",2];
};
if(buildtype == 1) then {
_pos = [(getpos player select 0) + 1,(getpos player select 1) + 1, 0];
_grp = group player;
if ( manned ) then {
_grp = createGroup GRLIB_side_friendly;
};
_classname createUnit [_pos, _grp,"this addMPEventHandler [""MPKilled"", {_this spawn kill_manager}]", 0.5, "private"];
build_confirmed = 0;
} else {
if ( buildtype == 8 ) then {
_pos = [(getpos player select 0) + 1,(getpos player select 1) + 1, 0];
_grp = createGroup GRLIB_side_friendly;
_grp setGroupId [format ["%1 %2",squads_names select buildindex, groupId _grp]];
_idx = 0;
{
_unitrank = "private";
if(_idx == 0) then { _unitrank = "sergeant"; };
if(_idx == 1) then { _unitrank = "corporal"; };
if (_classname isEqualTo blufor_squad_para) then {
_x createUnit [_pos, _grp,"this addMPEventHandler [""MPKilled"", {_this spawn kill_manager}]; removeBackpackGlobal this; this addBackpackGlobal ""B_parachute""", 0.5, _unitrank];
} else {
_x createUnit [_pos, _grp,"this addMPEventHandler [""MPKilled"", {_this spawn kill_manager}];", 0.5, _unitrank];
};
_idx = _idx + 1;
} foreach _classname;
_grp setBehaviour "SAFE";
build_confirmed = 0;
} else {
_posfob = getpos player;
if (buildtype != 99) then {
_posfob = [] call KPLIB_fnc_getNearestFob;
};
_idactcancel = -1;
_idactsnap = -1;
_idactplacebis = -1;
_idactvector = -1;
if (buildtype != 99 ) then {
_idactcancel = player addAction ["<t color='#B0FF00'>" + localize "STR_CANCEL" + "</t> <img size='2' image='res\ui_cancel.paa'/>",{build_confirmed = 3; GRLIB_ui_notif = ""; hint localize "STR_CANCEL_HINT";},"",-725,false,true,"","build_confirmed == 1"];
};
if (buildtype == 6 ) then {
_idactplacebis = player addAction ["<t color='#B0FF00'>" + localize "STR_PLACEMENT_BIS" + "</t> <img size='2' image='res\ui_confirm.paa'/>",{build_confirmed = 2; repeatbuild = true; hint localize "STR_CONFIRM_HINT";},"",-785,false,false,"","build_invalid == 0 && build_confirmed == 1"];
};
if (buildtype == 6 || buildtype == 99 || (toLower _classname) in KPLIB_storageBuildings || _classname isEqualTo KP_liberation_recycle_building || _classname isEqualTo KP_liberation_air_vehicle_building) then {
_idactsnap = player addAction ["<t color='#B0FF00'>" + localize "STR_GRID" + "</t>",{gridmode = gridmode + 1;},"",-735,false,false,"","build_confirmed == 1"];
_idactvector = player addAction ["<t color='#B0FF00'>" + localize "STR_VECACTION" + "</t>",{KP_vector = !KP_vector;},"",-800,false,false,"","build_confirmed == 1"];
};
_idactrotate = player addAction ["<t color='#B0FF00'>" + localize "STR_ROTATION" + "</t> <img size='2' image='res\ui_rotation.paa'/>",{build_rotation = build_rotation + 90;},"",-750,false,false,"","build_confirmed == 1"];
_idactraise = player addAction ["<t color='#B0FF00'>" + localize "STR_RAISE" + "</t>",{build_elevation = build_elevation + 0.2;},"",-765,false,false,"","build_confirmed == 1"];
_idactlower = player addAction ["<t color='#B0FF00'>" + localize "STR_LOWER" + "</t>",{build_elevation = build_elevation - 0.2;},"",-766,false,false,"","build_confirmed == 1"];
_idactplace = player addAction ["<t color='#B0FF00'>" + localize "STR_PLACEMENT" + "</t> <img size='2' image='res\ui_confirm.paa'/>",{build_confirmed = 2; hint localize "STR_CONFIRM_HINT";},"",-775,false,true,"","build_invalid == 0 && build_confirmed == 1"];
_ghost_spot = (markerPos "ghost_spot") findEmptyPosition [0,100];
_vehicle = _classname createVehicleLocal _ghost_spot;
_vehicle allowdamage false;
_vehicle setVehicleLock "LOCKED";
_vehicle enableSimulationGlobal false;
_vehicle setVariable ["KP_liberation_preplaced", true, true];
_dist = 0.6 * (sizeOf _classname);
if (_dist < 3.5) then { _dist = 3.5 };
_dist = _dist + 1;
for [{_i=0}, {_i<5}, {_i=_i+1}] do {
_vehicle setObjectTextureGlobal [_i, '#(rgb,8,8,3)color(0,1,0,0.8)'];
};
{_x setObjectTexture [0, "#(rgb,8,8,3)color(0,1,0,1)"];} foreach _object_spheres;
while { build_confirmed == 1 && alive player } do {
_truedir = 90 - (getdir player);
if ((toLower (typeOf _vehicle)) in KPLIB_b_static_classes) then {
_truepos = [((getposATL player) select 0) + (_dist * (cos _truedir)), ((getposATL player) select 1) + (_dist * (sin _truedir)),((getposATL player) select 2)];
} else {
_truepos = [((getpos player) select 0) + (_dist * (cos _truedir)), ((getpos player) select 1) + (_dist * (sin _truedir)),0];
};
_actualdir = ((getdir player) + build_rotation);
if ( _classname == "Land_Cargo_Patrol_V1_F" || _classname == "Land_PortableLight_single_F" ) then { _actualdir = _actualdir + 180 };
if ( _classname == FOB_typename ) then { _actualdir = _actualdir + 270 };
while { _actualdir > 360 } do { _actualdir = _actualdir - 360 };
while { _actualdir < 0 } do { _actualdir = _actualdir + 360 };
if ( ((buildtype == 6) || (buildtype == 99)) && ((gridmode % 2) == 1) ) then {
if ( _actualdir >= 22.5 && _actualdir <= 67.5 ) then { _actualdir = 45 };
if ( _actualdir >= 67.5 && _actualdir <= 112.5 ) then { _actualdir = 90 };
if ( _actualdir >= 112.5 && _actualdir <= 157.5 ) then { _actualdir = 135 };
if ( _actualdir >= 157.5 && _actualdir <= 202.5 ) then { _actualdir = 180 };
if ( _actualdir >= 202.5 && _actualdir <= 247.5 ) then { _actualdir = 225 };
if ( _actualdir >= 247.5 && _actualdir <= 292.5 ) then { _actualdir = 270 };
if ( _actualdir >= 292.5 && _actualdir <= 337.5 ) then { _actualdir = 315 };
if ( _actualdir <= 22.5 || _actualdir >= 337.5 ) then { _actualdir = 0 };
};
{
_x setPos (_truepos getPos [_dist, 10 * _forEachIndex]);
} foreach _object_spheres;
if !(buildtype isEqualTo 99) then {
{
_x setPos (_posfob getPos [GRLIB_fob_range, 10 * _forEachIndex])
} forEach _fob_spheres;
};
_vehicle setdir _actualdir;
_truepos = [_truepos select 0, _truepos select 1, (_truepos select 2) + build_elevation];
_near_objects = (_truepos nearobjects ["AllVehicles", _dist]) ;
_near_objects = _near_objects + (_truepos nearobjects [FOB_box_typename, _dist]);
_near_objects = _near_objects + (_truepos nearobjects [Arsenal_typename, _dist]);
_near_objects_25 = (_truepos nearobjects ["AllVehicles", 50]) ;
_near_objects_25 = _near_objects_25 + (_truepos nearobjects [FOB_box_typename, 50]);
_near_objects_25 = _near_objects_25 + (_truepos nearobjects [Arsenal_typename, 50]);
if( buildtype != 6 ) then {
_near_objects = _near_objects + (_truepos nearobjects ["Static", _dist]);
_near_objects_25 = _near_objects_25 + (_truepos nearobjects ["Static", 50]);
};
private _remove_objects = [];
{
private _typeOfX = typeOf _x;
if ((_x isKindOf "Animal") || (_typeOfX in GRLIB_ignore_colisions_when_building) || (_typeOfX isKindOf "CAManBase") || (isPlayer _x) || (_x == _vehicle) || ((toLower (typeOf _vehicle)) in KPLIB_b_static_classes)) then {
_remove_objects pushback _x;
};
} foreach _near_objects;
private _remove_objects_25 = [];
{
private _typeOfX = typeOf _x;
if ((_x isKindOf "Animal") || (_typeOfX in GRLIB_ignore_colisions_when_building) || (_typeOfX isKindOf "CAManBase") || (isPlayer _x) || (_x == _vehicle) || ((toLower (typeOf _vehicle)) in KPLIB_b_static_classes)) then {
_remove_objects_25 pushback _x;
};
} foreach _near_objects_25;
_near_objects = _near_objects - _remove_objects;
_near_objects_25 = _near_objects_25 - _remove_objects_25;
if ( count _near_objects == 0 ) then {
{
_dist22 = 0.6 * (sizeOf (typeof _x));
if ( _dist22 < 1 ) then { _dist22 = 1 };
if (_truepos distance _x < _dist22) then {
_near_objects pushback _x;
};
} foreach _near_objects_25;
};
if ( count _near_objects != 0 ) then {
GRLIB_conflicting_objects = _near_objects;
} else {
GRLIB_conflicting_objects = [];
};
if (count _near_objects == 0 && ((_truepos distance _posfob) < _maxdist) && ( ((!surfaceIsWater _truepos) && (!surfaceIsWater getpos player)) || (_classname in boats_names) ) ) then {
if ( ((buildtype == 6) || (buildtype == 99)) && ((gridmode % 2) == 1) ) then {
_vehicle setpos [round (_truepos select 0),round (_truepos select 1), _truepos select 2];
} else {
if ((toLower (typeOf _vehicle)) in KPLIB_b_static_classes) then {
_vehicle setPosATL _truepos;
} else {
_vehicle setpos _truepos;
};
};
if (buildtype == 6 || buildtype == 99 || (toLower _classname) in KPLIB_storageBuildings || _classname isEqualTo KP_liberation_recycle_building || _classname isEqualTo KP_liberation_air_vehicle_building) then {
if (KP_vector) then {
_vehicle setVectorUp [0,0,1];
} else {
_vehicle setVectorUp surfaceNormal position _vehicle;
};
} else {
_vehicle setVectorUp surfaceNormal position _vehicle;
};
if(build_invalid == 1) then {
GRLIB_ui_notif = "";
{_x setObjectTexture [0, "#(rgb,8,8,3)color(0,1,0,1)"];} foreach _object_spheres;
};
build_invalid = 0;
} else {
if ( build_invalid == 0 ) then {
{_x setObjectTexture [0, "#(rgb,8,8,3)color(1,0,0,1)"];} foreach _object_spheres;
};
_vehicle setpos _ghost_spot;
build_invalid = 1;
if(count _near_objects > 0) then {
GRLIB_ui_notif = format [localize "STR_PLACEMENT_IMPOSSIBLE",count _near_objects, round _dist];
if (_debug_colisions) then {
private [ "_objs_classnames" ];
_objs_classnames = [];
{ _objs_classnames pushback (typeof _x) } foreach _near_objects;
hint format [ "Colisions : %1", _objs_classnames ];
};
};
if( ((surfaceIsWater _truepos) || (surfaceIsWater getpos player)) && !(_classname in boats_names)) then {
GRLIB_ui_notif = localize "STR_BUILD_ERROR_WATER";
};
if((_truepos distance _posfob) > _maxdist) then {
GRLIB_ui_notif = format [localize "STR_BUILD_ERROR_DISTANCE",_maxdist];
};
};
sleep 0.05;
};
GRLIB_ui_notif = "";
{_x setPos [0, 0, 0];} forEach (_object_spheres + _fob_spheres);
if ( !alive player || build_confirmed == 3 ) then {
private ["_price_s", "_price_a", "_price_f", "_nearfob", "_storage_areas"];
_price_s = ((KPLIB_buildList select buildtype) select buildindex) select 1;
_price_a = ((KPLIB_buildList select buildtype) select buildindex) select 2;
_price_f = ((KPLIB_buildList select buildtype) select buildindex) select 3;
_nearfob = [] call KPLIB_fnc_getNearestFob;
_storage_areas = (_nearfob nearobjects (GRLIB_fob_range * 2)) select {(_x getVariable ["KP_liberation_storage_type",-1]) == 0};
_supplyCrates = ceil (_price_s / 100);
_ammoCrates = ceil (_price_a / 100);
_fuelCrates = ceil (_price_f / 100);
_crateSum = _supplyCrates + _ammoCrates + _fuelCrates;
_spaceSum = 0;
{
if (typeOf _x == KP_liberation_large_storage_building) then {
_spaceSum = _spaceSum + (count KP_liberation_large_storage_positions) - (count (attachedObjects _x));
};
if (typeOf _x == KP_liberation_small_storage_building) then {
_spaceSum = _spaceSum + (count KP_liberation_small_storage_positions) - (count (attachedObjects _x));
};
} forEach _storage_areas;
deleteVehicle _vehicle;
if (_spaceSum < _crateSum) then {
hint localize "STR_CANCEL_ERROR";
} else {
[_price_s, _price_a, _price_f, _storage_areas] remoteExec ["cancel_build_remote_call",2];
};
};
if ( build_confirmed == 2 ) then {
_vehpos = getpos _vehicle;
_vehdir = getdir _vehicle;
deleteVehicle _vehicle;
sleep 0.1;
_vehicle = _classname createVehicle _truepos;
_vehicle allowDamage false;
_vehicle setdir _vehdir;
if ((toLower (typeOf _vehicle)) in KPLIB_b_static_classes) then {
_vehicle setPosATL _truepos;
} else {
_vehicle setpos _truepos;
};
[_vehicle] call KPLIB_fnc_addObjectInit;
[_vehicle] call KPLIB_fnc_clearCargo;
if (buildtype == 6 || buildtype == 99 || (toLower _classname) in KPLIB_storageBuildings || _classname isEqualTo KP_liberation_recycle_building || _classname isEqualTo KP_liberation_air_vehicle_building) then {
if (KP_vector) then {
_vehicle setVectorUp [0,0,1];
} else {
_vehicle setVectorUp surfaceNormal position _vehicle;
};
} else {
_vehicle setVectorUp surfaceNormal position _vehicle;
};
if ( (unitIsUAV _vehicle) || manned ) then {
[ _vehicle ] call KPLIB_fnc_forceBluforCrew;
};
sleep 0.3;
_vehicle allowDamage true;
_vehicle setDamage 0;
if(buildtype != 6) then {
_vehicle addMPEventHandler ["MPKilled", {_this spawn kill_manager}];
{ _x addMPEventHandler ["MPKilled", {_this spawn kill_manager}]; } foreach (crew _vehicle);
};
};
if ( _idactcancel != -1 ) then {
player removeAction _idactcancel;
};
if ( _idactsnap != -1 ) then {
player removeAction _idactsnap;
};
if ( _idactplacebis != -1 ) then {
player removeAction _idactplacebis;
};
if ( _idactvector != -1 ) then {
player removeAction _idactvector;
};
player removeAction _idactrotate;
player removeAction _idactplace;
player removeAction _idactraise;
player removeAction _idactlower;
if(buildtype == 99) then {
_new_fob = getpos player;
[_new_fob, false] remoteExec ["build_fob_remote_call",2];
buildtype = 1;
};
build_confirmed = 0;
};
};
if ( repeatbuild ) then {
dobuild = 1;
repeatbuild = false;
} else {
dobuild = 0;
};
manned = false;
};

View File

@@ -0,0 +1,51 @@
private [ "_minfobdist", "_minsectordist", "_distfob", "_clearedtobuildfob", "_distsector", "_clearedtobuildsector", "_idx" ];
if ( count GRLIB_all_fobs >= GRLIB_maximum_fobs ) exitWith {
hint format [ localize "STR_HINT_FOBS_EXCEEDED", GRLIB_maximum_fobs ];
};
_minfobdist = 1000;
_minsectordist = GRLIB_capture_size + GRLIB_fob_range;
_distfob = 1;
_clearedtobuildfob = true;
_distsector = 1;
_clearedtobuildsector = true;
FOB_build_in_progress = true;
publicVariable "FOB_build_in_progress";
_idx = 0;
while { (_idx < (count GRLIB_all_fobs)) && _clearedtobuildfob } do {
if ( player distance (GRLIB_all_fobs select _idx) < _minfobdist ) then {
_clearedtobuildfob = false;
_distfob = player distance (GRLIB_all_fobs select _idx);
};
_idx = _idx + 1;
};
_idx = 0;
if(_clearedtobuildfob) then {
while { (_idx < (count sectors_allSectors)) && _clearedtobuildsector } do {
if ( player distance (markerPos (sectors_allSectors select _idx)) < _minsectordist ) then {
_clearedtobuildsector = false;
_distsector = player distance (markerPos (sectors_allSectors select _idx));
};
_idx = _idx + 1;
};
};
if (!_clearedtobuildfob) then {
hint format [localize "STR_FOB_BUILDING_IMPOSSIBLE",floor _minfobdist,floor _distfob];
FOB_build_in_progress = false;
publicVariable "FOB_build_in_progress";
} else {
if ( !_clearedtobuildsector ) then {
hint format [localize "STR_FOB_BUILDING_IMPOSSIBLE_SECTOR",floor _minsectordist,floor _distsector];
FOB_build_in_progress = false;
publicVariable "FOB_build_in_progress";
} else {
buildtype = 99;
dobuild = 1;
deleteVehicle (_this select 0);
};
};

View File

@@ -0,0 +1,106 @@
private ["_vector", "_idactcancel", "_idactplace", "_idactvector", "_ghost_spot", "_truedir", "_dist", "_truepos", "_sectorpos", "_building"];
if (((_this select 3) select 0) == KP_liberation_small_storage_building) then {
_truepos = [];
build_confirmed = 1;
build_invalid = 0;
KP_vector = true;
_sectorpos = markerPos ([100] call KPLIB_fnc_getNearestSector);
_idactcancel = player addAction ["<t color='#B0FF00'>" + localize "STR_CANCEL" + "</t> <img size='2' image='res\ui_cancel.paa'/>",{build_confirmed = 3;},"",-725,false,true,"","build_confirmed == 1"];
_idactplace = player addAction ["<t color='#B0FF00'>" + localize "STR_PLACEMENT" + "</t> <img size='2' image='res\ui_confirm.paa'/>",{build_confirmed = 2;},"",-775,false,true,"","build_invalid == 0 && build_confirmed == 1"];
_idactvector = player addAction ["<t color='#B0FF00'>" + localize "STR_VECACTION" + "</t>",{KP_vector = !KP_vector;},"",-800,false,false,"","build_confirmed == 1"];
_ghost_spot = (markerPos "ghost_spot") findEmptyPosition [0,100];
_building = ((_this select 3) select 0) createVehicleLocal _ghost_spot;
_building allowdamage false;
_building setVehicleLock "LOCKED";
_building enableSimulationGlobal false;
_dist = 0.6 * (sizeOf ((_this select 3) select 0));
if (_dist < 3.5) then { _dist = 3.5 };
_dist = _dist + 0.5;
for [{_i=0}, {_i<5}, {_i=_i+1}] do {
_building setObjectTextureGlobal [_i, '#(rgb,8,8,3)color(0,1,0,0.8)'];
};
while {build_confirmed == 1 && alive player} do {
_truedir = 90 - (getdir player);
_truepos = [((getpos player) select 0) + (_dist * (cos _truedir)), ((getpos player) select 1) + (_dist * (sin _truedir)),0];
if ((surfaceIsWater _truepos) || (surfaceIsWater getpos player) || ((_truepos distance _sectorpos) > 100)) then {
_building setpos _ghost_spot;
build_invalid = 1;
if(((surfaceIsWater _truepos) || (surfaceIsWater getpos player))) then {
GRLIB_ui_notif = localize "STR_BUILD_ERROR_WATER";
};
if((_truepos distance _sectorpos) > 100) then {
GRLIB_ui_notif = format [localize "STR_BUILD_ERROR_DISTANCE",100];
};
} else {
_building setdir (getDir player);
_building setpos _truepos;
if (KP_vector) then {
_building setVectorUp [0,0,1];
} else {
_building setVectorUp surfaceNormal position _building;
};
if (build_invalid == 1) then {
GRLIB_ui_notif = "";
};
build_invalid = 0;
};
sleep 0.05;
};
GRLIB_ui_notif = "";
if (!alive player || build_confirmed == 3) then {
deleteVehicle _building;
};
if (build_confirmed == 2) then {
_vehpos = getpos _building;
_vehdir = getdir _building;
deleteVehicle _building;
sleep 0.1;
_building = ((_this select 3) select 0) createVehicle _truepos;
_building allowDamage false;
_building setdir _vehdir;
_building setpos _truepos;
if (KP_vector) then {
_building setVectorUp [0,0,1];
} else {
_building setVectorUp surfaceNormal position _building;
};
_building setVariable ["KP_liberation_storage_type", 1, true];
sleep 0.3;
_building allowDamage true;
_building setDamage 0;
};
player removeAction _idactcancel;
player removeAction _idactplace;
player removeAction _idactvector;
recalculate_sectors = true;
publicVariable "recalculate_sectors";
build_confirmed = 0;
} else {
[player getVariable ["KPLIB_nearProd", []], ((_this select 3) select 0), clientOwner] remoteExec ["build_fac_remote_call",2];
};

View File

@@ -0,0 +1,206 @@
private [ "_oldbuildtype", "_cfg", "_initindex", "_dialog", "_iscommandant", "_squadname", "_buildpages", "_build_list", "_classnamevar", "_entrytext", "_icon", "_affordable", "_affordable_crew", "_selected_item", "_linked", "_linked_unlocked", "_base_link", "_link_color", "_link_str", "_nearfob", "_actual_fob"];
if (([ getpos player , 500 , GRLIB_side_enemy ] call KPLIB_fnc_getUnitsCount ) > 4 ) exitWith { hint localize "STR_BUILD_ENEMIES_NEARBY";};
if (isNil "buildtype") then {buildtype = 1};
if (isNil "buildindex") then {buildindex = -1};
dobuild = 0;
_oldbuildtype = -1;
_cfg = configFile >> "cfgVehicles";
_initindex = buildindex;
_dialog = createDialog "liberation_build";
waitUntil { dialog };
_iscommandant = false;
if (player == [] call KPLIB_fnc_getCommander) then {
_iscommandant = true;
};
ctrlShow [108, _iscommandant];
ctrlShow [1085, _iscommandant];
ctrlShow [121, _iscommandant];
_squadname = "";
_buildpages = [
localize "STR_BUILD1",
localize "STR_BUILD2",
localize "STR_BUILD3",
localize "STR_BUILD4",
localize "STR_BUILD5",
localize "STR_BUILD6",
localize "STR_BUILD7",
localize "STR_BUILD8"
];
_nearfob = [] call KPLIB_fnc_getNearestFob;
_actual_fob = KP_liberation_fob_resources select {((_x select 0) distance _nearfob) < GRLIB_fob_range};
while {dialog && alive player && (dobuild == 0 || buildtype == 1)} do {
_build_list = KPLIB_buildList select buildtype;
if (_oldbuildtype != buildtype || synchro_done) then {
synchro_done = false;
_oldbuildtype = buildtype;
_actual_fob = KP_liberation_fob_resources select {((_x select 0) distance _nearfob) < GRLIB_fob_range};
lbClear 110;
{
ctrlSetText [151, _buildpages select ( buildtype - 1)];
if (buildtype != 8) then {
_classnamevar = (_x select 0);
_entrytext = getText (_cfg >> _classnamevar >> "displayName");
switch (_classnamevar) do {
case FOB_box_typename: {_entrytext = localize "STR_FOBBOX";};
case Arsenal_typename: {if (KP_liberation_mobilearsenal) then {_entrytext = localize "STR_ARSENAL_BOX";};};
case Respawn_truck_typename: {if (KP_liberation_mobilerespawn) then {_entrytext = localize "STR_RESPAWN_TRUCK";};};
case FOB_truck_typename: {_entrytext = localize "STR_FOBTRUCK";};
case "Flag_White_F": {_entrytext = localize "STR_INDIV_FLAG";};
case KP_liberation_small_storage_building: {_entrytext = localize "STR_SMALL_STORAGE";};
case KP_liberation_large_storage_building: {_entrytext = localize "STR_LARGE_STORAGE";};
case KP_liberation_recycle_building: {_entrytext = localize "STR_RECYCLE_BUILDING";};
case KP_liberation_air_vehicle_building: {_entrytext = localize "STR_HELI_BUILDING";};
case KP_liberation_heli_slot_building: {_entrytext = localize "STR_HELI_SLOT";};
case KP_liberation_plane_slot_building: {_entrytext = localize "STR_PLANE_SLOT";};
default {};
};
((findDisplay 5501) displayCtrl (110)) lnbAddRow [ _entrytext, format [ "%1" ,_x select 1], format [ "%1" ,_x select 2], format [ "%1" ,_x select 3]];
_icon = getText ( _cfg >> (_x select 0) >> "icon");
if(isText (configFile >> "CfgVehicleIcons" >> _icon)) then {
_icon = (getText (configFile >> "CfgVehicleIcons" >> _icon));
};
lnbSetPicture [110, [((lnbSize 110) select 0) - 1, 0],_icon];
} else {
if ( ((lnbSize 110) select 0) <= count squads_names ) then {
_squadname = squads_names select ((lnbSize 110) select 0);
} else {
_squadname = "";
};
((findDisplay 5501) displayCtrl (110)) lnbAddRow [_squadname, format [ "%1" ,_x select 1], format [ "%1" ,_x select 2], format [ "%1" ,_x select 3]];
};
_affordable = true;
if (
((_x select 1 > 0) && ((_x select 1) > ((_actual_fob select 0) select 1))) ||
((_x select 2 > 0) && ((_x select 2) > ((_actual_fob select 0) select 2))) ||
((_x select 3 > 0) && ((_x select 3) > ((_actual_fob select 0) select 3)))
) then {
_affordable = false;
};
if ( _affordable ) then {
((findDisplay 5501) displayCtrl (110)) lnbSetColor [[((lnbSize 110) select 0) - 1, 0], [1,1,1,1]];
((findDisplay 5501) displayCtrl (110)) lnbSetColor [[((lnbSize 110) select 0) - 1, 1], [1,1,1,1]];
((findDisplay 5501) displayCtrl (110)) lnbSetColor [[((lnbSize 110) select 0) - 1, 2], [1,1,1,1]];
((findDisplay 5501) displayCtrl (110)) lnbSetColor [[((lnbSize 110) select 0) - 1, 3], [1,1,1,1]];
} else {
((findDisplay 5501) displayCtrl (110)) lnbSetColor [[((lnbSize 110) select 0) - 1, 0], [0.4,0.4,0.4,1]];
((findDisplay 5501) displayCtrl (110)) lnbSetColor [[((lnbSize 110) select 0) - 1, 1], [0.4,0.4,0.4,1]];
((findDisplay 5501) displayCtrl (110)) lnbSetColor [[((lnbSize 110) select 0) - 1, 2], [0.4,0.4,0.4,1]];
((findDisplay 5501) displayCtrl (110)) lnbSetColor [[((lnbSize 110) select 0) - 1, 3], [0.4,0.4,0.4,1]];
};
} foreach _build_list;
};
if(_initindex != -1) then {
lbSetCurSel [110, _initindex];
_initindex = -1;
};
_selected_item = lbCurSel 110;
_affordable = false;
_squad_full = false;
if ((buildtype == 1) && (count (units group player) >= GRLIB_max_squad_size)) then {
_squad_full = true;
};
_linked = false;
_linked_unlocked = true;
_base_link = "";
if (dobuild == 0 && _selected_item != -1 && (_selected_item < (count _build_list))) then {
_build_item = _build_list select _selected_item;
if (
((_build_item select 1 == 0 ) || ((_build_item select 1) <= ((_actual_fob select 0) select 1))) &&
((_build_item select 2 == 0 ) || ((_build_item select 2) <= ((_actual_fob select 0) select 2))) &&
((_build_item select 3 == 0 ) || ((_build_item select 3) <= ((_actual_fob select 0) select 3)))
) then {
if !((_build_item select 0) isEqualType []) then {
if ((toLower (_build_item select 0)) in KPLIB_b_air_classes && !([_build_item select 0] call KPLIB_fnc_isClassUAV)) then {
if (KP_liberation_air_vehicle_building_near &&
((((_build_item select 0) isKindOf "Helicopter") && (KP_liberation_heli_count < KP_liberation_heli_slots)) ||
(((_build_item select 0) isKindOf "Plane") && (KP_liberation_plane_count < KP_liberation_plane_slots)))
) then {
_affordable = true;
};
} else {
if (!((toLower (_build_item select 0)) in KPLIB_airSlots) || (((toLower (_build_item select 0)) in KPLIB_airSlots) && KP_liberation_air_vehicle_building_near)) then {
_affordable = true;
};
};
} else {
_affordable = true;
};
};
if ( buildtype != 8 ) then {
{ if ( ( _build_item select 0 ) == ( _x select 0 ) ) exitWith { _base_link = _x select 1; _linked = true; } } foreach GRLIB_vehicle_to_military_base_links;
if ( _linked ) then {
if ( !(_base_link in blufor_sectors) ) then { _linked_unlocked = false };
};
};
};
_affordable_crew = _affordable;
if ( unitcap >= ([] call KPLIB_fnc_getLocalCap)) then {
_affordable_crew = false;
if (buildtype == 1 || buildtype == 8) then {
_affordable = false;
};
};
ctrlEnable [ 120, _affordable && _linked_unlocked && !(_squad_full) ];
ctrlEnable [ 121, _affordable_crew && _linked_unlocked ];
ctrlSetText [131, format [ "%1 : %2" , localize "STR_MANPOWER", (floor KP_liberation_supplies)]] ;
ctrlSetText [132, format [ "%1 : %2" , localize "STR_AMMO", (floor KP_liberation_ammo)]];
ctrlSetText [133, format [ "%1 : %2" , localize "STR_FUEL", (floor KP_liberation_fuel)]];
((findDisplay 5501) displayCtrl (134)) ctrlSetStructuredText formatText [
"%1/%2 %3 - %4/%5 %6 - %7/%8 %9",
unitcap,
([] call KPLIB_fnc_getLocalCap),
image "\a3\Ui_F_Curator\Data\Displays\RscDisplayCurator\modeGroups_ca.paa",
KP_liberation_heli_count,
KP_liberation_heli_slots,
image "\A3\air_f_beta\Heli_Transport_01\Data\UI\Map_Heli_Transport_01_base_CA.paa",
KP_liberation_plane_count,
KP_liberation_plane_slots,
image "\A3\Air_F_EPC\Plane_CAS_01\Data\UI\Map_Plane_CAS_01_CA.paa"
];
_link_color = "#0040e0";
_link_str = localize "STR_VEHICLE_UNLOCKED";
if (!_linked_unlocked) then { _link_color = "#e00000"; _link_str = localize "STR_VEHICLE_LOCKED"; };
if ( _linked ) then {
((findDisplay 5501) displayCtrl (161)) ctrlSetStructuredText parseText ( "<t color='" + _link_color + "' align='center'>" + _link_str + "<br/>" + ( markerText _base_link ) + "</t>" );
} else {
((findDisplay 5501) displayCtrl (161)) ctrlSetStructuredText parseText "";
};
buildindex = _selected_item;
if(buildtype == 1 && dobuild != 0) then {
ctrlEnable [120, false];
ctrlEnable [121, false];
sleep 1;
dobuild = 0;
};
sleep 0.1;
};
if (!alive player || dobuild != 0) then { closeDialog 0 };

View File

@@ -0,0 +1,47 @@
params ["_informant"];
if (isDedicated) exitWith {};
if (KP_liberation_civinfo_debug > 0) then {[format ["civinfo_escort called on: %1 - Parameters: [%2]", debug_source, _informant], "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
waitUntil {sleep 0.5; local _informant || !alive _informant};
if !(alive _informant) exitWith {if (KP_liberation_civinfo_debug > 0) then {[format ["civinfo_escort exited by: %1 - Informant isn't alive", debug_source], "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};};
private _is_near_fob = false;
sleep 1;
_informant playmove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon";
sleep 2;
_informant enableAI "ANIM";
_informant enableAI "MOVE";
sleep 2;
[_informant, ""] remoteExecCall ["switchMove"];
waitUntil {sleep 5;
_nearestfob = [getpos _informant] call KPLIB_fnc_getNearestFob;
if (count _nearestfob == 3) then {
if ((_informant distance _nearestfob) < 30) then {
_is_near_fob = true;
};
};
!alive _informant || (_is_near_fob && (vehicle _informant == _informant))
};
if (alive _informant) then {
if (_is_near_fob) then {
sleep 5;
private _grp = createGroup [GRLIB_side_friendly, true];
[_informant] joinSilent _grp;
_informant playmove "AmovPercMstpSnonWnonDnon_AmovPsitMstpSnonWnonDnon_ground";
_informant disableAI "ANIM";
_informant disableAI "MOVE";
sleep 5;
[_informant, "AidlPsitMstpSnonWnonDnon_ground00"] remoteExecCall ["switchMove"];
[_informant] remoteExec ["civinfo_delivered",2];
if (KP_liberation_civinfo_debug > 0) then {["civinfo_escort -> Informant at FOB", "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
sleep 600;
deleteVehicle _informant;
if (KP_liberation_civinfo_debug > 0) then {[format ["civinfo_escort finished by: %1", debug_source], "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
};
};

View File

@@ -0,0 +1,51 @@
if (isDedicated) exitWith {};
params ["_notif_id", ["_pos", getpos player]];
if (KP_liberation_civinfo_debug > 0) then {[format ["civinfo_notifications called on: %1 - Parameters: [%2, %3]", debug_source, _notif_id, _pos], "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
switch (_notif_id) do {
case 0: {
["lib_civ_informant_start", [markertext ([10000, _pos] call KPLIB_fnc_getNearestSector)]] call BIS_fnc_showNotification;
private _informant_marker = createMarkerLocal ["informantmarker", _pos];
_informant_marker setMarkerColorLocal "ColorCIV";
_informant_marker setMarkerShape "ELLIPSE";
_informant_marker setMarkerBrush "FDiagonal";
_informant_marker setMarkerSize [500,500];
};
case 1: {
["lib_civ_informant_success"] call BIS_fnc_showNotification;
deleteMarkerLocal "informantmarker";
};
case 2: {
["lib_civ_informant_fail"] call BIS_fnc_showNotification;
deleteMarkerLocal "informantmarker";
};
case 3: {
["lib_civ_informant_death"] call BIS_fnc_showNotification;
deleteMarkerLocal "informantmarker";
};
case 4: {
["lib_civ_hvt_start", [markertext ([10000, _pos] call KPLIB_fnc_getNearestSector)]] call BIS_fnc_showNotification;
private _marker = createMarker ["HVT_marker", _pos];
_marker setMarkerColor GRLIB_color_enemy_bright;
_marker setMarkerType "hd_unknown";
private _marker_zone = createMarker ["HVT_zone", _pos];
_marker_zone setMarkerColor GRLIB_color_enemy_bright;
_marker_zone setMarkerShape "ELLIPSE";
_marker_zone setMarkerBrush "FDiagonal";
_marker_zone setMarkerSize [500,500];
};
case 5: {
["lib_civ_hvt_success"] call BIS_fnc_showNotification;
deleteMarkerLocal "HVT_marker";
deleteMarkerLocal "HVT_zone";
};
case 6: {
["lib_civ_hvt_fail"] call BIS_fnc_showNotification;
deleteMarkerLocal "HVT_marker";
deleteMarkerLocal "HVT_zone";
};
default {[format ["civinfo_notifications.sqf -> no valid value for _notif_id: %1", _notif_id], "ERROR"] remoteExecCall ["KPLIB_fnc_log", 2];};
};

View File

@@ -0,0 +1,24 @@
scriptName "[KPLIB] Enforce Whitelist";
[] call compileFinal preprocessFileLineNumbers "whitelist.sqf";
if (!GRLIB_use_whitelist) exitWith {};
waitUntil {alive player};
sleep 1;
if (player isEqualTo ([] call KPLIB_fnc_getCommander) && !(serverCommandAvailable "#kick")) then {
private _match = false;
[] call {
if ((getPlayerUID player) in GRLIB_whitelisted_steamids) exitWith {_match = true;};
if ((name player) in GRLIB_whitelisted_names) exitWith {_match = true;};
if (!((squadParams player) isEqualTo []) && {(((squadParams player) select 0) select 0) in GRLIB_whitelisted_tags}) exitWith {_match = true;};
};
if (!_match) then {
sleep 1;
endMission "END1";
};
};

View File

@@ -0,0 +1,230 @@
private ["_dialog", "_logi_count", "_listselect", "_selectedGroup", "_detailControls", "_nearfob", "_logi_destinations", "_mapdisplay", "_tempvariable"];
_dialog = createDialog "liberation_logistic";
_logi_count = 0;
_listselect = -1;
_selectedGroup = [];
_detailControls = [
75805,75806,75807,75808,75809,758010,758011,758012,758013,758014,758015,758016,758017,758018,
758019,758020,758021,758022,758023,758024,758025,758026,758027,758028,758029,758030,758031,
758032,758080,758081
];
_nearfob = [] call KPLIB_fnc_getNearestFob;
_logi_destinations = [];
{
_logi_destinations pushBack [(format ["FOB %1", military_alphabet select _forEachIndex]), (_x select 0), (_x select 1), (_x select 2), (_x select 3)];
} forEach KP_liberation_fob_resources;
{
_logi_destinations pushBack [(_x select 0), (markerPos (_x select 1)), (_x select 9), (_x select 10), (_x select 11)];
} forEach KP_liberation_production;
_logi_destinations sort true;
addLogiGroup = 0;
deleteLogiGroup = 0;
buyLogiTruck = 0;
sellLogiTruck = 0;
saveConvoySettings = 0;
convoyStandby = 0;
logiError = 0;
_tempvariable = nil;
disableSerialization;
waitUntil {dialog};
_mapdisplay = ((findDisplay 75802) displayCtrl 758098);
ctrlMapAnimClear _mapdisplay;
while {dialog && (alive player)} do {
"spawn_marker" setMarkerPosLocal markers_reset;
ctrlEnable [75803, false];
ctrlEnable [75804, false];
ctrlEnable [758021, false];
ctrlEnable [758022, false];
ctrlEnable [758024, false];
ctrlEnable [758025, false];
ctrlEnable [758026, false];
ctrlEnable [758027, false];
ctrlEnable [758029, false];
ctrlEnable [758030, false];
ctrlEnable [758031, false];
ctrlEnable [758032, false];
ctrlEnable [758080, false];
ctrlEnable [758081, false];
if (addLogiGroup == 1) then {
addLogiGroup = 0;
[_selectedGroup] remoteExec ["add_logiGroup_remote_call",2];
waitUntil {sleep 0.5; _logi_count != (count KP_liberation_logistics)};
};
if (deleteLogiGroup == 1) then {
deleteLogiGroup = 0;
[_selectedGroup] remoteExec ["del_logiGroup_remote_call",2];
lbSetCurSel [75802,-1];
waitUntil {sleep 0.5; _logi_count != (count KP_liberation_logistics)};
};
if (buyLogiTruck == 1) then {
buyLogiTruck = 0;
_tempvariable = _selectedGroup select 1;
[_listselect, _nearfob, clientOwner, KP_liberation_supplies, KP_liberation_ammo, KP_liberation_fuel] remoteExec ["add_logiTruck_remote_call",2];
waitUntil {sleep 0.5; (_tempvariable != ((KP_liberation_logistics select _listselect) select 1)) || (logiError == 1)};
};
if (sellLogiTruck == 1) then {
sellLogiTruck = 0;
_tempvariable = _selectedGroup select 1;
[_listselect, _nearfob, clientOwner] remoteExec ["del_logiTruck_remote_call",2];
waitUntil {sleep 0.5; (_tempvariable != ((KP_liberation_logistics select _listselect) select 1)) || (logiError == 1)};
};
if (saveConvoySettings == 1) then {
saveConvoySettings = 0;
if (((lbCurSel 758024) != -1) && ((lbCurSel 758029) != -1)) then {
[_listselect, ((_logi_destinations select lbCurSel 758024) select 1), [parseNumber ctrlText 758025,parseNumber ctrlText 758026,parseNumber ctrlText 758027], ((_logi_destinations select lbCurSel 758029) select 1), [parseNumber ctrlText 758030,parseNumber ctrlText 758031,parseNumber ctrlText 758032], clientOwner] remoteExec ["save_logi_remote_call",2];
waitUntil {sleep 0.5; (!(_selectedGroup isEqualTo (KP_liberation_logistics select _listselect))) || (logiError == 1)};
} else {
hint localize "STR_LOGISTIC_SAVE_ERROR";
};
};
if (convoyStandby == 1) then {
convoyStandby = 0;
[_listselect, clientOwner] remoteExec ["abort_logi_remote_call",2];
waitUntil {sleep 0.5; (!(_selectedGroup isEqualTo (KP_liberation_logistics select _listselect))) || (logiError == 1)};
};
logiError = 0;
_tempvariable = nil;
ctrlEnable [75803, true];
if (_logi_count != (count KP_liberation_logistics)) then {
_logi_count = (count KP_liberation_logistics);
lbClear 75802;
{
lbAdd [75802, (_x select 0)];
} forEach KP_liberation_logistics;
};
if ((_logi_count > 0) && (lbCurSel 75802 == -1)) then {
lbSetCurSel [75802,0];
};
_listselect = (lbCurSel 75802);
if ((_listselect != -1) && (_logi_count > 0)) then {
{ctrlShow [_x, true]} forEach _detailControls;
_selectedGroup = +(KP_liberation_logistics select _listselect);
if ((_selectedGroup select 7) == 0) then {
ctrlEnable [758021, true];
if ((_selectedGroup select 1) <= 0) then {
ctrlEnable [75804, true];
} else {
ctrlEnable [758022, true];
ctrlEnable [758024, true];
ctrlEnable [758025, true];
ctrlEnable [758026, true];
ctrlEnable [758027, true];
ctrlEnable [758029, true];
ctrlEnable [758030, true];
ctrlEnable [758031, true];
ctrlEnable [758032, true];
ctrlEnable [758080, true];
};
};
ctrlSetText [75805, (_selectedGroup select 0)];
switch ((_selectedGroup select 7)) do {
case 0: {ctrlSetText[758011, "-"]; ctrlSetText[75807, localize "STR_LOGISTIC_STANDBY"];};
case 1: {ctrlSetText[758011, "B"]; ctrlSetText[75807, localize "STR_LOGISTIC_LOADING"]; ctrlEnable [758081, true]; "spawn_marker" setMarkerPosLocal (_selectedGroup select 2); _mapdisplay ctrlMapAnimAdd [0.5, 0.2,(_selectedGroup select 2)]; ctrlMapAnimCommit _mapdisplay;};
case 2: {ctrlSetText[758011, "B"]; ctrlSetText[75807, localize "STR_LOGISTIC_TRAVEL"]; ctrlEnable [758081, true];};
case 3: {ctrlSetText[758011, "A"]; ctrlSetText[75807, localize "STR_LOGISTIC_LOADING"]; ctrlEnable [758081, true]; "spawn_marker" setMarkerPosLocal (_selectedGroup select 3); _mapdisplay ctrlMapAnimAdd [0.5, 0.2,(_selectedGroup select 3)]; ctrlMapAnimCommit _mapdisplay;};
case 4: {ctrlSetText[758011, "A"]; ctrlSetText[75807, localize "STR_LOGISTIC_TRAVEL"]; ctrlEnable [758081, true];};
case 5: {ctrlSetText[758011, "A"]; ctrlSetText[75807, localize "STR_LOGISTIC_ABORT"];};
case 6: {ctrlSetText[758011, "B"]; ctrlSetText[75807, localize "STR_LOGISTIC_ABORT"];};
};
((findDisplay 75802) displayCtrl 75809) ctrlSetTextColor [1,1,1,1];
if ((_selectedGroup select 8) != -1) then {
switch (_selectedGroup select 9) do {
case 2: {((findDisplay 75802) displayCtrl 75809) ctrlSetTextColor [0.9,0,0,1]; ctrlSetText[75809, localize "STR_LOGISTIC_NOSPACE"];};
case 3: {((findDisplay 75802) displayCtrl 75809) ctrlSetTextColor [0.9,0,0,1]; ctrlSetText[75809, localize "STR_LOGISTIC_NORESSOURCES"];};
default {ctrlSetText[75809,(format [localize "STR_PRODUCTION_MINUTES",(_selectedGroup select 8)])];};
};
} else {
ctrlSetText[75809, "-"];
};
ctrlSetText [758014, (str (_selectedGroup select 1))];
ctrlSetText [758016, (str ((_selectedGroup select 6) select 0))];
ctrlSetText [758018, (str ((_selectedGroup select 6) select 1))];
ctrlSetText [758020, (str ((_selectedGroup select 6) select 2))];
lbClear 758024;
lbClear 758029;
{
lbAdd [758024, format ["%1 (%2/%3/%4)",(_x select 0), (_x select 2), (_x select 3), (_x select 4)]];
lbAdd [758029, format ["%1 (%2/%3/%4)",(_x select 0), (_x select 2), (_x select 3), (_x select 4)]];
} forEach _logi_destinations;
if (!((_selectedGroup select 2) isEqualTo [0,0,0])) then {
ctrlShow [758024,false];
ctrlShow [758033,true];
{
// Why the hell does "if ((_selectedGroup select 2) isEqualTo (_x select 1)) ..." return false? -.-
if (((_selectedGroup select 2) distance2D (_x select 1) < 10)) exitWith {ctrlSetText [758033, _x select 0];};
} forEach _logi_destinations;
} else {
ctrlShow [758024,true];
ctrlShow [758033,false];
};
if (!((_selectedGroup select 3) isEqualTo [0,0,0])) then {
ctrlShow [758029,false];
ctrlShow [758034,true];
{
if (((_selectedGroup select 3) distance2D (_x select 1) < 10)) exitWith {ctrlSetText [758034, _x select 0];};
} forEach _logi_destinations;
} else {
ctrlShow [758029,true];
ctrlShow [758034,false];
};
ctrlSetText [758025, (str ((_selectedGroup select 4) select 0))];
ctrlSetText [758026, (str ((_selectedGroup select 4) select 1))];
ctrlSetText [758027, (str ((_selectedGroup select 4) select 2))];
ctrlSetText [758030, (str ((_selectedGroup select 5) select 0))];
ctrlSetText [758031, (str ((_selectedGroup select 5) select 1))];
ctrlSetText [758032, (str ((_selectedGroup select 5) select 2))];
} else {
{ctrlShow [_x, false]} forEach _detailControls;
_selectedGroup = [];
};
waitUntil {
!dialog
|| !(alive player)
|| (lbCurSel 75802) != _listselect
|| addLogiGroup != 0
|| deleteLogiGroup != 0
|| buyLogiTruck != 0
|| sellLogiTruck != 0
|| saveConvoySettings != 0
|| convoyStandby != 0
};
};
"spawn_marker" setMarkerPosLocal markers_reset;

View File

@@ -0,0 +1,202 @@
waitUntil {!isNil "GRLIB_permissions"};
private _players_array = [];
private _uids_array = ["Default"];
private _dialog = createDialog "liberation_permissions";
permission_playerid = -1;
permission_toset = -1;
save_changes = 0;
color_authorized = [0,0.9,0,1];
color_denied = [0.9,0,0,1];
fontsize = 0.017 * safezoneH;
private _modify_permissions = +GRLIB_permissions;
disableSerialization;
waitUntil { dialog };
permission_create_activetext = compileFinal '
params ["_idx", "_column", "_permission", "_text", "_tooltip"];
private _control = (findDisplay 5118) ctrlCreate ["RscActiveText", ((10 * _idx) + 111) + _column, (findDisplay 5118) displayCtrl 9969];
_control ctrlSetPosition [0.072 * _column * safeZoneW, (_idx * 0.025) * safezoneH, 0.072 * safeZoneW, 0.025 * safezoneH];
_control ctrlSetText _text;
_control ctrlSetFontHeight fontsize;
_control ctrlSetTooltip _tooltip;
buttonSetAction [((10 * _idx) + 111) + _column, format ["permission_playerid = %1; permission_toset = %2;", _idx, _permission]];
_control ctrlSetTextColor color_denied;
_control ctrlSetActiveColor color_denied;
_control ctrlCommit 0;
';
_players_array pushback ["Default", localize "STR_DEFAULT", 0];
private _idx = 2;
{
if (!((name _x) in ["HC1", "HC2", "HC3"])) then {
private _nextplayer = _x;
private _displayname = "";
if(count (squadParams _nextplayer) != 0) then {
_displayname = "[" + ((squadParams _nextplayer select 0) select 0) + "] ";
};
_displayname = _displayname + name _nextplayer;
_players_array pushback [getPlayerUID _nextplayer, _displayname, _idx];
_uids_array pushBack getPlayerUID _nextplayer;
_idx = _idx + 1;
};
} foreach allPlayers;
_idx = _idx + 1;
{
if !((_x select 0) in _uids_array) then {
_players_array pushBack [_x select 0, _x select 1, _idx];
_idx = _idx + 1;
}
} forEach _modify_permissions;
{
private _nextplayer = _x;
private _idx = _nextplayer select 2;
if (_idx % 2 == 0) then {
private _control = (findDisplay 5118) ctrlCreate ["RscBackground", -1, (findDisplay 5118) displayCtrl 9969];
_control ctrlSetPosition [0, (_idx * 0.025) * safezoneH, 0.595 * safeZoneW, 0.025 * safezoneH];
_control ctrlSetBackgroundColor [0.75,1,0.75,0.12];
_control ctrlCommit 0;
};
private _control = (findDisplay 5118) ctrlCreate ["RscText", (10 * _idx), (findDisplay 5118) displayCtrl 9969];
_control ctrlSetPosition [0, (_idx * 0.025) * safezoneH, 0.072 * safeZoneW, 0.025 * safezoneH];
_control ctrlSetText (_nextplayer select 1);
_control ctrlSetFontHeight fontsize;
_control ctrlCommit 0;
[_idx, 1, 0, localize "STR_PERMISSIONS_LIGHT", localize "STR_PERMISSIONS_TOOLTIP_LIGHT"] call permission_create_activetext;
[_idx, 2, 1, localize "STR_PERMISSIONS_ARMORED", localize "STR_PERMISSIONS_TOOLTIP_ARMORED"] call permission_create_activetext;
[_idx, 3, 2, localize "STR_PERMISSIONS_AIR", localize "STR_PERMISSIONS_TOOLTIP_AIR"] call permission_create_activetext;
[_idx, 4, 3, localize "STR_PERMISSIONS_CONSTRUCTION", localize "STR_PERMISSIONS_TOOLTIP_CONSTRUCTION"] call permission_create_activetext;
[_idx, 5, 4, localize "STR_PERMISSIONS_RECYCLING", localize "STR_PERMISSIONS_TOOLTIP_RECYCLING"] call permission_create_activetext;
[_idx, 6, 5, localize "STR_PERMISSIONS_MISC", localize "STR_PERMISSIONS_TOOLTIP_MISC"] call permission_create_activetext;
_control = (findDisplay 5118) ctrlCreate ["RscButton", ((10 * _idx) + 111) + 7, (findDisplay 5118) displayCtrl 9969];
_control ctrlSetPosition [((0.075 * 7) - 0.02) * safeZoneW, ((_idx * 0.025) * safezoneH) + 0.0025, (0.035 * safeZoneW), 0.022 * safezoneH];
_control ctrlSetText (localize "STR_PERMISSIONS_ALL");
_control ctrlSetFontHeight fontsize;
_control ctrlSetTooltip (localize "STR_PERMISSIONS_TOOLTIP_ALL");
buttonSetAction [ ((10 * _idx) + 111) + 7, format ["permission_playerid = %1; permission_toset = 666;", _idx]];
_control ctrlCommit 0;
_control = (findDisplay 5118) ctrlCreate ["RscButton", ((10 * _idx) + 111) + 8, (findDisplay 5118) displayCtrl 9969];
_control ctrlSetPosition [((0.075 * 7) + 0.02) * safeZoneW, (_idx * 0.025) * safezoneH + 0.0025, 0.035 * safeZoneW, 0.022 * safezoneH];
_control ctrlSetText (localize "STR_PERMISSIONS_NONE");
_control ctrlSetFontHeight fontsize;
_control ctrlSetTooltip (localize "STR_PERMISSIONS_TOOLTIP_NONE");
buttonSetAction [((10 * _idx) + 111) + 8, format ["permission_playerid = %1; permission_toset = 999;", _idx]];
_control ctrlCommit 0;
} foreach _players_array;
while {dialog && alive player} do {
if (permission_playerid != -1 || permission_toset != -1) then {
private _player_uid = "";
private _player_name = "";
{
if (_x select 2 == permission_playerid) exitWith {_player_uid = _x select 0; _player_name = _x select 1;};
} foreach _players_array;
if (_player_uid != "") then {
private _player_idx = -1;
private _player_uids = [];
private _player_permissions = [];
{
_player_uids pushback (_x select 0);
} foreach _modify_permissions;
_player_idx = _player_uids find _player_uid;
if (permission_toset == 666) then {
_player_permissions = [true, true, true, true, true, true];
};
if (permission_toset == 999) then {
_player_permissions = [false, false, false, false, false, false];
};
if (_player_idx == -1) then {
if (permission_toset != 666 && permission_toset != 999) then {
_player_permissions = [false, false, false, false, false, false];
_player_permissions set [permission_toset, true];
};
_modify_permissions pushback [_player_uid, _player_name, _player_permissions];
} else {
if (permission_toset != 666 && permission_toset != 999) then {
_player_permissions = (_modify_permissions select _player_idx) select 2;
private _idx = 0;
{
if (permission_toset == _idx) exitWith {
if (_player_permissions select _idx) then {
_player_permissions set [_idx, false];
} else {
_player_permissions set [_idx, true];
};
};
_idx = _idx + 1;
} foreach _player_permissions;
};
_modify_permissions set [_player_idx, [_player_uid, _player_name, _player_permissions]];
};
};
permission_playerid = -1;
permission_toset = -1;
};
{
private _nextplayer = _x;
{
if (_nextplayer select 0 == _x select 0) exitWith {
private _idx = _nextplayer select 2;
private _player_permissions = _x select 2;
{
private _control = ((findDisplay 5118) displayCtrl ((10 * _idx) + _x + 111));
if (_player_permissions select (_x - 1)) then {
_control ctrlSetTextColor color_authorized;
_control ctrlSetActiveColor color_authorized;
} else {
_control ctrlSetTextColor color_denied;
_control ctrlSetActiveColor color_denied;
};
} foreach [1, 2, 3, 4, 5, 6];
};
} foreach _modify_permissions;
} foreach _players_array;
if (save_changes == 1) then {
GRLIB_permissions = +_modify_permissions;
publicVariable "GRLIB_permissions";
closeDialog 0;
};
waitUntil {!dialog || !(alive player) || permission_playerid != -1 || permission_toset != -1 || save_changes != 0};
};

View File

@@ -0,0 +1,136 @@
private ["_dialog", "_color_positive", "_color_neutral", "_color_negative", "_color_actual", "_sectorType", "_storage", "_crateCount", "_crateMax", "_producing", "_storagespace", "_productiontime", "_saveChanges", "_listselect", "_listcolor", "_selectedSector", "_mapdisplay", "_supplyValue", "_ammoValue", "_fuelValue"];
_dialog = createDialog "liberation_production";
saveSectorSetting = 0;
new_production = 0;
_color_positive = [0,0.9,0,1];
_color_neutral = [1,1,1,1];
_color_negative = [0.9,0,0,1];
_color_actual = _color_neutral;
_listselect = -1;
_listcolor = [1,1,1,1];
_selectedSector = [];
disableSerialization;
waitUntil {dialog};
_mapdisplay = ((findDisplay 75801) displayCtrl 758016);
lbClear 75802;
{
lbAdd [75802, (markerText (_x select 1))];
} forEach KP_liberation_production;
ctrlMapAnimClear _mapdisplay;
while {dialog && (alive player)} do {
if (lbCurSel 75802 == -1) then {
lbSetCurSel [75802,0];
};
if (saveSectorSetting == 1) then {
saveSectorSetting = 0;
[(_selectedSector select 1), new_production] remoteExec ["change_prod_remote_call",2];
waitUntil {sleep 0.5; (!(_selectedSector isEqualTo (KP_liberation_production select _listselect)))};
};
_listselect = -1;
{
_listselect = _listselect + 1;
if ((count (_x select 3)) > 0) then {
switch (_x select 7) do {
case 1: {_listcolor = [0.75,0,0,1];};
case 2: {_listcolor = [0.75,0.75,0,1];};
case 3: {_listcolor = [1,1,1,1];};
default {_listcolor = [0,0.75,0,1];};
};
} else {
_listcolor = [0.6,0.6,0.6,0.8];
};
lbSetColor [75802, _listselect, _listcolor];
} forEach KP_liberation_production;
_listselect = (lbCurSel 75802);
waitUntil {_listselect == (lbCurSel 75802)};
_selectedSector = +(KP_liberation_production select _listselect);
ctrlSetText [75803,(_selectedSector select 0)];
if ((_selectedSector select 2) == 1) then {_sectorType = localize "STR_PRODUCTION_FACTORY";} else {_sectorType = localize "STR_PRODUCTION_CITY";};
ctrlSetText [75804, _sectorType];
if ((count (_selectedSector select 3)) > 0) then {
_storage = ((nearestObjects [((_selectedSector select 3) select 0), [KP_liberation_small_storage_building], 25]) select 0);
_crateCount = count (attachedObjects _storage);
_crateMax = count (KP_liberation_small_storage_positions);
if (_crateCount >= _crateMax) then {
_color_actual = _color_negative;
};
_storagespace = format ["%1 / %2",_crateCount,_crateMax];
_productiontime = format [localize "STR_PRODUCTION_MINUTES",(_selectedSector select 8)];
switch (_selectedSector select 7) do {
case 1: {_producing = localize "STR_AMMO";};
case 2: {_producing = localize "STR_FUEL";};
case 3: {_producing = localize "STR_PRODUCTION_NOTHING"; _productiontime = localize "STR_PRODUCTION_NOTIMER";};
default {_producing = localize "STR_MANPOWER";};
};
ctrlSetText [75805, _producing];
if ((_selectedSector select 7) == 3) then {
((findDisplay 75801) displayCtrl 75805) ctrlSetTextColor _color_negative;
((findDisplay 75801) displayCtrl 75807) ctrlSetTextColor _color_negative;
} else {
((findDisplay 75801) displayCtrl 75805) ctrlSetTextColor _color_neutral;
((findDisplay 75801) displayCtrl 75807) ctrlSetTextColor _color_neutral;
};
ctrlSetText [75806, _storagespace];
((findDisplay 75801) displayCtrl 75806) ctrlSetTextColor _color_actual;
ctrlSetText [75807, _productiontime];
_color_actual = _color_neutral;
} else {
_producing = localize "STR_PRODUCTION_NOTHING";
_storagespace = localize "STR_PRODUCTION_NOSTORAGE";
_productiontime = localize "STR_PRODUCTION_NOTIMER";
ctrlSetText [75805, _producing];
((findDisplay 75801) displayCtrl 75805) ctrlSetTextColor _color_negative;
ctrlSetText [75806, _storagespace];
((findDisplay 75801) displayCtrl 75806) ctrlSetTextColor _color_negative;
ctrlSetText [75807, _productiontime];
((findDisplay 75801) displayCtrl 75807) ctrlSetTextColor _color_negative;
};
if (_selectedSector select 4) then {_color_actual = _color_positive;} else {_color_actual = _color_negative;};
((findDisplay 75801) displayCtrl 75808) ctrlSetTextColor _color_actual;
if (_selectedSector select 5) then {_color_actual = _color_positive;} else {_color_actual = _color_negative;};
((findDisplay 75801) displayCtrl 75809) ctrlSetTextColor _color_actual;
if (_selectedSector select 6) then {_color_actual = _color_positive;} else {_color_actual = _color_negative;};
((findDisplay 75801) displayCtrl 758010) ctrlSetTextColor _color_actual;
_color_actual = _color_neutral;
_supplyValue = ceil ((_selectedSector select 9) / 100);
_ammoValue = ceil ((_selectedSector select 10) / 100);
_fuelValue = ceil ((_selectedSector select 11) / 100);
if (_supplyValue == 1) then {_supplyValue = format [localize "STR_PRODUCTION_CRATE", _supplyValue];} else {_supplyValue = format [localize "STR_PRODUCTION_CRATES", _supplyValue];};
if (_ammoValue == 1) then {_ammoValue = format [localize "STR_PRODUCTION_CRATE", _ammoValue];} else {_ammoValue = format [localize "STR_PRODUCTION_CRATES", _ammoValue];};
if (_fuelValue == 1) then {_fuelValue = format [localize "STR_PRODUCTION_CRATE", _fuelValue];} else {_fuelValue = format [localize "STR_PRODUCTION_CRATES", _fuelValue];};
ctrlSetText [758011, (str (_selectedSector select 9)) + " (" + _supplyValue + ")"];
ctrlSetText [758012, (str (_selectedSector select 10)) + " (" + _ammoValue + ")"];
ctrlSetText [758013, (str (_selectedSector select 11)) + " (" + _fuelValue + ")"];
"spawn_marker" setMarkerPosLocal (markerPos (_selectedSector select 1));
_mapdisplay ctrlMapAnimAdd [0.5, 0.2,(markerPos (_selectedSector select 1))];
ctrlMapAnimCommit _mapdisplay;
waitUntil {!dialog || !(alive player) || (lbCurSel 75802) != _listselect || saveSectorSetting != 0};
};
"spawn_marker" setMarkerPosLocal markers_reset;

View File

@@ -0,0 +1,106 @@
[] call compileFinal preprocessFileLineNumbers "scripts\client\misc\init_markers.sqf";
switch (KP_liberation_arsenal) do {
case 1: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\custom.sqf";};
case 2: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\rhsusaf.sqf";};
case 3: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\3cbBAF.sqf";};
case 4: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\gm_west.sqf";};
case 5: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\gm_east.sqf";};
case 6: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\csat.sqf";};
case 7: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\unsung.sqf";};
case 8: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\sfp.sqf";};
case 9: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\bwmod.sqf";};
case 10: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\vanilla_nato_mtp.sqf";};
case 11: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\vanilla_nato_tropic.sqf";};
case 12: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\vanilla_nato_wdl.sqf";};
case 13: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\vanilla_csat_hex.sqf";};
case 14: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\vanilla_csat_ghex.sqf";};
case 15: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\vanilla_aaf.sqf";};
case 16: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\vanilla_ldf.sqf";};
default {GRLIB_arsenal_weapons = [];GRLIB_arsenal_magazines = [];GRLIB_arsenal_items = [];GRLIB_arsenal_backpacks = [];};
};
if (typeOf player == "VirtualSpectator_F") exitWith {
execVM "scripts\client\markers\empty_vehicles_marker.sqf";
execVM "scripts\client\markers\fob_markers.sqf";
execVM "scripts\client\markers\group_icons.sqf";
execVM "scripts\client\markers\hostile_groups.sqf";
execVM "scripts\client\markers\sector_manager.sqf";
execVM "scripts\client\markers\spot_timer.sqf";
execVM "scripts\client\misc\synchronise_vars.sqf";
execVM "scripts\client\ui\ui_manager.sqf";
};
// This causes the script error with not defined variable _display in File A3\functions_f_bootcamp\Inventory\fn_arsenal.sqf [BIS_fnc_arsenal], line 2122
// ["Preload"] call BIS_fnc_arsenal;
spawn_camera = compileFinal preprocessFileLineNumbers "scripts\client\spawn\spawn_camera.sqf";
cinematic_camera = compileFinal preprocessFileLineNumbers "scripts\client\ui\cinematic_camera.sqf";
write_credit_line = compileFinal preprocessFileLineNumbers "scripts\client\ui\write_credit_line.sqf";
do_load_box = compileFinal preprocessFileLineNumbers "scripts\client\ammoboxes\do_load_box.sqf";
kp_fuel_consumption = compileFinal preprocessFileLineNumbers "scripts\client\misc\kp_fuel_consumption.sqf";
kp_vehicle_permissions = compileFinal preprocessFileLineNumbers "scripts\client\misc\vehicle_permissions.sqf";
execVM "scripts\client\actions\intel_manager.sqf";
execVM "scripts\client\actions\recycle_manager.sqf";
execVM "scripts\client\actions\unflip_manager.sqf";
execVM "scripts\client\ammoboxes\ammobox_action_manager.sqf";
execVM "scripts\client\build\build_overlay.sqf";
execVM "scripts\client\build\do_build.sqf";
execVM "scripts\client\commander\enforce_whitelist.sqf";
if (KP_liberation_mapmarkers) then {execVM "scripts\client\markers\empty_vehicles_marker.sqf";};
execVM "scripts\client\markers\fob_markers.sqf";
if (!KP_liberation_high_command && KP_liberation_mapmarkers) then {execVM "scripts\client\markers\group_icons.sqf";};
execVM "scripts\client\markers\hostile_groups.sqf";
if (KP_liberation_mapmarkers) then {execVM "scripts\client\markers\huron_marker.sqf";} else {deleteMarkerLocal "huronmarker"};
execVM "scripts\client\markers\sector_manager.sqf";
execVM "scripts\client\markers\spot_timer.sqf";
execVM "scripts\client\misc\broadcast_squad_colors.sqf";
execVM "scripts\client\misc\init_arsenal.sqf";
execVM "scripts\client\misc\permissions_warning.sqf";
if (!KP_liberation_ace) then {execVM "scripts\client\misc\resupply_manager.sqf";};
execVM "scripts\client\misc\secondary_jip.sqf";
execVM "scripts\client\misc\synchronise_vars.sqf";
execVM "scripts\client\misc\synchronise_eco.sqf";
execVM "scripts\client\misc\playerNamespace.sqf";
execVM "scripts\client\spawn\redeploy_manager.sqf";
execVM "scripts\client\ui\ui_manager.sqf";
execVM "scripts\client\ui\tutorial_manager.sqf";
execVM "scripts\client\markers\update_production_sites.sqf";
player addMPEventHandler ["MPKilled", {_this spawn kill_manager;}];
player addEventHandler ["GetInMan", {[_this select 2] spawn kp_fuel_consumption;}];
player addEventHandler ["GetInMan", {[_this select 2] call KPLIB_fnc_setVehiclesSeized;}];
player addEventHandler ["GetInMan", {[_this select 2] call KPLIB_fnc_setVehicleCaptured;}];
player addEventHandler ["GetInMan", {[_this select 2] call kp_vehicle_permissions;}];
player addEventHandler ["SeatSwitchedMan", {[_this select 2] call kp_vehicle_permissions;}];
player addEventHandler ["HandleRating", {if ((_this select 1) < 0) then {0};}];
// Disable stamina, if selected in parameter
if (!GRLIB_fatigue) then {
player enableStamina false;
player addEventHandler ["Respawn", {player enableStamina false;}];
};
// Reduce aim precision coefficient, if selected in parameter
if (!KPLIB_sway) then {
player setCustomAimCoef 0.1;
player addEventHandler ["Respawn", {player setCustomAimCoef 0.1;}];
};
execVM "scripts\client\ui\intro.sqf";
[player] joinSilent (createGroup [GRLIB_side_friendly, true]);
// Commander init
if (player isEqualTo ([] call KPLIB_fnc_getCommander)) then {
// Start tutorial
if (KP_liberation_tutorial) then {
[] call KPLIB_fnc_tutorial;
};
// Request Zeus if enabled
if (KP_liberation_commander_zeus) then {
[] spawn {
sleep 5;
[] call KPLIB_fnc_requestZeus;
};
};
};

View File

@@ -0,0 +1,52 @@
private [ "_vehmarkers", "_markedveh", "_cfg", "_vehtomark", "_supporttomark", "_marker" ];
_vehmarkers = [];
_markedveh = [];
_cfg = configFile >> "cfgVehicles";
_vehtomark = [];
_support_to_skip = [
KP_liberation_recycle_building,
KP_liberation_air_vehicle_building,
"B_Slingload_01_Repair_F",
"B_Slingload_01_Fuel_F",
"B_Slingload_01_Ammo_F"
];
{
_vehtomark append _x;
} forEach [KPLIB_b_light_classes, KPLIB_b_heavy_classes, KPLIB_b_air_classes, KPLIB_b_support_classes];
_vehtomark = _vehtomark - _support_to_skip;
while { true } do {
_markedveh = [];
{
if (alive _x && (toLower (typeof _x)) in _vehtomark && (count (crew _x)) == 0 && (_x distance2d startbase) > 500) then {
_markedveh pushback _x;
};
} foreach vehicles;
if ( count _markedveh != count _vehmarkers ) then {
{ deleteMarkerLocal _x; } foreach _vehmarkers;
_vehmarkers = [];
{
_marker = createMarkerLocal [ format [ "markedveh%1" ,_x], markers_reset ];
_marker setMarkerColorLocal "ColorKhaki";
_marker setMarkerTypeLocal "mil_dot";
_marker setMarkerSizeLocal [ 0.75, 0.75 ];
_vehmarkers pushback _marker;
} foreach _markedveh;
};
{
_marker = _vehmarkers select (_markedveh find _x);
_marker setMarkerPosLocal getpos _x;
_marker setMarkerTextLocal (getText (_cfg >> typeOf _x >> "displayName"));
} foreach _markedveh;
sleep 5;
};

View File

@@ -0,0 +1,50 @@
waitUntil {!isNil "save_is_loaded"};
waitUntil {!isNil "GRLIB_all_fobs"};
waitUntil {save_is_loaded};
uiSleep 3;
private _markers = [];
private _markers_mobilespawns = [];
while {true} do {
if (count _markers != count GRLIB_all_fobs) then {
{deleteMarkerLocal _x;} forEach _markers;
_markers = [];
for "_idx" from 0 to ((count GRLIB_all_fobs) - 1) do {
private _marker = createMarkerLocal [format ["fobmarker%1", _idx], markers_reset];
_marker setMarkerTypeLocal "b_hq";
_marker setMarkerSizeLocal [1.5, 1.5];
_marker setMarkerPosLocal (GRLIB_all_fobs select _idx);
_marker setMarkerTextLocal format ["FOB %1",military_alphabet select _idx];
_marker setMarkerColorLocal "ColorYellow";
_markers pushback _marker;
};
};
if (KP_liberation_mobilerespawn) then {
private _respawn_trucks = [] call KPLIB_fnc_getMobileRespawns;
if (count _markers_mobilespawns != count _respawn_trucks) then {
{deleteMarkerLocal _x;} forEach _markers_mobilespawns;
_markers_mobilespawns = [];
for "_idx" from 0 to ((count _respawn_trucks) - 1) do {
_marker = createMarkerLocal [format ["mobilespawn%1", _idx], markers_reset];
_marker setMarkerTypeLocal "mil_end";
_marker setMarkerColorLocal "ColorYellow";
_markers_mobilespawns pushback _marker;
};
};
if (count _respawn_trucks == count _markers_mobilespawns) then {
for "_idx" from 0 to ((count _markers_mobilespawns) - 1) do {
(_markers_mobilespawns select _idx) setMarkerPosLocal getPos (_respawn_trucks select _idx);
(_markers_mobilespawns select _idx) setMarkerTextLocal format ["%1 %2", localize "STR_RESPAWN_TRUCK", mapGridPosition (_respawn_trucks select _idx)];
};
};
};
sleep 5;
};

View File

@@ -0,0 +1,68 @@
private [ "_iconed_groups", "_ticks", "_localgroup", "_grouptype", "_groupicon" ];
_iconed_groups = [];
_ticks = 0;
setGroupIconsVisible [true,false];
while { true } do {
{
if ((_x != group player) && ((side _x == GRLIB_side_friendly))) then {
if ( (_x in _iconed_groups) && (
(count units _x == 0) || (side _x == GRLIB_side_friendly && (((leader _x) distance (markerPos GRLIB_respawn_marker) < 100) || ((leader _x) distance startbase < 500))))) then {
clearGroupIcons _x;
_iconed_groups = _iconed_groups - [_x];
};
if ( !(_x in _iconed_groups) && (
(count units _x > 0) && (side _x == GRLIB_side_friendly && (((leader _x) distance (markerPos GRLIB_respawn_marker) > 100) && ((leader _x) distance startbase > 500))))) then {
clearGroupIcons _x;
_localgroup = _x;
_grouptype = [_localgroup] call KPLIB_fnc_getGroupType;
_groupicon = "";
switch (_grouptype) do {
case "infantry": { _groupicon = "b_inf" };
case "light": { _groupicon = "b_motor_inf" };
case "heavy": { _groupicon = "b_armor" };
case "air": { _groupicon = "b_air" };
case "support": { _groupicon = "b_maint" };
case "static": { _groupicon = "b_mortar" };
case "uav": { _groupicon = "b_uav" };
default { };
};
_localgroup addGroupIcon [ _groupicon, [ 0,0 ] ];
if ( side _localgroup == GRLIB_side_friendly ) then {
_groupiconsize = "group_0";
_groupsize = (count (units _localgroup));
if ( _groupsize >= 2 ) then { _groupiconsize = "group_1" };
if ( _groupsize >= 6 ) then { _groupiconsize = "group_2" };
if ( _groupsize >= 10 ) then { _groupiconsize = "group_3" };
_localgroup addGroupIcon [ _groupiconsize, [ 0,0 ] ];
};
_iconed_groups pushback _x;
};
};
} foreach allGroups;
{
_color = [];
if ( isplayer leader _x ) then {
_color = [0.8,0.8,0,1];
} else {
_color = [0,0.3,0.8,1];
};
_x setGroupIconParams [_color,"",1,true];
} foreach _iconed_groups;
_ticks = _ticks + 1;
if ( _ticks >= 15 ) then {
_ticks = 0;
_iconed_groups = [];
};
sleep 4.7;
};

View File

@@ -0,0 +1,52 @@
private ["_kp_markers_array","_kp_markers_start","_kp_markers_change","_kp_markers_pos","_kp_markers_posx","_kp_markers_posy","_kp_markers_name","_kp_markers_color"];
waitUntil {sleep 0.1; !isNil "save_is_loaded" && {save_is_loaded}};
_kp_markers_array = [];
_kp_markers_start = 0.2;
_kp_markers_change = 0.05;
while {true} do {
{deleteMarkerLocal _x;} forEach _kp_markers_array;
_kp_markers_array = [];
{
if ((side _x == GRLIB_side_enemy) && (({!captive _x} count (units _x) ) > 0) && ([(getpos leader _x), GRLIB_side_friendly, GRLIB_radiotower_size] call KPLIB_fnc_getNearestTower != "")) then {
_kp_markers_pos = getPosATL leader _x;
_kp_markers_posx = floor (_kp_markers_pos select 0);
_kp_markers_posx = _kp_markers_posx - (_kp_markers_posx mod 500);
_kp_markers_posy = floor (_kp_markers_pos select 1);
_kp_markers_posy = _kp_markers_posy - (_kp_markers_posy mod 500);
// Chernarus Grid Fix
if (worldName == "Chernarus") then {
_kp_markers_posy = _kp_markers_posy - 140;
if ((_kp_markers_posy + 500) < (_kp_markers_pos select 1)) then {
_kp_markers_posy = _kp_markers_posy + 500;
};
};
// Sahrani Grid Fix
if (worldName == "Sara") then {
_kp_markers_posy = _kp_markers_posy - 20;
if ((_kp_markers_posy + 500) < (_kp_markers_pos select 1)) then {
_kp_markers_posy = _kp_markers_posy + 500;
};
};
_kp_markers_name = format["kp_marker_grid_%1_%2", _kp_markers_posx, _kp_markers_posy];
_kp_markers_color = format["Color%1", side _x];
if ((markerShape _kp_markers_name) isEqualTo "RECTANGLE") then {
_kp_markers_name setMarkerAlphaLocal ((markerAlpha _kp_markers_name) + _kp_markers_change);
} else {
createMarkerLocal[_kp_markers_name, [_kp_markers_posx + 250, _kp_markers_posy + 250, 0]];
_kp_markers_name setMarkerShapeLocal "RECTANGLE";
_kp_markers_name setMarkerSizeLocal [250,250];
_kp_markers_name setMarkerColorLocal _kp_markers_color;
_kp_markers_name setMarkerAlphaLocal (_kp_markers_start + _kp_markers_change);
_kp_markers_array pushBack _kp_markers_name;
};
};
} forEach allGroups;
uiSleep (60 + (random 60));
};

View File

@@ -0,0 +1,13 @@
private [ "_huronlocal" ];
"huronmarker" setMarkerTextLocal "Potato 01";
while { true } do {
_huronlocal = [] call KPLIB_fnc_potatoScan;
if ( !( isNull _huronlocal) ) then {
"huronmarker" setmarkerposlocal (getpos _huronlocal);
} else {
"huronmarker" setmarkerposlocal markers_reset;
};
sleep 4.9;
};

View File

@@ -0,0 +1,36 @@
waitUntil {!isNil "save_is_loaded"};
waitUntil {!isNil "GRLIB_vehicle_to_military_base_links"};
waitUntil {!isNil "blufor_sectors"};
waitUntil {save_is_loaded};
private _vehicle_unlock_markers = [];
private _cfg = configFile >> "cfgVehicles";
{
_x params ["_vehicle", "_base"];
private _marker = createMarkerLocal [format ["vehicleunlockmarker%1", _base], [(markerpos _base) select 0, ((markerpos _base) select 1) + 125]];
_marker setMarkerTextLocal (getText (_cfg >> _vehicle >> "displayName"));
_marker setMarkerColorLocal GRLIB_color_enemy;
_marker setMarkerTypeLocal "mil_pickup";
_vehicle_unlock_markers pushback [_marker, _base];
} forEach GRLIB_vehicle_to_military_base_links;
private _sector_count = -1;
uiSleep 1;
while {true} do {
waitUntil {
uiSleep 1;
count blufor_sectors != _sector_count
};
{_x setMarkerColorLocal GRLIB_color_enemy;} forEach (sectors_allSectors - blufor_sectors);
{_x setMarkerColorLocal GRLIB_color_friendly;} forEach blufor_sectors;
{
_x params ["_marker", "_base"];
_marker setMarkerColorLocal ([GRLIB_color_enemy, GRLIB_color_friendly] select (_base in blufor_sectors));
} forEach _vehicle_unlock_markers;
_sector_count = count blufor_sectors;
};

View File

@@ -0,0 +1,23 @@
createMarkerLocal ["opfor_bg_marker", markers_reset];
"opfor_bg_marker" setMarkerTypeLocal "mil_unknown";
"opfor_bg_marker" setMarkerColorLocal GRLIB_color_enemy_bright;
createMarkerLocal ["opfor_capture_marker", markers_reset];
"opfor_capture_marker" setMarkerTypeLocal "mil_objective";
"opfor_capture_marker" setMarkerColorLocal GRLIB_color_enemy_bright;
if ( isNil "sector_timer" ) then { sector_timer = 0 };
while { true } do {
sleep 1;
if ( sector_timer > 0 ) then {
"opfor_capture_marker" setMarkerTextLocal format ["%1",([sector_timer] call KPLIB_fnc_secondsToTimer)];
sector_timer = sector_timer - 1;
} else {
"opfor_capture_marker" setMarkerTextLocal "VULNERABLE";
waitUntil{
sleep 1;
sector_timer > 0
};
};
};

View File

@@ -0,0 +1,22 @@
waitUntil {!isNil "save_is_loaded"};
waitUntil {!isNil "KP_liberation_production_markers"};
waitUntil {save_is_loaded};
private _KP_liberation_production_markers_old = [0];
while {GRLIB_endgame == 0} do {
waitUntil {sleep 5;
!(_KP_liberation_production_markers_old isEqualTo KP_liberation_production_markers)
};
{
private _marker_text = (_x select 4) + " [";
if (_x select 1) then {_marker_text = _marker_text + "S";};
if (_x select 2) then {_marker_text = _marker_text + "A";};
if (_x select 3) then {_marker_text = _marker_text + "F";};
_marker_text = _marker_text + "]";
(_x select 0) setMarkerTextLocal _marker_text;
} forEach KP_liberation_production_markers;
_KP_liberation_production_markers_old = +KP_liberation_production_markers;
};

View File

@@ -0,0 +1,12 @@
while { true } do {
if ( local group player ) then {
{
if ( _x getVariable ["GRLIB_squad_color", "MAIN"] != assignedTeam _x ) then {
_x setVariable ["GRLIB_squad_color", assignedTeam _x, true ];
};
} foreach (units group player);
};
sleep 5;
};

View File

@@ -0,0 +1,113 @@
if (KP_liberation_arsenalUsePreset) then {
private _crawled = [] call KPLIB_fnc_crawlAllItems;
private _weapons = [];
private _magazines = [];
private _items = [];
private _backpacks = [];
KP_liberation_allowed_items = [];
if (isNil "GRLIB_arsenal_weapons") then {GRLIB_arsenal_weapons = []};
if (isNil "GRLIB_arsenal_magazines") then {GRLIB_arsenal_magazines = []};
if (isNil "GRLIB_arsenal_items") then {GRLIB_arsenal_items = []};
if (isNil "GRLIB_arsenal_backpacks") then {GRLIB_arsenal_backpacks = []};
if (isNil "blacklisted_from_arsenal") then {blacklisted_from_arsenal = []};
if ((count GRLIB_arsenal_weapons) == 0) then {
if ((count blacklisted_from_arsenal) == 0) then {
_weapons = _crawled select 0;
} else {
{if (!(_x in blacklisted_from_arsenal)) then {_weapons pushBack _x};} forEach (_crawled select 0);
};
[missionNamespace, _weapons] call BIS_fnc_addVirtualWeaponCargo;
KP_liberation_allowed_items append _weapons;
} else {
[missionNamespace, GRLIB_arsenal_weapons] call BIS_fnc_addVirtualWeaponCargo;
KP_liberation_allowed_items append GRLIB_arsenal_weapons;
};
// Support for CBA disposable launchers, https://github.com/CBATeam/CBA_A3/wiki/Disposable-Launchers
if !(configProperties [configFile >> "CBA_DisposableLaunchers"] isEqualTo []) then {
private _disposableLaunchers = ["CBA_FakeLauncherMagazine"];
{
private _loadedLauncher = cba_disposable_LoadedLaunchers get _x;
if (!isNil "_loadedLauncher") then {
_disposableLaunchers pushBack _loadedLauncher;
};
private _normalLauncher = cba_disposable_NormalLaunchers get _x;
if (!isNil "_normalLauncher") then {
_normalLauncher params ["_loadedLauncher"];
_disposableLaunchers pushBack _loadedLauncher;
};
} forEach KP_liberation_allowed_items;
KP_liberation_allowed_items append _disposableLaunchers;
};
if ((count GRLIB_arsenal_magazines) == 0) then {
if ((count blacklisted_from_arsenal) == 0) then {
_magazines = _crawled select 1;
} else {
{if (!(_x in blacklisted_from_arsenal)) then {_magazines pushBack _x};} forEach (_crawled select 1);
};
[missionNamespace, _magazines] call BIS_fnc_addVirtualMagazineCargo;
KP_liberation_allowed_items append _magazines;
} else {
[missionNamespace, GRLIB_arsenal_magazines] call BIS_fnc_addVirtualMagazineCargo;
KP_liberation_allowed_items append GRLIB_arsenal_magazines;
};
if ((count GRLIB_arsenal_items) == 0) then {
if ((count blacklisted_from_arsenal) == 0) then {
_items = _crawled select 2;
} else {
{if (!(_x in blacklisted_from_arsenal)) then {_items pushBack _x};} forEach (_crawled select 2);
};
[missionNamespace, _items] call BIS_fnc_addVirtualItemCargo;
KP_liberation_allowed_items append _items;
} else {
[missionNamespace, GRLIB_arsenal_items] call BIS_fnc_addVirtualItemCargo;
KP_liberation_allowed_items append GRLIB_arsenal_items;
};
if ((count GRLIB_arsenal_backpacks) == 0) then {
if ((count blacklisted_from_arsenal) == 0) then {
_backpacks = _crawled select 3;
} else {
{if (!(_x in blacklisted_from_arsenal)) then {_backpacks pushBack _x};} forEach (_crawled select 3);
};
[missionNamespace, _backpacks] call BIS_fnc_addVirtualBackpackCargo;
KP_liberation_allowed_items append _backpacks;
} else {
[missionNamespace, GRLIB_arsenal_backpacks] call BIS_fnc_addVirtualBackpackCargo;
KP_liberation_allowed_items append GRLIB_arsenal_backpacks;
};
{
if ((_x find "rhs_acc") == 0) then {
KP_liberation_allowed_items_extension append [_x + "_3d", _x + "_pip"];
};
if ((_x find "rhsusf_acc") == 0) then {
KP_liberation_allowed_items_extension append [_x + "_3d", _x + "_pip"];
};
} forEach KP_liberation_allowed_items;
if ((count KP_liberation_allowed_items_extension) > 0) then {
KP_liberation_allowed_items append KP_liberation_allowed_items_extension;
};
if (KP_liberation_ace && KP_liberation_arsenal_type) then {
[player, KP_liberation_allowed_items, false] call ace_arsenal_fnc_addVirtualItems;
};
// Lowercase all classnames
KP_liberation_allowed_items = KP_liberation_allowed_items apply {toLower _x};
} else {
[missionNamespace, true] call BIS_fnc_addVirtualWeaponCargo;
[missionNamespace, true] call BIS_fnc_addVirtualMagazineCargo;
[missionNamespace, true] call BIS_fnc_addVirtualItemCargo;
[missionNamespace, true] call BIS_fnc_addVirtualBackpackCargo;
if (KP_liberation_ace && KP_liberation_arsenal_type) then {
[player, true, false] call ace_arsenal_fnc_addVirtualItems;
};
};

View File

@@ -0,0 +1,9 @@
_marker = createMarkerLocal ["zone_capture", markers_reset];
_marker setMarkerColorLocal "ColorUNKNOWN";
_marker setMarkerShapeLocal "Ellipse";
_marker setMarkerBrushLocal "SolidBorder";
_marker setMarkerSizeLocal [ GRLIB_capture_size, GRLIB_capture_size ];
_marker = createMarkerLocal ["spawn_marker", markers_reset];
_marker setMarkerColorLocal "ColorGreen";
_marker setMarkerTypeLocal "Select";

View File

@@ -0,0 +1,53 @@
/*
kp_fuel_consumption.sqf
Author: Wyqer
Website: www.killahpotatoes.de
Date: 2017-02-02
Description:
This script handles the fuel consumption of vehicles, so that refueling will be necessary more often.
Parameters:
_this select 0 - OBJECT - Vehicle
Method:
execVM
Example for initPlayerLocal.sqf:
player addEventHandler ["GetInMan", {[ _this select 2] execVM "scripts\kp_fuel_consumption.sqf";}];
*/
//CONFIG
// Time in Minutes till a full tank depletes when the vehicle is standing with running engine
private _kp_neutral_consumption = KP_liberation_fuel_neutral;
// Time in Minutes till a full tank depletes when the vehicle is driving
private _kp_normal_consumption = KP_liberation_fuel_normal;
// Time in Minutes till a full tank depletes when the vehicle is driving at max speed
private _kp_max_consumption = KP_liberation_fuel_max;
/*
DO NOT EDIT BELOW
*/
if (isNil "kp_fuel_consumption_vehicles") then {
kp_fuel_consumption_vehicles = [];
};
if (!((_this select 0) in kp_fuel_consumption_vehicles)) then {
kp_fuel_consumption_vehicles pushBack (_this select 0);
while {local (_this select 0)} do {
if (isEngineOn (_this select 0)) then {
if (speed (_this select 0) > 5) then {
if (speed (_this select 0) > (getNumber (configFile >> "CfgVehicles" >> typeOf (_this select 0) >> "maxSpeed") * 0.9)) then {
(_this select 0) setFuel (fuel (_this select 0) - (1 / (_kp_max_consumption * 60)));
} else {
(_this select 0) setFuel (fuel (_this select 0) - (1 / (_kp_normal_consumption * 60)));
};
} else {
(_this select 0) setFuel (fuel (_this select 0) - (1 / (_kp_neutral_consumption * 60)));
};
};
uiSleep 1;
};
kp_fuel_consumption_vehicles deleteAt (kp_fuel_consumption_vehicles find (_this select 0));
};

View File

@@ -0,0 +1,14 @@
if ( GRLIB_permissions_param ) then {
waitUntil { !(isNil "GRLIB_permissions") };
sleep 5;
while { count GRLIB_permissions == 0 } do {
hint localize "STR_PERMISSION_WARNING";
sleep 5;
};
hintSilent "";
};

View File

@@ -0,0 +1,69 @@
/*
File: playerNamespace.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2020-04-12
Last Update: 2020-05-08
License: MIT License - http://www.opensource.org/licenses/MIT
Description:
Tracks player state values to provide this information for other scripts.
*/
scriptName "KPLIB_playerNamespace";
waitUntil {!isNil "one_synchro_done"};
waitUntil {!isNil "one_eco_done"};
waitUntil {one_synchro_done};
waitUntil {one_eco_done};
private _fobPos = [0, 0, 0];
private _fobDist = 99999;
private _fobName = "";
while {true} do {
// FOB distance, name and position
if !(GRLIB_all_fobs isEqualTo []) then {
_fobPos = [] call KPLIB_fnc_getNearestFob;
_fobDist = player distance2d _fobPos;
_fobName = ["", ["FOB", [_fobPos] call KPLIB_fnc_getFobName] joinString " "] select (_fobDist < GRLIB_fob_range);
} else {
_fobPos = [0, 0, 0];
_fobDist = 99999;
_fobName = "";
};
// TODO more self explanatory names, KPLIB_nearestFobDist, KPLIB_currentFobName, KPLIB_nearestFobPos
player setVariable ["KPLIB_fobDist", _fobDist];
player setVariable ["KPLIB_fobName", _fobName];
player setVariable ["KPLIB_fobPos", _fobPos];
// Direct acces due to config, commander or admin
player setVariable ["KPLIB_hasDirectAccess", (getPlayerUID player) in KP_liberation_commander_actions || {player == ([] call KPLIB_fnc_getCommander)} || {serverCommandAvailable "#kick"}];
// Outside of startbase "safezone"
player setVariable ["KPLIB_isAwayFromStart", (player distance2d startbase) > 1000];
// Is near an arsenal object
if (KP_liberation_mobilearsenal) then {
player setVariable ["KPLIB_isNearArsenal", !(((player nearObjects [Arsenal_typename, 5]) select {getObjectType _x >= 8}) isEqualTo [])];
};
// Is near a mobile respawn
if (KP_liberation_mobilerespawn) then {
player setVariable ["KPLIB_isNearMobRespawn", !((player nearEntities [[Respawn_truck_typename, huron_typename], 10]) isEqualTo [])];
};
// Is near startbase
player setVariable ["KPLIB_isNearStart", (player distance2d startbase) < 200];
// Nearest activated sector and possible production data
player setVariable ["KPLIB_nearProd", KP_liberation_production param [KP_liberation_production findIf {(_x select 1) isEqualTo ([100] call KPLIB_fnc_getNearestSector)}, []]];
player setVariable ["KPLIB_nearSector", [GRLIB_sector_size] call KPLIB_fnc_getNearestSector];
// Zeus module synced to player
player setVariable ["KPLIB_ownedZeusModule", getAssignedCuratorLogic player];
// Update state in Discord rich presence
[] call KPLIB_fnc_setDiscordState;
sleep 1;
};

View File

@@ -0,0 +1,80 @@
private [ "_resupply_dist", "_repair_increment", "_repair_speed", "_repair_altitude", "_veh", "_repaired", "_rearmed", "_refueled", "_average_damage", "_average_fuel", "_screenmsg", "_rearm_time", "_refuel_amount", "_rearm_ticker" ];
_repair_amount = 0.01;
_repair_speed = 2;
_repair_altitude = 2;
_resupply_dist = 30;
_rearm_time = 60;
_refuel_amount = 0.02;
_rearm_ticker = 0;
while { true } do {
_repaired = false;
_rearmed = false;
_refueled = false;
_average_damage = 0;
_average_fuel = 0;
_screenmsg = "";
_veh = vehicle player;
if ( _veh != player ) then {
if ( effectiveCommander _veh == player ) then {
if ( (speed _veh < _repair_speed) && (((getPosATL _veh) select 2) < _repair_altitude) ) then {
if ( count ( (getpos _veh) nearEntities [ vehicle_repair_sources , _resupply_dist] ) > 0 ) then {
if ( damage _veh > 0 ) then {
_repaired = true;
_average_damage = (damage _veh) - _repair_amount;
if ( _average_damage < 0 ) then { _average_damage = 0 };
_veh setDamage _average_damage;
};
};
if ( ( count ( (getpos _veh) nearEntities [ vehicle_rearm_sources , _resupply_dist] ) > 0 ) && ( _rearm_ticker < _rearm_time ) ) then {
_rearmed = true;
_rearm_ticker = _rearm_ticker + 1;
if ( _rearm_ticker >= _rearm_time ) then {
[_veh, 1] remoteExecCall ["setVehicleAmmo", _veh];
};
};
if ( count ( (getpos _veh) nearEntities [ vehicle_refuel_sources , _resupply_dist] ) > 0 ) then {
if ( fuel _veh < ( 1 - _refuel_amount ) ) then {
_refueled = true;
[_veh, (fuel _veh + _refuel_amount)] remoteExecCall ["setFuel", _veh];
};
};
} else {
_rearm_ticker = 0;
};
} else {
_rearm_ticker = 0;
};
} else {
_rearm_ticker = 0;
};
if ( _repaired ) then {
_screenmsg = format [ "%1 : %2%3", localize "STR_REPAIRING", round ( 100 - (_average_damage * 100) ), "%" ];
};
if ( _rearmed ) then {
if ( _repaired ) then {
_screenmsg = format [ "%1 - ", _screenmsg ];
};
_screenmsg = format [ "%1%2", _screenmsg, format [ localize "STR_REARMING", _rearm_time - _rearm_ticker ] ];
};
if ( _refueled ) then {
if ( _repaired || _rearmed ) then {
_screenmsg = format [ "%1 - ", _screenmsg ];
};
_screenmsg = format [ "%1%2", _screenmsg, format [ "%1 : %2%3", localize "STR_REFUELING", round ( (fuel _veh) * 100 ), "%" ] ];
};
titleText [ _screenmsg, "PLAIN DOWN" ];
sleep 1;
};

View File

@@ -0,0 +1,10 @@
waitUntil {
time > 20;
};
if ( isNil "GRLIB_secondary_in_progress" ) exitWith {};
if ( GRLIB_secondary_in_progress < 0 ) exitWith {};
if ( GRLIB_secondary_in_progress == 0 ) then {
[ 2 ] call remote_call_intel;
};

View File

@@ -0,0 +1,14 @@
one_eco_done = false;
waitUntil {!isNil "sync_eco"};
while {true} do {
waitUntil {
sleep 0.2;
count sync_eco > 0;
};
KP_liberation_production = sync_eco select 0;
KP_liberation_logistics = sync_eco select 1;
KP_liberation_production_markers = sync_eco select 2;
sync_eco = [];
one_eco_done = true;
};

View File

@@ -0,0 +1,30 @@
one_synchro_done = false;
synchro_done = false;
waitUntil {!isNil "sync_vars"};
while {true} do {
waitUntil {sleep 0.2; (count sync_vars) > 0};
KP_liberation_fob_resources = sync_vars select 0;
KP_liberation_supplies_global = sync_vars select 1;
KP_liberation_ammo_global = sync_vars select 2;
KP_liberation_fuel_global = sync_vars select 3;
unitcap = sync_vars select 4;
KP_liberation_heli_count = sync_vars select 5;
KP_liberation_plane_count = sync_vars select 6;
KP_liberation_heli_slots = sync_vars select 7;
KP_liberation_plane_slots = sync_vars select 8;
combat_readiness = sync_vars select 9;
resources_intel = sync_vars select 10;
infantry_cap = sync_vars select 11;
KP_liberation_civ_rep = sync_vars select 12;
KP_liberation_guerilla_strength = sync_vars select 13;
infantry_weight = sync_vars select 14;
armor_weight = sync_vars select 15;
air_weight = sync_vars select 16;
sync_vars = [];
one_synchro_done = true;
synchro_done = true;
};

View File

@@ -0,0 +1,20 @@
params ["_vehicle"];
private _vehicleClass = toLower (typeOf _vehicle);
// Cargo is always allowed
private _isCargo = (_vehicle getCargoIndex player) != -1;
if (_isCargo || _vehicle isKindOf "ParachuteBase") exitWith {};
private _permissibleVehicles = [
[KPLIB_typeLightClasses, "STR_PERMISSION_NO_LIGHT"],
[KPLIB_typeHeavyClasses, "STR_PERMISSION_NO_ARMOR"],
[KPLIB_typeAirClasses, "STR_PERMISSION_NO_AIR"]
];
private _permissionIdx = _permissibleVehicles findIf {_vehicleClass in (_x select 0)};
if (_permissionIdx isEqualTo -1) exitWith {};
if !([_permissionIdx] call KPLIB_fnc_hasPermission) exitWith {
moveOut player;
hint localize (_permissibleVehicles select _permissionIdx select 1);
};

View File

@@ -0,0 +1,10 @@
if ( isDedicated ) exitWith {};
params [ "_battlegroup_position" ];
"opfor_bg_marker" setMarkerPosLocal ( markerPos _battlegroup_position );
[ "lib_battlegroup", [ markerText ( [ 10000, markerPos _battlegroup_position ] call KPLIB_fnc_getNearestSector ) ] ] call BIS_fnc_showNotification;
sleep 600;
"opfor_bg_marker" setMarkerPosLocal markers_reset;

View File

@@ -0,0 +1,6 @@
player allowDamage false;
(vehicle player) allowDamage false;
GRLIB_endgame = 1;
sleep 20;
_this call compileFinal preprocessFileLineNumbers "scripts\client\ui\end_screen.sqf";

View File

@@ -0,0 +1,30 @@
if ( isDedicated ) exitWith {};
if ( isNil "sector_timer" ) then { sector_timer = 0 };
params [ "_fob", "_status" ];
private [ "_fobname" ];
_fobname = [_fob] call KPLIB_fnc_getFobName;
if ( _status == 0 ) then {
[ "lib_fob_built", [ _fobname ] ] call BIS_fnc_showNotification;
};
if ( _status == 1 ) then {
[ "lib_fob_attacked", [ _fobname ] ] call BIS_fnc_showNotification;
"opfor_capture_marker" setMarkerPosLocal _fob;
sector_timer = GRLIB_vulnerability_timer;
};
if ( _status == 2 ) then {
[ "lib_fob_lost", [ _fobname ] ] call BIS_fnc_showNotification;
"opfor_capture_marker" setMarkerPosLocal markers_reset;
sector_timer = 0;
};
if ( _status == 3 ) then {
[ "lib_fob_safe", [ _fobname ] ] call BIS_fnc_showNotification;
"opfor_capture_marker" setMarkerPosLocal markers_reset;
sector_timer = 0;
};

View File

@@ -0,0 +1,23 @@
if ( isDedicated ) exitWith {};
params [ "_attack_destination" ];
if ( isNil "GRLIB_last_incoming_notif_time" ) then { GRLIB_last_incoming_notif_time = -9999 };
if ( time > GRLIB_last_incoming_notif_time + 60 ) then {
GRLIB_last_incoming_notif_time = time;
private [ "_attack_location_name" ];
_attack_location_name = [_attack_destination] call KPLIB_fnc_getLocationName;
[ "lib_incoming", [ _attack_location_name ] ] call BIS_fnc_showNotification;
private [ "_mrk" ];
_mrk = createMarkerLocal [ "opfor_incoming_marker", _attack_destination];
"opfor_incoming_marker" setMarkerTypeLocal "selector_selectedMission";
"opfor_incoming_marker" setMarkerColorLocal GRLIB_color_enemy_bright;
sleep 250;
deleteMarkerLocal _mrk;
};

View File

@@ -0,0 +1,59 @@
if (isDedicated) exitWith {};
params ["_notiftype", ["_obj_position", getpos player]];
switch (_notiftype) do {
case 0: {["lib_intel_prisoner"] call BIS_fnc_showNotification;};
case 1: {["lib_intel_document"] call BIS_fnc_showNotification;};
case 2: {
waitUntil {!isNil "secondary_objective_position_marker"};
waitUntil {count secondary_objective_position_marker > 0};
waitUntil {secondary_objective_position_marker distance zeropos > 1000};
["lib_intel_fob", [markertext ([10000, secondary_objective_position_marker] call KPLIB_fnc_getNearestSector)]] call BIS_fnc_showNotification;
_secondary_marker = createMarkerLocal ["secondarymarker", secondary_objective_position_marker];
_secondary_marker setMarkerColorLocal GRLIB_color_enemy_bright;
_secondary_marker setMarkerTypeLocal "hd_unknown";
_secondary_marker_zone = createMarkerLocal ["secondarymarkerzone", secondary_objective_position_marker];
_secondary_marker_zone setMarkerColorLocal GRLIB_color_enemy_bright;
_secondary_marker_zone setMarkerShapeLocal "ELLIPSE";
_secondary_marker_zone setMarkerBrushLocal "FDiagonal";
_secondary_marker_zone setMarkerSizeLocal [1500,1500];
};
case 3: {
["lib_secondary_fob_destroyed"] call BIS_fnc_showNotification;
deleteMarkerLocal "secondarymarker";
deleteMarkerLocal "secondarymarkerzone";
secondary_objective_position_marker = [];
};
case 4: {["lib_intel_convoy", [markertext ([10000, _obj_position] call KPLIB_fnc_getNearestSector)]] call BIS_fnc_showNotification;};
case 5: {["lib_secondary_convoy_destroyed"] call BIS_fnc_showNotification;};
case 6: {
waitUntil {!isNil "secondary_objective_position_marker"};
waitUntil {count secondary_objective_position_marker > 0};
waitUntil {secondary_objective_position_marker distance zeropos > 1000};
["lib_intel_sar", [markertext ([10000, secondary_objective_position_marker] call KPLIB_fnc_getNearestSector)]] call BIS_fnc_showNotification;
_secondary_marker = createMarkerLocal ["secondarymarker", secondary_objective_position_marker];
_secondary_marker setMarkerColorLocal GRLIB_color_enemy_bright;
_secondary_marker setMarkerTypeLocal "hd_unknown";
_secondary_marker_zone = createMarkerLocal ["secondarymarkerzone", secondary_objective_position_marker];
_secondary_marker_zone setMarkerColorLocal GRLIB_color_enemy_bright;
_secondary_marker_zone setMarkerShapeLocal "ELLIPSE";
_secondary_marker_zone setMarkerBrushLocal "FDiagonal";
_secondary_marker_zone setMarkerSizeLocal [1500,1500];
};
case 7: {
["lib_intel_sar_failed"] call BIS_fnc_showNotification;
deleteMarkerLocal "secondarymarker";
deleteMarkerLocal "secondarymarkerzone";
secondary_objective_position_marker = [];
};
case 8: {
["lib_intel_sar_succeeded"] call BIS_fnc_showNotification;
deleteMarkerLocal "secondarymarker";
deleteMarkerLocal "secondarymarkerzone";
secondary_objective_position_marker = [];
};
default {[format ["remote_call_intel.sqf -> no valid value for _notiftype: %1", _notiftype], "ERROR"] remoteExecCall ["KPLIB_fnc_log", 2];};
};

View File

@@ -0,0 +1,86 @@
params [ "_unit" ];
private [ "_nearestfob", "_is_near_fob", "_is_near_blufor", "_grp", "_waypoint", "_nearblufor" ];
waitUntil {
sleep 0.5;
local _unit
};
_is_near_fob = false;
_is_near_blufor = true;
sleep 1;
_unit playmove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon";
sleep 2;
_unit enableAI "ANIM";
_unit enableAI "MOVE";
sleep 2;
[_unit, ""] remoteExecCall ["switchMove"];
if ( typeof _unit == pilot_classname ) exitWith {};
waitUntil { sleep 5;
_nearestfob = [ getpos _unit ] call KPLIB_fnc_getNearestFob;
if ( count _nearestfob == 3) then {
if ( ( _unit distance _nearestfob ) < 30 ) then {
_is_near_fob = true;
};
};
_is_near_blufor = false;
if ( !_is_near_blufor ) then {
{
if ((_x distance _unit) < 100) exitWith { _is_near_blufor = true };
} forEach (allUnits select {!((toLower (typeof _x)) in KPLIB_o_inf_classes || (typeof _x) in militia_squad)});
};
!alive _unit || !(_is_near_blufor) || (_is_near_fob && (vehicle _unit == _unit))
};
if (alive _unit) then {
if (_is_near_fob) then {
sleep 5;
_grp = createGroup [GRLIB_side_civilian, true];
[_unit] joinSilent _grp;
_unit playmove "AmovPercMstpSnonWnonDnon_AmovPsitMstpSnonWnonDnon_ground";
_unit disableAI "ANIM";
_unit disableAI "MOVE";
sleep 5;
[_unit, "AidlPsitMstpSnonWnonDnon_ground00"] remoteExecCall ["switchMove"];
[_unit] remoteExec ["prisonner_remote_call",2];
sleep 600;
deleteVehicle _unit;
} else {
_grp = createGroup [GRLIB_side_enemy, true];
[_unit] joinSilent _grp;
_unit setUnitPos "AUTO";
_unit setCaptive false;
if ((vehicle _unit != _unit) && !(_unit isEqualTo (driver vehicle _unit))) then {
unAssignVehicle _unit;
_unit action ["eject", vehicle _unit];
_unit action ["getout", vehicle _unit];
unAssignVehicle _unit;
};
while {(count (waypoints _grp)) != 0} do {deleteWaypoint ((waypoints _grp) select 0);};
{_x doFollow leader _grp} foreach units _grp;
_possible_sectors = (sectors_allSectors - blufor_sectors);
if ( count _possible_sectors > 0 ) then {
_possible_sectors = [ _possible_sectors , [getpos _unit, 5000] , { (markerPos _x) distance _input0 } , 'ASCEND' ] call BIS_fnc_sortBy;
if ( count _possible_sectors > 0 ) then {
_target_sector = _possible_sectors select 0;
_waypoint = _grp addWaypoint [markerpos _target_sector, 300];
_waypoint setWaypointType "MOVE";
_waypoint setWaypointSpeed "FULL";
};
};
};
};

View File

@@ -0,0 +1,30 @@
if ( isDedicated ) exitWith {};
if ( isNil "sector_timer" ) then { sector_timer = 0 };
params [ "_sector", "_status" ];
if ( _status == 0 ) then {
[ "lib_sector_captured", [ markerText _sector ] ] call BIS_fnc_showNotification;
};
if ( _status == 1 ) then {
[ "lib_sector_attacked", [ markerText _sector ] ] call BIS_fnc_showNotification;
"opfor_capture_marker" setMarkerPosLocal ( markerpos _sector );
sector_timer = GRLIB_vulnerability_timer;
};
if ( _status == 2 ) then {
[ "lib_sector_lost", [ markerText _sector ] ] call BIS_fnc_showNotification;
"opfor_capture_marker" setMarkerPosLocal markers_reset;
sector_timer = 0;
};
if ( _status == 3 ) then {
[ "lib_sector_safe", [ markerText _sector ] ] call BIS_fnc_showNotification;
"opfor_capture_marker" setMarkerPosLocal markers_reset;
sector_timer = 0;
};
{ _x setMarkerColorLocal GRLIB_color_enemy; } foreach (sectors_allSectors - blufor_sectors);
{ _x setMarkerColorLocal GRLIB_color_friendly; } foreach blufor_sectors;

View File

@@ -0,0 +1,64 @@
private [ "_dialog", "_backpack", "_backpackcontents" ];
if ( isNil "GRLIB_last_halo_jump" ) then { GRLIB_last_halo_jump = -6000; };
if ( GRLIB_halo_param > 1 && ( GRLIB_last_halo_jump + ( GRLIB_halo_param * 60 ) ) >= time ) exitWith {
hint format [ localize "STR_HALO_DENIED_COOLDOWN", ceil ( ( ( GRLIB_last_halo_jump + ( GRLIB_halo_param * 60 ) ) - time ) / 60 ) ];
};
_dialog = createDialog "liberation_halo";
dojump = 0;
halo_position = getpos player;
_backpackcontents = [];
[ "halo_map_event", "onMapSingleClick", { halo_position = _pos } ] call BIS_fnc_addStackedEventHandler;
"spawn_marker" setMarkerTextLocal (localize "STR_HALO_PARAM");
waitUntil { dialog };
while { dialog && alive player && dojump == 0 } do {
"spawn_marker" setMarkerPosLocal halo_position;
sleep 0.1;
};
if ( dialog ) then {
closeDialog 0;
sleep 0.1;
};
"spawn_marker" setMarkerPosLocal markers_reset;
"spawn_marker" setMarkerTextLocal "";
[ "halo_map_event", "onMapSingleClick" ] call BIS_fnc_removeStackedEventHandler;
if ( dojump > 0 ) then {
GRLIB_last_halo_jump = time;
halo_position = halo_position getPos [random 250, random 360];
halo_position = [ halo_position select 0, halo_position select 1, GRLIB_halo_altitude + (random 200) ];
halojumping = true;
sleep 0.1;
cutRsc ["fasttravel", "PLAIN", 1];
playSound "parasound";
sleep 2;
_backpack = backpack player;
if ( _backpack != "" && _backpack != "B_Parachute" ) then {
_backpackcontents = backpackItems player;
removeBackpack player;
sleep 0.1;
};
player addBackpack "B_Parachute";
player setpos halo_position;
sleep 4;
halojumping = false;
waitUntil { !alive player || isTouchingGround player };
if ( _backpack != "" && _backpack != "B_Parachute" ) then {
sleep 2;
player addBackpack _backpack;
clearAllItemsFromBackpack player;
{ player addItemToBackpack _x } foreach _backpackcontents;
};
};

View File

@@ -0,0 +1,229 @@
#define DEPLOY_DISPLAY (findDisplay 5201)
#define DEPLOY_LIST_IDC 201
#define DEPLOY_BUTTON_IDC 202
KPLIB_respawnPositionsList = [];
fullmap = 0;
private _old_fullmap = 0;
private _oldsel = -999;
private _standard_map_pos = [];
private _frame_pos = [];
GRLIB_force_redeploy = false;
waitUntil {!isNil "GRLIB_all_fobs"};
waitUntil {!isNil "blufor_sectors"};
waitUntil {!isNil "save_is_loaded"};
waitUntil {save_is_loaded};
private _spawn_str = "";
waitUntil {!isNil "introDone"};
waitUntil {introDone};
waitUntil {!isNil "cinematic_camera_stop"};
waitUntil {cinematic_camera_stop};
private _basenamestr = "Operation Base";
KP_liberation_respawn_time = time;
KP_liberation_respawn_mobile_done = false;
while {true} do {
waitUntil {
sleep 0.2;
(GRLIB_force_redeploy || (player distance (markerPos GRLIB_respawn_marker) < 50)) && vehicle player == player && alive player && !dialog && howtoplay == 0
};
private _backpack = backpack player;
fullmap = 0;
_old_fullmap = 0;
GRLIB_force_redeploy = false;
createDialog "liberation_deploy";
deploy = 0;
_oldsel = -999;
showCinemaBorder false;
camUseNVG false;
respawn_camera = "camera" camCreate (getposATL startbase);
respawn_object = "Sign_Arrow_Blue_F" createVehicleLocal (getposATL startbase);
respawn_object hideObject true;
respawn_camera camSetTarget respawn_object;
respawn_camera cameraEffect ["internal","back"];
respawn_camera camcommit 0;
waitUntil {dialog};
(DEPLOY_DISPLAY displayCtrl DEPLOY_LIST_IDC) ctrlAddEventHandler ["mouseButtonDblClick", {
if (ctrlEnabled (DEPLOY_DISPLAY displayCtrl DEPLOY_BUTTON_IDC)) then {
deploy = 1;
};
}];
_standard_map_pos = ctrlPosition (DEPLOY_DISPLAY displayCtrl 251);
_frame_pos = ctrlPosition (DEPLOY_DISPLAY displayCtrl 198);
// Get loadouts either from ACE or BI arsenals
private ["_loadouts_data"];
if (KP_liberation_ace && KP_liberation_arsenal_type) then {
_loadouts_data = +(profileNamespace getVariable ["ace_arsenal_saved_loadouts", []]);
} else {
private _saved_loadouts = +(profileNamespace getVariable "bis_fnc_saveInventory_data");
_loadouts_data = [];
private _counter = 0;
if (!isNil "_saved_loadouts") then {
{
if (_counter % 2 == 0) then {
_loadouts_data pushback _x;
};
_counter = _counter + 1;
} forEach _saved_loadouts;
};
};
lbAdd [203, "--"];
{lbAdd [203, _x param [0]]} forEach _loadouts_data;
lbSetCurSel [203, 0];
while {dialog && alive player && deploy == 0} do {
// ARRAY - [[NAME, POSITION(, OBJECT)], ...]
KPLIB_respawnPositionsList = [[_basenamestr, getposATL startbase]];
{
KPLIB_respawnPositionsList pushBack [
format ["FOB %1 - %2", (military_alphabet select _forEachIndex), mapGridPosition _x],
_x
];
} forEach GRLIB_all_fobs;
if (KP_liberation_mobilerespawn) then {
if (KP_liberation_respawn_time <= time) then {
private _mobileRespawns = [] call KPLIB_fnc_getMobileRespawns;
{
KPLIB_respawnPositionsList pushBack [
format ["%1 - %2", localize "STR_RESPAWN_TRUCK", mapGridPosition getPosATL _x],
getPosATL _x,
_x
];
} forEach _mobileRespawns
};
};
lbClear DEPLOY_LIST_IDC;
{
lbAdd [DEPLOY_LIST_IDC, (_x select 0)];
} foreach KPLIB_respawnPositionsList;
if (lbCurSel DEPLOY_LIST_IDC == -1) then {
lbSetCurSel [201, 0];
};
if (lbCurSel DEPLOY_LIST_IDC != _oldsel) then {
_oldsel = lbCurSel DEPLOY_LIST_IDC;
private _objectpos = [0,0,0];
if (dialog) then {
_objectpos = ((KPLIB_respawnPositionsList select _oldsel) select 1);
};
respawn_object setPosATL ((KPLIB_respawnPositionsList select _oldsel) select 1);
private _startdist = 120;
private _enddist = 120;
private _alti = 35;
if (dialog) then {
if (((KPLIB_respawnPositionsList select (lbCurSel DEPLOY_LIST_IDC)) select 0) == _basenamestr) then {
_startdist = 200;
_enddist = 300;
_alti = 30;
};
// Disable if sector is under attack
if (!KPLIB_respawnOnAttackedSectors && {_objectpos in KPLIB_sectorsUnderAttack}) then {
(DEPLOY_DISPLAY displayCtrl DEPLOY_BUTTON_IDC) ctrlSetText localize "STR_DEPLOY_UNDERATTACK";
(DEPLOY_DISPLAY displayCtrl DEPLOY_BUTTON_IDC) ctrlEnable false;
} else {
(DEPLOY_DISPLAY displayCtrl DEPLOY_BUTTON_IDC) ctrlSetText localize "STR_DEPLOY_BUTTON";
(DEPLOY_DISPLAY displayCtrl DEPLOY_BUTTON_IDC) ctrlEnable true;
};
};
"spawn_marker" setMarkerPosLocal (getpos respawn_object);
ctrlMapAnimClear (DEPLOY_DISPLAY displayCtrl 251);
private _transition_map_pos = getpos respawn_object;
private _fullscreen_map_offset = 4000;
if(fullmap % 2 == 1) then {
_transition_map_pos = [(_transition_map_pos select 0) - _fullscreen_map_offset, (_transition_map_pos select 1) + (_fullscreen_map_offset * 0.75), 0];
};
(DEPLOY_DISPLAY displayCtrl 251) ctrlMapAnimAdd [0, 0.3,_transition_map_pos];
ctrlMapAnimCommit (DEPLOY_DISPLAY displayCtrl 251);
respawn_camera camSetPos [(getpos respawn_object select 0) - 70, (getpos respawn_object select 1) + _startdist, (getpos respawn_object select 2) + _alti];
respawn_camera camcommit 0;
respawn_camera camSetPos [(getpos respawn_object select 0) - 70, (getpos respawn_object select 1) - _enddist, (getpos respawn_object select 2) + _alti];
respawn_camera camcommit 90;
};
if (_old_fullmap != fullmap) then {
_old_fullmap = fullmap;
if (fullmap % 2 == 1) then {
(DEPLOY_DISPLAY displayCtrl 251) ctrlSetPosition [ (_frame_pos select 0) + (_frame_pos select 2), (_frame_pos select 1), (0.6 * safezoneW), (_frame_pos select 3)];
} else {
(DEPLOY_DISPLAY displayCtrl 251) ctrlSetPosition _standard_map_pos;
};
(DEPLOY_DISPLAY displayCtrl 251) ctrlCommit 0.2;
_oldsel = -1;
};
uiSleep 0.1;
};
if (dialog && deploy == 1) then {
private _idxchoice = lbCurSel DEPLOY_LIST_IDC;
_spawn_str = (KPLIB_respawnPositionsList select _idxchoice) select 0;
if (count (KPLIB_respawnPositionsList select _idxchoice) == 3) then {
private _truck = (KPLIB_respawnPositionsList select _idxchoice) select 2;
player setposATL (_truck getPos [5 + (random 3), random 360]);
KP_liberation_respawn_mobile_done = true;
} else {
private _destpos = ((KPLIB_respawnPositionsList select _idxchoice) select 1);
player setposATL [((_destpos select 0) + 5) - (random 10),((_destpos select 1) + 5) - (random 10),(_destpos select 2)];
};
if ((lbCurSel 203) > 0) then {
private _selectedLoadout = _loadouts_data select ((lbCurSel 203) - 1);
if (KP_liberation_ace && KP_liberation_arsenal_type) then {
player setUnitLoadout (_selectedLoadout select 1);
} else {
[player, [profileNamespace, _selectedLoadout]] call BIS_fnc_loadInventory;
};
};
};
respawn_camera cameraEffect ["Terminate","back"];
camDestroy respawn_camera;
deleteVehicle respawn_object;
camUseNVG false;
"spawn_marker" setMarkerPosLocal markers_reset;
if (dialog) then {
closeDialog 0;
};
if (alive player && deploy == 1) then {
[_spawn_str] spawn spawn_camera;
if (KP_liberation_respawn_mobile_done) then {
KP_liberation_respawn_time = time + KP_liberation_respawn_cooldown;
KP_liberation_respawn_mobile_done = false;
};
};
if (KP_liberation_arsenalUsePreset) then {
[_backpack] call KPLIB_fnc_checkGear;
};
if (KP_liberation_mobilerespawn && (KP_liberation_respawn_time > time)) then {
hint format [localize "STR_RESPAWN_COOLDOWN_HINT", ceil ((KP_liberation_respawn_time - time) / 60)];
uiSleep 12;
hint "";
};
};

View File

@@ -0,0 +1,77 @@
private [ "_nearest_sector", "_leadingzero_hour", "_leadingzero_minute", "_startpos0", "_startpos1", "_endpos1", "_startpos2", "_endpos2", "_startpos3", "_endpos3", "_spawn_camera", "_datestring" ];
params [ "_spawn_str" ];
_nearest_sector = [2000] call KPLIB_fnc_getNearestSector;
if ( _nearest_sector != "" ) then { _nearest_sector = format ["%1 %2",localize "STR_SPAWN_NEAR", markertext _nearest_sector]; };
_leadingzero_hour = "";
_leadingzero_minute = "";
if ( (date select 3) < 10 ) then { _leadingzero_hour = "0" };
if ( (date select 4) < 10 ) then { _leadingzero_minute = "0" };
_datestring = format [ "%3/%2/%1 %4%5:%6%7", date select 0, date select 1, date select 2, _leadingzero_hour, date select 3, _leadingzero_minute, date select 4];
private [ "_spawn_camera", "_startpos0", "_startpos1", "_endpos1","_startpos2","_endpos2","_startpos3","_endpos3"];
if ( GRLIB_deployment_cinematic ) then {
camUseNVG false;
showCinemaBorder false;
_startpos0 = [ 0, 500, 3000];
_startpos1 = [ 0, 500, 250];
_endpos1 = [ 0, 450, 225];
_startpos2 = [ 0, 100, 40];
_endpos2 = [ 0, 80, 30];
_startpos3 = [ 0, 8, 2.8];
_endpos3 = [ 0, 6, 2.25];
_spawn_camera = "camera" camCreate _startpos0;
_spawn_camera cameraEffect ["internal","front"];
_spawn_camera camSetTarget player;
_spawn_camera camSetRelPos _startpos0;
_spawn_camera camcommit 0;
_spawn_camera camSetRelPos _startpos1;
_spawn_camera camcommit 0.5;
waitUntil { camCommitted _spawn_camera };
};
[ format [ "<t size='0.7' align='left'>%1<br/>%2<br/>%3<br/>%4</t>", name player, _spawn_str, _datestring, _nearest_sector ],1,0.8,8,1 ] spawn BIS_fnc_dynamictext;
if ( GRLIB_deployment_cinematic ) then {
_spawn_camera camSetRelPos _endpos1;
_spawn_camera camcommit 1.75;
waitUntil { camCommitted _spawn_camera };
_spawn_camera camSetRelPos _startpos2;
_spawn_camera camcommit 0.25;
waitUntil { camCommitted _spawn_camera };
_spawn_camera camSetRelPos _endpos2;
_spawn_camera camcommit 1.75;
waitUntil { camCommitted _spawn_camera };
_spawn_camera camSetRelPos _startpos3;
_spawn_camera camcommit 0.25;
waitUntil { camCommitted _spawn_camera };
_spawn_camera camSetRelPos _endpos3;
_spawn_camera camcommit 1.75;
waitUntil { camCommitted _spawn_camera };
_spawn_camera camSetRelPos [0,0.4,1.75];
_spawn_camera camcommit 1;
waitUntil { camCommitted _spawn_camera };
_spawn_camera cameraEffect ["Terminate","back"];
camDestroy _spawn_camera;
camUseNVG false;
};

View File

@@ -0,0 +1,48 @@
class KPLIB_Tasks_Tutorial_Main {
title = $STR_TUTORIAL_TASK_MAIN_TITLE;
description = $STR_TUTORIAL_TASK_MAIN_DESC;
};
class KPLIB_Tasks_Tutorial_Fob {
title = $STR_TUTORIAL_TASK_FOB_TITLE;
description = $STR_TUTORIAL_TASK_FOB_DESC;
};
class KPLIB_Tasks_Tutorial_Fob_01a {
title = $STR_TUTORIAL_TASK_FOB_01A_TITLE;
description = $STR_TUTORIAL_TASK_FOB_01A_DESC;
};
class KPLIB_Tasks_Tutorial_Fob_01b {
title = $STR_TUTORIAL_TASK_FOB_01B_TITLE;
description = $STR_TUTORIAL_TASK_FOB_01B_DESC;
};
class KPLIB_Tasks_Tutorial_Fob_02 {
title = $STR_TUTORIAL_TASK_FOB_02_TITLE;
description = $STR_TUTORIAL_TASK_FOB_02_DESC;
};
class KPLIB_Tasks_Tutorial_Fob_03 {
title = $STR_TUTORIAL_TASK_FOB_03_TITLE;
description = $STR_TUTORIAL_TASK_FOB_03_DESC;
};
class KPLIB_Tasks_Tutorial_Sector {
title = $STR_TUTORIAL_TASK_SECTOR_TITLE;
description = $STR_TUTORIAL_TASK_SECTOR_DESC;
};
class KPLIB_Tasks_Tutorial_Sector_01 {
title = $STR_TUTORIAL_TASK_SECTOR_01_TITLE;
description = $STR_TUTORIAL_TASK_SECTOR_01_DESC;
};
class KPLIB_Tasks_Tutorial_Sector_02 {
title = $STR_TUTORIAL_TASK_SECTOR_02_TITLE;
description = $STR_TUTORIAL_TASK_SECTOR_02_DESC;
};
class KPLIB_Tasks_Tutorial_Sector_03 {
title = $STR_TUTORIAL_TASK_SECTOR_03_TITLE;
description = $STR_TUTORIAL_TASK_SECTOR_03_DESC;
};
class KPLIB_Tasks_Tutorial_Sector_04 {
title = $STR_TUTORIAL_TASK_SECTOR_04_TITLE;
description = $STR_TUTORIAL_TASK_SECTOR_04_DESC;
};
class KPLIB_Tasks_Tutorial_Sector_05 {
title = $STR_TUTORIAL_TASK_SECTOR_05_TITLE;
description = $STR_TUTORIAL_TASK_SECTOR_05_DESC;
};

View File

@@ -0,0 +1,43 @@
/*
File: fn_handleCrateStorageTask.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2020-05-09
Last Update: 2020-05-09
License: MIT License - http://www.opensource.org/licenses/MIT
Description:
Handles the monitoring for the store crate tutorial task.
Parameter(s):
_taskId - Task ID of the task to handle [STRING, defaults to ""]
_obj - Object connected to the task [OBJECT, defaults to objNull]
Returns:
Function reached the end [BOOL]
*/
params [
["_taskId", "", [""]],
["_obj", objNull, [objNull]]
];
if (_taskId isEqualTo "" || isNull _obj) exitWith {["Invalid parameters given"] call BIS_fnc_error; false};
if (!canSuspend) exitWith {_this spawn KPLIB_fnc_handleCrateStorageTask};
[
allPlayers,
[_taskId, "KPLIB_Tasks_Tutorial_Fob_03"],
["", localize "STR_TUTORIAL_CRATE"],
[_obj, true],
"CREATED",
-1,
false,
"default",
true
] call BIS_fnc_taskCreate;
waitUntil {sleep 0.1; (toLower (typeOf (attachedTo _obj))) in KPLIB_storageBuildings};
[_taskId, "SUCCEEDED", false] call BIS_fnc_taskSetState;
true

View File

@@ -0,0 +1,43 @@
/*
File: fn_handleHealCivTask.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2020-05-09
Last Update: 2020-05-09
License: MIT License - http://www.opensource.org/licenses/MIT
Description:
Handles the monitoring for the heal civilian tutorial task.
Parameter(s):
_taskId - Task ID of the task to handle [STRING, defaults to ""]
_obj - Object connected to the task [OBJECT, defaults to objNull]
Returns:
Function reached the end [BOOL]
*/
params [
["_taskId", "", [""]],
["_obj", objNull, [objNull]]
];
if (_taskId isEqualTo "" || isNull _obj) exitWith {["Invalid parameters given"] call BIS_fnc_error; false};
if (!canSuspend) exitWith {_this spawn KPLIB_fnc_handleHealCivTask};
[
allPlayers,
[_taskId, "KPLIB_Tasks_Tutorial_Sector_03"],
["", localize "STR_TUTORIAL_CIVILIAN"],
[_obj, true],
"CREATED",
-1,
false,
"heal",
true
] call BIS_fnc_taskCreate;
waitUntil {sleep 0.1; !(alive _obj && (damage _obj) > 0.4)};
[_taskId, "SUCCEEDED"] call BIS_fnc_taskSetState;
true

View File

@@ -0,0 +1,43 @@
/*
File: fn_handleTakePowTask.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2020-05-09
Last Update: 2020-05-09
License: MIT License - http://www.opensource.org/licenses/MIT
Description:
Handles the monitoring for the capture POW tutorial task.
Parameter(s):
_taskId - Task ID of the task to handle [STRING, defaults to ""]
_obj - Object connected to the task [OBJECT, defaults to objNull]
Returns:
Function reached the end [BOOL]
*/
params [
["_taskId", "", [""]],
["_obj", objNull, [objNull]]
];
if (_taskId isEqualTo "" || isNull _obj) exitWith {["Invalid parameters given"] call BIS_fnc_error; false};
if (!canSuspend) exitWith {_this spawn KPLIB_fnc_handleTakePowTask};
[
allPlayers,
[_taskId, "KPLIB_Tasks_Tutorial_Sector_03"],
["", localize "STR_TUTORIAL_SOLDIER"],
[_obj, true],
"CREATED",
-1,
false,
"danger",
true
] call BIS_fnc_taskCreate;
waitUntil {sleep 0.1; !(alive _obj && captive _obj)};
[_taskId, "SUCCEEDED"] call BIS_fnc_taskSetState;
true

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,275 @@
if ( isNil "active_sectors" ) then { active_sectors = [] };
if ( isNil "GRLIB_all_fobs" ) then { GRLIB_all_fobs = [] };
cinematic_camera_started = true;
private _last_transition = -1;
private _last_position = [ -1, -1, -1 ];
showCinemaBorder true;
private _cinematic_camera = "camera" camCreate [0,0,0];
private _cinematic_pointer = "Sign_Arrow_Blue_F" createVehicleLocal [0,0,0];
_cinematic_pointer hideObject true;
_cinematic_camera camSetTarget _cinematic_pointer;
_cinematic_camera cameraEffect ["internal","back"];
_cinematic_camera camcommit 0;
if ( isNil "first_camera_round" ) then { first_camera_round = true; };
while { cinematic_camera_started } do {
waitUntil { !cinematic_camera_started || camCommitted _cinematic_camera };
if ( cinematic_camera_started ) then {
camUseNVG false;
private _positions = [ getpos startbase ];
if ( !first_camera_round ) then {
if ( count GRLIB_all_fobs > 0 ) then {
for [ {_idx=0},{_idx < 2},{_idx=_idx+1} ] do {
_positions pushback (selectRandom GRLIB_all_fobs);
};
};
if ( count active_sectors > 0 ) then {
for [ {_idx=0},{_idx < 5},{_idx=_idx+1} ] do {
_positions pushback (markerPos (selectRandom active_sectors));
};
} else {
for [ {_idx=0},{_idx < 5},{_idx=_idx+1} ] do {
_positions pushback (markerPos (selectRandom sectors_allSectors));
};
};
if ( GRLIB_endgame == 0 ) then {
_activeplayers = (allPlayers select {alive _x && (_x distance (markerPos GRLIB_respawn_marker)) > 100});
if ( count _activeplayers > 0 ) then {
for [ {_idx=0},{_idx < 3},{_idx=_idx+1} ] do {
_positions pushback (getpos (selectRandom _activeplayers));
};
};
};
};
_position = selectRandom (_positions - [_last_position]);
_last_position = _position;
_cinematic_pointer setpos [ _position select 0, _position select 1, (_position select 2) + 7 ];
private _nearentities = _position nearEntities [ "Man", 100 ];
private _camtarget = _cinematic_pointer;
if ( first_camera_round ) then {
_camtarget = startbase;
} else {
if (count (_nearentities select {alive _x && isPlayer _x}) != 0) then {
_camtarget = selectRandom (_nearentities select {alive _x && isPlayer _x});
} else {
if (count (_nearentities select { alive _x }) != 0) then {
_camtarget = selectRandom (_nearentities select {alive _x});
};
};
};
_cinematic_camera camSetTarget _camtarget;
private _startpos = [ ((getpos _camtarget) select 0) - 60, ((getpos _camtarget) select 1) + 350, 5 ];
private _endpos = [ ((getpos _camtarget) select 0) - 60, ((getpos _camtarget) select 1) - 230, 5 ];
private _startfov = 0.5;
private _endfov = 0.5;
if ( !first_camera_round ) then {
_startfov = 0.8;
_endfov = 0.8;
_next_transition = selectRandom ([0, 1, 2, 3, 4, 5, 6, 7 ,8 ,9 ,10, 11 ,12 ,13 ,14, 15] - [_last_transition]);
_last_transition = _next_transition;
switch ( _next_transition ) do {
case 0: {
_startpos = [ ((getpos _camtarget) select 0) - 30, ((getpos _camtarget) select 1) - 50, 15 ];
_endpos = [ ((getpos _camtarget) select 0) - 30, ((getpos _camtarget) select 1) + 50, 15 ];
_endfov = 0.8;
};
case 1: {
_startpos = [ ((getpos _camtarget) select 0) + 5, ((getpos _camtarget) select 1) - 100, 1 ];
_endpos = [ ((getpos _camtarget) select 0) + 5, ((getpos _camtarget) select 1) + 100, 40 ];
_endfov = 0.55;
};
case 2: {
_startpos = [ ((getpos _camtarget) select 0) + 50, ((getpos _camtarget) select 1) - 50, 100 ];
_endpos = [ ((getpos _camtarget) select 0) + 50, ((getpos _camtarget) select 1) + 50, 100 ];
_startfov = 0.5;
_endfov = 0.3;
};
case 3: {
_startpos = [ ((getpos _camtarget) select 0) + 50, ((getpos _camtarget) select 1) - 80, 2 ];
_endpos = [ ((getpos _camtarget) select 0) + 50, ((getpos _camtarget) select 1) + 80, 20 ];
};
case 4: {
_startpos = [ ((getpos _camtarget) select 0) - 400, ((getpos _camtarget) select 1) + 400, 50 ];
_endpos = [ ((getpos _camtarget) select 0) + 400, ((getpos _camtarget) select 1) + 400, 50 ];
_startfov = 0.25;
_endfov = 0.25;
};
case 5: {
_startpos = [ ((getpos _camtarget) select 0) + 300, ((getpos _camtarget) select 1) - 100, 15 ];
_endpos = [ ((getpos _camtarget) select 0) -300, ((getpos _camtarget) select 1) - 120, 15 ];
};
case 6: {
_startpos = [ ((getpos _camtarget) select 0) + 100, ((getpos _camtarget) select 1) - 100, 1 ];
_endpos = [ ((getpos _camtarget) select 0) + 100, ((getpos _camtarget) select 1) - 100, 50 ];
};
case 7: {
_startpos = [ ((getpos _camtarget) select 0) + 50, ((getpos _camtarget) select 1) - 50, 150 ];
_endpos = [ ((getpos _camtarget) select 0) + 20, ((getpos _camtarget) select 1) - 20, 5 ];
_startfov = 0.6;
_endfov = 0.9;
};
case 8: {
_startpos = [ ((getpos _camtarget) select 0) - 300, ((getpos _camtarget) select 1) - 80, 20 ];
_endpos = [ ((getpos _camtarget) select 0) + 300, ((getpos _camtarget) select 1) + 120, 20 ];
_startfov = 0.55;
_endfov = 0.55;
};
case 9: {
_startpos = [ ((getpos _camtarget) select 0) - 80, ((getpos _camtarget) select 1) - 300, 30 ];
_endpos = [ ((getpos _camtarget) select 0) + 120, ((getpos _camtarget) select 1) + 300, 30 ];
_startfov = 0.65;
_endfov = 0.65;
};
case 10: {
_startpos = [ ((getpos _camtarget) select 0) - 5, ((getpos _camtarget) select 1) + 30, 5 ];
_endpos = [ ((getpos _camtarget) select 0) - 25, ((getpos _camtarget) select 1) -30, 150 ];
};
case 11 : {
_cinematic_camera cameraEffect ["Terminate", "BACK"];
camDestroy _cinematic_camera;
_cinematic_camera = "camera" camCreate [0,0,0];
_cinematic_camera cameraEffect ["internal","back"];
_cinematic_camera camcommit 0;
_startpos = [ ((getpos _camtarget) select 0) + 2, ((getpos _camtarget) select 1) -200, 25 ];
_endpos = [ ((getpos _camtarget) select 0) + 2, ((getpos _camtarget) select 1) +200, 25 ];
_cinematic_camera setDir 0;
[ _cinematic_camera, -30, 0 ] call BIS_fnc_setPitchBank;
};
case 12 : {
_cinematic_camera cameraEffect ["Terminate", "BACK"];
camDestroy _cinematic_camera;
_cinematic_camera = "camera" camCreate [0,0,0];
_cinematic_camera cameraEffect ["internal","back"];
_cinematic_camera camcommit 0;
_startpos = [ ((getpos _camtarget) select 0) + 302 , ((getpos _camtarget) select 1) + 300, 50 ];
_endpos = [ ((getpos _camtarget) select 0) - 198, ((getpos _camtarget) select 1) - 200, 50 ];
_cinematic_camera setDir 225;
[ _cinematic_camera, -25, 0 ] call BIS_fnc_setPitchBank;
};
case 13 : {
_cinematic_camera cameraEffect ["Terminate", "BACK"];
camDestroy _cinematic_camera;
_cinematic_camera = "camera" camCreate [0,0,0];
_cinematic_camera cameraEffect ["internal","back"];
_cinematic_camera camcommit 0;
_startpos = [ ((getpos _camtarget) select 0) - 80 , ((getpos _camtarget) select 1) + 150, 20 ];
_endpos = [ ((getpos _camtarget) select 0) - 80, ((getpos _camtarget) select 1) - 150, 20 ];
_cinematic_camera setDir 90;
[ _cinematic_camera, -15, 0 ] call BIS_fnc_setPitchBank;
};
case 14 : {
_cinematic_camera cameraEffect ["Terminate", "BACK"];
camDestroy _cinematic_camera;
_cinematic_camera = "camera" camCreate [0,0,0];
_cinematic_camera cameraEffect ["internal","back"];
_cinematic_camera camcommit 0;
_startpos = [ ((getpos _camtarget) select 0) - 50 , ((getpos _camtarget) select 1) + 2, 30 ];
_endpos = [ ((getpos _camtarget) select 0) + 150, ((getpos _camtarget) select 1) - 2, 30 ];
_cinematic_camera setDir 270;
[ _cinematic_camera, -20, 0 ] call BIS_fnc_setPitchBank;
_startfov = 0.55;
_endfov = 0.55;
};
case 15 : {
_cinematic_camera cameraEffect ["Terminate", "BACK"];
camDestroy _cinematic_camera;
_cinematic_camera = "camera" camCreate [0,0,0];
_cinematic_camera cameraEffect ["internal","back"];
_cinematic_camera camcommit 0;
_startpos = [ ((getpos _camtarget) select 0) - 150 , ((getpos _camtarget) select 1) + 5, 250 ];
_endpos = [ ((getpos _camtarget) select 0) + 150, ((getpos _camtarget) select 1) + 5, 250 ];
_cinematic_camera setDir 0;
[ _cinematic_camera, -88, 0 ] call BIS_fnc_setPitchBank;
_startfov = 0.3;
_endfov = 0.3;
};
};
};
if ( surfaceIsWater _position ) then {
_startpos = [ _startpos select 0, _startpos select 1, (_startpos select 2) + 25 ];
_endpos = [ _endpos select 0, _endpos select 1, (_endpos select 2) + 25 ];
};
while { terrainIntersect [ _startpos, _endpos ] } do {
_startpos = [ _startpos select 0, _startpos select 1, (_startpos select 2) + 30 ];
_endpos = [ _endpos select 0, _endpos select 1, (_endpos select 2) + 30 ];
};
_cinematic_camera camSetPos _startpos;
_cinematic_camera camSetFov _startfov;
_cinematic_camera camCommit 0;
_cinematic_camera camSetPos _endpos;
_cinematic_camera camSetFov _endfov;
if ( isNil "howtoplay" ) then { howtoplay = 0; };
if ( first_camera_round ) then {
_cinematic_camera camcommit 18;
} else {
if ( howtoplay == 0 ) then {
_cinematic_camera camcommit 10;
} else {
_cinematic_camera camcommit 20;
};
};
first_camera_round = false;
if ( !isNil "showcaminfo" ) then {
if ( showcaminfo && howtoplay == 0 ) then {
private _unitname = "";
if ( isPlayer _camtarget ) then { _unitname = name _camtarget };
private _nearest_sector = "";
if ( _position distance startbase < 300 ) then {
_nearest_sector = "BEGIN OF OPERATION";
} else {
_nearest_sector = [300, _position ] call KPLIB_fnc_getNearestSector;
if ( _nearest_sector != "" ) then {
_nearest_sector = markertext _nearest_sector;
} else {
_nearfobs = GRLIB_all_fobs select {_x distance _position < 300};
if ( count _nearfobs > 0 ) then {
_nearest_sector = format [ "FOB %1", military_alphabet select ( GRLIB_all_fobs find ( _nearfobs select 0 ) ) ];
};
};
};
[ format [ "<t size='0.7' align='left'>%1<br/>%2</t>", _unitname, _nearest_sector ],1,0.8,6,1 ] spawn BIS_fnc_dynamictext;
};
};
};
};
_cinematic_camera cameraEffect ["Terminate", "BACK"];
camDestroy _cinematic_camera;
camUseNVG false;
cinematic_camera_stop = true;

View File

@@ -0,0 +1,154 @@
params [
"_stats_ammo_produced",
"_stats_ammo_spent",
"_stats_blufor_soldiers_killed",
"_stats_blufor_soldiers_recruited",
"_stats_blufor_teamkills",
"_stats_blufor_vehicles_built",
"_stats_blufor_vehicles_killed",
"_stats_civilian_buildings_destroyed",
"_stats_civilian_vehicles_killed",
"_stats_civilian_vehicles_killed_by_players",
"_stats_civilian_vehicles_seized",
"_stats_civilians_healed",
"_stats_civilians_killed",
"_stats_civilians_killed_by_players",
"_stats_fobs_built",
"_stats_fobs_lost",
"_stats_fuel_produced",
"_stats_fuel_spent",
"_stats_hostile_battlegroups",
"_stats_ieds_detonated",
"_stats_opfor_killed_by_players",
"_stats_opfor_soldiers_killed",
"_stats_opfor_vehicles_killed",
"_stats_opfor_vehicles_killed_by_players",
"_stats_player_deaths",
"_stats_playtime",
"_stats_prisoners_captured",
"_stats_readiness_earned",
"_stats_reinforcements_called",
"_stats_resistance_killed",
"_stats_resistance_teamkills",
"_stats_resistance_teamkills_by_players",
"_stats_secondary_objectives",
"_stats_sectors_liberated",
"_stats_sectors_lost",
"_stats_spartan_respawns",
"_stats_supplies_produced",
"_stats_supplies_spent",
"_stats_vehicles_recycled",
"_stats_rabbits_killed"
];
// Some preparations
if (isNil "cinematic_camera_started") then {cinematic_camera_started = false};
private _line_delay = 0.75;
private _page_delay = 5;
private _addReportLine = {
params [
"_control",
"_string",
["_pageEnd", false, [false]]
];
if (dialog) then {
[_control, _string] call write_credit_line;
sleep ([_line_delay, _page_delay] select _pageEnd);
};
};
private _cleanPage = {
if (dialog) then {
ctrlSetText [691, ""];
ctrlSetText [692, ""];
ctrlSetText [693, ""];
ctrlSetText [694, ""];
ctrlSetText [695, ""];
ctrlSetText [696, ""];
sleep 2;
};
};
// Calculate the playtime
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;
[] spawn cinematic_camera;
private _dialog = createDialog "liberation_endscreen";
waitUntil {dialog};
if (dialog) then {sleep 3};
// Playtime line
[690, format [localize "STR_STATS_PLAYTIME", _playtime_days, _playtime_hours, _playtime_minutes, _playtime_seconds]] call _addReportLine;
if (dialog) then {sleep 3};
// First page
[691, format [localize "STR_STATS_OPFOR_K_INF", _stats_opfor_soldiers_killed]] call _addReportLine;
[692, format [localize "STR_STATS_OPFOR_K_INF_PL", _stats_opfor_killed_by_players]] call _addReportLine;
[693, format [localize "STR_STATS_OPFOR_K_VEH", _stats_opfor_vehicles_killed]] call _addReportLine;
[694, format [localize "STR_STATS_OPFOR_K_VEH_PL", _stats_opfor_vehicles_killed_by_players], true] call _addReportLine;
[] call _cleanPage;
// Second page
[691, format [localize "STR_STATS_BLUFOR_B_INF", _stats_blufor_soldiers_recruited]] call _addReportLine;
[692, format [localize "STR_STATS_BLUFOR_K_INF", _stats_blufor_soldiers_killed]] call _addReportLine;
[693, format [localize "STR_STATS_BLUFOR_B_VEH", _stats_blufor_vehicles_built]] call _addReportLine;
[694, format [localize "STR_STATS_BLUFOR_K_VEH", _stats_blufor_vehicles_killed]] call _addReportLine;
[695, format [localize "STR_STATS_BLUFOR_K_PL", _stats_player_deaths]] call _addReportLine;
[696, format [localize "STR_STATS_BLUFOR_TK", _stats_blufor_teamkills], true] call _addReportLine;
[] call _cleanPage;
// Third page
[691, format [localize "STR_STATS_GUE_K_INF", _stats_resistance_killed]] call _addReportLine;
[692, format [localize "STR_STATS_GUE_TK_INF", _stats_resistance_teamkills]] call _addReportLine;
[693, format [localize "STR_STATS_GUE_TK_INF_PL", _stats_resistance_teamkills_by_players]] call _addReportLine;
[694, format [localize "STR_STATS_CIV_K_INF", _stats_civilians_killed]] call _addReportLine;
[695, format [localize "STR_STATS_CIV_K_INF_PL", _stats_civilians_killed_by_players]] call _addReportLine;
[696, format [localize "STR_STATS_CIV_B_INF", _stats_civilians_healed], true] call _addReportLine;
[] call _cleanPage;
// Fourth page
[691, format [localize "STR_STATS_CIV_K_VEH", _stats_civilian_vehicles_killed]] call _addReportLine;
[692, format [localize "STR_STATS_CIV_K_VEH_PL", _stats_civilian_vehicles_killed_by_players]] call _addReportLine;
[693, format [localize "STR_STATS_CIV_S_VEH", _stats_civilian_vehicles_seized]] call _addReportLine;
[694, format [localize "STR_STATS_CIV_K_BUILDINGS", _stats_civilian_buildings_destroyed]] call _addReportLine;
[695, format [localize "STR_STATS_VEH_RECYCLED", _stats_vehicles_recycled], true] call _addReportLine;
[] call _cleanPage;
// Fifth page
[691, format [localize "STR_STATS_PROD_AMMO", _stats_ammo_produced]] call _addReportLine;
[692, format [localize "STR_STATS_SPENT_AMMO", _stats_ammo_spent]] call _addReportLine;
[693, format [localize "STR_STATS_PROD_FUEL", _stats_fuel_produced]] call _addReportLine;
[694, format [localize "STR_STATS_SPENT_FUEL", _stats_fuel_spent]] call _addReportLine;
[695, format [localize "STR_STATS_PROD_SUPPLY", _stats_supplies_produced]] call _addReportLine;
[696, format [localize "STR_STATS_SPENT_SUPPLY", _stats_supplies_spent], true] call _addReportLine;
[] call _cleanPage;
// Sixth page
[691, format [localize "STR_STATS_SECTORS_CAPTURED", _stats_sectors_liberated]] call _addReportLine;
[692, format [localize "STR_STATS_SECTORS_LOST", _stats_sectors_lost]] call _addReportLine;
[693, format [localize "STR_STATS_FOBS_BUILT", _stats_fobs_built]] call _addReportLine;
[694, format [localize "STR_STATS_FOBS_LOST", _stats_fobs_lost]] call _addReportLine;
[695, format [localize "STR_STATS_SIDEMISSIONS", _stats_secondary_objectives]] call _addReportLine;
[696, format [localize "STR_STATS_PRISONERS", _stats_prisoners_captured], true] call _addReportLine;
[] call _cleanPage;
// Seventh page
[691, format [localize "STR_STATS_BATTLEGROUPS", _stats_hostile_battlegroups]] call _addReportLine;
[692, format [localize "STR_STATS_REINFORCEMENTS", _stats_reinforcements_called]] call _addReportLine;
[693, format [localize "STR_STATS_COMBATREADINESS", round _stats_readiness_earned]] call _addReportLine;
[694, format [localize "STR_STATS_IEDS", _stats_ieds_detonated]] call _addReportLine;
[695, format [localize "STR_STATS_POTATO", _stats_spartan_respawns]] call _addReportLine;
[696, format [localize "STR_STATS_RABBITS", _stats_rabbits_killed], true] call _addReportLine;
[] call _cleanPage;
// Eighth page
[693, localize "STR_STATS_END1"] call _addReportLine;
[694, localize "STR_STATS_END2"] call _addReportLine;
[696, localize "STR_STATS_END3"] call _addReportLine;
waitUntil {!dialog};
cinematic_camera_started = false;

View File

@@ -0,0 +1,28 @@
if ( isNil "cinematic_camera_started" ) then { cinematic_camera_started = false };
sleep 0.5;
waitUntil { time > 0 };
[] spawn cinematic_camera;
if ( GRLIB_introduction ) then {
sleep 1;
cutRsc ["intro1","PLAIN",1,true];
sleep 5.5;
cutRsc ["intro2","PLAIN",1,true];
sleep 10;
};
showcaminfo = true;
dostartgame = 0;
howtoplay = 0;
private _dialog = createDialog "liberation_menu";
waitUntil { dialog };
waitUntil { dostartgame == 1 || howtoplay == 1 || !dialog };
closeDialog 0;
if ( howtoplay == 0 ) then {
cinematic_camera_started = false;
};
introDone = true;

View File

@@ -0,0 +1,81 @@
if ( isNil "GRLIB_secondary_starting" ) then { GRLIB_secondary_starting = false; };
if ( isNil "GRLIB_secondary_in_progress" ) then { GRLIB_secondary_in_progress = -1; };
_dialog = createDialog "liberation_secondary";
dostartsecondary = 0;
waitUntil { dialog };
{
lbAdd [ 101, localize _x ];
} foreach [
"STR_SECONDARY_MISSION0",
"STR_SECONDARY_MISSION1",
"STR_SECONDARY_MISSION2"
];
private [ "_oldchoice", "_images", "_briefings", "_missioncost" ];
_images = [
"res\secondary\fob_hunting.jpg",
"res\secondary\convoy_hijack.jpg",
"res\secondary\sar.jpg"
];
_briefings = [
"STR_SECONDARY_BRIEFING0",
"STR_SECONDARY_BRIEFING1",
"STR_SECONDARY_BRIEFING2"
];
_oldchoice = -1;
lbSetCurSel [ 101, 0 ];
while { dialog && alive player && dostartsecondary == 0 } do {
if ( _oldchoice != lbCurSel 101 ) then {
_oldchoice = lbCurSel 101;
ctrlSetText [ 106, _images select _oldchoice ];
((findDisplay 6842) displayCtrl (102)) ctrlSetStructuredText parseText localize (_briefings select _oldchoice);
};
_missioncost = GRLIB_secondary_missions_costs select _oldchoice;
if ( ( _missioncost <= resources_intel ) && ( !GRLIB_secondary_starting ) ) then {
ctrlEnable [ 103, true ];
((findDisplay 6842) displayCtrl (103)) ctrlSetTooltip "";
} else {
ctrlEnable [ 103, false ];
if ( _missioncost > resources_intel ) then {
((findDisplay 6842) displayCtrl (103)) ctrlSetTooltip (localize "STR_SECONDARY_NOT_ENOUGH_INTEL");
};
if ( GRLIB_secondary_starting ) then {
((findDisplay 6842) displayCtrl (103)) ctrlSetTooltip (localize "STR_SECONDARY_IN_PROGRESS");
};
};
if ( GRLIB_secondary_in_progress >= 0 ) then {
lbSetCurSel [ 101, GRLIB_secondary_in_progress ];
ctrlEnable [ 101, false ];
} else {
ctrlEnable [ 101, true ];
};
ctrlSetText [ 107, format [ localize "STR_SECONDARY_INTEL", resources_intel ] ];
sleep 0.1;
};
if ( dostartsecondary == 1 ) then {
private _index = lbCurSel 101;
if !(([2000,999999,false] call KPLIB_fnc_getOpforSpawnPoint) isEqualTo "") then {
[_index] remoteExec ["start_secondary_remote_call", 2];
} else {
hint "There is not enough enemy territory left for secondary missions.";
uiSleep 2;
hintSilent "";
}
};
if ( dialog ) then {
closeDialog 0;
};

View File

@@ -0,0 +1,249 @@
private [ "_dialog", "_membercount", "_memberselection", "_unitname", "_selectedmember", "_cfgVehicles", "_cfgWeapons", "_primary_mags", "_secondary_mags", "_vehstring", "_nearfob", "_fobdistance", "_nearsquad", "_tempgmp", "_destpos", "_destdir", "_resupplied","_firstloop", "_squad_camera", "_targetobject", "_isvehicle" ];
GRLIB_squadaction = -1;
GRLIB_squadconfirm = -1;
_membercount = -1;
_resupplied = false;
_memberselection = -1;
_selectedmember = objNull;
_dialog = createDialog "liberation_squad";
_cfgVehicles = configFile >> "cfgVehicles";
_cfgWeapons = configFile >> "cfgWeapons";
_firstloop = true;
_isvehicle = false;
waitUntil { dialog };
_targetobject = "Sign_Sphere100cm_F" createVehicleLocal [ 0, 0, 0 ];
hideObject _targetobject;
_squad_camera = "camera" camCreate (getpos player);
_squad_camera cameraEffect ["internal","back", "rtt"];
_squad_camera camSetTarget _targetobject;
_squad_camera camcommit 0;
"rtt" setPiPEffect [0];
while { dialog && alive player } do {
if ( { alive _x } count (units group player) != _membercount ) then {
_membercount = { alive _x } count (units group player);
lbClear 101;
{
if ( alive _x ) then {
_unitname = format ["%1. ", [ _x ] call KPLIB_fnc_getUnitPositionId];
if(isPlayer _x) then {
if ( count (squadParams _x ) != 0) then {
_unitname = "[" + ((squadParams _x select 0) select 0) + "] ";
};
};
_unitname = _unitname + ( name _x );
lbAdd [ 101, _unitname ];
};
} foreach (units group player);
if ( _firstloop ) then {
lbSetCurSel [ 101, 0 ];
_firstloop = false;
};
};
_selectedmember = objNull;
if ( lbCurSel 101 != -1 && (count (units group player ) > lbCurSel 101 ) ) then {
_selectedmember = (units group player) select (lbCurSel 101);
};
if ( !(isNull _selectedmember) ) then {
"spawn_marker" setMarkerPosLocal (getpos _selectedmember);
ctrlMapAnimClear ((findDisplay 5155) displayCtrl 100);
((findDisplay 5155) displayCtrl 100) ctrlMapAnimAdd [0, 0.3, getpos _selectedmember];
ctrlMapAnimCommit ((findDisplay 5155) displayCtrl 100);
};
if ( !(isNull _selectedmember) ) then {
if ( _memberselection != lbCurSel 101 || _resupplied || ( ( vehicle _selectedmember == _selectedmember && _isvehicle ) || ( vehicle _selectedmember != _selectedmember && !_isvehicle ) ) ) then {
_memberselection = lbCurSel 101;
_resupplied = false;
if (vehicle _selectedmember == _selectedmember) then {
_targetobject attachTo [ _selectedmember, [0, 10, 0.05], "neck" ];
_squad_camera attachTo [ _selectedmember, [0, 0.25, 0.05], "neck" ];
_isvehicle = false;
} else {
_targetobject attachTo [ vehicle _selectedmember, [0, 20, 2]];
_squad_camera attachTo [ vehicle _selectedmember, [0, 0, 2]];
_isvehicle = true;
};
_squad_camera camcommit 0;
_unitname = format ["%1. ", [ _selectedmember ] call KPLIB_fnc_getUnitPositionId];
if(isPlayer _selectedmember) then {
if ( count (squadParams _selectedmember ) != 0) then {
_unitname = "[" + ((squadParams _selectedmember select 0) select 0) + "] ";
};
};
_unitname = _unitname + ( name _selectedmember );
ctrlSetText [ 201, _unitname];
ctrlSetText [ 202, getText (_cfgVehicles >> (typeof _selectedmember) >> "displayName") ];
ctrlSetText [ 203, format ["%1 %2%3", localize 'STR_HEALTH', round (100 - ((damage _selectedmember) * 100)), '%' ] ];
((findDisplay 5155) displayCtrl 203) ctrlSetTextColor [1,1,1,1];
if ( damage _selectedmember > 0.4 ) then { ((findDisplay 5155) displayCtrl 203) ctrlSetTextColor [1,1,0,1]; };
if ( damage _selectedmember > 0.6 ) then { ((findDisplay 5155) displayCtrl 203) ctrlSetTextColor [1,0.5,0,1]; };
if ( damage _selectedmember > 0.8 ) then { ((findDisplay 5155) displayCtrl 203) ctrlSetTextColor [1,0,0,1]; };
ctrlSetText [ 204, format ["%1 %2m", localize 'STR_DISTANCE', round (player distance _selectedmember) ] ];
if ( primaryWeapon _selectedmember != "") then {
ctrlSetText [ 205, format ["%1: %2", localize 'STR_PRIMARY_WEAPON', getText (_cfgWeapons >> (primaryWeapon _selectedmember) >> "displayName") ] ];
_primary_mags = 0;
if ( count primaryWeaponMagazine _selectedmember > 0 ) then {
_primary_mags = 1;
{ if ( ( _x select 0 ) == ( ( primaryWeaponMagazine _selectedmember ) select 0 ) ) then { _primary_mags = _primary_mags + 1; } } foreach (magazinesAmmo _selectedmember);
};
ctrlSetText [ 206, format ["%1: %2", localize 'STR_AMMO', _primary_mags ] ];
} else {
ctrlSetText [ 205, format ["%1: %2", localize 'STR_PRIMARY_WEAPON', localize 'STR_NONE' ] ];
ctrlSetText [ 206, format ["%1: %2", localize 'STR_AMMO', 0 ] ];
};
if ( secondaryWeapon _selectedmember != "") then {
ctrlSetText [ 207, format ["%1: %2", localize 'STR_SECONDARY_WEAPON', getText (_cfgWeapons >> (secondaryWeapon _selectedmember) >> "displayName") ] ];
_secondary_mags = 0;
if ( count secondaryWeaponMagazine _selectedmember > 0 ) then {
_secondary_mags = 1;
{ if ( ( _x select 0 ) == ( ( secondaryWeaponMagazine _selectedmember ) select 0 ) ) then { _secondary_mags = _secondary_mags + 1; } } foreach (magazinesAmmo _selectedmember);
};
ctrlSetText [ 208, format ["%1: %2", localize 'STR_AMMO', _secondary_mags ] ];
} else {
ctrlSetText [ 207, format ["%1: %2", localize 'STR_SECONDARY_WEAPON', localize 'STR_NONE' ] ];
ctrlSetText [ 208, format ["%1: %2", localize 'STR_AMMO', 0 ] ];
};
if ( vehicle _selectedmember == _selectedmember ) then {
ctrlSetText [ 209, "" ];
} else {
_vehstring = localize 'STR_PASSENGER';
if (driver vehicle _selectedmember == _selectedmember ) then { _vehstring = localize 'STR_DRIVER'; };
if (gunner vehicle _selectedmember == _selectedmember ) then { _vehstring = localize 'STR_GUNNER'; };
if (commander vehicle _selectedmember == _selectedmember ) then { _vehstring = localize 'STR_COMMANDER'; };
_vehstring = _vehstring + format [ " (%1)", getText (_cfgVehicles >> (typeof vehicle _selectedmember) >> "displayName") ];
ctrlSetText [ 209, _vehstring ];
};
};
} else {
{ ctrlSetText [ _x, "" ] } foreach [ 201, 202, 203, 204, 205, 206, 207, 208, 209 ];
GRLIB_squadconfirm = -1;
GRLIB_squadaction = -1;
};
if ( GRLIB_squadaction == -1 ) then {
ctrlEnable [ 213, false ];
ctrlEnable [ 214, false ];
if ( !(isPlayer _selectedmember) && (vehicle _selectedmember == _selectedmember) ) then {
ctrlEnable [ 210, true ];
if ( leader group player == player ) then {
ctrlEnable [ 211, true ];
};
ctrlEnable [ 212, true ];
} else {
ctrlEnable [ 210, false ];
ctrlEnable [ 211, false ];
ctrlEnable [ 212, false ];
};
} else {
ctrlEnable [ 210, false ];
ctrlEnable [ 211, false ];
ctrlEnable [ 212, false ];
ctrlEnable [ 213, true ];
ctrlEnable [ 214, true ];
};
if( GRLIB_squadconfirm == 0 ) then {
GRLIB_squadconfirm = -1;
GRLIB_squadaction = -1;
};
if ( GRLIB_squadconfirm == 1 ) then {
GRLIB_squadconfirm = -1;
if ( GRLIB_squadaction == 1 ) then {
_nearfob = [ getpos _selectedmember ] call KPLIB_fnc_getNearestFob;
_fobdistance = 9999;
if ( count _nearfob == 3 ) then {
_fobdistance = _selectedmember distance _nearfob;
};
_nearsquad = (getPos _selectedmember) nearEntities [KPLIB_aiResupplySources, 30];
if ( _fobdistance < 100 || count _nearsquad > 0 ) then {
_tempgmp = createGroup [GRLIB_side_friendly, true];
(typeof _selectedmember) createUnit [ markers_reset, _tempgmp,''];
[ (units _tempgmp) select 0, _selectedmember ] call KPLIB_fnc_swapInventory;
deleteVehicle ((units _tempgmp) select 0);
_selectedmember setDamage 0;
hint localize 'STR_RESUPPLY_OK';
_resupplied = true;
} else {
hint localize 'STR_RESUPPLY_KO';
};
};
if (GRLIB_squadaction == 2) then {
deleteVehicle _selectedmember;
_resupplied = true;
hint localize 'STR_REMOVE_OK';
};
if (GRLIB_squadaction == 3) then {
closeDialog 0;
if ( primaryWeapon player == "" && secondaryWeapon player == "" ) then {
[ _selectedmember, player ] call KPLIB_fnc_swapInventory;
};
_destpos = getposATL _selectedmember;
_destdir = getdir _selectedmember;
if ( damage _selectedmember > 0.4 ) then {
if ( damage _selectedmember < 0.7 ) then {
player setDamage (damage _selectedmember);
} else {
player setDamage 0.7;
};
};
deleteVehicle _selectedmember;
sleep 0.01;
player setPosATL _destpos;
player setDir _destdir;
sleep 0.01;
[ localize 'STR_SQUAD_DEPLOY' ] spawn spawn_camera;
};
GRLIB_squadaction = -1;
};
sleep 0.1;
};
"spawn_marker" setMarkerPosLocal markers_reset;
_squad_camera cameraEffect ["terminate","back"];
camDestroy _squad_camera;
deleteVehicle _targetobject;

View File

@@ -0,0 +1,65 @@
private [ "_tutorial_titles", "_tutorial_pages", "_current_page", "_old_page", "_dialog" ];
if ( isNil "howtoplay" ) then { howtoplay = 0; };
_tutorial_titles = [
localize "STR_TUTO_TITLE1",
localize "STR_TUTO_TITLE2",
localize "STR_TUTO_TITLE3",
localize "STR_TUTO_TITLE4",
localize "STR_TUTO_TITLE5",
localize "STR_TUTO_TITLE6",
localize "STR_TUTO_TITLE7",
localize "STR_TUTO_TITLE8",
localize "STR_TUTO_TITLE9",
localize "STR_TUTO_TITLE10"
];
_tutorial_pages = [
"STR_TUTO_TEXT1",
"STR_TUTO_TEXT2",
"STR_TUTO_TEXT3",
"STR_TUTO_TEXT4",
"STR_TUTO_TEXT5",
"STR_TUTO_TEXT6",
"STR_TUTO_TEXT7",
"STR_TUTO_TEXT8",
"STR_TUTO_TEXT9",
"STR_TUTO_TEXT10"
];
_current_page = 0;
_old_page = -99;
while { true } do {
waitUntil { sleep 0.3; howtoplay == 1 };
waitUntil { !dialog };
sleep 0.1;
_dialog = createDialog "liberation_tutorial";
if ( !cinematic_camera_started ) then {
[] spawn cinematic_camera;
};
waitUntil { dialog };
{
lbAdd [ 513, _x];
} foreach _tutorial_titles;
lbSetCurSel [ 513, 0 ];
while { howtoplay == 1 && alive player && dialog } do {
_current_page = lbCurSel 513;
if ( _current_page != _old_page ) then {
ctrlSetText [ 514, _tutorial_titles select _current_page ];
((findDisplay 5353) displayCtrl (515)) ctrlSetStructuredText parseText localize (_tutorial_pages select _current_page);
_old_page = _current_page;
};
sleep 0.2;
};
if ( dialog ) then { closeDialog 0 };
cinematic_camera_started = false;
howtoplay = 0;
}

View File

@@ -0,0 +1,177 @@
scriptName "KPLIB_uiManager";
disableSerialization;
private _sectorcontrols = [
201, // BG Picture Sector
202, // Capture Frame
203, // Capture Frame OPFOR
205, // Label Point
244 // Capture Frame BLUFOR
];
GRLIB_ui_notif = "";
KP_liberation_supplies = 0;
KP_liberation_ammo = 0;
KP_liberation_fuel = 0;
KP_liberation_air_vehicle_building_near = false;
KP_liberation_recycle_building_near = false;
waitUntil { !isNil "synchro_done" };
waitUntil { synchro_done };
if (isNil "cinematic_camera_started") then {cinematic_camera_started = false;};
if (isNil "halojumping") then {halojumping = false;};
private _uiticks = 0;
private _active_sectors_hint = false;
private _attacked_string = "";
private _nearest_active_sector = "";
private _zone_size = 0;
private _colorzone = "ColorGrey";
private _bar = controlNull;
private _barwidth = 0;
private _overlay = displayNull;
private _overlayVisible = false;
private _showHud = false;
private _showResources = false;
private _currentFob = "";
while {true} do {
_currentFob = player getVariable ["KPLIB_fobName", ""];
_showHud = alive player && {!dialog && {isNull curatorCamera && {!cinematic_camera_started && !halojumping}}};
_visibleMap = visibleMap;
if (_showHud && {!_overlayVisible}) then {
"KPLIB_ui" cutRsc ["KPLIB_overlay", "PLAIN", 1];
_uiticks = 0;
};
if (!_showHud && {_overlayVisible}) then {
"KPLIB_ui" cutText ["", "PLAIN"];
};
_overlay = uiNamespace getVariable ["KPLIB_overlay", displayNull];
_overlayVisible = !isNull _overlay;
// Player is at FOB
if (_currentFob != "" || {_visibleMap}) then {
_showResources = true;
private _nearestFob = player getVariable "KPLIB_fobPos";
([_nearestFob] call KPLIB_fnc_getFobResources) params ["", "_supplies", "_ammo", "_fuel", "_hasAir", "_hasRecycling"];
if (KP_liberation_resources_global || {_visibleMap}) then {
// Overwrite FOB name in global mode
_currentFob = localize "STR_RESOURCE_GLOBAL";
KP_liberation_supplies = KP_liberation_supplies_global;
KP_liberation_ammo = KP_liberation_ammo_global;
KP_liberation_fuel = KP_liberation_fuel_global;
} else {
KP_liberation_supplies = _supplies;
KP_liberation_ammo = _ammo;
KP_liberation_fuel = _fuel;
};
// TODO this is used by build scripts, move to relevant places
KP_liberation_air_vehicle_building_near = _hasAir;
KP_liberation_recycle_building_near = _hasRecycling;
} else {
_showResources = false;
KP_liberation_supplies = 0;
KP_liberation_ammo = 0;
KP_liberation_fuel = 0;
KP_liberation_air_vehicle_building_near = false;
KP_liberation_recycle_building_near = false;
};
if (_overlayVisible) then {
(_overlay displayCtrl (266)) ctrlSetText format [ "%1", GRLIB_ui_notif ];
(_overlay displayCtrl (267)) ctrlSetText format [ "%1", GRLIB_ui_notif ];
if ((markerPos "opfor_capture_marker") distance markers_reset > 100 ) then {
private [ "_attacked_string" ];
_attacked_string = [markerpos "opfor_capture_marker"] call KPLIB_fnc_getLocationName;
(_overlay displayCtrl (401)) ctrlShow true;
(_overlay displayCtrl (402)) ctrlSetText _attacked_string;
(_overlay displayCtrl (403)) ctrlSetText (markerText "opfor_capture_marker");
} else {
(_overlay displayCtrl (401)) ctrlShow false;
(_overlay displayCtrl (402)) ctrlSetText "";
(_overlay displayCtrl (403)) ctrlSetText "";
};
// Update resources overlay
[
_overlay,
_showResources,
_uiticks % 5 == 0, // update values
_currentFob // area title
] call KPLIB_fnc_overlayUpdateResources;
if (_uiticks % 25 == 0) then {
if (!isNil "active_sectors" && ([] call KPLIB_fnc_getOpforCap >= GRLIB_sector_cap)) then {
(_overlay displayCtrl (517)) ctrlShow true;
if (!_active_sectors_hint) then {
hint localize "STR_OVERLOAD_HINT";
_active_sectors_hint = true;
};
_active_sectors_string = "<t align='right' color='#e0e000'>" + (localize "STR_ACTIVE_SECTORS") + "<br/>";
{
_active_sectors_string = [_active_sectors_string, markerText _x, "<br/>"] joinString "";
} forEach active_sectors;
_active_sectors_string = [_active_sectors_string, "</t>"] joinString "";
(_overlay displayCtrl (516)) ctrlSetStructuredText parseText _active_sectors_string;
} else {
(_overlay displayCtrl (516)) ctrlSetStructuredText parseText " ";
(_overlay displayCtrl (517)) ctrlShow false;
};
_nearest_active_sector = [GRLIB_sector_size] call KPLIB_fnc_getNearestSector;
if ( _nearest_active_sector != "" ) then {
_zone_size = GRLIB_capture_size;
if ( _nearest_active_sector in sectors_bigtown ) then {
_zone_size = GRLIB_capture_size * 1.4;
};
"zone_capture" setmarkerposlocal (markerpos _nearest_active_sector);
_colorzone = "ColorGrey";
if ( [ markerpos _nearest_active_sector, _zone_size ] call KPLIB_fnc_getSectorOwnership == GRLIB_side_friendly ) then { _colorzone = GRLIB_color_friendly };
if ( [ markerpos _nearest_active_sector, _zone_size ] call KPLIB_fnc_getSectorOwnership == GRLIB_side_enemy ) then { _colorzone = GRLIB_color_enemy };
if ( [ markerpos _nearest_active_sector, _zone_size ] call KPLIB_fnc_getSectorOwnership == GRLIB_side_resistance ) then { _colorzone = "ColorCivilian" };
"zone_capture" setmarkercolorlocal _colorzone;
_ratio = [_nearest_active_sector] call KPLIB_fnc_getBluforRatio;
_barwidth = 0.084 * safezoneW * _ratio;
_bar = _overlay displayCtrl (244);
_bar ctrlSetPosition [(ctrlPosition _bar) select 0,(ctrlPosition _bar) select 1,_barwidth,(ctrlPosition _bar) select 3];
_bar ctrlCommit ([0, 2] select ctrlShown _bar);
(_overlay displayCtrl (205)) ctrlSetText (markerText _nearest_active_sector);
{(_overlay displayCtrl (_x)) ctrlShow true;} forEach _sectorcontrols;
if (_nearest_active_sector in blufor_sectors) then {
(_overlay displayCtrl (205)) ctrlSetTextColor [0,0.3,1.0,1];
} else {
(_overlay displayCtrl (205)) ctrlSetTextColor [0.85,0,0,1];
};
"zone_capture" setMarkerSizeLocal [ _zone_size,_zone_size ];
} else {
{(_overlay displayCtrl (_x)) ctrlShow false;} forEach _sectorcontrols;
"zone_capture" setmarkerposlocal markers_reset;
};
};
};
_uiticks = _uiticks + 1;
if (_uiticks > 1000) then {_uiticks = 0;};
uiSleep 0.25;
};

View File

@@ -0,0 +1,20 @@
params [
"_control",
"_linearray"
];
_linearray = toArray _linearray;
private _caretPosition = 0;
private ["_currentline", "_caretcharacter"];
while {dialog && (_caretPosition <= count _linearray)} do {
_currentline = [];
while {count _currentline < _caretPosition} do {
_currentline pushback (_linearray select (count _currentline));
};
_caretcharacter = "";
if ((_caretPosition % 2 == 0) && (_caretPosition != count _linearray)) then {_caretcharacter = "_"};
ctrlSetText [_control, format ["%1%2", toString _currentline, _caretcharacter]];
_caretPosition = _caretPosition + 1;
sleep 0.04;
};