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 module pt1 #566

Merged
merged 27 commits into from
Feb 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c5a10a1
Additional getter functions for resources module
Wyqer Feb 16, 2019
5d0efcb
nearEntities doesn't work for buildings
Wyqer Feb 18, 2019
e3c741c
Example Module Template
Wyqer Feb 18, 2019
a45acc9
Enemy module foundation
Wyqer Feb 18, 2019
d062472
Enemy module additional functions
Wyqer Feb 18, 2019
c208e63
Tweaked params order in common_createGroup
Wyqer Feb 23, 2019
c0f2100
added unarmed light to possible transports
Wyqer Feb 23, 2019
a96e703
Change project inline comment tags
Wyqer Feb 23, 2019
e565486
Sector state handles
Wyqer Feb 23, 2019
1e9bc31
Infantry transfer between sector garrisons
Wyqer Feb 23, 2019
579cc04
Handle reinforcement convoy for active sector
Wyqer Feb 23, 2019
e48f9f8
Proper despawn of transport vehicles upon sector despawn
Wyqer Feb 23, 2019
2dfbbb7
Tweaks initial waypoint removal
Wyqer Feb 23, 2019
4e60709
Tweaked transfer to handle no available road objects
Wyqer Feb 23, 2019
e4f7b99
Simplified transport despawn
Wyqer Feb 23, 2019
42d6e5a
Spawn garrison vehicle on road, when available
Wyqer Feb 23, 2019
39635e0
Prevent spawning on same road object -> boom
Wyqer Feb 23, 2019
251b854
Small format tweak
Wyqer Feb 23, 2019
171fcaf
Dev tags for transferGarrison
Wyqer Feb 23, 2019
be2db05
FOB alphabet tweak
Wyqer Feb 23, 2019
39158a8
Another findIf to find
Wyqer Feb 23, 2019
d9983d8
Garrison vehicle transfer
Wyqer Feb 24, 2019
2bb5eb4
Enemy addStrength function
Wyqer Feb 24, 2019
73ed879
strengthInc use addStrength
Wyqer Feb 24, 2019
9c31c98
addAwareness function
Wyqer Feb 24, 2019
1ffa47c
reinforceGarrison function
Wyqer Feb 24, 2019
1523a8b
bind addAction JIP to object instead of true
Wyqer Feb 24, 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
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: 2018-12-13
Last Update: 2019-02-02

License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Expand All @@ -26,4 +26,5 @@ class KPLIB {
#include "modules\14_virtual\functions.hpp"
#include "modules\15_build\functions.hpp"
#include "modules\16_garrison\functions.hpp"
#include "modules\24_enemy\functions.hpp"
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_common_createCrew.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-10-25
Last Update: 2018-12-17
Last Update: 2019-02-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Expand Down Expand Up @@ -53,7 +53,7 @@ private _crewClasses = _turrets apply {
};

// Spawn group and move into to vehicle
private _grp = [_side, _driverClass + _crewClasses, getPos _vehicle] call KPLIB_fnc_common_createGroup;
private _grp = [_driverClass + _crewClasses, getPos _vehicle, _side] call KPLIB_fnc_common_createGroup;
// Move the units into the vehicle, -1 indicates driver
{
if (_forEachIndex isEqualTo 0) then {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
File: fn_common_createGroup.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-10-24
Last Update: 2018-12-08
Last Update: 2019-02-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Creates a group at given side with units according to given array of classnames and fires the Liberation group created event.

Parameter(s):
_side - Side of the group [SIDE, defaults to KPLIB_preset_sideE]
_units - Array of classnames to spawn as group members [ARRAY, defaults to []]
_spawnPos - Position to spawn the group and units [POSITION, defaults to KPLIB_zeroPos]
_side - Side of the group [SIDE, defaults to KPLIB_preset_sideE]
_addition - Additional argument for unit creation [STRING, defaults to "NONE"]

Returns:
Created group [GROUP]
*/

params [
["_side", KPLIB_preset_sideE, [sideEmpty]],
["_units", [], [[]]],
["_spawnPos", [KPLIB_zeroPos], [[]], [3]],
["_side", KPLIB_preset_sideE, [sideEmpty]],
["_addition", "NONE", [""]]
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_common_getFobAlphabetName.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-11-27
Last Update: 2018-12-08
Last Update: 2019-02-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Expand All @@ -20,7 +20,7 @@ params [
["_fob", "", [""]]
];

private _index = KPLIB_sectors_fobs findIf {_x == _fob};
private _index = KPLIB_sectors_fobs find _fob;

if (_index isEqualTo -1) then {
""
Expand Down
4 changes: 2 additions & 2 deletions Missionframework/modules/02_core/fnc/fn_core_areUnitsNear.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_core_areUnitsNear.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-05-07
Last Update: 2018-12-08
Last Update: 2019-02-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Expand All @@ -19,7 +19,7 @@
Result [BOOL]
*/

// TODO
// !TODO!
// Guess we can move this to common

params [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_core_changeSectorOwner.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-05-07
Last Update: 2018-11-27
Last Update: 2019-02-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Expand All @@ -27,7 +27,7 @@ if (_toPlayerSide) then {
KPLIB_sectors_blufor pushBack _sectorToChange;
[] call KPLIB_fnc_core_checkWinCond;
} else {
KPLIB_sectors_blufor deleteAt (KPLIB_sectors_blufor findIf {_x isEqualTo _sectorToChange});
KPLIB_sectors_blufor deleteAt (KPLIB_sectors_blufor find _sectorToChange);
};

publicVariable "KPLIB_sectors_blufor";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_core_handleVehicleSpawn.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-09-10
Last Update: 2018-12-11
Last Update: 2019-02-24
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Expand All @@ -29,7 +29,7 @@ switch (typeOf _vehicle) do {
_vehicle,
"STR_KPLIB_ACTION_DEPLOY",
[{["KPLIB_fob_build_requested", _this select 0] call CBA_fnc_localEvent}, true, -800, false, true, "", "[_target, _this] call KPLIB_fnc_core_canBuildFob", 10]
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, true];
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _vehicle];
};

case KPLIB_preset_respawnTruckF;
Expand All @@ -41,7 +41,7 @@ switch (typeOf _vehicle) do {
_vehicle,
"STR_KPLIB_ACTION_REDEPLOY",
[{["KPLIB_respawn_requested", _this] call CBA_fnc_localEvent}, nil, -801, false, true, "", "_this == vehicle _this", 10]
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, true];
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _vehicle];
};

case KPLIB_preset_addHeliF: {
Expand All @@ -52,7 +52,7 @@ switch (typeOf _vehicle) do {
"STR_KPLIB_ACTION_HELIMOVE",
[{[_this select 0] call KPLIB_fnc_core_heliToDeck;}, nil, 10, true, true, "", "(_target distance KPLIB_eden_startbase) < 20", 4],
"#FF8000"
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, true];
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _vehicle];
};
};
};
Expand Down
4 changes: 2 additions & 2 deletions Missionframework/modules/02_core/fnc/fn_core_spawnPotato.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_core_spawnPotato.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2017-05-01
Last Update: 2018-12-08
Last Update: 2019-02-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Expand All @@ -18,7 +18,7 @@
*/

// Check if there wasn't a Potato 01 already spawned or if the spawned one is destroyed.
// NOTE: As the loading will happen before this function is called, it won't interfere with a loaded Potato 01.
// !NOTE! As the loading will happen before this function is called, it won't interfere with a loaded Potato 01.
if(!isServer || alive KPLIB_core_potato01) exitWith {};

// If Potato 01 wreck is too close to respawn we should delete it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_core_spawnStartFobBox.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-05-09
Last Update: 2018-12-11
Last Update: 2019-02-24
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Expand Down Expand Up @@ -41,7 +41,7 @@ private _fobBox = [KPLIB_preset_fobBoxF, [_spawnPos select 0, _spawnPos select 1
"STR_KPLIB_ACTION_DEPLOYRANDOM",
[{[_this select 0] call KPLIB_fnc_core_buildFobRandom;}, true, -800, false, true, "", "(_target distance KPLIB_eden_boxspawn) < 3 && KPLIB_sectors_fobs isEqualTo []", 4],
"#FF0000"
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, true];
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _fobBox];

// Add event handler to call this script again if box was destroyed.
_fobBox addMPEventHandler ["MPKilled", {[_this select 0] call KPLIB_fnc_core_spawnStartFobBox}];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: sectorMonitor.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-05-05
Last Update: 2018-11-09
Last Update: 2019-02-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Expand All @@ -15,7 +15,7 @@ scriptName "KPLIB_sectorMonitor";
if(isServer) then {

// Update sector markers every time sector state was changed
{[_x, {call KPLIB_fnc_core_updateSectorMarkers}] call CBA_fnc_addEventHandler;} forEach ["KPLIB_sector_activated", "KPLIB_sector_deactivated"];
{[_x, {[] call KPLIB_fnc_core_updateSectorMarkers}] call CBA_fnc_addEventHandler;} forEach ["KPLIB_sector_activated", "KPLIB_sector_deactivated"];

// Init function, executed every time whole list of sectors was iterated
private _initFunction = {
Expand Down
4 changes: 2 additions & 2 deletions Missionframework/modules/02_core/ui/KPLIB_titles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: KPLIB_defines.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2017-10-28
Last Update: 2018-11-27
Last Update: 2019-02-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Expand Down Expand Up @@ -71,7 +71,7 @@ class RscTitles
};
};

// TODO: Rework and implementation of the Status Overlay
// !TODO! Rework and implementation of the Status Overlay
/*
class statusoverlay
{
Expand Down
4 changes: 2 additions & 2 deletions Missionframework/modules/04_adm/ui.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
KP LIBERATION MODULE UI FILE

File: KPLIB_ui.hpp
File: ui.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-08-02
Last Update: 2018-11-10
Last Update: 2019-02-18
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Expand Down
2 changes: 1 addition & 1 deletion Missionframework/modules/10_resources/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# KP Liberation Module Description

## Resources Module
TODO Description
!TODO! Description

### Dependencies
* Init
Expand Down
14 changes: 7 additions & 7 deletions Missionframework/modules/10_resources/fnc/fn_res_addActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_res_addActions.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-12-15
Last Update: 2018-12-16
Last Update: 2019-02-24
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Expand Down Expand Up @@ -32,31 +32,31 @@ if ((typeOf _object) in KPLIB_res_crateClasses) then {
"STR_KPLIB_ACTION_CHECKCRATE",
[{[_this select 0] call KPLIB_fnc_res_checkCrate;}, nil, -500, false, true, "", "isNull attachedTo _target", 4],
"#FFFF00"
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, true];
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _object];

// Add push action to crate
[
_object,
"STR_KPLIB_ACTION_PUSHCRATE",
[{[_this select 0] call KPLIB_fnc_res_pushCrate;}, nil, -501, false, false, "", "isNull attachedTo _target", 4],
"#FFFF00"
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, true];
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _object];

// Add store action to crate
[
_object,
"STR_KPLIB_ACTION_STORECRATE",
[{[_this select 0] call KPLIB_fnc_res_storeCrate;}, nil, -502, false, true, "", "isNull attachedTo _target", 4],
"#FFFF00"
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, true];
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _object];

// Add load to transport action to crate
[
_object,
"STR_KPLIB_ACTION_LOADCRATE",
[{[_this select 0] call KPLIB_fnc_res_loadCrate;}, nil, -503, false, true, "", "isNull attachedTo _target", 4],
"#FFFF00"
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, true];
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _object];
};

// Storage actions
Expand All @@ -71,7 +71,7 @@ if ((typeOf _object) in KPLIB_res_storageClasses) then {
"STR_KPLIB_ACTION_UNSTORE" + (toUpper _x),
[{[_this select 0, _this select 3] call KPLIB_fnc_res_unstoreCrate;}, _x, -500 - _forEachIndex, false, true, "", "", 10],
"#FFFF00"
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, true];
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _object];
} forEach ["Supply", "Ammo", "Fuel"];

// Stack and Sort action for storage
Expand All @@ -80,7 +80,7 @@ if ((typeOf _object) in KPLIB_res_storageClasses) then {
"STR_KPLIB_ACTION_STACKNSORT",
[{[_this select 0] call KPLIB_fnc_res_stackNsort;}, nil, -503, false, false, "", "", 10],
"#FFFF00"
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, true];
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _object];
};

true
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
KPLIB_fnc_res_getStorageSpace

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

Description:
Returns the amount of free storage space of a given storage.

Parameter(s):
_storage - Storage to check for free space [OBJECT, defaults to objNull]

Returns:
Amount of free storage spaces [NUMBER]
*/

params [
["_storage", objNull, [objNull]]
];

// Get the storage positions amount
private _allSpaces = count ([typeOf _storage] call KPLIB_fnc_res_getAttachArray);

// Get amount of already stored crates
private _attachedCrates = count (attachedObjects _storage);

// Return free space amount
_allSpaces - _attachedCrates
26 changes: 26 additions & 0 deletions Missionframework/modules/10_resources/fnc/fn_res_getStorages.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
KPLIB_fnc_res_getStorages

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

Description:
Returns all storages inside given radius of a given position.

Parameter(s):
_center - Position AGL from where to look for storages [POSITION AGL, defaults to KPLIB_zeroPos]
_radius - Radius from the center [NUMBER, defaults to 100]

Returns:
All found storage objects [ARRAY]
*/

params [
["_center", KPLIB_zeroPos, [[]], 3],
["_radius", 100, [0]]
];

nearestObjects [_center, KPLIB_res_storageClasses, _radius]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
File: fn_res_loadCrate.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-12-16
Last Update: 2018-12-16
Last Update: 2019-02-24
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Expand Down Expand Up @@ -61,7 +61,7 @@ if !(_nearTransport getVariable ["KPLIB_res_unloadAction", false]) then {
"STR_KPLIB_ACTION_UNLOADCRATE",
[{[_this select 0] call KPLIB_fnc_res_unloadCrate;}, nil, -500, false, true, "", "!((_target getVariable ['KPLIB_res_usedSlots', 0]) isEqualTo 0)", 10],
"#FFFF00"
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, true];
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _nearTransport];

_nearTransport setVariable ["KPLIB_res_unloadAction", true, true];
};
Expand Down
Loading