Merge pull request #75 from Ghostrider-DbD-/Version-6.76-Build-104

Version 6 76 build 104
This commit is contained in:
Ghostrider [GRG] 2018-01-04 14:14:10 -05:00 committed by GitHub
commit 7839d269d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 270 additions and 20 deletions

View File

@ -28,7 +28,7 @@ private["_numTransfered","_clientId","_allGroups","_groupsOwned","_idHC","_id","
{
if !(_x in blck_connectedHCs) then {blck_connectedHCs pushBack _x};
}forEach entities "HeadlessClient_F";
diag_log format["_fnc_passToHCs:: blck_connectedHCs = %1 | count _HCs = %2 | server FPS",blck_connectedHCs,count blck_connectedHCs,diag_fps];
diag_log format["_fnc_passToHCs:: blck_connectedHCs = %1 | count _HCs = %2 | server FPS = %3",blck_connectedHCs,count blck_connectedHCs,diag_fps];
if ((count blck_connectedHCs) > 0) then
{
_idHC = [blck_connectedHCs] call blck_fnc_leastBurdened;

View File

@ -0,0 +1,31 @@
/*
by Ghostrider
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
params["_pos"];
private["_nearestGroup","_modType"];
_modType = call blck_fnc_getModType;
if (_modType == "Epoch") then {_units = (_pos) nearEntities ["I_Soldier_EPOCH", 100]};
if (_modType == "Exile") then {_units = (_pos) nearEntities ["i_g_soldier_unarmed_f", 100]};
_nearestGroup = group (_units select 0);
{
if ((group _x) != _group) then
{
if ( _x distance (leader _group) < ((leader _nearestGroup) distance (leader _group)) ) then
{
if ((vehicle _x == _x) ) then {_nearestGroup = group _x};
};
};
}forEach _units;
_nearestGroup

View File

@ -87,7 +87,8 @@ if (blck_debugLevel > 1) then
// params["_vehType","_pos",["_clearInventory",true]];
_wep = [(_x select 0),[0,0,0],false] call blck_fnc_spawnVehicle;
_wep addEventHandler["HandleDamage",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}];
//_wep addEventHandler["HandleDamage",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}];
_wep addMPEventHandler["MPHit",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}];
_empGroup setVariable["groupVehicle",_wep];
_wep setVariable["vehicleGroup",_empGroup];
#ifdef blck_debugMode

View File

@ -36,7 +36,10 @@ if (blck_debugLevel >=2) then
_ResidualUnits = _unitsToSpawn - (_unitsPerGroup * _noAIGroups);
_blck_AllMissionAI = [];
_abort = false;
if (count _weapons == 0) then {_weapons = [_aiDifficultyLevel] call blck_fnc_selectAILoadout};
if (count _weapons == 0) then
{
_weapons = [_aiDifficultyLevel] call blck_fnc_selectAILoadout;
};
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
@ -44,12 +47,12 @@ if (blck_debugLevel >=2) then
};
#endif
if (count _missionGroups > 0) then
{
{ // [[1,-1,-1],"red",4, 5,10]
_x params["_position","_skillLevel","_numAI","_minPatrolRadius","_maxPatrolRadius"];
{
{ //[[-98.9121,-35.9824,-1.20243],5,7,"Green",5,12],[[1,-1,-1],"red",4, 5,10]
_x params["_position","_minAI","_maxAI","_skillLevel","_minPatrolRadius","_maxPatrolRadius"];
_groupSpawnPos = _coords vectorAdd _position;
// params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_configureWaypoints",true],["_weaponList",[]],["_vests",blck_vests],["_scuba",false] ];
_newGroup = [_groupSpawnPos,_numAI,_numAI,_skillLevel,_coords,_minPatrolRadius,_maxPatrolRadius,_uniforms,_headGear,true,_weapons,_vests,_isScubaGroup] call blck_fnc_spawnGroup;
_newGroup = [_groupSpawnPos,_minAI,_maxAI,_skillLevel,_coords,_minPatrolRadius,_maxPatrolRadius,_uniforms,_headGear,true,_weapons,_vests,_isScubaGroup] call blck_fnc_spawnGroup;
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then

View File

@ -24,6 +24,10 @@ _objs = [];
{
_x params["_crateType","_crateOffset","_lootArray","_lootCounts"];
//_pos = [(_coords select 0)+(_crateOffset select 0),(_coords select 1) + (_crateOffset select 1),(_coords select 2)+(_crateOffset select 2)]; // calculate the world coordinates
_pos = _coords vectorAdd _crateOffset;
_crate = [_pos,_crateType] call blck_fnc_spawnCrate;
_objs pushback _crate;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
@ -32,10 +36,7 @@ _objs = [];
_marker setMarkerType "mil_triangle";
_marker setMarkerColor "colorGreen";
};
#endif
_pos = _coords vectorAdd _crateOffset;
_crate = [_pos,_crateType] call blck_fnc_spawnCrate;
_objs pushback _crate;
#endif
if (_loadCrateTiming isEqualTo "atMissionSpawn") then
{
//diag_log format["_fnc_spawnMissionCrates::-> loading loot at mission spawn for crate %1",_x];

View File

@ -0,0 +1,29 @@
/*
by Ghostrider
9-20-15
Allerts all units within a certain radius of the location of a killer.
** Not in use at this time; reserved for the future **
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_alertDist","_intelligence"];
params["_unit","_killer"];
_nearbyGroup = [group _unit] call blck_fnc_findNearestGroup;
//diag_log format["#-alertNearbyUnits.sqf-# alerting nearby units of killer of unit %1",_unit];
_alertDist = _unit getVariable ["alertDist",300];
_intelligence = _unit getVariable ["intelligence",1];
if (_alertDist > 0) then {
//diag_log format["+----+ alerting units close to %1",_unit];
{
_knowsAbout = _x knowsAbout _killer;
_x reveal [_killer, _knowsAbout + _intelligence];
diag_log "_fnc_alertNearbyGroup: Killer revealed";
} forEach (units _nearbyGroup);
};

View File

@ -1,7 +1,5 @@
/*
by Ghostrider
4-5-17
Alerts the units of nearby vehicles of the location of an enemy.
--------------------------
License

View File

@ -0,0 +1,17 @@
/*
Find Nearest Infantry Group
*/
params["_group"];
private["_nearestGroup","_modType"];
_modType = call blck_fnc_getModType;
if (_modType == "Epoch") then {_units = _group nearEntities ["I_Soldier_EPOCH", 100]};
if (_modType == "Exile") then (_units = _group nearEntities ["i_g_soldier_unarmed_f", 100]};
_nearestGroup = group _units select 0;
{
if (group _x != _group && _x distance (leader _group) < ((leader _nearestGroup) distance (leader _group))) then {_nearestGroup = group _x};
}forEach _units;
_nearestGroup

View File

@ -0,0 +1,18 @@
/*
By Ghostrider [GRG]
Last Modified 7-27-17
Handles the case where a vehicle is hit.
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//#include "\q\addons\custom_server\Configs\blck_defines.hpp";
if !(isDedicated) exitWith {};
_this call blck_fnc_HandleAIVehicleHit;

View File

@ -0,0 +1,16 @@
/*
Killed handler for _units
By Ghostrider-DbD
Last Modified 4-11-17
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//#include "\q\addons\custom_server\Configs\blck_defines.hpp";
if !(isDedicated) exitWith {};
_this call blck_fnc_processAIVehicleKill;

View File

@ -0,0 +1,17 @@
/*
Killed handler for _units
By Ghostrider-DbD
Last Modified 4-11-17
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//#include "\q\addons\custom_server\Configs\blck_defines.hpp";
diag_log format["_EH_processAIVehicleKill: _this = %1",_this];
if !(isDedicated) exitWith {};
_this call blck_fnc_processAIVehicleKill;

View File

@ -0,0 +1,44 @@
/*
By Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_veh","_instigator","_group","_wp"];
_veh = _this select 0 select 0;
_instigator = _this select 0 select 3;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_HandleAIVehicleDamage: _this = %1",_this];
diag_log format["_EH_AIVehicle_HandleDamage:: _units = %1 and _instigator = %2 units damage is %3",_veh,_instigator, damage _veh];
};
#endif
//if (!(alive _veh)) exitWith {};
if (!(isPlayer _instigator)) exitWith {};
_crew = crew _veh;
_group = group (_crew select 0);
// Tell the vehicle crew something about the player who caused the damage
[_crew select 0,_instigator] call blck_fnc_alertGroupUnits;
// Tell nearby vehicles something about the player who caused the damage
[_instigator] call blck_fnc_alertNearbyVehicles;
// Ask for help from the nearest group of infantry, especially if they have launchers
_nearestGroup = [getPos _veh] call blck_fnc_findNearestInfantryGroup;
[(units _nearestGroup) select 0,_instigator] call blck_fnc_alertGroupUnits;
_group setBehaviour "COMBAT";
_wp = [_group, currentWaypoint _group];
_wp setWaypointBehaviour "COMBAT";
_group setCombatMode "RED";
_wp setWaypointCombatMode "RED";

View File

@ -0,0 +1,55 @@
/*
By Ghostrider [GRG]
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_veh","_instigator","_group","_wp"];
_veh = _this select 0 select 0;
_instigator = _this select 0 select 3;
params["_unit","_killer"];
{
_veh removealleventhandlers _x;
} forEach ["GetIn","GetOut","fired","hit","hitpart","reloaded","dammaged","HandleDamage"];
{
_veh removeAllMPEventHandlers _x;
} forEach ["MPHit","MPKilled"];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_processAIVehicleKill: _this = %1",_this];
diag_log format["_fnc_processAIVehicleKill:: _units = %1 and _instigator = %2 units damage is %3",_veh,_instigator, damage _veh];
};
#endif
//if (!(alive _veh)) exitWith {};
if (!(isPlayer _instigator)) exitWith {};
_crew = crew _veh;
if !(count _crew == 0) then
{
_group = group (_crew select 0);
// Tell the vehicle crew something about the player who caused the damage
};
// Tell nearby vehicles something about the player who caused the damage
[_instigator] call blck_fnc_alertNearbyVehicles;
// Ask for help from the nearest group of infantry, especially if they have launchers
_nearestGroup = [getPos _veh] call blck_fnc_findNearestGroup;
[(units _nearestGroup) select 0,_instigator] call blck_fnc_alertGroupUnits;
_group setBehaviour "COMBAT";
_wp = [_group, currentWaypoint _group];
_wp setWaypointBehaviour "COMBAT";
_group setCombatMode "RED";
_wp setWaypointCombatMode "RED";

View File

@ -21,6 +21,8 @@
_v removeAllEventHandlers "GetOut";
_v removeAllEventHandlers "Fired";
_v removeAllEventHandlers "Reloaded";
_v removeAllMPEventHandlers "MPHit";
_v removeAllMPEventHandlers "MPKilled";
_v setVehicleLock "UNLOCKED" ;
_v setVariable["releasedToPlayers",true];
[_v] call blck_fnc_emptyObject;

View File

@ -35,7 +35,8 @@ if (blck_debugLevel > 1) then
if !(isNull _group) then
{ // exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnVehiclePatrol"; objNull;};
_veh = [_vehType,_pos] call blck_fnc_spawnVehicle;
_veh addEventHandler["HandleDamage",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}];
// _veh addEventHandler["HandleDamage",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}];
_veh addMPEventHandler["MPHit",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleHit}];
_group setVariable["groupVehicle",_veh];
//#ifdef blck_debugMode
if (blck_debugLevel > 1) then

View File

@ -37,7 +37,9 @@ _fn_releaseVehicle = {
{
_veh removealleventhandlers _x;
} forEach ["GetIn","GetOut","fired","hit","hitpart","reloaded","dammaged","HandleDamage"];
{
_veh removeAllMPEventHandlers _x;
} forEach ["MPHit","MPKilled"];
_veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer,true];
if ((damage _veh) > 0.5) then {_veh setDamage 0.5};
//diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1 and blck_deleteAT = %2",_veh, _veh getVariable["blck_DeleteAt",0]];

View File

@ -12,7 +12,6 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//blck_functionsCompiled = false;
// General functions
blck_fnc_waitTimer = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_waitTimer.sqf";
@ -78,6 +77,7 @@ blck_fnc_changeToMoveWaypoint = compileFinal preprocessFileLineNumbers "\q\addo
blck_fnc_changeToSentryWaypoint = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Groups\GMS_fnc_changeToSentryWaypoint.sqf"; //
//blck_fnc_setNextWaypoint = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Groups\GMS_fnc_setNextWaypoint.sqf";
blck_fnc_cleanEmptyGroups = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Groups\GMS_fnc_cleanEmptyGroups.sqf"; // GMS_fnc_cleanEmptyGroups
blck_fnc_findNearestInfantryGroup = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Groups\GMS_fnc_findNearestInfantryGroup.sqf";
// Functions specific to vehicles, whether wheeled, aircraft or static
blck_fnc_spawnVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnVehicle.sqf";
@ -90,8 +90,10 @@ blck_fnc_spawnMissionHeli = compileFinal preprocessFileLineNumbers "\q\addons\cu
blck_fnc_spawnMissionParatroops = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnMissionParatroops.sqf"; // Lumped here because these 'jump' from aircraft
blck_fnc_spawnParaUnits = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnParaUnits.sqf"; // Lumped here because these 'jump' from aircraft
//blck_fnc_releaseVehicleToPlayers = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_releaseVehicleToPlayers.sqf"; // GMS_fnc_releaseVehicleToPlayers
blck_EH_AIVehicle_HandleDamage = "\q\addons\custom_server\Compiles\Vehicles\GMS_EH_AIVehicle_HandleDamage.sqf";
blck_fnc_HandleAIVehicleDamage = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_HandleAIVehicleDamage.sqf";
blck_EH_AIVehicle_HandleHit = "\q\addons\custom_server\Compiles\Vehicles\GMS_EH_AIVehicle_Hit.sqf";
blck_fnc_HandleAIVehicleHit = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_HandleAIVehicleHit.sqf";
blck_EH_VehicleKilled = "\q\addons\custom_server\Compiles\Vehicles\GMS_EH_VehicleKilled.sqf";
blck_fnc_processAIVehicleKill = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_processAIVehicleKill.sqf";
// functions to support Units
blck_fnc_removeGear = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_removeGear.sqf"; // Strip an AI unit of all gear.

View File

@ -12,8 +12,8 @@
*/
#include"\q\addons\custom_server\Configs\blck_defines.hpp";
blck_debugON = false;
blck_debugLevel = 0; // Sets level of detail for debugging info - WIP.
blck_debugON = true;
blck_debugLevel = 2; // Sets level of detail for debugging info - WIP.
blck_minFPS = 8;
////////////////////////////////////////////////

View File

@ -8,6 +8,19 @@ Ideas or code from that by Vampire and KiloSwiss have been used for certain func
Significant Changes:
=====================
Version 6.76 Build 104
Added: A new timer that determines the time after which Vehicles are deleted once all AI are dead if no player has entered the driver's seat.
Added: an optional variable in the template for missions called _missionGroups by which you can define the parameters (position, skill level, number, patrol radius) for each group spawned.
See the default2.sqf mission under custom_server\Missions\blue for an example
Changed: The method by which the server handles AI damage was changed to use MPHit.
Added: an MPKilled event handler for vehicles.
Fixed: Static Vehicles were being spawned repeatedly.
Fixed: _missionGroups parameters were not being handled correctly.
Fixed: sever FPS was not being logged by GMS_passToHCs
Fixed: crate marker was not shown when in debug mode.
Known Issues: Vehicles are not unlocked when released to players if an HC is connected.
Version 6.74 Build 97
Added Core Code for spawning dynamic underwater missions.
Added Core Code for spawning scuba units and surface and SDV patrols.