initial files
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params ["_index", "_clientID"];
|
||||
|
||||
private ["_time","_nextState"];
|
||||
|
||||
logiError = 0;
|
||||
|
||||
if ((((KP_liberation_logistics select _index) select 7) == 0) || (((KP_liberation_logistics select _index) select 7) == 5) || (((KP_liberation_logistics select _index) select 7) == 6)) exitWith {logiError = 1;(localize "STR_LOGISTIC_STANDBY_ERROR") remoteExec ["hint",_clientID]; _clientID publicVariableClient "logiError";};
|
||||
|
||||
switch ((KP_liberation_logistics select _index) select 7) do {
|
||||
case 1;
|
||||
case 3: {
|
||||
_time = ceil (((ceil ((((KP_liberation_logistics select _index) select 6) select 0) / 100)) + (ceil ((((KP_liberation_logistics select _index) select 6) select 1) / 100)) + (ceil ((((KP_liberation_logistics select _index) select 6) select 2) / 100))) / 3);
|
||||
_time = _time + 1;
|
||||
};
|
||||
case 2;
|
||||
case 4: {
|
||||
_time = ceil ((((KP_liberation_logistics select _index) select 2) distance2D ((KP_liberation_logistics select _index) select 3)) / 400);
|
||||
_time = _time - ((KP_liberation_logistics select _index) select 8);
|
||||
|
||||
_time = _time + (ceil (((ceil ((((KP_liberation_logistics select _index) select 6) select 0) / 100)) + (ceil ((((KP_liberation_logistics select _index) select 6) select 1) / 100)) + (ceil ((((KP_liberation_logistics select _index) select 6) select 2) / 100))) / 3));
|
||||
_time = _time + 1;
|
||||
};
|
||||
};
|
||||
|
||||
_nextState = switch ((KP_liberation_logistics select _index) select 7) do {case 1; case 2: {5}; case 3; case 4: {6};};
|
||||
|
||||
KP_liberation_logistics set [_index,[
|
||||
(KP_liberation_logistics select _index) select 0,
|
||||
(KP_liberation_logistics select _index) select 1,
|
||||
(KP_liberation_logistics select _index) select 2,
|
||||
(KP_liberation_logistics select _index) select 3,
|
||||
(KP_liberation_logistics select _index) select 4,
|
||||
(KP_liberation_logistics select _index) select 5,
|
||||
(KP_liberation_logistics select _index) select 6,
|
||||
_nextState,
|
||||
_time,
|
||||
0
|
||||
]];
|
||||
@@ -0,0 +1,16 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
private _newID = [count KP_liberation_logistics] call KPLIB_fnc_getMilitaryId;
|
||||
|
||||
KP_liberation_logistics append [[
|
||||
_newID, // ID
|
||||
0, // Truck Count
|
||||
[0,0,0], // Position Point A
|
||||
[0,0,0], // Position Point B
|
||||
[0,0,0], // Ressource transport count A -> B [S,A,F]
|
||||
[0,0,0], // Ressource transport count B -> A [S,A,F]
|
||||
[0,0,0], // Currently loaded [S,A,F]
|
||||
0, // Status (0 standby, 1 at A, 2 to B, 3 at B, 4 to A, 5 aborting to A, 6 aborting to B)
|
||||
-1, // Time left in current status
|
||||
0 // Special Flag (0 unload, 1 load, 2 no storage, 3 no ressources)
|
||||
]];
|
||||
@@ -0,0 +1,88 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params ["_index", "_nearfob", "_clientID", "_supplies", "_ammo", "_fuel"];
|
||||
|
||||
logiError = 0;
|
||||
|
||||
private _storage_areas = (_nearfob nearobjects GRLIB_fob_range) select {(_x getVariable ["KP_liberation_storage_type",-1]) == 0};
|
||||
|
||||
if ((count _storage_areas) == 0) exitWith {(localize "STR_LOGISTIC_CANTAFFORD") remoteExec ["hint",_clientID]; logiError = 1; _clientID publicVariableClient "logiError";};
|
||||
|
||||
private _price_s = 100;
|
||||
private _price_a = 0;
|
||||
private _price_f = 100;
|
||||
|
||||
if ((_price_s > _supplies) || (_price_a > _ammo) || (_price_f > _fuel)) exitWith {(localize "STR_LOGISTIC_CANTAFFORD") remoteExec ["hint",_clientID]; logiError = 1; _clientID publicVariableClient "logiError";};
|
||||
|
||||
{
|
||||
|
||||
|
||||
private _storage_positions = [];
|
||||
private _storedCrates = (attachedObjects _x);
|
||||
reverse _storedCrates;
|
||||
|
||||
{
|
||||
private _crateValue = _x getVariable ["KP_liberation_crate_value",0];
|
||||
|
||||
switch ((typeOf _x)) do {
|
||||
case KP_liberation_supply_crate: {
|
||||
if (_price_s > 0) then {
|
||||
if (_crateValue > _price_s) then {
|
||||
_crateValue = _crateValue - _price_s;
|
||||
_x setVariable ["KP_liberation_crate_value", _crateValue, true];
|
||||
_price_s = 0;
|
||||
} else {
|
||||
detach _x;
|
||||
deleteVehicle _x;
|
||||
_price_s = _price_s - _crateValue;
|
||||
};
|
||||
};
|
||||
};
|
||||
case KP_liberation_ammo_crate: {
|
||||
if (_price_a > 0) then {
|
||||
if (_crateValue > _price_a) then {
|
||||
_crateValue = _crateValue - _price_a;
|
||||
_x setVariable ["KP_liberation_crate_value", _crateValue, true];
|
||||
_price_a = 0;
|
||||
} else {
|
||||
detach _x;
|
||||
deleteVehicle _x;
|
||||
_price_a = _price_a - _crateValue;
|
||||
};
|
||||
};
|
||||
};
|
||||
case KP_liberation_fuel_crate: {
|
||||
if (_price_f > 0) then {
|
||||
if (_crateValue > _price_f) then {
|
||||
_crateValue = _crateValue - _price_f;
|
||||
_x setVariable ["KP_liberation_crate_value", _crateValue, true];
|
||||
_price_f = 0;
|
||||
} else {
|
||||
detach _x;
|
||||
deleteVehicle _x;
|
||||
_price_f = _price_f - _crateValue;
|
||||
};
|
||||
};
|
||||
};
|
||||
default {[format ["Invalid object (%1) at storage area", (typeOf _x)], "ERROR"] call KPLIB_fnc_log;};
|
||||
};
|
||||
} forEach _storedCrates;
|
||||
|
||||
([_x] call KPLIB_fnc_getStoragePositions) params ["_storage_positions"];
|
||||
|
||||
private _area = _x;
|
||||
_i = 0;
|
||||
{
|
||||
_height = [typeOf _x] call KPLIB_fnc_getCrateHeight;
|
||||
detach _x;
|
||||
_x attachTo [_area, [(_storage_positions select _i) select 0, (_storage_positions select _i) select 1, _height]];
|
||||
_i = _i + 1;
|
||||
} forEach attachedObjects (_x);
|
||||
|
||||
if ((_price_s == 0) && (_price_a == 0) && (_price_f == 0)) exitWith {};
|
||||
|
||||
} forEach _storage_areas;
|
||||
|
||||
please_recalculate = true;
|
||||
|
||||
(KP_liberation_logistics select _index) set [1, ((KP_liberation_logistics select _index) select 1) + 1];
|
||||
@@ -0,0 +1,101 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params ["_sector", "_fac","_clientID"];
|
||||
|
||||
private _tempProduction = +KP_liberation_production;
|
||||
private _checkFor = 0;
|
||||
private _price_s = 100;
|
||||
private _price_a = 100;
|
||||
private _price_f = 100;
|
||||
private _success = false;
|
||||
|
||||
switch (_fac) do {
|
||||
case "supply": {_checkFor = 4;_price_s = 50};
|
||||
case "ammo": {_checkFor = 5;_price_a = 50;};
|
||||
case "fuel": {_checkFor = 6;_price_f = 50;};
|
||||
};
|
||||
|
||||
{
|
||||
if ((_x select 1) == (_sector select 1)) exitWith {
|
||||
if (((_x select 9) >= _price_s) && ((_x select 10) >= _price_a) && ((_x select 11) >= _price_f)) then {
|
||||
stats_supplies_spent = stats_supplies_spent + _price_s;
|
||||
stats_ammo_spent = stats_ammo_spent + _price_a;
|
||||
stats_fuel_spent = stats_fuel_spent + _price_f;
|
||||
|
||||
private _storage = nearestObjects [(markerPos (_x select 1)), [KP_liberation_small_storage_building], 100];
|
||||
_storage = _storage select {(_x getVariable ["KP_liberation_storage_type",-1]) == 1};
|
||||
if ((count _storage) == 0) exitWith {};
|
||||
_storage = (_storage select 0);
|
||||
private _storedCrates = (attachedObjects _storage);
|
||||
reverse _storedCrates;
|
||||
|
||||
{
|
||||
private _crateValue = _x getVariable ["KP_liberation_crate_value",0];
|
||||
|
||||
switch ((typeOf _x)) do {
|
||||
case KP_liberation_supply_crate: {
|
||||
if (_price_s > 0) then {
|
||||
if (_crateValue > _price_s) then {
|
||||
_crateValue = _crateValue - _price_s;
|
||||
_x setVariable ["KP_liberation_crate_value", _crateValue, true];
|
||||
_price_s = 0;
|
||||
} else {
|
||||
detach _x;
|
||||
deleteVehicle _x;
|
||||
_price_s = _price_s - _crateValue;
|
||||
};
|
||||
};
|
||||
};
|
||||
case KP_liberation_ammo_crate: {
|
||||
if (_price_a > 0) then {
|
||||
if (_crateValue > _price_a) then {
|
||||
_crateValue = _crateValue - _price_a;
|
||||
_x setVariable ["KP_liberation_crate_value", _crateValue, true];
|
||||
_price_a = 0;
|
||||
} else {
|
||||
detach _x;
|
||||
deleteVehicle _x;
|
||||
_price_a = _price_a - _crateValue;
|
||||
};
|
||||
};
|
||||
};
|
||||
case KP_liberation_fuel_crate: {
|
||||
if (_price_f > 0) then {
|
||||
if (_crateValue > _price_f) then {
|
||||
_crateValue = _crateValue - _price_f;
|
||||
_x setVariable ["KP_liberation_crate_value", _crateValue, true];
|
||||
_price_f = 0;
|
||||
} else {
|
||||
detach _x;
|
||||
deleteVehicle _x;
|
||||
_price_f = _price_f - _crateValue;
|
||||
};
|
||||
};
|
||||
};
|
||||
default {[format ["Invalid object (%1) at storage area", (typeOf _x)], "ERROR"] call KPLIB_fnc_log;};
|
||||
};
|
||||
} forEach _storedCrates;
|
||||
|
||||
private _i = 0;
|
||||
{
|
||||
private _height = [typeOf _x] call KPLIB_fnc_getCrateHeight;
|
||||
detach _x;
|
||||
_x attachTo [_storage, [(KP_liberation_small_storage_positions select _i) select 0, (KP_liberation_small_storage_positions select _i) select 1, _height]];
|
||||
_i = _i + 1;
|
||||
} forEach (attachedObjects _storage);
|
||||
|
||||
_x set [_checkFor, true];
|
||||
private _hint = format [localize "STR_PRODUCTION_FACBUILD_SUCCESS"];
|
||||
_hint remoteExec ["hint",_clientID];
|
||||
_success = true;
|
||||
} else {
|
||||
private _hint = format [localize "STR_PRODUCTION_FACBUILD_ERROR",_price_s,_price_a,_price_f];
|
||||
_hint remoteExec ["hint",_clientID];
|
||||
};
|
||||
};
|
||||
} forEach _tempProduction;
|
||||
|
||||
if (_success) then {
|
||||
KP_liberation_production = +_tempProduction;
|
||||
recalculate_sectors = true;
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params [ "_new_fob", "_create_fob_building" ];
|
||||
private [ "_fob_building", "_fob_pos" ];
|
||||
|
||||
GRLIB_all_fobs pushback _new_fob;
|
||||
publicVariable "GRLIB_all_fobs";
|
||||
|
||||
if ( _create_fob_building ) then {
|
||||
_fob_pos = [ (_new_fob select 0) + 15, (_new_fob select 1) + 2, 0 ];
|
||||
[_fob_pos, 20, true] call KPLIB_fnc_createClearance;
|
||||
_fob_building = FOB_typename createVehicle _fob_pos;
|
||||
_fob_building setpos _fob_pos;
|
||||
_fob_building setVectorUp [0,0,1];
|
||||
[_fob_building] call KPLIB_fnc_addObjectInit;
|
||||
sleep 1;
|
||||
};
|
||||
|
||||
[] spawn KPLIB_fnc_doSave;
|
||||
|
||||
sleep 3;
|
||||
[_new_fob, 0] remoteExec ["remote_call_fob"];
|
||||
|
||||
stats_fobs_built = stats_fobs_built + 1;
|
||||
|
||||
FOB_build_in_progress = false;
|
||||
publicVariable "FOB_build_in_progress";
|
||||
@@ -0,0 +1,91 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params ["_price_s", "_price_a", "_price_f", "_typename", "_localtype", "_storage_areas"];
|
||||
|
||||
if ((_price_s > 0) || (_price_a > 0) || (_price_f > 0)) then {
|
||||
|
||||
stats_supplies_spent = stats_supplies_spent + _price_s;
|
||||
stats_ammo_spent = stats_ammo_spent + _price_a;
|
||||
stats_fuel_spent = stats_fuel_spent + _price_f;
|
||||
|
||||
{
|
||||
private _storage_positions = [];
|
||||
private _storedCrates = (attachedObjects _x);
|
||||
reverse _storedCrates;
|
||||
|
||||
{
|
||||
_crateValue = _x getVariable ["KP_liberation_crate_value",0];
|
||||
|
||||
switch ((typeOf _x)) do {
|
||||
case KP_liberation_supply_crate: {
|
||||
if (_price_s > 0) then {
|
||||
if (_crateValue > _price_s) then {
|
||||
_crateValue = _crateValue - _price_s;
|
||||
_x setVariable ["KP_liberation_crate_value", _crateValue, true];
|
||||
_price_s = 0;
|
||||
} else {
|
||||
detach _x;
|
||||
deleteVehicle _x;
|
||||
_price_s = _price_s - _crateValue;
|
||||
};
|
||||
};
|
||||
};
|
||||
case KP_liberation_ammo_crate: {
|
||||
if (_price_a > 0) then {
|
||||
if (_crateValue > _price_a) then {
|
||||
_crateValue = _crateValue - _price_a;
|
||||
_x setVariable ["KP_liberation_crate_value", _crateValue, true];
|
||||
_price_a = 0;
|
||||
} else {
|
||||
detach _x;
|
||||
deleteVehicle _x;
|
||||
_price_a = _price_a - _crateValue;
|
||||
};
|
||||
};
|
||||
};
|
||||
case KP_liberation_fuel_crate: {
|
||||
if (_price_f > 0) then {
|
||||
if (_crateValue > _price_f) then {
|
||||
_crateValue = _crateValue - _price_f;
|
||||
_x setVariable ["KP_liberation_crate_value", _crateValue, true];
|
||||
_price_f = 0;
|
||||
} else {
|
||||
detach _x;
|
||||
deleteVehicle _x;
|
||||
_price_f = _price_f - _crateValue;
|
||||
};
|
||||
};
|
||||
};
|
||||
default {[format ["Invalid object (%1) at storage area", (typeOf _x)], "ERROR"] call KPLIB_fnc_log;};
|
||||
};
|
||||
} forEach _storedCrates;
|
||||
|
||||
([_x] call KPLIB_fnc_getStoragePositions) params ["_storage_positions"];
|
||||
|
||||
private _area = _x;
|
||||
_i = 0;
|
||||
{
|
||||
_height = [typeOf _x] call KPLIB_fnc_getCrateHeight;
|
||||
detach _x;
|
||||
_x attachTo [_area, [(_storage_positions select _i) select 0, (_storage_positions select _i) select 1, _height]];
|
||||
_i = _i + 1;
|
||||
} forEach attachedObjects (_x);
|
||||
|
||||
if ((_price_s == 0) && (_price_a == 0) && (_price_f == 0)) exitWith {};
|
||||
|
||||
} forEach _storage_areas;
|
||||
|
||||
if ( _localtype == 8 ) then {
|
||||
stats_blufor_soldiers_recruited = stats_blufor_soldiers_recruited + 10;
|
||||
} else {
|
||||
if ( _typename isKindOf "Man" ) then {
|
||||
stats_blufor_soldiers_recruited = stats_blufor_soldiers_recruited + 1;
|
||||
} else {
|
||||
if ( ! ( _typename isKindOf "Building" ) ) then {
|
||||
stats_blufor_vehicles_built = stats_blufor_vehicles_built + 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
please_recalculate = true;
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params ["_price_s", "_price_a", "_price_f", "_storage_areas"];
|
||||
|
||||
if ((_price_s > 0) || (_price_a > 0) || (_price_f > 0)) then {
|
||||
{
|
||||
private _space = 0;
|
||||
if (typeOf _x == KP_liberation_large_storage_building) then {
|
||||
_space = (count KP_liberation_large_storage_positions) - (count (attachedObjects _x));
|
||||
};
|
||||
if (typeOf _x == KP_liberation_small_storage_building) then {
|
||||
_space = (count KP_liberation_small_storage_positions) - (count (attachedObjects _x));
|
||||
};
|
||||
|
||||
while {(_space > 0) && (_price_s > 0)} do {
|
||||
private _amount = 100;
|
||||
if ((_price_s / 100) < 1) then {
|
||||
_amount = _price_s;
|
||||
};
|
||||
_price_s = _price_s - _amount;
|
||||
private _crate = [KP_liberation_supply_crate, _amount, getPos _x] call KPLIB_fnc_createCrate;
|
||||
[_crate, _x] call KPLIB_fnc_crateToStorage;
|
||||
_space = _space - 1;
|
||||
};
|
||||
|
||||
while {(_space > 0) && (_price_a > 0)} do {
|
||||
private _amount = 100;
|
||||
if ((_price_a / 100) < 1) then {
|
||||
_amount = _price_a;
|
||||
};
|
||||
_price_a = _price_a - _amount;
|
||||
private _crate = [KP_liberation_ammo_crate, _amount, getPos _x] call KPLIB_fnc_createCrate;
|
||||
[_crate, _x] call KPLIB_fnc_crateToStorage;
|
||||
_space = _space - 1;
|
||||
};
|
||||
|
||||
while {(_space > 0) && (_price_f > 0)} do {
|
||||
private _amount = 100;
|
||||
if ((_price_f / 100) < 1) then {
|
||||
_amount = _price_f;
|
||||
};
|
||||
_price_f = _price_f - _amount;
|
||||
private _crate = [KP_liberation_fuel_crate, _amount, getPos _x] call KPLIB_fnc_createCrate;
|
||||
[_crate, _x] call KPLIB_fnc_crateToStorage;
|
||||
_space = _space - 1;
|
||||
};
|
||||
if ((_price_s == 0) && (_price_a == 0) && (_price_f == 0)) exitWith {};
|
||||
} forEach _storage_areas;
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params ["_sector", "_new_production"];
|
||||
|
||||
private ["_tempProduction","_checkFor"];
|
||||
|
||||
_tempProduction = [];
|
||||
|
||||
{
|
||||
if ((_x select 1) == _sector) then {
|
||||
|
||||
switch (_new_production) do {
|
||||
case 1: {_checkFor = 5;};
|
||||
case 2: {_checkFor = 6;};
|
||||
default {_checkFor = 4;};
|
||||
};
|
||||
|
||||
if (_x select _checkFor) then {
|
||||
_tempProduction pushBack [
|
||||
(_x select 0),
|
||||
(_x select 1),
|
||||
(_x select 2),
|
||||
(_x select 3),
|
||||
(_x select 4),
|
||||
(_x select 5),
|
||||
(_x select 6),
|
||||
_new_production,
|
||||
KP_liberation_production_interval,
|
||||
(_x select 9),
|
||||
(_x select 10),
|
||||
(_x select 11)
|
||||
];
|
||||
} else {
|
||||
hint localize "STR_PRODUCTION_FACFALSE";
|
||||
_tempProduction pushBack _x;
|
||||
};
|
||||
} else {
|
||||
_tempProduction pushBack _x;
|
||||
};
|
||||
} forEach KP_liberation_production;
|
||||
|
||||
KP_liberation_production = _tempProduction;
|
||||
@@ -0,0 +1,13 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params ["_groupToDelete"];
|
||||
|
||||
private _temp = +KP_liberation_logistics;
|
||||
|
||||
_temp = _temp - [_groupToDelete];
|
||||
|
||||
{
|
||||
_x set [0, [_forEachIndex] call KPLIB_fnc_getMilitaryId];
|
||||
} forEach _temp;
|
||||
|
||||
KP_liberation_logistics = +_temp;
|
||||
@@ -0,0 +1,79 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params ["_index", "_nearfob", "_clientID"];
|
||||
|
||||
logiError = 0;
|
||||
|
||||
if (((KP_liberation_logistics select _index) select 1) <= 0) exitWith {logiError = 1; _clientID publicVariableClient "logiError";};
|
||||
|
||||
private _storage_areas = (_nearfob nearobjects GRLIB_fob_range) select {(_x getVariable ["KP_liberation_storage_type",-1]) == 0};
|
||||
|
||||
if ((count _storage_areas) == 0) exitWith {(localize "STR_LOGISTIC_NOSPACE") remoteExec ["hint",_clientID]; logiError = 1; _clientID publicVariableClient "logiError";};
|
||||
|
||||
private _price_s = 50;
|
||||
private _price_a = 0;
|
||||
private _price_f = 50;
|
||||
|
||||
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) exitWith {(localize "STR_LOGISTIC_NOSPACE") remoteExec ["hint",_clientID]; logiError = 1; _clientID publicVariableClient "logiError";};
|
||||
|
||||
{
|
||||
private _space = 0;
|
||||
if (typeOf _x == KP_liberation_large_storage_building) then {
|
||||
_space = (count KP_liberation_large_storage_positions) - (count (attachedObjects _x));
|
||||
};
|
||||
if (typeOf _x == KP_liberation_small_storage_building) then {
|
||||
_space = (count KP_liberation_small_storage_positions) - (count (attachedObjects _x));
|
||||
};
|
||||
|
||||
while {(_space > 0) && (_price_s > 0)} do {
|
||||
private _amount = 100;
|
||||
if ((_price_s / 100) < 1) then {
|
||||
_amount = _price_s;
|
||||
};
|
||||
_price_s = _price_s - _amount;
|
||||
private _crate = [KP_liberation_supply_crate, _amount, getPos _x] call KPLIB_fnc_createCrate;
|
||||
[_crate, _x] call KPLIB_fnc_crateToStorage;
|
||||
_space = _space - 1;
|
||||
};
|
||||
|
||||
while {(_space > 0) && (_price_a > 0)} do {
|
||||
private _amount = 100;
|
||||
if ((_price_a / 100) < 1) then {
|
||||
_amount = _price_a;
|
||||
};
|
||||
_price_a = _price_a - _amount;
|
||||
private _crate = [KP_liberation_ammo_crate, _amount, getPos _x] call KPLIB_fnc_createCrate;
|
||||
[_crate, _x] call KPLIB_fnc_crateToStorage;
|
||||
_space = _space - 1;
|
||||
};
|
||||
|
||||
while {(_space > 0) && (_price_f > 0)} do {
|
||||
private _amount = 100;
|
||||
if ((_price_f / 100) < 1) then {
|
||||
_amount = _price_f;
|
||||
};
|
||||
_price_f = _price_f - _amount;
|
||||
private _crate = [KP_liberation_fuel_crate, _amount, getPos _x] call KPLIB_fnc_createCrate;
|
||||
[_crate, _x] call KPLIB_fnc_crateToStorage;
|
||||
_space = _space - 1;
|
||||
};
|
||||
|
||||
if ((_price_s == 0) && (_price_a == 0) && (_price_f == 0)) exitWith {};
|
||||
} forEach _storage_areas;
|
||||
|
||||
please_recalculate = true;
|
||||
|
||||
(KP_liberation_logistics select _index) set [1, ((KP_liberation_logistics select _index) select 1) - 1];
|
||||
@@ -0,0 +1,11 @@
|
||||
if ( !isServer ) exitWith {};
|
||||
|
||||
params [ "_intel_object" ];
|
||||
|
||||
if ( isNull _intel_object ) exitWith {};
|
||||
|
||||
_intel_yield = 8;
|
||||
deleteVehicle _intel_object;
|
||||
resources_intel = resources_intel + (floor (_intel_yield + (random _intel_yield)));
|
||||
|
||||
[1] remoteExec ["remote_call_intel"];
|
||||
@@ -0,0 +1,15 @@
|
||||
params ["_unit"];
|
||||
|
||||
private _milita_prisonner_intel_yield = 3;
|
||||
private _csat_prisonner_intel_yield = 6;
|
||||
|
||||
if (isServer) then {
|
||||
private _yield = _csat_prisonner_intel_yield;
|
||||
if ((typeof _unit) in militia_squad) then {
|
||||
_yield = _milita_prisonner_intel_yield;
|
||||
};
|
||||
resources_intel = resources_intel + ( _yield + (round (random _yield)));
|
||||
stats_prisoners_captured = stats_prisoners_captured + 1;
|
||||
|
||||
[0] remoteExec ["remote_call_intel"];
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params ["_object_recycled", "_price_s", "_price_a", "_price_f", "_storage_areas"];
|
||||
|
||||
if (isNull _object_recycled) exitWith {};
|
||||
if (!(alive _object_recycled)) exitWith {};
|
||||
|
||||
deleteVehicle _object_recycled;
|
||||
if ((_price_s > 0) || (_price_a > 0) || (_price_f > 0)) then {
|
||||
{
|
||||
private _space = 0;
|
||||
if (typeOf _x == KP_liberation_large_storage_building) then {
|
||||
_space = (count KP_liberation_large_storage_positions) - (count (attachedObjects _x));
|
||||
};
|
||||
if (typeOf _x == KP_liberation_small_storage_building) then {
|
||||
_space = (count KP_liberation_small_storage_positions) - (count (attachedObjects _x));
|
||||
};
|
||||
|
||||
while {(_space > 0) && (_price_s > 0)} do {
|
||||
private _amount = 100;
|
||||
if ((_price_s / 100) < 1) then {
|
||||
_amount = _price_s;
|
||||
};
|
||||
_price_s = _price_s - _amount;
|
||||
private _crate = [KP_liberation_supply_crate, _amount, getPos _x] call KPLIB_fnc_createCrate;
|
||||
[_crate, _x] call KPLIB_fnc_crateToStorage;
|
||||
_space = _space - 1;
|
||||
};
|
||||
|
||||
while {(_space > 0) && (_price_a > 0)} do {
|
||||
private _amount = 100;
|
||||
if ((_price_a / 100) < 1) then {
|
||||
_amount = _price_a;
|
||||
};
|
||||
_price_a = _price_a - _amount;
|
||||
private _crate = [KP_liberation_ammo_crate, _amount, getPos _x] call KPLIB_fnc_createCrate;
|
||||
[_crate, _x] call KPLIB_fnc_crateToStorage;
|
||||
_space = _space - 1;
|
||||
};
|
||||
|
||||
while {(_space > 0) && (_price_f > 0)} do {
|
||||
private _amount = 100;
|
||||
if ((_price_f / 100) < 1) then {
|
||||
_amount = _price_f;
|
||||
};
|
||||
_price_f = _price_f - _amount;
|
||||
private _crate = [KP_liberation_fuel_crate, _amount, getPos _x] call KPLIB_fnc_createCrate;
|
||||
[_crate, _x] call KPLIB_fnc_crateToStorage;
|
||||
_space = _space - 1;
|
||||
};
|
||||
|
||||
if ((_price_s == 0) && (_price_a == 0) && (_price_f == 0)) exitWith {};
|
||||
} forEach _storage_areas;
|
||||
};
|
||||
please_recalculate = true;
|
||||
stats_vehicles_recycled = stats_vehicles_recycled + 1;
|
||||
@@ -0,0 +1,2 @@
|
||||
params ["_targetsector"];
|
||||
[_targetsector] spawn reinforcements_manager;
|
||||
@@ -0,0 +1,51 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params ["_index", "_dest_a", "_ress_a", "_dest_b", "_ress_b", "_clientID"];
|
||||
|
||||
logiError = 0;
|
||||
|
||||
if ((_ress_a isEqualTo [0,0,0]) && (_ress_b isEqualTo [0,0,0])) then {
|
||||
logiError = 1;
|
||||
};
|
||||
|
||||
if (
|
||||
(((_ress_a select 0) != 0) && ((_ress_b select 0) != 0))
|
||||
|| (((_ress_a select 1) != 0) && ((_ress_b select 1) != 0))
|
||||
|| (((_ress_a select 2) != 0) && ((_ress_b select 2) != 0))
|
||||
) then {
|
||||
logiError = 1;
|
||||
};
|
||||
|
||||
if (_dest_a isEqualTo _dest_b) then {
|
||||
logiError = 1;
|
||||
};
|
||||
|
||||
{
|
||||
if (
|
||||
((((_x select 2) isEqualTo _dest_a)) || (((_x select 2) isEqualTo _dest_b)))
|
||||
&& ((((_x select 3) isEqualTo _dest_a)) || (((_x select 3) isEqualTo _dest_b)))
|
||||
) exitWith {logiError = 1;}
|
||||
} forEach KP_liberation_logistics;
|
||||
|
||||
if (logiError == 1) exitWith {(localize "STR_LOGISTIC_SAVE_ERROR") remoteExec ["hint",_clientID]; _clientID publicVariableClient "logiError";};
|
||||
|
||||
private _time = ceil (((ceil ((_ress_a select 0) / 100)) + (ceil ((_ress_a select 1) / 100)) + (ceil ((_ress_a select 2) / 100))) / 3);
|
||||
|
||||
if (_time > ((KP_liberation_logistics select _index) select 1)) then {
|
||||
_time = ((KP_liberation_logistics select _index) select 1);
|
||||
};
|
||||
|
||||
_time = _time + 1;
|
||||
|
||||
KP_liberation_logistics set [_index,[
|
||||
(KP_liberation_logistics select _index) select 0,
|
||||
(KP_liberation_logistics select _index) select 1,
|
||||
_dest_a,
|
||||
_dest_b,
|
||||
_ress_a,
|
||||
_ress_b,
|
||||
(KP_liberation_logistics select _index) select 6,
|
||||
1,
|
||||
_time,
|
||||
0
|
||||
]];
|
||||
@@ -0,0 +1,72 @@
|
||||
params ["_liberated_sector"];
|
||||
|
||||
private _combat_readiness_increase = 0;
|
||||
switch (true) do {
|
||||
case (_liberated_sector in sectors_bigtown): {_combat_readiness_increase = floor (random 10) * GRLIB_difficulty_modifier;};
|
||||
case (_liberated_sector in sectors_capture): {_combat_readiness_increase = floor (random 6) * GRLIB_difficulty_modifier;};
|
||||
case (_liberated_sector in sectors_military): {_combat_readiness_increase = 5 + (floor (random 11)) * GRLIB_difficulty_modifier;};
|
||||
case (_liberated_sector in sectors_factory): {_combat_readiness_increase = 3 + (floor (random 7)) * GRLIB_difficulty_modifier;};
|
||||
case (_liberated_sector in sectors_tower): {_combat_readiness_increase = floor (random 4);};
|
||||
};
|
||||
|
||||
combat_readiness = combat_readiness + _combat_readiness_increase;
|
||||
if (combat_readiness > 100.0 && GRLIB_difficulty_modifier <= 2.0) then {combat_readiness = 100.0};
|
||||
stats_readiness_earned = stats_readiness_earned + _combat_readiness_increase;
|
||||
|
||||
[_liberated_sector, 0] remoteExecCall ["remote_call_sector"];
|
||||
blufor_sectors pushback _liberated_sector; publicVariable "blufor_sectors";
|
||||
stats_sectors_liberated = stats_sectors_liberated + 1;
|
||||
|
||||
reset_battlegroups_ai = true; publicVariable "reset_battlegroups_ai";
|
||||
|
||||
if (_liberated_sector in sectors_factory) then {
|
||||
{
|
||||
if (_liberated_sector in _x) exitWith {KP_liberation_production = KP_liberation_production - [_x];};
|
||||
} forEach KP_liberation_production;
|
||||
|
||||
private _sectorFacilities = (KP_liberation_production_markers select {_liberated_sector == (_x select 0)}) select 0;
|
||||
KP_liberation_production pushBack [
|
||||
markerText _liberated_sector,
|
||||
_liberated_sector,
|
||||
1,
|
||||
[],
|
||||
_sectorFacilities select 1,
|
||||
_sectorFacilities select 2,
|
||||
_sectorFacilities select 3,
|
||||
3,
|
||||
KP_liberation_production_interval,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
];
|
||||
};
|
||||
|
||||
[_liberated_sector] spawn F_cr_liberatedSector;
|
||||
|
||||
if ((random 100) <= KP_liberation_cr_wounded_chance || (count blufor_sectors) == 1) then {
|
||||
[_liberated_sector] spawn civrep_wounded_civs;
|
||||
};
|
||||
|
||||
asymm_blocked_sectors pushBack [_liberated_sector, time];
|
||||
publicVariable "asymm_blocked_sectors";
|
||||
|
||||
[] spawn check_victory_conditions;
|
||||
|
||||
sleep 1;
|
||||
|
||||
[] spawn KPLIB_fnc_doSave;
|
||||
|
||||
sleep 45;
|
||||
|
||||
if (GRLIB_endgame == 0) then {
|
||||
if (
|
||||
!(_liberated_sector in sectors_tower)
|
||||
&& {
|
||||
(random (150 / (GRLIB_difficulty_modifier * GRLIB_csat_aggressivity))) < (combat_readiness - 15)
|
||||
|| _liberated_sector in sectors_bigtown
|
||||
}
|
||||
&& {[] call KPLIB_fnc_getOpforCap < GRLIB_battlegroup_cap}
|
||||
) then {
|
||||
[_liberated_sector, (random 100) < 45] spawn spawn_battlegroup;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
if (!isServer) exitWith {false};
|
||||
|
||||
params [
|
||||
["_mission_index", -1, [0]]
|
||||
];
|
||||
|
||||
if (_mission_index < 0) exitWith {false};
|
||||
|
||||
if (isNil "GRLIB_secondary_starting") then { GRLIB_secondary_starting = false;};
|
||||
if (GRLIB_secondary_starting) exitWith {["Multiple calls to start secondary mission : shouldn't be possible, isn't allowed", "ERROR"] call KPLIB_fnc_log;};
|
||||
if (isNil "used_positions") then {used_positions = [];};
|
||||
|
||||
GRLIB_secondary_starting = true; publicVariable "GRLIB_secondary_starting";
|
||||
|
||||
resources_intel = resources_intel - ( GRLIB_secondary_missions_costs select _mission_index );
|
||||
|
||||
if (_mission_index == 0) then {[] spawn fob_hunting;};
|
||||
if (_mission_index == 1) then {[] spawn convoy_hijack;};
|
||||
if (_mission_index == 2) then {[] spawn search_and_rescue;};
|
||||
|
||||
GRLIB_secondary_starting = false; publicVariable "GRLIB_secondary_starting";
|
||||
|
||||
true
|
||||
Reference in New Issue
Block a user