suggestions by @veteran29

This commit is contained in:
Mario 2019-09-29 21:34:52 +02:00
parent ed22bf360b
commit 6cbaeeaf34
3 changed files with 37 additions and 8 deletions

View File

@ -4,7 +4,7 @@
File: fn_core_handleSector.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-05-06
Last Update: 2019-09-28
Last Update: 2019-09-29
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
@ -28,17 +28,18 @@ private _handler = [
// Per Tick
_this getVariable "params" params ["_sector", "_sectorPos"];
// If there are no enemy units in two times the capture range and friendly units are in capture range
// If the enemy units within capture range are outnumbered and there are no enemy tanks
// capture the sector
// ToDo: optimize
if (
(
({side _x isEqualTo KPLIB_preset_sideF} count (_sectorPos nearEntities ["AllVehicles", KPLIB_param_sectorCapRange])) >
({side _x isEqualTo KPLIB_preset_sideE} count (_sectorPos nearEntities ["AllVehicles", KPLIB_param_sectorCapRange * 1.5]))
* KPLIB_param_sectorCapRatio
) && (
) && {
({side _x isEqualTo KPLIB_preset_sideE} count (_sectorPos nearEntities ["Tank", KPLIB_param_sectorCapRange * 1.5]))
isEqualTo 0
)
}
) then {
[format ["Sector %1 (%2) captured", markerText _sector, _sector], "CORE", true] call KPLIB_fnc_common_log;

View File

@ -4,7 +4,7 @@
File: fn_garrison_despawn.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-10-20
Last Update: 2019-09-16
Last Update: 2019-09-29
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
@ -54,7 +54,10 @@ private _heavyVeh = [];
if (!((crew _x) isEqualTo []) && !(_x in (KPLIB_preset_vehTransPlE + KPLIB_preset_vehLightUnarmedPlE))) then {
_vehicle = _x;
_lightVeh pushBack (typeOf _x);
{_handledCrew pushBack _x; _vehicle deleteVehicleCrew _x;} forEach ((crew _x) select {!(_x getVariable ["KPLIB_captured", false])});
{
_handledCrew pushBack _x;
_vehicle deleteVehicleCrew _x;
} forEach ((crew _x) select {!(_x getVariable ["KPLIB_captured", false])});
};
deleteVehicle _x;
};
@ -65,7 +68,10 @@ private _heavyVeh = [];
if ((alive _x) && !((crew _x) isEqualTo []) && !(_x getVariable ["KPLIB_captured", false])) then {
_vehicle = _x;
_heavyVeh pushBack (typeOf _x);
{_handledCrew pushBack _x; _vehicle deleteVehicleCrew _x;} forEach ((crew _x) select {!(_x getVariable ["KPLIB_captured", false])});
{
_handledCrew pushBack _x;
_vehicle deleteVehicleCrew _x;
} forEach ((crew _x) select {!(_x getVariable ["KPLIB_captured", false])});
deleteVehicle _vehicle;
};
} forEach (_activeGarrisonRef select 4);

View File

@ -4,7 +4,7 @@
File: fn_captive_preInit.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-10
Last Update: 2019-09-26
Last Update: 2019-09-29
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
@ -63,6 +63,26 @@ if (isServer) then {
_unit switchMove "AmovPercMstpSnonWnonDnon_EaseIn";
}] call CBA_fnc_addEventHandler;
// Emit lib captive event on ace event to ensure compatibilty
["ace_captives_moveInCaptive", {
params [
["_unit", objNull, [objNull]],
["_vehicle", objNull, [objNull]]
];
// Emit global event
["KPLIB_captive_loaded", [_unit, _vehicle]] call CBA_fnc_globalEvent;
}] call CBA_fnc_addEventHandler;
// Emit lib captive event on ace event to ensure compatibilty
["ace_captives_moveOutCaptive", {
params [
["_unit", objNull, [objNull]]
];
// Emit global event
["KPLIB_captive_unloaded", [_unit]] call CBA_fnc_globalEvent;
}] call CBA_fnc_addEventHandler;
// Player section
if (hasInterface) then {
@ -72,6 +92,8 @@ if (hasInterface) then {
["_unit", objNull, [objNull]],
["_vehicle", objNull, [objNull]]
];
// Exit the function on missing vehicle, due to an emitted event through ace
if (isNull _vehicle) exitWith {};
// Remove the stop escort action if available
player removeAction (player getVariable ["KPLIB_stopEscort_id", 9000]);