Workaround for direction delays

This commit is contained in:
He-Man 2019-10-14 20:23:56 +02:00
parent 1b1c9ca997
commit 412756bb09
5 changed files with 45 additions and 4 deletions

View File

@ -0,0 +1,33 @@
/*
Author: He-Man - EpochMod.com
Contributors:
Description:
Workaround for delayed positioning for Server side placed items
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/functions/EPOCH_fnc_SetFinalDir.sqf
usage:
_array = [];
{
_array pushback [_x,[vectordir _x, VectorUp _x]];
} foreach _objs;
_array remoteExec ["EPOCH_fnc_SetFinalDir",_player];
*/
uisleep 1; // Give some time for init Server Side
{
_x params ["_obj","_dir"];
if (_dir isEqualType []) then {
_obj setVectorDirAndUp _dir;
}
else {
_obj setdir _dir;
};
} foreach _this;

View File

@ -175,6 +175,7 @@ class CfgClientFunctions
class fnc_createLocalMarkerSet {};
class fnc_deleteLocalMarkerSet {};
class fnc_AnimateScheduled {};
class fnc_SetFinalDir {};
};
class environment
{

View File

@ -70,6 +70,7 @@ if (isText _staticClassConfig) then {
};
[_player,"BuildingsSet",1,true] call EPOCH_server_updatePlayerStats;
diag_log format["Epoch: STORAGE: %1 created storage %2 at %3 with slot %4", _playerUID, _staticClass, _vehiclePos, _slot];
[[_storageObj,[vectordir _storageObj, vectorup _storageObj]]] remoteexec ['Epoch_fnc_SetFinalDir',_player];
};
} else {
@ -113,6 +114,7 @@ if (isText _staticClassConfig) then {
};
_newVehicle call EPOCH_saveBuilding;
[_player,"BuildingsSet",1,true] call EPOCH_server_updatePlayerStats;
[[_newVehicle,[vectordir _newVehicle, vectorup _newVehicle]]] remoteexec ['Epoch_fnc_SetFinalDir',_player];
};
} else {

View File

@ -2,7 +2,7 @@
//[[[cog import generate_private_arrays ]]]
private ["_newObj","_objectPos","_owner","_UpdatePlots"];
//[[[end]]]
params [["_class",""],["_object",objNull],["_method",2]];
params [["_class",""],["_object",objNull],["_method",0]];
_newObj = objNull;
if (!isNull _object && !(_class isEqualTo "")) then {
_objectPos = getPosWorld _object;

View File

@ -14,13 +14,13 @@
*/
private [ "_masterConfig","_building","_buildingLoot","_selectedConfig","_config","_EpochLootChance","_cfgBaseBuilding","_loots","_lootLimit","_possibleLoots","_posName","_positions","_possibleCount","_randomIndex","_selectedLoot",
"_pos","_dir","_item","_color","_GroundSpawnChance","_MinGroundContainers","_MaxGroundContainers","_lootType"
"_pos","_dir","_item","_color","_GroundSpawnChance","_MinGroundContainers","_MaxGroundContainers","_lootType","_privateDir"
];
params [["_player",objNull,[objNull]],["_token","",[""]],["_LootsArray",[]]];
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
_privateDir = [];
_masterConfig = getmissionconfig "CfgBuildingLootPos";
{
_x params [["_Building",objnull],["_LootType",""],["_buildingLootArray",[]]];
@ -38,6 +38,8 @@ _masterConfig = getmissionconfig "CfgBuildingLootPos";
_item setvariable ["Epoch_ParentBuilding",_building];
_buildingLoot pushback _item;
_item setDir _dir;
_item setowner (owner _player); // switch owner for better simulations on looting
_privateDir pushback [_item,_dir];
if (surfaceIsWater _pos) then {
_item setPosASL _pos;
}
@ -72,4 +74,7 @@ _masterConfig = getmissionconfig "CfgBuildingLootPos";
};
};
};
} foreach _LootsArray;
} foreach _LootsArray;
if !(_privateDir isEqualTo []) then {
_privateDir remoteexec ['Epoch_fnc_SetFinalDir',_player];
};