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