Merge pull request #676 from KillahPotatoes/v0.97S14

V0.97 s14
This commit is contained in:
Christian 2019-09-30 11:12:26 +02:00 committed by GitHub
commit 26711e7df7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 1016 additions and 27 deletions

View File

@ -22,6 +22,8 @@
"KPLIB_param_aceResupply",
"KPLIB_param_ammoInfluence",
"KPLIB_param_arsenalType",
"KPLIB_param_captiveIntel",
"KPLIB_param_captiveIntelRandom",
"KPLIB_param_clearVehicleCargo",
"KPLIB_param_commanderZeusMode",
"KPLIB_param_copyDistance",
@ -66,6 +68,7 @@
"KPLIB_param_sectorActRange",
"KPLIB_param_sectorCap",
"KPLIB_param_sectorCapRange",
"KPLIB_param_sectorCapRatio",
"KPLIB_param_stamina",
"KPLIB_param_subCommanderZeusMode",
"KPLIB_param_timeMulti",

View File

@ -4,7 +4,7 @@
File: KPLIB_functions.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2017-10-16
Last Update: 2019-06-22
Last Update: 2019-09-10
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Description:
@ -30,5 +30,6 @@ class KPLIB {
#include "modules\24_enemy\functions.hpp"
#include "modules\26_cratefiller\functions.hpp"
#include "modules\27_mission\functions.hpp"
#include "modules\28_captive\functions.hpp"
#include "modules\90_missions\functions.hpp"
};

View File

@ -4,7 +4,7 @@
File: fn_common_addAction.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-12-05
Last Update: 2019-03-30
Last Update: 2019-09-28
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: Yes
@ -13,27 +13,32 @@
This should be used if adding an action to an object to ensure the localization is correct.
Parameter(s):
_target - Object to add the action to [OBJECT, defaults to objNull]
_string - Stringtable string key for the action [STRING, defaults to ""]
_args - Array of all other arguments for addAction without the title [ARRAY, defaults to []]
_color - Hex code of desired color e.g. #FF8000. Optional. [STRING, defaults to ""]
_target - Object to add the action to [OBJECT, defaults to objNull]
_string - Stringtable string key or string/variable array for the action [STRING/ARRAY, defaults to ""]
_args - Array of all other arguments for addAction without the title [ARRAY, defaults to []]
_color - Hex code of desired color e.g. #FF8000. Optional. [STRING, defaults to ""]
Returns:
Action added [BOOL]
Action ID [NUMBER]
*/
params [
["_target", objNull, [objNull]],
["_string", "", [""]],
["_string", "", ["", []]],
["_args", [], [[]], []],
["_color", "", [""]]
];
// Leave if there are parameters missing
if (isNull _target || _string isEqualTo "" || _args isEqualTo []) exitWith {false};
if (isNull _target || _string isEqualTo "" || _args isEqualTo []) exitWith {-1};
// Localize local to clients language
_string = localize _string;
// Check if given string is string key or formatted text
if (_string isEqualType "") then {
// Localize local to clients language
_string = localize _string;
} else {
_string = format [localize (_string select 0), _string select 1];
};
// Add color, if provided
if !(_color isEqualTo "") then {
@ -45,6 +50,4 @@ private _actionArray = [_string];
_actionArray append _args;
// Add action to target
_target addAction _actionArray;
true
_target addAction _actionArray

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-04-22
Last Update: 2019-09-29
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
@ -28,11 +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 (
!([_sectorPos, 2 * KPLIB_param_sectorCapRange, [KPLIB_preset_sideE]] call KPLIB_fnc_core_areUnitsNear)
&& {[_sectorPos, KPLIB_param_sectorCapRange] call KPLIB_fnc_core_areUnitsNear}
(
({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_core_settings.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-11-11
Last Update: 2019-06-15
Last Update: 2019-09-10
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
@ -61,6 +61,19 @@
{}
] call CBA_Settings_fnc_init;
// KPLIB_param_sectorCapRatio
// Ratio of enemy units to friendly units, which is needed to capture a sector.
// Default: 1.5
[
"KPLIB_param_sectorCapRatio",
"SLIDER",
[localize "STR_KPLIB_SETTINGS_SECTOR_SECRATIO", localize "STR_KPLIB_SETTINGS_SECTOR_SECRATIO_TT"],
localize "STR_KPLIB_SETTINGS_SECTOR",
[1, 10, 1.5, 1],
1,
{}
] call CBA_Settings_fnc_init;
/*
----- BI REVIVE SETTINGS -----

View File

@ -4,7 +4,7 @@
File: fn_common_setupPlayerActions.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-05-28
Last Update: 2019-04-22
Last Update: 2019-09-12
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
@ -19,7 +19,7 @@
*/
// Actions avalible LOCALLY to player
if(hasInterface) then {
if (hasInterface) then {
// FOB redeploy action
private _fobRedeployCondition = '_target isEqualTo _originalTarget && !(_originalTarget getVariable ["KPLIB_fob", ""] isEqualTo "")';
private _actionArray = [localize "STR_KPLIB_ACTION_REDEPLOY", {["KPLIB_respawn_requested", _this] call CBA_fnc_localEvent}, nil, -801, false, true, "", _fobRedeployCondition, 10];

View File

@ -99,3 +99,6 @@ Furthermore it handles the saving/loading of all objects which are buildable/spa
### Scripts
No scripts will be started by this module
### Implemented permissions
* Build menu

View File

@ -50,3 +50,6 @@ It'll also provide functions to change garrison data and a garrison management d
### Scripts
No scripts will be started by this module
### Implemented permissions
* Garrison management

View File

@ -4,7 +4,7 @@
File: fn_garrison_changeOwner.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-10-23
Last Update: 2019-03-30
Last Update: 2019-09-28
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: Yes

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-05-04
Last Update: 2019-09-29
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
@ -40,7 +40,7 @@ private _heavyVeh = [];
deleteVehicle _x;
_infantry = _infantry + 1;
};
} forEach (_activeGarrisonRef select 2);
} forEach ((_activeGarrisonRef select 2) select {!(_x getVariable ["KPLIB_captured", false])});
/* !NOTE!
With the current despawn checks for the vehicles, the vehicle won't be deleted if it's a wreck or the crew bailed out due to damage.
@ -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);
{
_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);
{
_handledCrew pushBack _x;
_vehicle deleteVehicleCrew _x;
} forEach ((crew _x) select {!(_x getVariable ["KPLIB_captured", false])});
deleteVehicle _vehicle;
};
} forEach (_activeGarrisonRef select 4);
@ -76,7 +82,7 @@ private _heavyVeh = [];
deleteVehicle _x;
_infantry = _infantry + 1;
};
} forEach (_activeGarrisonRef select 5);
} forEach ((_activeGarrisonRef select 5) select {!(_x getVariable ["KPLIB_captured", false])});
// Update persistent garrison data
if ((_activeGarrisonRef select 1) isEqualTo (_persistentGarrisonRef select 1)) then {

View File

@ -116,3 +116,6 @@ Calls KPLIB_fnc_cratefiller_presets to process the new white- and blacklist
### Scripts
No scripts will be started by this module
### Implemented permissions
* Cratefiller

View File

@ -89,3 +89,6 @@ Processes a mission start or abort dependent on the passed arguments
### Scripts
No scripts will be started by this module
### Implemented permissions
* Mission dialog

View File

@ -0,0 +1,108 @@
# KP Liberation Module Description
## Captive Module
This module handles the prisoners of war.
It'll check for remaining soldiers on sector capture and ensure that they'll surrender and can get handled through interactions.
### Dependencies
* Common
### Consumed events
**KPLIB_sector_captured** (server side)
Calls KPLIB_fnc_captive_checkSector to search and handle remaining units
**KPLIB_captive_arrested** (server side)
Plays the arrest moves for captives to ensure that the moves are handled at the correct locality
**ace_captiveStatusChanged** (server side)
Calls KPLIB_fnc_captive_setAceCaptive to handle the ace captive system and integrate the lib stuff to the captives
**KPLIB_captive_load** (global)
Move the captive into the vehicle cargo
**KPLIB_captive_unload** (global)
Move the captive out of the vehicle cargo
**KPLIB_captive_loaded** (client side)
Handles the captive load, to ensure that the actions get applied and remove accordingly
**KPLIB_captive_unloaded** (client side)
Removes the unload action from the vehicle
### Emitted events
**KPLIB_captive_surrendered** (global)
Emitted when a unit surrenders
**KPLIB_captive_arrested** (global)
Emitted when a surrendered unit gets arrested
**KPLIB_captive_load** (target event)
Emitted when a captive should get loaded
**KPLIB_captive_loaded** (global)
Emitted when a captive gets loaded
**KPLIB_captive_unload** (target event)
Emitted when a captive should get unloaded
**KPLIB_captive_unloaded** (global)
Emitted when a captive gets unloaded
**KPLIB_captive_interrogated** (global)
Emitted when a captive gets interrogated
### Functions
* KPLIB_fnc_captive_addCaptiveAction
*Adds all needed actions to a surrendered unit.*
* KPLIB_fnc_captive_checkSector
*Checks the given sector for remaining enemys and let them surrender.*
* KPLIB_fnc_captive_escort
*ttach a captive to the escorting player.*
* KPLIB_fnc_captive_interrogate
*Interrogates the unit, adds intel and deletes it.*
* KPLIB_fnc_captive_loadCaptive
*Loads given unit into the nearest vehicle cargo seat.*
* KPLIB_fnc_captive_postInit
*Module post initialization.*
* KPLIB_fnc_captive_preInit
*Module pre initialization.*
* KPLIB_fnc_captive_setAceCaptive
*Checks for ACE handcuffed units and rebinds them into the Liberation captive system.*
* KPLIB_fnc_captive_setCaptive
*Sets an unit into captive mode.*
* KPLIB_fnc_captive_setSurrender
*Given unit surrenders.*
* KPLIB_fnc_captive_settings
*CBA Settings initialization for this module*
* KPLIB_fnc_captive_stopEscort
*Detach a captive from the escorting player.*
* KPLIB_fnc_captive_unloadCaptive
*Unloads the give unit and removes the action from the vehicle.*
### Scripts
No scripts will be started by this module

View File

@ -0,0 +1,66 @@
/*
KPLIB_fnc_captive_addCaptiveAction
File: fn_captive_addCaptiveAction.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-11
Last Update: 2019-09-25
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Adds all needed actions to a surrendered unit.
Parameter(s):
_unit - Unit to apply the actions [OBJECT, defaults to objNull]
Returns:
Function reached the end [BOOL]
*/
params [
["_unit", objNull, [objNull]]
];
// Exit on missing object
if (isNull _unit) exitWith {
false
};
if !(KPLIB_ace_enabled) then {
// Add arrest action
[
_unit,
["STR_KPLIB_ACTION_ARREST", name _unit],
[{[_this select 0] call KPLIB_fnc_captive_setCaptive;}, nil, -800, false, true, "", "(_target getVariable [""KPLIB_surrender"", false]) && !(_target getVariable [""KPLIB_captive"", false])", 10]
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _unit];
// Add escort action
[
_unit,
["STR_KPLIB_ACTION_ESCORT", name _unit],
[{[_this select 0, _this select 1] call KPLIB_fnc_captive_escort;}, nil, -800, false, true, "", "_target getVariable [""KPLIB_captive"", false] && !(_this getVariable [""KPLIB_captive_isEscorting"", false])", 10]
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _unit];
// Add move in vehicle action
[_unit, {
private _id = [
_this,
["STR_KPLIB_ACTION_LOADCAPTIVE", name _this],
[{[_this select 0] call KPLIB_fnc_captive_loadCaptive;}, nil, -800, false, true, "", "_target getVariable [""KPLIB_captive"", false] && ({(_x emptyPositions ""cargo"") > 0} count (_target nearEntities [[""LandVehicle"", ""Air""], 5])) > 0", 10]
] call KPLIB_fnc_common_addAction;
// Store the load action to switch the locality when escorting
_this setVariable ["KPLIB_captive_loadID", _id];
}] remoteExecCall ["call", 0, _unit];
};
// Add interrogate action near FOB
[
_unit,
["STR_KPLIB_ACTION_INTERROGATE", name _unit],
[{[_this select 0] call KPLIB_fnc_captive_interrogate;}, nil, -800, false, true, "", "!((nearestObjects [_target ,[KPLIB_preset_fobBuildingF], 25]) isEqualTo [])", 10]
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _unit];
true

View File

@ -0,0 +1,37 @@
/*
KPLIB_fnc_captive_checkSector
File: fn_captive_checkSector.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-10
Last Update: 2019-09-28
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Checks the given sector for remaining enemys and lets them surrender.
Parameter(s):
_sector - Sector marker [STRING, defaults to ""]
Returns:
Function reached the end [BOOL]
*/
params [
["_sector", "", [""]]
];
// Exit if no sector is given
if (_sector isEqualTo "") exitWith {
false
};
private _sectorPos = getMarkerPos _sector;
// Check the sector for remaining units
{
[_x] call KPLIB_fnc_captive_setSurrender;
} forEach ((_sectorPos nearEntities ["Man", KPLIB_param_sectorCapRange * 2]) select {side _x isEqualTo KPLIB_preset_sideE});
true

View File

@ -0,0 +1,58 @@
/*
KPLIB_fnc_captive_escort
File: fn_captive_escort.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-21
Last Update: 2019-09-24
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Attach a captive to the escorting player.
Parameter(s):
_unit - Unit which will be escorted [OBJECT, defaults to objNull]
_escort - Escorting player [OBJECT, defaults to objNull]
Returns:
Function reached the end [BOOL]
*/
params [
["_unit", objNull, [objNull]],
["_escort", objNull, [objNull]]
];
// Exit on missing object
if (isNull _unit || isNull _escort) exitWith {
false
};
// Set variable on escort
_escort setVariable ["KPLIB_captive_isEscorting", true, true];
_escort setVariable ["KPLIB_captive_escorting", _unit, true];
// Attach the captive to the player
_unit attachTo [_escort, [0, 1, 0]];
// Switch the load action from unit to player
_unit removeAction (_unit getVariable ["KPLIB_captive_loadID", 9000]);
private _id = [
_escort,
["STR_KPLIB_ACTION_LOADCAPTIVE", name _unit],
[{[_this select 3] call KPLIB_fnc_captive_loadCaptive;}, _unit, -800, false, true, "", "({(_x emptyPositions ""cargo"") > 0} count (_target nearEntities [[""LandVehicle"", ""Air""], 5])) > 0", 10]
] call KPLIB_fnc_common_addAction;
_unit setVariable ["KPLIB_captive_loadID", _id];
// Add the action to release the captive
private _id = [
_escort,
["STR_KPLIB_ACTION_STOPESCORT", name _unit],
[{[_this select 0, _this select 2] call KPLIB_fnc_captive_stopEscort;}, nil, -800, false, true, "","", 10]
] call KPLIB_fnc_common_addAction;
// Write the id into the player
_escort setVariable ["KPLIB_stopEscort_id", _id];
true

View File

@ -0,0 +1,45 @@
/*
KPLIB_fnc_captive_interrogate
File: fn_captive_interrogate.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-25
Last Update: 2019-09-25
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Interrogates the unit, adds intel and deletes it.
Parameter(s):
_unit - Unit to load in vehicle [OBJECT, defaults to objNull]
Returns:
Function reached the end [BOOL]
*/
params [
["_unit", objNull, [objNull]]
];
// Exit on missing object
if (isNull _unit) exitWith {
false
};
// Calculate the intel gain
private _intel = KPLIB_param_captiveIntel;
if !(KPLIB_param_captiveIntelRandom isEqualTo 0) then {
_intel = _intel + ((round (random (KPLIB_param_captiveIntelRandom * 2))) - KPLIB_param_captiveIntelRandom);
};
// Add the intel
[_intel] call KPLIB_fnc_resources_addIntel;
// Delete the unit
deleteVehicle _unit;
// Emit global event
["KPLIB_captive_interrogated", [_unit]] call CBA_fnc_globalEvent;
true

View File

@ -0,0 +1,57 @@
/*
KPLIB_fnc_captive_loadCaptive
File: fn_captive_loadCaptive.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-22
Last Update: 2019-09-24
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Loads given unit into the nearest vehicle cargo seat.
Parameter(s):
_unit - Unit to load in vehicle [OBJECT, defaults to objNull]
Returns:
Function reached the end [BOOL]
*/
params [
["_unit", objNull, [objNull]]
];
// Exit on missing object
if (isNull _unit) exitWith {
false
};
// Get the nearest vehicle
private _vehicle = ((_unit nearEntities [["LandVehicle", "Air"], 5]) select {(_x emptyPositions "cargo") > 0}) select 0;
// Check if the unit is getting escorted
if !(isNull attachedTo _unit) then {
detach _unit;
// Set variable on escorting unit
player setVariable ["KPLIB_captive_isEscorting", false, true];
player setVariable ["KPLIB_captive_escorting", objNull, true];
// Switch the load action from player to unitAddons
player removeAction (_unit getVariable ["KPLIB_captive_loadID", 9000]);
private _id = [
_unit,
["STR_KPLIB_ACTION_LOADCAPTIVE", name _unit],
[{[_this select 0] call KPLIB_fnc_captive_loadCaptive;}, nil, -800, false, true, "", "_target getVariable [""KPLIB_captive"", false] && ({(_x emptyPositions ""cargo"") > 0} count (_target nearEntities [[""LandVehicle"", ""Air""], 5])) > 0", 10]
] call KPLIB_fnc_common_addAction;
_unit setVariable ["KPLIB_captive_loadID", _id];
};
// Emit target event to move the unit into the vehicle
["KPLIB_captive_load", [_unit, _vehicle], _unit] call CBA_fnc_targetEvent;
// Emit global event
["KPLIB_captive_loaded", [_unit, _vehicle]] call CBA_fnc_globalEvent;
true

View File

@ -0,0 +1,41 @@
/*
KPLIB_fnc_captive_postInit
File: fn_captive_postInit.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-10
Last Update: 2019-09-10
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
The postInit function of a module takes care of starting/executing the modules functions or scripts.
Basically it starts/initializes the module functionality to make all provided features usable.
Parameter(s):
NONE
Returns:
Module postInit finished [BOOL]
*/
if (isServer) then {["Module initializing...", "POST] [CAPTIVE", true] call KPLIB_fnc_common_log;};
// Server section (dedicated and player hosted)
if (isServer) then {
};
// HC section
if (!hasInterface && !isDedicated) then {
};
// Player section
if (hasInterface) then {
};
if (isServer) then {["Module initialized", "POST] [CAPTIVE", true] call KPLIB_fnc_common_log;};
true

View File

@ -0,0 +1,124 @@
/*
KPLIB_fnc_captive_preInit
File: fn_captive_preInit.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-10
Last Update: 2019-09-29
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
The preInit function defines global variables, adds event handlers and set some vital settings which are used in this module.
Parameter(s):
NONE
Returns:
Module preInit finished [BOOL]
*/
if (isServer) then {
["Module initializing...", "PRE] [CAPTIVE", true] call KPLIB_fnc_common_log;
/*
----- Module Initialization -----
*/
// Process CBA Settings
[] call KPLIB_fnc_captive_settings;
// Units surrender on sector capture
["KPLIB_sector_captured", {[_this select 0] call KPLIB_fnc_captive_checkSector;}] call CBA_fnc_addEventHandler;
// Unit animation on arrest
["KPLIB_captive_arrested", {
_this select 0 playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon";
_this select 0 playMove "AmovPercMstpSnonWnonDnon_EaseIn";
}] call CBA_fnc_addEventHandler;
// Check for handcuffed enemys
["ace_captiveStatusChanged", {[_this select 0, _this select 1, _this select 2] call KPLIB_fnc_captive_setAceCaptive}] call CBA_fnc_addEventHandler;
};
// Add load captive EH
["KPLIB_captive_load", {
params [
["_unit", objNull, [objNull]],
["_vehicle", objNull, [objNull]]
];
// Move unit in vehicle cargo
_unit moveInCargo _vehicle;
}] call CBA_fnc_addEventHandler;
// Add unload captive EH
["KPLIB_captive_unload", {
params [
["_unit", objNull, [objNull]],
["_vehicle", objNull, [objNull]]
];
// Unload the unit
moveOut _unit;
_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 {
// Add EH for the captive unload action
["KPLIB_captive_loaded", {
params [
["_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]);
// Add the unload action to the vehicle
private _id = [
_vehicle,
["STR_KPLIB_ACTION_UNLOADCAPTIVE", name _unit],
[{[_this select 3, _this select 0] call KPLIB_fnc_captive_unloadCaptive;}, _unit, -800, false, true, "", "", 10]
] call KPLIB_fnc_common_addAction;
// Save id in unit
_unit setVariable ["KPLIB_captive_unloadID", _id]
}] call CBA_fnc_addEventHandler;
// Add EH to remove the unload action
["KPLIB_captive_unloaded", {
params [
["_unit", objNull, [objNull]],
["_vehicle", objNull, [objNull]]
];
// Remove the unload action from the vehicle
_vehicle removeAction (_unit getVariable ["KPLIB_captive_unloadID", 9000]);
}] call CBA_fnc_addEventHandler;
};
if (isServer) then {["Module initialized", "PRE] [CAPTIVE", true] call KPLIB_fnc_common_log;};
true

View File

@ -0,0 +1,45 @@
/*
KPLIB_fnc_captive_setAceCaptive
File: fn_captive_setAceCaptive.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-11
Last Update: 2019-09-28
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Checks for ACE handcuffed units and rebinds them into the Liberation captive system.
Parameter(s):
_unit - Unit to set in captive mode [OBJECT, defaults to objNull]
_state - State of captive [BOOLEAN, defaults to false]
_reason - Reason of the activated event [STRING, defaults to ""]
Returns:
Function reached the end [BOOL]
*/
params [
["_unit", objNull, [objNull]],
["_state", false, [false]],
["_reason", "", [""]]
];
// Exit on missing object
if (isNull _unit) exitWith {
false
};
if (_reason isEqualTo "SetHandcuffed" && _state) then {
// Set variable on unit
_unit setVariable ["KPLIB_captive", true];
// Apply the actions on the unit
[_unit] call KPLIB_fnc_captive_addCaptiveActions;
};
// Emit global event
["KPLIB_captive_arrested", [_unit]] call CBA_fnc_globalEvent;
true

View File

@ -0,0 +1,36 @@
/*
KPLIB_fnc_captive_setCaptive
File: fn_captive_setCaptive.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-11
Last Update: 2019-09-26
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Sets an unit into captive mode.
Parameter(s):
_unit - Unit to set in captive mode [OBJECT, defaults to objNull]
Returns:
Unit set into captive mode [BOOL]
*/
params [
["_unit", objNull, [objNull]]
];
// Exit on missing object
if (isNull _unit) exitWith {
false
};
// Set variable on unit
_unit setVariable ["KPLIB_captive", true, true];
// Emit global event
["KPLIB_captive_arrested", [_unit]] call CBA_fnc_globalEvent;
true

View File

@ -0,0 +1,71 @@
/*
KPLIB_fnc_captive_setSurrender
File: fn_captive_setSurrender.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-11
Last Update: 2019-09-25
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Given unit surrenders.
Parameter(s):
_unit - Unit to set in surrender [OBJECT, defaults to objNull]
Returns:
Unit surrendered [BOOL]
*/
params [
["_unit", objNull, [objNull]]
];
// Exit on missing object
if (isNull _unit) exitWith {
false
};
if !(vehicle _unit isEqualTo _unit) then {
moveOut _unit;
};
// Set variable on unit
_unit setVariable ["KPLIB_surrender", true, true];
_unit setVariable ["KPLIB_captured", true, true];
// Remove some equipment of the unit
removeAllWeapons _unit;
removeHeadgear _unit;
removeBackpack _unit;
_unit setUnitPos "UP";
if (KPLIB_ace_enabled) then {
[_unit, true] call ACE_captives_fnc_setSurrendered;
} else {
_unit disableAI "ANIM";
_unit disableAI "MOVE";
_unit playMove "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon";
_unit setCaptive true;
_unit setBehaviour "CARELESS";
// Apply the actions on the unit
[_unit] call KPLIB_fnc_captive_addCaptiveActions;
};
// Add a killed EH to the unit, to ensure that all actions will be removed
_unit addMPEventHandler ["MPKilled", {
// Remove all actions of the unit
removeAllActions (_this select 0);
// Remove the unload action from the vehicle if the unit is in a vehicle
private _vehicle = objectParent (_this select 0);
if !(isNull _vehicle) then {
_vehicle removeAction ((_this select 0) getVariable ["KPLIB_captive_unloadID", 9000]);
};
}];
// Emit global event
["KPLIB_captive_surrendered", [_unit]] call CBA_fnc_globalEvent;
true

View File

@ -0,0 +1,47 @@
/*
KPLIB_fnc_captive_settings
File: fn_captive_settings.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-12
Last Update: 2019-09-28
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
CBA Settings initialization for this module.
Parameter(s):
NONE
Returns:
Function reached the end [BOOL]
*/
// KPLIB_param_captiveIntel
// Amount of intel which will be granted on interrogation.
// Default: 10
[
"KPLIB_param_captiveIntel",
"SLIDER",
[localize "STR_KPLIB_SETTINGS_CAPTIVE_INTELVALUE", localize "STR_KPLIB_SETTINGS_CAPTIVE_INTELVALUE_TT"],
localize "STR_KPLIB_SETTINGS_CAPTIVE",
[1, 100, 10, 1],
1,
{}
] call CBA_Settings_fnc_init;
// KPLIB_param_captiveIntelRandom
// Amount of random intel modifier on interrogation.
// Default: 5
[
"KPLIB_param_captiveIntelRandom",
"SLIDER",
[localize "STR_KPLIB_SETTINGS_CAPTIVE_INTELRANDOM", localize "STR_KPLIB_SETTINGS_CAPTIVE_INTELRANDOM_TT"],
localize "STR_KPLIB_SETTINGS_CAPTIVE",
[0, 100, 5, 1],
1,
{}
] call CBA_Settings_fnc_init;
true

View File

@ -0,0 +1,54 @@
/*
KPLIB_fnc_captive_stopEscort
File: fn_captive_stopEscort.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-21
Last Update: 2019-09-26
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Detach a captive from the escorting player.
Parameter(s):
_escort - Escorting player [OBJECT, defaults to objNull]
_id - ID of the action [NUMBER, defaults to 0.068117098106117110107]
Returns:
Function reached the end [BOOL]
*/
params [
["_escort", objNull, [objNull]],
["_id", 0.068117098106117110107, [0]]
];
// Exit on missing object
if (isNull _escort || _id isEqualTo 0.068117098106117110107) exitWith {
false
};
// Get the captive
private _unit = _escort getVariable ["KPLIB_captive_escorting", objNull];
// Set variable on escort
_escort setVariable ["KPLIB_captive_isEscorting", false, true];
_escort setVariable ["KPLIB_captive_escorting", objNull, true];
// Detach the captive from the player
detach _unit;
// Remove the action
player removeAction _id;
// Switch the load action from player to unitAddons
player removeAction (_unit getVariable ["KPLIB_captive_loadID", 9000]);
_id = [
_unit,
["STR_KPLIB_ACTION_LOADCAPTIVE", name _unit],
[{[_this select 0] call KPLIB_fnc_captive_loadCaptive;}, nil, -800, false, true, "", "_target getVariable [""KPLIB_captive"", false] && ({(_x emptyPositions ""cargo"") > 0} count (_target nearEntities [[""LandVehicle"", ""Air""], 5])) > 0", 10]
] call KPLIB_fnc_common_addAction;
_unit setVariable ["KPLIB_captive_loadID", _id];
true

View File

@ -0,0 +1,38 @@
/*
KPLIB_fnc_captive_unloadCaptive
File: fn_captive_unloadCaptive.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-22
Last Update: 2019-09-24
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Unloads the give unit and removes the action from the vehicle.
Parameter(s):
_unit - Unit to load in vehicle [OBJECT, defaults to objNull]
_vehicle - Vehicle which carries the unit [OBJECT, defaults to objNull]
Returns:
Function reached the end [BOOL]
*/
params [
["_unit", objNull, [objNull]],
["_vehicle", objNull, [objNull]]
];
// Exit on missing object
if (isNull _unit || isNull _vehicle) exitWith {
false
};
// Emit target event to move the unit out of the vehicle
["KPLIB_captive_unload", [_unit, _vehicle], _unit] call CBA_fnc_targetEvent;
// Emit global event
["KPLIB_captive_unloaded", [_unit, _vehicle]] call CBA_fnc_globalEvent;
true

View File

@ -0,0 +1,61 @@
/*
KP LIBERATION MODULE FUNCTIONS
File: functions.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-09-10
Last Update: 2019-09-26
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Defines for all functions, which are brought by this module.
*/
class captive {
file = "modules\28_captive\fnc";
// Adds all needed actions to a surrendered unit
class captive_addCaptiveActions {};
// Checks the given sector for remaining enemys and sets them into captive mode
class captive_checkSector {};
// Attach a captive to the escorting player
class captive_escort {};
// Interrogates the unit, adds intel and deletes it
class captive_interrogate {};
// Loads given unit into the nearest vehicle cargo seat
class captive_loadCaptive {};
// Module post initialization
class captive_postInit {
postInit = 1;
};
// Module pre initialization
class captive_preInit {
preInit = 1;
};
// Checks for ACE handcuffed units and rebinds them into the Liberation captive system
class captive_setAceCaptive {};
// Sets an unit into captive mode
class captive_setCaptive {};
// Given unit surrenders
class captive_setSurrender {};
// CBA Settings for this module
class captive_settings {};
// Detach a captive from the escorting player
class captive_stopEscort {};
// Unloads the give unit and removes the action from the vehicle
class captive_unloadCaptive {};
};

View File

@ -45,6 +45,7 @@ With these additions the intended complexity comes into the mission. It is highl
25 Friendly Commander Managing Dialog
26 Cratefiller
27 Mission handling
28 Prisoners of war
```
### TBA
Mod specific compatibility modules

View File

@ -203,6 +203,10 @@
<Chinese>-- 管理員選單 --</Chinese>
<German>-- Admin Menü --</German>
</Key>
<Key ID="STR_KPLIB_ACTION_ARREST">
<English>Arrest %1</English>
<German>%1 festnehmen</German>
</Key>
<Key ID="STR_KPLIB_ACTION_ARSENAL">
<English>-- ARSENAL --</English>
<Chinese>-- 軍火庫 --</Chinese>
@ -247,6 +251,10 @@
<English>-- RANDOM FOB DEPLOYMENT --</English>
<German>-- ZUFÄLLIGE FOB PLATZIERUNG --</German>
</Key>
<Key ID="STR_KPLIB_ACTION_ESCORT">
<English>Escort %1</English>
<German>%1 eskortieren</German>
</Key>
<Key ID="STR_KPLIB_ACTION_GARRISON_MENU">
<English>-- GARRISON MANAGEMENT --</English>
<German>-- GARNISONSVERWALTUNG --</German>
@ -255,6 +263,14 @@
<English>Move to aft deck</English>
<German>Zum Achterdeck bewegen</German>
</Key>
<Key ID="STR_KPLIB_ACTION_INTERROGATE">
<English>Interrogate %1</English>
<German>%1 verhören</German>
</Key>
<Key ID="STR_KPLIB_ACTION_LOADCAPTIVE">
<English>Load %1</English>
<German>%1 einladen</German>
</Key>
<Key ID="STR_KPLIB_ACTION_LOADCRATE">
<English>- LOAD CRATE -</English>
<Chinese>- 裝載貨物 -</Chinese>
@ -313,6 +329,10 @@
<Portuguese>- ORDENAR E CLASSIFICAR -</Portuguese>
<Turkish>- SIRALA VE DÜZENLE -</Turkish>
</Key>
<Key ID="STR_KPLIB_ACTION_STOPESCORT">
<English>Stop escorting %1</English>
<German>%1 loslassen</German>
</Key>
<Key ID="STR_KPLIB_ACTION_STORECRATE">
<English>- STORE CRATE -</English>
<Chinese>- 倉儲貨物 -</Chinese>
@ -324,6 +344,10 @@
<Spanish>- CAJA DE ALMACENAJE -</Spanish>
<Turkish>- KUTUYU DEPOLA -</Turkish>
</Key>
<Key ID="STR_KPLIB_ACTION_UNLOADCAPTIVE">
<English>Unload %1</English>
<German>%1 ausladen</German>
</Key>
<Key ID="STR_KPLIB_ACTION_UNLOADCRATE">
<English>- UNLOAD CRATES -</English>
<Chinese>- 卸載貨物 -</Chinese>
@ -1664,6 +1688,14 @@
<Chinese>在戰區中心半徑公尺內的單位可進行佔領</Chinese>
<German>Radius in Metern vom Sektor aus, in dem sich eine Einheit befinden muss, um den Sektor zu erobern.</German>
</Key>
<Key ID="STR_KPLIB_SETTINGS_SECTOR_SECRATIO">
<English>Sector Capture Unit Ratio</English>
<German>Einheitenverhältnis zur Sektoreroberung</German>
</Key>
<Key ID="STR_KPLIB_SETTINGS_SECTOR_SECRATIO_TT">
<English>Ratio of friendly to enemy units, which is needed to capture a sector.</English>
<German>Verhältnis von freundlichen zu feindlichen Kräften, welches benötigt wird um einen Sektor zu erobern.</German>
</Key>
<!-- ZEUS CATEGORY -->
<Key ID="STR_KPLIB_SETTINGS_ZEUS">
@ -1900,6 +1932,29 @@
<Key ID="STR_KPLIB_SETTINGS_MISSION_REFUND_TT">
<English>Defines the mission abortion refund in percentage.</English>
<German>Definiert die Rückerstattung in Prozent.</German>
</Key>
<!-- CAPTIVE CATEGORY -->
<Key ID="STR_KPLIB_SETTINGS_CAPTIVE">
<English>KPLIB - Captives</English>
<German>KPLIB - Gefangene</German>
</Key>
<Key ID="STR_KPLIB_SETTINGS_CAPTIVE_INTELVALUE">
<English>Intel gain through interrogation</English>
<German>Informationszuwachs bei einem Verhör</German>
</Key>
<Key ID="STR_KPLIB_SETTINGS_CAPTIVE_INTELVALUE_TT">
<English>Amount of intel gained through interrogation.</English>
<German>Menge an Informationen, die bei einem Verhör gewonnen werden.</German>
</Key>
<Key ID="STR_KPLIB_SETTINGS_CAPTIVE_INTELRANDOM">
<English>Intel randomization range</English>
<German>Zufallsbereich für den Informationszuwachs</German>
</Key>
<Key ID="STR_KPLIB_SETTINGS_CAPTIVE_INTELRANDOM_TT">
<English>Randomization range for intel gain through interrogation. E.g. a value of 5 will grant you 5 - 15 intel for a base value of 10.</English>
<German>Zufallsbereich für den Informationszuwachs bei einem Verhör. Mit einem Wert von 5 liegt der effektive Zuwachs, bei einem Ausgangswert von 10, zwischen 5 und 15.</German>
</Key>
</Package>