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,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 "";
};