Skip to content

Commit

Permalink
Merge pull request #676 from KillahPotatoes/v0.97S14
Browse files Browse the repository at this point in the history
V0.97 s14
  • Loading branch information
Wyqer authored Sep 30, 2019
2 parents 4461e5e + 2f537e9 commit 26711e7
Show file tree
Hide file tree
Showing 29 changed files with 1,017 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion Missionframework/KPLIB_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
};
31 changes: 17 additions & 14 deletions Missionframework/modules/01_common/fnc/fn_common_addAction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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};

// Localize local to clients language
_string = localize _string;
if (isNull _target || _string isEqualTo "" || _args isEqualTo []) exitWith {-1};

// 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 {
Expand All @@ -45,6 +50,4 @@ private _actionArray = [_string];
_actionArray append _args;

// Add action to target
_target addAction _actionArray;

true
_target addAction _actionArray
15 changes: 11 additions & 4 deletions Missionframework/modules/02_core/fnc/fn_core_handleSector.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;

Expand Down
15 changes: 14 additions & 1 deletion Missionframework/modules/02_core/fnc/fn_core_settings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 -----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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];
Expand Down
3 changes: 3 additions & 0 deletions Missionframework/modules/15_build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions Missionframework/modules/16_garrison/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions Missionframework/modules/16_garrison/fnc/fn_garrison_despawn.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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;
};
Expand All @@ -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);
Expand All @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions Missionframework/modules/26_cratefiller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions Missionframework/modules/27_mission/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
108 changes: 108 additions & 0 deletions Missionframework/modules/28_captive/README.md
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 26711e7

Please sign in to comment.