Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enemy Commander FSM and patrols #617

Merged
merged 25 commits into from
Jun 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
24d92ad
Some cleaning in hpp files
Wyqer May 18, 2019
14bbfb9
texture `ca` in lowercase
Wyqer May 18, 2019
efac152
Removed unused texture files
Wyqer May 19, 2019
5936981
First draft for the enemy commander FSM
Wyqer May 26, 2019
115cc5d
Start FSM always in unaware for debug for now
Wyqer May 26, 2019
bcb33d8
Removed pushBack forEach iteration
Wyqer Jun 8, 2019
25071dc
save/load of enemy commander state
Wyqer Jun 8, 2019
5a87ade
Update enemy functions.hpp
Wyqer Jun 8, 2019
4716814
common_fps function
Wyqer Jun 8, 2019
e13cdfa
Small optimization in locked vehicle assignment
Wyqer Jun 8, 2019
3e6a4c1
getNearestMarker with 2d distance instead of 3d
Wyqer Jun 8, 2019
0ef129d
Typo in parameter list
Wyqer Jun 8, 2019
33603f8
Spawn enemy patrol function
Wyqer Jun 8, 2019
2ec60a4
Spawn condition for patrols
Wyqer Jun 9, 2019
132ac8a
Adjusted spawnPatrol function
Wyqer Jun 9, 2019
b7ec883
Update Changelog
Wyqer Jun 9, 2019
f865018
Debug Param for enemy module
Wyqer Jun 15, 2019
f03b706
Very small format tweaks in settings files
Wyqer Jun 15, 2019
f00201c
Apply enemy debug setting in functions
Wyqer Jun 15, 2019
0f84c11
Tweaked Commander FSM debug messages
Wyqer Jun 15, 2019
0d5ed3b
Log output for spawn patrol with distance
Wyqer Jun 15, 2019
cd307e4
Wrong key id for cratefiller tooltip
Wyqer Jun 15, 2019
ebe8461
Merge branch 'v0.97S13' into v0.97S13-574
Wyqer Jun 15, 2019
37e1b04
Shuffle sectors before appending to start sector
Wyqer Jun 17, 2019
8925405
Patrol sector shuffle tweak
Wyqer Jun 22, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"_thisId",
"_thisType",
"BIS_fnc_reviveInit",
"CBA_Settings_fnc_init",
"CBA_fnc_compatibleMagazines",
"CBA_fnc_notify",
"CBA_Settings_fnc_init",
"KPLIB_eden_boxspawn",
"KPLIB_eden_potatospawn",
"KPLIB_eden_startbase",
Expand All @@ -30,6 +30,7 @@
"KPLIB_param_crateVolume",
"KPLIB_param_damageInfluence",
"KPLIB_param_debug",
"KPLIB_param_enemyDebug",
"KPLIB_param_fobRange",
"KPLIB_param_fuelInfluence",
"KPLIB_param_limitedZeusCeiling",
Expand All @@ -44,9 +45,9 @@
"KPLIB_param_presetF",
"KPLIB_param_presetR",
"KPLIB_param_recycleFactor",
"KPLIB_param_refundSupply",
"KPLIB_param_refundAmmo",
"KPLIB_param_refundFuel",
"KPLIB_param_refundSupply",
"KPLIB_param_resupplyAmmoCost",
"KPLIB_param_resupplyFuelCost",
"KPLIB_param_resupplyGallCost",
Expand Down Expand Up @@ -116,13 +117,13 @@
"KPLIB_preset_lockedVehPlF",
"KPLIB_preset_logiBuildingE",
"KPLIB_preset_logiBuildingF",
"KPLIB_preset_logiTruckE",
"KPLIB_preset_logiTruckF",
"KPLIB_preset_logisticE",
"KPLIB_preset_logisticF",
"KPLIB_preset_logisticPlC",
"KPLIB_preset_logisticPlE",
"KPLIB_preset_logisticPlF",
"KPLIB_preset_logiTruckE",
"KPLIB_preset_logiTruckF",
"KPLIB_preset_mortarE",
"KPLIB_preset_mortarF",
"KPLIB_preset_nameC",
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Added: Mission configuration completely via CBA Settings.
* Added: Logistic station with cratefiller, vehicle resupply and recycle functionality.
* Added: Garrison dialog for the commander to manage his own sector garrisons.
* Added: Enemy Commander decision making and (re)action triggering via a FSM.
* Updated: Traditional Chinese Localization. Thanks to [dustin902001](https://github.com/dustin902001)
* Removed: Mission configuration via mission parameters.
* Tweaked: License changed from MIT to GPLv3.
Expand Down
17 changes: 3 additions & 14 deletions Missionframework/KPGUI/KPGUI_classes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: KPGUI_classes.hpp
Author: Wyqer - https://github.com/KillahPotatoes
Date: 2018-09-13
Last Update: 2019-05-04
Last Update: 2019-05-19
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Expand Down Expand Up @@ -57,7 +57,6 @@ class KPGUI_PRE_ScrollBar {
class KPGUI_PRE_Title {
deletable = 0;
fade = 0;
access = 0;
type = 0;
idc = -1;
colorBackground[] = KP_COLOR_PLAYERDEFINE;
Expand All @@ -83,7 +82,6 @@ class KPGUI_PRE_Title {
class KPGUI_PRE_CloseCross {
deletable = 0;
fade = 0;
access = 0;
type = 11;
style = 48 + 2048;
color[] = {1, 1, 1, 0.75};
Expand Down Expand Up @@ -124,7 +122,6 @@ class KPGUI_PRE_VersionIcon: KPGUI_PRE_CloseCross {
class KPGUI_PRE_Background {
deletable = 0;
fade = 0;
access = 0;
type = 0;
idc = -1;
colorBackground[] = KP_COLOR_BACKGROUND;
Expand All @@ -150,7 +147,6 @@ class KPGUI_PRE_Background {
class KPGUI_PRE_Text {
deletable = 0;
fade = 0;
access = 0;
type = 0;
idc = -1;
colorBackground[] = {0, 0, 0, 0};
Expand Down Expand Up @@ -182,7 +178,6 @@ class KPGUI_PRE_InlineTitle: KPGUI_PRE_Text {
class KPGUI_PRE_ActiveText {
deletable = 0;
fade = 0;
access = 0;
type = 11;
style = 2;
color[] = {0, 0, 0, 1};
Expand Down Expand Up @@ -234,7 +229,6 @@ class KPGUI_PRE_PictureRatio: KPGUI_PRE_Picture {
class KPGUI_PRE_Button {
deletable = 0;
fade = 0;
access = 0;
type = 1;
text = "";
colorText[] = {1, 1, 1, 1};
Expand Down Expand Up @@ -316,7 +310,6 @@ class KPGUI_PRE_ControlsGroupNoScrollbars: KPGUI_PRE_ControlsGroup
class KPGUI_PRE_Combo {
deletable = 0;
fade = 0;
access = 0;
type = 4;
colorSelect[] = {0, 0, 0, 1};
colorText[] = {1, 1, 1, 1};
Expand Down Expand Up @@ -401,7 +394,6 @@ class KPGUI_PRE_CheckBox {
class KPGUI_PRE_ListBox {
deletable = 0;
fade = 0;
access = 0;
type = 5;
rowHeight = 0;
colorText[] = {1, 1, 1, 1};
Expand Down Expand Up @@ -451,7 +443,6 @@ class KPGUI_PRE_ListBox {
class KPGUI_PRE_ListNBox {
deletable = 0;
fade = 0;
access = 0;
type = 102;
rowHeight = 0;
colorText[] = {1, 1, 1, 1};
Expand Down Expand Up @@ -553,7 +544,6 @@ class KPGUI_PRE_Slider {
class KPGUI_PRE_EditBox {
deletable = 0;
fade = 0;
access = 0;
type = 2;
x = 0;
y = 0;
Expand Down Expand Up @@ -595,7 +585,6 @@ class KPGUI_PRE_ProgressBar
class KPGUI_PRE_MapControl {
deletable = 0;
fade = 0;
access = 0;
type = 101;
idc = 51;
style = 16 + 32;
Expand Down Expand Up @@ -1195,7 +1184,7 @@ class KPGUI_PRE_DialogTitleSR: KPGUI_PRE_Title {

// Cross symbol
class KPGUI_PRE_DialogCrossSR: KPGUI_PRE_CloseCross {
x = safeZoneX + safeZoneW * (KP_X_VAL_SR + KP_WIDTH_VAL_SR - 0.02)
x = safeZoneX + safeZoneW * (KP_X_VAL_SR + KP_WIDTH_VAL_SR - 0.02);
y = KP_GETY_CROSS(KP_Y_VAL_SR);
};

Expand All @@ -1219,7 +1208,7 @@ class KPGUI_PRE_DialogButtonSR: KPGUI_PRE_Button {
*/

class KPGUI_PRE_LogoRightCorner: KPGUI_PRE_PictureRatio {
text = "KPGUI\res\kp512_CA.paa";
text = "KPGUI\res\kp512_ca.paa";
x = "safezoneX + safezoneW - 5.3 * (((safezoneW / safezoneH) min 1.2) / 40)";
y = "safezoneY + safezoneH - 4.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
w = "3.5 * (((safezoneW / safezoneH) min 1.2) / 40)";
Expand Down
10 changes: 5 additions & 5 deletions Missionframework/modules/00_init/fnc/fn_init_loadData.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_init_loadData.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2017-10-16
Last Update: 2019-04-22
Last Update: 2019-06-08
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No

Expand Down Expand Up @@ -35,8 +35,8 @@ if (_moduleData isEqualTo []) then {
private _nextVehicle = "";
private _nextBase = "";
while {((count _assignedVehicles) < (count KPLIB_preset_lockedVehPlF)) && ((count _assignedBases) < (count KPLIB_sectors_military))} do {
_nextVehicle = selectRandom (KPLIB_preset_lockedVehPlF select {!(_x in _assignedVehicles)});
_nextBase = selectRandom (KPLIB_sectors_military select {!(_x in _assignedBases)});
_nextVehicle = selectRandom (KPLIB_preset_lockedVehPlF - _assignedVehicles);
_nextBase = selectRandom (KPLIB_sectors_military - _assignedBases);
_assignedVehicles pushBack _nextVehicle;
_assignedBases pushBack _nextBase;
KPLIB_sectors_lockedVeh pushBack [_nextVehicle, _nextBase];
Expand Down Expand Up @@ -75,8 +75,8 @@ if (_moduleData isEqualTo []) then {
} forEach KPLIB_sectors_lockedVeh;

while {((count _assignedVehicles) < (count KPLIB_preset_lockedVehPlF)) && ((count _assignedBases) < (count KPLIB_sectors_military))} do {
_nextVehicle = selectRandom (KPLIB_preset_lockedVehPlF select {!(_x in _assignedVehicles)});
_nextBase = selectRandom (KPLIB_sectors_military select {!(_x in _assignedBases)});
_nextVehicle = selectRandom (KPLIB_preset_lockedVehPlF - _assignedVehicles);
_nextBase = selectRandom (KPLIB_sectors_military - _assignedBases);
_assignedVehicles pushBack _nextVehicle;
_assignedBases pushBack _nextBase;
KPLIB_sectors_lockedVeh pushBack [_nextVehicle, _nextBase];
Expand Down
4 changes: 1 addition & 3 deletions Missionframework/modules/00_init/fnc/fn_init_settings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_init_settings.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-11-09
Last Update: 2019-04-27
Last Update: 2019-06-15
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No

Expand All @@ -18,7 +18,6 @@
Function reached the end [BOOL]
*/


/*
----- GENERAL SETTINGS -----
*/
Expand Down Expand Up @@ -119,7 +118,6 @@
----- PRESET SETTINGS -----
*/


// KPLIB_param_presetF
// Selection for the units, vehicles, etc. for the player side.
// Default: Custom West Army
Expand Down
29 changes: 29 additions & 0 deletions Missionframework/modules/01_common/fnc/fn_common_fps.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
KPLIB_fnc_common_fps

File: fn_common_fps.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-08
Last Update: 2019-06-08
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: Yes

Description:
Returns the current FPS or, if a number is given, if the FPS are above or equal given number.

Parameter(s):
_fps - Value to check if FPS are equal or above. -1 to get current FPS. [NUMBER, defaults to -1]

Returns:
Current FPS above given number or current FPS value [BOOL or NUMBER]
*/

params [
["_fps", -1, [0]]
];

if (_fps > -1) then {
diag_fps >= _fps
} else {
parseNumber (diag_fps toFixed 2)
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_common_getPresetClass.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-12-08
Last Update: 2019-04-22
Last Update: 2019-06-09
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: Yes

Expand All @@ -13,7 +13,7 @@

Parameter(s):
_type - Preset type name [STRING, defaults to ""]
_side - Preset side [SIDE, defaults to KPLIB_preset_sideEnemy]
_side - Preset side [SIDE, defaults to KPLIB_preset_sideE]
_isArray - Array of classnames (true) or single classname (false) [BOOL, defaults to false]

Returns:
Expand Down
5 changes: 4 additions & 1 deletion Missionframework/modules/01_common/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: functions.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-09-15
Last Update: 2019-04-22
Last Update: 2019-06-08
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Expand Down Expand Up @@ -38,6 +38,9 @@ class common {
// Creates a vehicle at given position with given direction
class common_createVehicle {};

// Check current FPS or if they are higher or equal than given number
class common_fps {};

// Generate positions in circle
class common_getCirclePositions {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_core_getNearestMarker.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2017-11-26
Last Update: 2019-04-22
Last Update: 2019-06-08
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: Yes

Expand All @@ -27,8 +27,8 @@ params [
];


private _markersWithinRange = _markers select {((markerPos _x) distance _centerPos) < _range};
private _markersAscByRange = [_markersWithinRange, [_centerPos], {(markerPos _x) distance _input0}, "ASCEND"] call BIS_fnc_sortBy;
private _markersWithinRange = _markers select {((markerPos _x) distance2D _centerPos) < _range};
private _markersAscByRange = [_markersWithinRange, [_centerPos], {(markerPos _x) distance2D _input0}, "ASCEND"] call BIS_fnc_sortBy;
// Return nearest marker
if !(_markersAscByRange isEqualTo []) then {
_markersAscByRange select 0
Expand Down
3 changes: 1 addition & 2 deletions 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-04-22
Last Update: 2019-06-15
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No

Expand All @@ -18,7 +18,6 @@
Function reached the end [BOOL]
*/


/*
----- SECTOR SETTINGS -----
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_respawn_settings.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-11-11
Last Update: 2019-04-22
Last Update: 2019-06-15
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No

Expand All @@ -18,6 +18,10 @@
Function reached the end [BOOL]
*/

/*
----- RESPAWN SETTINGS -----
*/

// KPLIB_param_mobileRespawn
// Enables/Disables the mobile respawn functionality of certain vehicles.
// Default: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_resources_preInit.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-12-13
Last Update: 2019-04-22
Last Update: 2019-06-08
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No

Expand Down Expand Up @@ -147,10 +147,7 @@ if (isServer) then {
]] call KPLIB_fnc_init_filterMods;

// Plain transport vehicle classnames array
KPLIB_resources_transportVehicles = [];
{
KPLIB_resources_transportVehicles pushBack (_x select 0);
} forEach KPLIB_resources_transportConfigs;
KPLIB_resources_transportVehicles = KPLIB_resources_transportConfigs apply {_x select 0};

// Send filtered lists to clients
publicVariable "KPLIB_resources_transportConfigs";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_resources_settings.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-12-14
Last Update: 2019-05-04
Last Update: 2019-06-15
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No

Expand All @@ -18,7 +18,6 @@
Function reached the end [BOOL]
*/


/*
----- RESOURCES SETTINGS -----
*/
Expand Down
Loading