From 50923897ef3646e6954c65621d39633120e68f30 Mon Sep 17 00:00:00 2001 From: vbawol Date: Tue, 3 Oct 2017 15:05:37 -0500 Subject: [PATCH] changelog and bunker loot spawning fixes respawn bunkers on first spawn, to see if this fixes animation issues --- .../compile/looting/EPOCH_spawnLoot.sqf | 11 ++++- .../Configs/CfgBuildingLootPos.hpp | 1 + .../EpochEvents/DynamicBunker.sqf | 49 ++++++++----------- changelog.md | 1 + 4 files changed, 33 insertions(+), 29 deletions(-) diff --git a/Sources/epoch_code/compile/looting/EPOCH_spawnLoot.sqf b/Sources/epoch_code/compile/looting/EPOCH_spawnLoot.sqf index a0871780..80edd10e 100644 --- a/Sources/epoch_code/compile/looting/EPOCH_spawnLoot.sqf +++ b/Sources/epoch_code/compile/looting/EPOCH_spawnLoot.sqf @@ -28,8 +28,17 @@ private ["_cfgBaseBuilding","_class","_color","_colors","_config","_delete","_di //[[[end]]] params [["_building",objNull,[objNull]], ["_lootCheckBufferLimit",333], ["_lootObjectLimit",33]]; +_selectedConfig = typeOf _building; +if (_selectedConfig isEqualTo "") then { + (getModelInfo _building) params [["_modelName",""]]; + if (!isnil "_modelName") then { + // replace spaces and periods with underscores + _selectedConfig = (_modelName splitString " .") joinString "_"; + }; +}; + _masterConfig = 'CfgBuildingLootPos' call EPOCH_returnConfig; -_config = _masterConfig >> (typeOf _building); +_config = _masterConfig >> _selectedConfig; _cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig; // exit with false if building is not lootable diff --git a/Sources/epoch_config/Configs/CfgBuildingLootPos.hpp b/Sources/epoch_config/Configs/CfgBuildingLootPos.hpp index 8111688d..2af9d34d 100644 --- a/Sources/epoch_config/Configs/CfgBuildingLootPos.hpp +++ b/Sources/epoch_config/Configs/CfgBuildingLootPos.hpp @@ -4768,6 +4768,7 @@ class CfgBuildingLootPos { {-5.7334,5.8186,0.188561}, 355.754 } }; }; + class 4_way_bunker_p3d : bunker_epoch {}; }; /*[[[end]]]*/ diff --git a/Sources/epoch_server_bunker_event/EpochEvents/DynamicBunker.sqf b/Sources/epoch_server_bunker_event/EpochEvents/DynamicBunker.sqf index 34f952eb..6d42112d 100644 --- a/Sources/epoch_server_bunker_event/EpochEvents/DynamicBunker.sqf +++ b/Sources/epoch_server_bunker_event/EpochEvents/DynamicBunker.sqf @@ -9,7 +9,7 @@ https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_bunker_event/EpochEvents/BunkerSpawner.sqf */ //[[[cog import generate_private_arrays ]]] -private ["_allBunkers","_animationStates","_bunkerClasses","_bunkerCounter","_bunkerLocationsKey","_bunkerLocationsTMP","_colCount","_debug","_debugLocation","_expiresBunker","_firstBunker","_instanceID","_list","_loc1","_location","_maxBunkerLimitPerRow","_maxBunkerLimitSlots","_maxColumns","_memoryPoints","_modelInfo","_newBunkerCounter","_object","_originalLocation","_pOffset","_response","_rng","_rngChance","_rowCount","_score","_scriptHiveKey","_seed","_selectedBunker","_size","_veh"]; +private ["_allBunkers","_animationStates","_bunkerClasses","_bunkerCounter","_bunkerLocationsKey","_bunkerLocations","_colCount","_debug","_debugLocation","_expiresBunker","_firstBunker","_instanceID","_list","_loc1","_location","_maxBunkerLimitPerRow","_maxBunkerLimitSlots","_maxColumns","_memoryPoints","_modelInfo","_newBunkerCounter","_object","_originalLocation","_pOffset","_response","_rng","_rngChance","_rowCount","_score","_scriptHiveKey","_seed","_selectedBunker","_size","_veh"]; //[[[end]]] if (worldName == "VR") then { @@ -26,52 +26,35 @@ if (worldName == "VR") then { _maxBunkerLimitPerRow = 10; _rngChance = 0; // Lower this to spawn more positions - _scriptHiveKey = "EPOCH:DynamicBunker"; // change this to force a new seed to be generated. + _scriptHiveKey = "EPOCH:DynamicBunker007"; // change this to force a new seed to be generated. _bunkerLocationsKey = format ["%1:%2", _instanceID, worldname]; _response = [_scriptHiveKey, _bunkerLocationsKey] call EPOCH_fnc_server_hiveGETRANGE; _response params [["_status",0],["_data",[]] ]; _firstBunker = objNull; + _bunkerLocations = []; // check for proper return and data type if (_status == 1 && _data isEqualType [] && !(_data isEqualTo [])) then { - - // spawn cached bunker - { - if (_x isEqualType [] && !(_x isEqualTo [])) then { - _x params ["_selectedBunker", "_posWorld", ["_memoryPointsStatus",[]] ]; - _object = createSimpleObject [_selectedBunker, _posWorld]; - if (isNull _firstBunker) then {_firstBunker = _object;}; - { - _object animate [_x,(_memoryPointsStatus param [_forEachIndex,1]),true]; - } forEach _memoryPoints; - _bunkerCounter = _bunkerCounter + 1; - }; - } forEach _data; - + _bunkerLocations = _data; } else { // generate new bunker _size = 13.081; _maxColumns = _maxBunkerLimitSlots / _maxBunkerLimitPerRow; _allBunkers = []; - _bunkerLocationsTMP = []; _newBunkerCounter = 0; - // Generate Seed _seed = random 999999; diag_log format["Generating bunker with seed: %1",_seed]; _location = ATLToASL _debugLocation; _originalLocation = +_location; - _bunkerClasses = [ "bunker_epoch" ]; - _rowCount = 0; _colCount = 0; - //spawn x number of connected bunkers. while {true} do { if (_colCount > _maxColumns) exitWith {}; @@ -79,9 +62,7 @@ if (worldName == "VR") then { if (_rng > _rngChance) then { _selectedBunker = selectRandom _bunkerClasses; _object = createSimpleObject [_selectedBunker, _location]; - if (isNull _firstBunker) then {_firstBunker = _object;}; _allBunkers pushBack _object; - //_bunkerLocationsTMP pushBack [_selectedBunker,getPosWorld _object, vectorDir _object, vectorUp _object]; _newBunkerCounter = _newBunkerCounter + 1; }; _location set [0,(_location select 0) + _size]; @@ -104,23 +85,35 @@ if (worldName == "VR") then { _loc1 = _veh modelToWorldVisual _pOffset; _list = nearestObjects[_loc1, [], 1]; if !(_list isEqualTo []) then { - _veh animate [_x,0,true]; _score = _score + 1; _animationStates pushBack 0 } else { - _veh animate [_x,1,true]; _animationStates pushBack 1 }; }; } forEach _memoryPoints; _modelInfo = getModelInfo _veh; - _bunkerLocationsTMP pushBack [_modelInfo select 1, getPosWorld _veh, _animationStates, _score]; + _bunkerLocations pushBack [_modelInfo select 1, getPosWorld _veh, _animationStates, _score]; } forEach _allBunkers; - + // remove temp bunkers + _allBunkers apply {deleteVehicle _x}; // save to DB - [_scriptHiveKey, _bunkerLocationsKey, _expiresBunker, _bunkerLocationsTMP] call EPOCH_fnc_server_hiveSETEX; + [_scriptHiveKey, _bunkerLocationsKey, _expiresBunker, _bunkerLocations] call EPOCH_fnc_server_hiveSETEX; }; + // spawn final bunkers + { + if (_x isEqualType [] && !(_x isEqualTo [])) then { + _x params ["_selectedBunker", "_posWorld", ["_memoryPointsStatus",[]] ]; + _object = createSimpleObject [_selectedBunker, _posWorld]; + if (isNull _firstBunker) then {_firstBunker = _object;}; + { + _object animate [_x,(_memoryPointsStatus param [_forEachIndex,1]),true]; + } forEach _memoryPoints; + _bunkerCounter = _bunkerCounter + 1; + }; + } forEach _bunkerLocations; + // move respawn point into first bunker. if (!(isNull _firstBunker) && {_firstBunker distance _debugLocation > 1}) then { deleteMarker "respawn_west"; diff --git a/changelog.md b/changelog.md index d02044a2..8bcc7d1a 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,7 @@ All changes for [Arma 3](https://arma3.com/) [Epoch Mod](https://epochmod.com) a - Vehicle Upgrade System - Upgrade your ride by using one of the new vehicle upgrade documents found in the world. @DirtySanchez - Vector Base Building (uses Arrow keys by default and with SHIFT / ALT you can control the steps). @DirtySanchez & @Ignatz-Heman - New Base Building Objects: Quarter and Half wood floors @DirtySanchez, Cinder block floor, Cinder wall with a window. Metal and Cinder Towers @Helion4. +- Added the following new buildables (bringing most buildables from A2/Epoch to A3 using standard ARMA models): Burn Barrel, Light Pole, Small (forest and desert) Camo Nets, Large (forest and desert) Camo Nets, Camp Fire, Field Toilet, Scaffolding, Sink (water source), Single and Double Portable Lights, Lifeguard Tower, Sun Shade, Fuel Pump, Small Sandbag Bunker, Short Sandbag Wall, Long Sandbag Wall, Bar Gate and Water Pump, @morgoth0 (Grahame) and @DirtySanchez - A-frame and Dome tents as insecure storage objects. @morgoth0, @DirtySanchez, @Helion4 - Farming system - craft-able garden plot allows you to grow seeds into mature plants. Models by @Helion4, configs by @DirtySanchez - Medical items: Adrenaline Shot (adrenaline_epoch), Caffeine Pills (caffeinepills_epoch). Orlistat Pills (orlistat_epoch) by @Helion4 and configs by @DirtySanchez