- Debris Updates and MD5 unit test
- reworked to only use one single hive call.
- add debug flag to remove markers by default.
- added check to prevent spawning debris on top of each other.
This commit is contained in:
vbawol 2017-06-03 10:55:47 -05:00
parent 71cb216a02
commit dc03dae4bb
48 changed files with 120 additions and 109 deletions

View File

@ -1,35 +1,22 @@
== WIP ==
[Added] Md5 hash function 840 to hive. See use example with EPOCH_fnc_server_hiveMD5 SQF function.
Usage Examples:
_hash = "Hello World" call EPOCH_fnc_server_hiveMD5;
// _hash = "b10a8db164e0754105b7a99be72e3fe5"
or multiple:
_hashes = ["Hello World","Lorem Ipsum"] call EPOCH_fnc_server_hiveMD5;
// _hashes = ["b10a8db164e0754105b7a99be72e3fe5", "6dbd01b4309de2c22b027eb35a3ce18b"]
## [0.6.0.0] - TBA
### Added
- Vector Base Building (uses Arrow keys by default and with SHIFT / ALT you can control the steps). @DirtySanchez & @Ignatz-Heman
- Base Building elements can be detached to walk around the Element before saving. @Ignatz-Heman
- Helper arrow to indicate door-opening direction for Base Building. @Ignatz-Heman
- Option to drink directly from water sources. @Ignatz-HeMan
- Epoch Events 3.0: Allow external events based on server side configs and pbos. New server side events can be added just dropping the pbo into @epochhive/addons folder. To make your own use Dynamic Debris Event as a template.
- Dynamic Debris: Dynamically spawns vehicle and other debris on the roadways. Scans the roads on startup and uses a random seed generator to determine the locations of debris. Debris is spawned using createSimpleObject for best performance and is made to conform with the upper most roadway surface.
- Epoch Dev Libs, See https://github.com/EpochModTeam/Epoch/tree/experimental/Tools/DevFrameWork for more info. @raymix
- Md5 hash function and Unit test to hive. See usage example with EPOCH_fnc_server_hiveMD5 SQF function.
[Added] Option to drink from predetermined sources. @Ignatz-HeMan
### Fixed
- Base Building 90° and 270° Snap was broken.
- Sometimes snapped Base Building elements rotated back on save.
- BE kick since 1.70.
[Added] Epoch Events 3.0: Allow external events based on server side configs and pbos.
New server side events can be added just dropping the pbo into @epochhive/addons folder.
To make your own use Dynamic Debris Event as a template.
[Added] Dynamic Debris Epoch Event. Dynamically spawns vehicle and other debris on the roadways.
Scans the roads on startup and uses a random seed generator to determine the locations of debris.
Debris is spawned using createSimpleObject and is made to conform with the upper most roadway surface.
[Added] Epoch Dev Libs by @raymix
[Fixed] BE kick since 1.70.
[Changed] Reworked Basebuilding Script. @DirtySanchez & @Ignatz-Heman
- Added Vecorbuilding (with arrow keys by default)
- Added: Building element can be detached to walk around the Element before saving
- Added: With SHIFT / ALT you can control the steps of building placement while building
- Added: Help-Arrow to indicate door-opening direction
- Added: Max building height now will be checked direcly by building element placement
- Changed: Replaced 0/90/180/270° direction build mode with "Rotate 90°"
- Fixed: 90° and 270° Snap was broken
- Fixed: Sometimes Snapped elements rotate back on save
[Info] Server requires epochserver(_x64).dll/so hive extension updates.
### Changed
- Base Building: Replaced 0/90/180/270° direction build mode with "Rotate 90°". @Ignatz-Heman
- Base Building: Max building height now will be checked directly at building element placement. @Ignatz-Heman
- Separated Hunger and Thirst loss values to baseHungerLoss/baseThirstLoss and removed baseHTLoss from CfgEpochClient.
- Hunger and Thirst loss rates are now effected by timeMultiplier.
- Bump to hive version 0.6.0.0, Note: this requires epochserver(_x64).dll/so hive extension updates server side.

View File

@ -79,17 +79,21 @@ if !(_attackers isEqualTo[]) then {
call EPOCH_fnc_Weather;
// Hunger / Thirst
_HTlossRate = _baseHTLoss;
_hungerlossRate = _baseHungerLoss * timeMultiplier;
_thirstlossRate = _baseThirstLoss * timeMultiplier;
// Increase hunger if player is Fatigued
if (EPOCH_playerStamina < 100) then {
if ((getFatigue player) > 0) then {
_HTlossRate = _HTlossRate + (_HTlossRate*(getFatigue player));
_hungerlossRate = _hungerlossRate + (_hungerlossRate*(getFatigue player));
};
} else {
_HTlossRate = (_HTlossRate / 2);
// reduce hunger loss if player stamina is greater than 100
_hungerlossRate = (_hungerlossRate / 2);
};
EPOCH_playerHunger = (EPOCH_playerHunger - _HTlossRate) max 0;
EPOCH_playerThirst = (EPOCH_playerThirst - _HTlossRate) max 0;
EPOCH_playerHunger = (EPOCH_playerHunger - _hungerlossRate) max 0;
EPOCH_playerThirst = (EPOCH_playerThirst - _thirstlossRate) max 0;
call _lootBubble;

View File

@ -1,13 +1,13 @@
_spawnChance = ((EPOCH_playerNuisance + EPOCH_playerSoiled)/2) max 1;
if (random EPOCH_droneRndChance < _spawnChance) then {
if (random _droneRndChance < _spawnChance) then {
"I_UAV_01_F" call EPOCH_unitSpawnIncrease;
};
if (EPOCH_mod_Ryanzombies_Enabled) then {
if (random EPOCH_zombieRngChance < _spawnChance) then {
if (random _zombieRngChance < _spawnChance) then {
["EPOCH_RyanZombie_1",12] call EPOCH_unitSpawnIncrease;
};
};
if (random EPOCH_sapperRndChance < _spawnChance) then {
if (random _sapperRndChance < _spawnChance) then {
"Epoch_Sapper_F" call EPOCH_unitSpawnIncrease;
};
// diag_log format["DEBUG: _spawnChance %1",_spawnChance];

View File

@ -19,10 +19,11 @@ _panic = false;
_prevEnergy = EPOCH_playerEnergy;
// init config data
EPOCH_sapperRndChance = ["CfgEpochClient", "sapperRngChance", 100] call EPOCH_fnc_returnConfigEntryV2;
EPOCH_zombieRngChance = ["CfgEpochClient", "zombieRngChance", 50] call EPOCH_fnc_returnConfigEntryV2;
EPOCH_droneRndChance = ["CfgEpochClient", "droneRngChance", 100] call EPOCH_fnc_returnConfigEntryV2;
_baseHTLoss = ["CfgEpochClient", "baseHTLoss", 8] call EPOCH_fnc_returnConfigEntryV2;
_sapperRndChance = ["CfgEpochClient", "sapperRngChance", 100] call EPOCH_fnc_returnConfigEntryV2;
_zombieRngChance = ["CfgEpochClient", "zombieRngChance", 50] call EPOCH_fnc_returnConfigEntryV2;
_droneRndChance = ["CfgEpochClient", "droneRngChance", 100] call EPOCH_fnc_returnConfigEntryV2;
_baseHungerLoss = ["CfgEpochClient", "baseHungerLoss", 2] call EPOCH_fnc_returnConfigEntryV2;
_baseThirstLoss = ["CfgEpochClient", "baseThirstLoss", 2] call EPOCH_fnc_returnConfigEntryV2;
_energyCostNV = ["CfgEpochClient", "energyCostNV", 3] call EPOCH_fnc_returnConfigEntryV2;
_energyRegenMax = ["CfgEpochClient", "energyRegenMax", 5] call EPOCH_fnc_returnConfigEntryV2;
_energyRange = ["CfgEpochClient", "energyRange", 75] call EPOCH_fnc_returnConfigEntryV2;

View File

@ -62,10 +62,6 @@ rmx_var_dynamicHUD_groupCTRL = [];
["EPOCH_onEachFrame", "onEachFrame", EPOCH_onEachFrame] call BIS_fnc_addStackedEventHandler;
EPOCH_droneRndChance = 100;
EPOCH_sapperRndChance = 100;
EPOCH_zombieRngChance = 50;
// Custom Keys
EPOCH_keysActionPressed = false; //prevents EH spam
0 call EPOCH_clientKeyMap;

View File

@ -20,6 +20,9 @@ class CfgEpochClient
droneRngChance = 100; // increase number to reduce chances and reduce to increase. Default 100
zombieRngChance = 50; // increase number to reduce chances and reduce to increase. Default 50
baseHungerLoss = 2; // increase number to speed up rate of Hunger loss
baseThirstLoss = 2; // increase number to speed up rate of Thirst loss
buildingNearbyMilitary = 0; //1 to allow building nearby
buildingNearbyMilitaryRange = 300; //Define radius of blocked area
buildingNearbyMilitaryClasses[] = {"Cargo_Tower_base_F","Cargo_HQ_base_F","Cargo_Patrol_base_F","Cargo_House_base_F"};

View File

@ -1 +1 @@
build=777;
build=780;

View File

@ -1 +1 @@
build=777;
build=780;

Binary file not shown.

View File

@ -1 +1 @@
build=778;
build=780;

View File

@ -12,6 +12,14 @@
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveMD5.sqf
Usage Examples:
_hash = "Hello World" call EPOCH_fnc_server_hiveMD5;
// _hash = "b10a8db164e0754105b7a99be72e3fe5"
or multiple:
_hashes = ["Hello World","Lorem Ipsum"] call EPOCH_fnc_server_hiveMD5;
// _hashes = ["b10a8db164e0754105b7a99be72e3fe5", "6dbd01b4309de2c22b027eb35a3ce18b"]
*/
params ["_val"];
if (_this isEqualType []) then {

View File

@ -13,7 +13,7 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_core/compile/epoch_hive/fn_server_hiveUnitTest.sqf
*/
//[[[cog import generate_private_arrays ]]]
private ["_charCheck","_expires","_payload","_payload_64k","_payload_64k_count","_response","_startTime","_testID"];
private ["_charCheck","_expires","_hashes","_payload","_payload_64k","_payload_64k_count","_response","_startTime","_testID"];
//[[[end]]]
_testID = "1234567890";
_payload = "32D1ECB8511569B43A5CC39DF4261CACDA912C798B066EE1E1EE06E2F09D02073C1B3FC638F091D58E7691DA7D0F7E1F01371CB58346572A015F6F93429F3BDC";
@ -147,3 +147,9 @@ diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveLog Time: %2 : %1 ", _res
_startTime = diag_tickTime;
_response = ['TEST_LOG', _payload_64k] call EPOCH_fnc_server_hiveLog;
diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveLog 64k Time: %2 : %1 ", _response, (diag_tickTime-_startTime)];
// MD5 HASH
_hashes = ["Hello World","Lorem Ipsum"] call EPOCH_fnc_server_hiveMD5;
// _hashes = ["b10a8db164e0754105b7a99be72e3fe5", "6dbd01b4309de2c22b027eb35a3ce18b"]
_charCheck = _hashes isEqualTo ["b10a8db164e0754105b7a99be72e3fe5", "6dbd01b4309de2c22b027eb35a3ce18b"];
diag_log format ["Epoch UnitTest: EPOCH_fnc_server_hiveMD5 Time: %2 : %1 ", ["isOK:",_charCheck], (diag_tickTime-_startTime)];

View File

@ -9,9 +9,9 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_settings/EpochEvents/DebrisSpawner.sqf
*/
//[[[cog import generate_private_arrays ]]]
private ["_allRoads","_debris","_debrisCounter","_debrisLocations","_debrisLocationsKey","_expiresDebris","_export","_hiveKey","_instanceID","_intersections","_marker","_maxDebrisLimit","_object","_offsetX","_offsetY","_position","_response","_rng","_seed","_selectedDebris","_worldSize"];
private ["_allRoads","_allowDebris","_debris","_debrisCounter","_debrisLocations","_debrisLocationsKey","_debrisLocationsTMP","_debug","_expiresDebris","_export","_instanceID","_intersections","_marker","_maxDebrisLimit","_newDebrisCounter","_object","_offsetX","_offsetY","_position","_response","_rng","_rngChance","_scriptHiveKey","_seed","_selectedDebris","_worldSize"];
//[[[end]]]
_debug = true;
_expiresDebris = 604800;
_debris = [
"Land_GarbageBags_F",
@ -35,76 +35,82 @@ _debris = [
"Land_Wreck_HMMWV_F"
];
_debrisCounter = 0;
_newDebrisCounter = 0;
_worldSize = worldSize/2;
_instanceID = call EPOCH_fn_InstanceID;
_maxDebrisLimit = 500;
_maxDebrisLimit = 500; // max total objects to spawn
_rngChance = 0.95; // Lower this to spawn more positions
_scriptHiveKey = "EPOCH:DynamicDebris456"; // change this to force a new seed to be generated.
_debrisLocationsKey = format ["%1:%2", _instanceID, worldname];
_response = ["DebrisLocations", _debrisLocationsKey] call EPOCH_fnc_server_hiveGETRANGE;
_response = [_scriptHiveKey, _debrisLocationsKey] call EPOCH_fnc_server_hiveGETRANGE;
_response params [["_status",0],["_data",[]] ];
_debrisLocations = [];
_debrisLocationsTMP = [];
if (_status == 1 && _data isEqualType [] && !(_data isEqualTo [])) then {
_debrisLocations = _data;
} else {
diag_log format["DEBUG: Generating new Debris Locations... this is only done once every %1 days.",(_expiresDebris/86400)];
_allRoads = [_worldSize,_worldSize] nearRoads _worldSize;
_allRoads = _allRoads call BIS_fnc_arrayShuffle;
_seed = random 999999;
diag_log format["DEBUG: Generating new Debris Locations... with seed %1",_seed];
diag_log format["DEBUG: Generating new Debris Locations... with seed %1.",_seed];
{
if (_newDebrisCounter >= _maxDebrisLimit) exitWith {};
_position = getPosWorld _x;
_position params ["_posX","_posY"];
_rng = _seed random [_posX,_posY];
if (_rng > 0.95) then {
_debrisLocations pushBack _position;
};
} forEach _allRoads;
["DebrisLocations", _debrisLocationsKey, _expiresDebris, _debrisLocations] call EPOCH_fnc_server_hiveSETEX;
};
for "_i" from 1 to _maxDebrisLimit do {
_hiveKey = format ["%1:%2", _instanceID, _i];
_response = ["Debris", _hiveKey] call EPOCH_fnc_server_hiveGETRANGE;
_response params [["_status",0],["_data",[]] ];
if (_status == 1 && _data isEqualType [] && !(_data isEqualTo [])) then {
_data params ["_selectedDebris","_posWorld", "_vectorDir", "_vectorUp"];
_object = createSimpleObject [_selectedDebris, _posWorld];
_object setVectorDirAndUp [_vectorDir,_vectorUp];
_object setPosWorld _posWorld;
_debrisCounter = _debrisCounter + 1;
} else {
_position = selectRandom _debrisLocations;
_debrisLocations = _debrisLocations - _position;
if (_rng > _rngChance) then {
if (_debug) then {
_marker = createMarker[str(_position), _position];
_marker setMarkerShape "ICON";
_marker setMarkerType "waypoint";
_marker setMarkerColor "ColorGreen";
};
_selectedDebris = selectRandom _debris;
_offsetX = (random 10) - 5;
_offsetY = (random 10) - 5;
_position set [0,(_position select 0) + _offsetX];
_position set [1,(_position select 1) + _offsetY];
_position set [2,0];
_intersections = lineIntersectsSurfaces [[_position select 0,_position select 1,1000], _position, objNull, objNull, true, 1];
if !(_intersections isEqualTo []) then {
(_intersections select 0) params ["_intersectPosASL","_surfaceNormal","_intersectObject","_parentObject"];
_allowDebris = true;
if !(isNull _intersectObject) then {
_allowDebris = !((typeOf _intersectObject) in _debris);
};
if (_allowDebris) then {
_object = createSimpleObject [_selectedDebris, _intersectPosASL];
_object setDir random 360;
_object setVectorUp _surfaceNormal;
_object setPosASL _intersectPosASL;
_export = [_selectedDebris,getPosWorld _object, vectorDir _object, vectorUp _object];
["Debris", _hiveKey, _expiresDebris, _export] call EPOCH_fnc_server_hiveSETEX;
_debrisCounter = _debrisCounter + 1;
_debrisLocationsTMP pushBack _export;
_newDebrisCounter = _newDebrisCounter + 1;
};
};
};
} forEach _allRoads;
[_scriptHiveKey, _debrisLocationsKey, _expiresDebris, _debrisLocationsTMP] call EPOCH_fnc_server_hiveSETEX;
};
EP = _debrisCounter;
{
if (_debrisCounter >= _maxDebrisLimit) exitWith {};
if (_x isEqualType [] && !(_x isEqualTo [])) then {
_x params ["_selectedDebris","_posWorld", "_vectorDir", "_vectorUp"];
_object = createSimpleObject [_selectedDebris, _posWorld];
_object setVectorDirAndUp [_vectorDir,_vectorUp];
_object setPosWorld _posWorld;
_debrisCounter = _debrisCounter + 1;
};
} forEach _debrisLocations;
if (_debug) then {
diag_log format["DEBUG: Spawned %1 Existing Debris",_debrisCounter];
if (_newDebrisCounter > 0) then {
diag_log format["DEBUG: Spawned %1 New Debris.",_newDebrisCounter];
};
};

View File

@ -1 +1 @@
build=777;
build=780;

View File

@ -1 +1 @@
build=777;
build=780;

View File

@ -1 +1 @@
build=777;
build=780;

View File

@ -1 +1 @@
778
780